def call_object(self, obj: Union[str, Callable, Any], *args, **kwargs):
        """Call obj with given arguments if it is a function, otherwise just return the object."""
        obj = self.load_object(obj)
        # We check for FunctionType, MethodType here instead of Callable since objects with __call__ methods
        # like torch.nn.module are also Callables
        if isinstance(obj, (FunctionType, MethodType)):
            return obj(*args, **kwargs)
        return obj
Call obj with given arguments if it is a function, otherwise just return the object.
olive/common/user_module_loader.py