Skip to content

backend_utils

add_compute_function(name, np_function, th_function)

Adds a custom compute function defined by @name

Parameters:

Name Type Description Default
name str

name of the function to add

required
np_function callable

numpy version of the function

required
th_function callable

torch version of the function

required
Source code in OmniGibson/omnigibson/utils/backend_utils.py
def add_compute_function(name, np_function, th_function):
    """
    Adds a custom compute function defined by @name

    Args:
        name (str): name of the function to add
        np_function (callable): numpy version of the function
        th_function (callable): torch version of the function
    """
    _ComputeNumpyBackend.set_custom_method(name, np_function)
    _ComputeTorchBackend.set_custom_method(name, th_function)