Open3D (C++ API)
|
Data Structures | |
class | Argument |
Functions | |
def | parse_schema_from_docstring (docstring) |
def | get_tensorflow_docstring_from_file (path) |
def | find_op_reg_file (ops_dir, op_name) |
def | main () |
Variables | |
string | INDENT_SPACES = ' ' |
string | FN_TEMPLATE_STR |
string | FN_RETURN_NAMEDTUPLE_TEMPLATE_STR |
string | NAMEDTUPLE_TEMPLATE_STR = "{name} = _namedtuple( '{name}', '{fields}')\n" |
Schema = namedtuple('Schema', ['name', 'arguments', 'returns']) | |
This script inspects the open3d_torch_ops library and generates function wrappers
def generate_torch_ops_wrapper.find_op_reg_file | ( | ops_dir, | |
op_name | |||
) |
Tries to find the corresponding tensorflow file for the op_name
def generate_torch_ops_wrapper.get_tensorflow_docstring_from_file | ( | path | ) |
Extracts the docstring from a tensorflow register op file
def generate_torch_ops_wrapper.main | ( | ) |
def generate_torch_ops_wrapper.parse_schema_from_docstring | ( | docstring | ) |
Parses the schema from the definition in the docstring of the function. At the moment we only allow tuples and a single Tensor as return value. All input arguments must have a name. E.g. the following are schemas for which we can generate wrappers open3d::my_function(int a, Tensor b, Tensor c) -> (Tensor d, Tensor e) open3d::my_function(int a, Tensor b, Tensor c) -> Tensor d open3d::my_function(int a, Tensor b, str c='bla') -> Tensor d
string generate_torch_ops_wrapper.FN_RETURN_NAMEDTUPLE_TEMPLATE_STR |
string generate_torch_ops_wrapper.FN_TEMPLATE_STR |
string generate_torch_ops_wrapper.INDENT_SPACES = ' ' |
string generate_torch_ops_wrapper.NAMEDTUPLE_TEMPLATE_STR = "{name} = _namedtuple( '{name}', '{fields}')\n" |
generate_torch_ops_wrapper.Schema = namedtuple('Schema', ['name', 'arguments', 'returns']) |