ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
tensor.cpp File Reference
Include dependency graph for tensor.cpp:

Go to the source code of this file.

Namespaces

 cloudViewer
 Generic file read and write utility for python interface.
 
 cloudViewer::core
 

Macros

#define CONST_ARG   const
 
#define NON_CONST_ARG
 
#define BIND_BINARY_OP_ALL_DTYPES_WITH_SCALAR(py_name, cpp_name, self_const)
 
#define BIND_CLIP_SCALAR(py_name, cpp_name, self_const)
 
#define BIND_BINARY_R_OP_ALL_DTYPES(py_name, cpp_name)
 
#define BIND_REDUCTION_OP(py_name, cpp_name)
 
#define BIND_REDUCTION_OP_NO_KEEPDIM(py_name, cpp_name)
 

Functions

template<typename T >
static std::vector< T > cloudViewer::core::ToFlatVector (py::array_t< T, py::array::c_style|py::array::forcecast > np_array)
 
template<typename func_t >
static void cloudViewer::core::BindTensorCreation (py::module &m, py::class_< Tensor > &tensor, const std::string &py_name, func_t cpp_func)
 
template<typename T >
static void cloudViewer::core::BindTensorFullCreation (py::module &m, py::class_< Tensor > &tensor)
 
void cloudViewer::core::pybind_core_tensor (py::module &m)
 

Macro Definition Documentation

◆ BIND_BINARY_OP_ALL_DTYPES_WITH_SCALAR

#define BIND_BINARY_OP_ALL_DTYPES_WITH_SCALAR (   py_name,
  cpp_name,
  self_const 
)

Definition at line 33 of file tensor.cpp.

◆ BIND_BINARY_R_OP_ALL_DTYPES

#define BIND_BINARY_R_OP_ALL_DTYPES (   py_name,
  cpp_name 
)

Definition at line 116 of file tensor.cpp.

◆ BIND_CLIP_SCALAR

#define BIND_CLIP_SCALAR (   py_name,
  cpp_name,
  self_const 
)

Definition at line 71 of file tensor.cpp.

◆ BIND_REDUCTION_OP

#define BIND_REDUCTION_OP (   py_name,
  cpp_name 
)
Value:
tensor.def( \
#py_name, \
[](const Tensor& tensor, const utility::optional<SizeVector>& dim, \
bool keepdim) { \
SizeVector reduction_dims; \
if (dim.has_value()) { \
reduction_dims = dim.value(); \
} else { \
for (int64_t i = 0; i < tensor.NumDims(); i++) { \
reduction_dims.push_back(i); \
} \
} \
return tensor.cpp_name(reduction_dims, keepdim); \
}, \
"dim"_a = py::none(), "keepdim"_a = false);

Definition at line 162 of file tensor.cpp.

◆ BIND_REDUCTION_OP_NO_KEEPDIM

#define BIND_REDUCTION_OP_NO_KEEPDIM (   py_name,
  cpp_name 
)
Value:
tensor.def( \
#py_name, \
[](const Tensor& tensor, \
const utility::optional<SizeVector>& dim) { \
SizeVector reduction_dims; \
if (dim.has_value()) { \
reduction_dims = dim.value(); \
} else { \
for (int64_t i = 0; i < tensor.NumDims(); i++) { \
reduction_dims.push_back(i); \
} \
} \
return tensor.cpp_name(reduction_dims); \
}, \
"dim"_a = py::none());

Definition at line 181 of file tensor.cpp.

◆ CONST_ARG

#define CONST_ARG   const

Definition at line 30 of file tensor.cpp.

◆ NON_CONST_ARG

#define NON_CONST_ARG

Definition at line 31 of file tensor.cpp.