pub fn call_op(
op_name: impl AsRef<str>,
overload: impl AsRef<str>,
args: &[RValue],
kwargs: &HashMap<String, RValue>,
flatten_results: bool,
) -> Result<Vec<RValue>, CallOpError>
Expand description
Call a PyTorch-dispatched operator by name.
op_name
is the fully qualified name of the operator, like "aten::add"
.
overload
is the name of the overload, like "Scalar"
. Due to a
quirk of libtorch, the default
overload must be called by passing
an empty string.
flatten_results
is a flag that indicates whether the results of the
operator should be flattened into a single list. Extracting out values
from lists, tuples and dicts recursively.
ยงErrors
If the called operator throws an exception, a cxx::Exception
will be returned which contains the C++ exception.