![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <Tensor.h>


Classes | |
| struct | ConstIterator |
| Const iterator for Tensor. More... | |
| struct | Iterator |
| Iterator for Tensor. More... | |
Public Member Functions | |
| Tensor () | |
| Tensor (const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0")) | |
| Constructor for creating a contiguous Tensor. More... | |
| template<typename T > | |
| Tensor (const std::vector< T > &init_vals, const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0")) | |
| Constructor for creating a contiguous Tensor with initial values. More... | |
| template<typename T > | |
| Tensor (const T *init_vals, const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0")) | |
| Constructor from raw host buffer. The memory will be copied. More... | |
| Tensor (const SizeVector &shape, const SizeVector &strides, void *data_ptr, Dtype dtype, const std::shared_ptr< Blob > &blob) | |
| template<typename T > | |
| Tensor (std::vector< T > &&vec, const SizeVector &shape={}) | |
| Take ownership of data in std::vector<T> More... | |
| Tensor (void *data_ptr, Dtype dtype, const SizeVector &shape, const SizeVector &strides={}, const Device &device=Device("CPU:0")) | |
| Tensor wrapper constructor from raw host buffer. More... | |
| Tensor (const Tensor &other)=default | |
| Tensor (Tensor &&other)=default | |
| Tensor & | operator= (const Tensor &other) & |
| Tensor & | operator= (Tensor &&other) & |
| Tensor & | operator= (const Tensor &other) && |
Tensor assignment rvalue = lvalue, e.g. tensor_a[0] = tensor_b. More... | |
| Tensor & | operator= (Tensor &&other) && |
Tensor assignment rvalue = rvalue, e.g. tensor_a[0] = tensor_b[0]. More... | |
| template<typename T > | |
| Tensor & | operator= (const T v) && |
| Tensor | ReinterpretCast (const core::Dtype &dtype) const |
| template<typename Object > | |
| Tensor & | AssignObject (const Object &v) && |
| template<typename S > | |
| void | Fill (S v) |
| Fill the whole Tensor with a scalar value, the scalar will be casted to the Tensor's Dtype. More... | |
| template<typename Object > | |
| void | FillObject (const Object &v) |
| Tensor | Reverse () const |
| Reverse a Tensor's elements by viewing the tensor as a 1D array. More... | |
| Tensor | GetItem (const TensorKey &tk) const |
| Tensor | GetItem (const std::vector< TensorKey > &tks) const |
| Tensor | SetItem (const Tensor &value) |
Set all items. Equivalent to tensor[:] = value in Python. More... | |
| Tensor | SetItem (const TensorKey &tk, const Tensor &value) |
| Tensor | SetItem (const std::vector< TensorKey > &tks, const Tensor &value) |
| Tensor | Append (const Tensor &other, const utility::optional< int64_t > &axis=utility::nullopt) const |
Appends the other tensor, along the given axis and returns a copy of the tensor. The other tensors must have same data-type, device, and number of dimensions. All dimensions must be the same, except the dimension along the axis the tensors are to be appended. More... | |
| Tensor | Broadcast (const SizeVector &dst_shape) const |
| Broadcast Tensor to a new broadcastable shape. More... | |
| Tensor | Expand (const SizeVector &dst_shape) const |
| Tensor | Reshape (const SizeVector &dst_shape) const |
| Tensor | Flatten (int64_t start_dim=0, int64_t end_dim=-1) const |
| Tensor | View (const SizeVector &dst_shape) const |
| Tensor | Clone () const |
| Copy Tensor to the same device. More... | |
| void | CopyFrom (const Tensor &other) |
| Copy Tensor values to current tensor from the source tensor. More... | |
| Tensor | To (Dtype dtype, bool copy=false) const |
| Tensor | To (const Device &device, bool copy=false) const |
| Tensor | To (const Device &device, Dtype dtype, bool copy=false) const |
| std::string | ToString (bool with_suffix=true, const std::string &indent="") const |
| Tensor | operator[] (int64_t i) const |
| Extract the i-th Tensor along the first axis, returning a new view. More... | |
| Tensor | IndexExtract (int64_t dim, int64_t idx) const |
| Tensor | Slice (int64_t dim, int64_t start, int64_t stop, int64_t step=1) const |
| Tensor | AsRvalue () |
| const Tensor | AsRvalue () const |
| Convert to constant rvalue. More... | |
| Tensor | IndexGet (const std::vector< Tensor > &index_tensors) const |
| Advanced indexing getter. This will always allocate a new Tensor. More... | |
| void | IndexSet (const std::vector< Tensor > &index_tensors, const Tensor &src_tensor) |
| Advanced indexing getter. More... | |
| void | IndexAdd_ (int64_t dim, const Tensor &index, const Tensor &src) |
| Advanced in-place reduction by index. More... | |
| Tensor | Permute (const SizeVector &dims) const |
| Permute (dimension shuffle) the Tensor, returns a view. More... | |
| Tensor | AsStrided (const SizeVector &new_shape, const SizeVector &new_strides) const |
| Create a Tensor view of specified shape and strides. The underlying buffer and data_ptr offsets remain the same. More... | |
| Tensor | Transpose (int64_t dim0, int64_t dim1) const |
Transpose a Tensor by swapping dimension dim0 and dim1. More... | |
| Tensor | T () const |
| Expects input to be <= 2-D Tensor by swapping dimension 0 and 1. More... | |
| double | Det () const |
| Compute the determinant of a 2D square tensor. More... | |
| template<typename T > | |
| T | Item () const |
| Tensor | Add (const Tensor &value) const |
| Adds a tensor and returns the resulting tensor. More... | |
| Tensor | Add (Scalar value) const |
| Tensor | operator+ (const Tensor &value) const |
| Tensor | operator+ (Scalar value) const |
| Tensor | Add_ (const Tensor &value) |
| Tensor | Add_ (Scalar value) |
| Tensor | operator+= (const Tensor &value) |
| Tensor | operator+= (Scalar value) |
| Tensor | Sub (const Tensor &value) const |
| Substracts a tensor and returns the resulting tensor. More... | |
| Tensor | Sub (Scalar value) const |
| Tensor | operator- (const Tensor &value) const |
| Tensor | operator- (Scalar value) const |
| Tensor | Sub_ (const Tensor &value) |
| Tensor | Sub_ (Scalar value) |
| Tensor | operator-= (const Tensor &value) |
| Tensor | operator-= (Scalar value) |
| Tensor | Mul (const Tensor &value) const |
| Multiplies a tensor and returns the resulting tensor. More... | |
| Tensor | Mul (Scalar value) const |
| Tensor | operator* (const Tensor &value) const |
| Tensor | operator* (Scalar value) const |
| Tensor | Mul_ (const Tensor &value) |
| Tensor | Mul_ (Scalar value) |
| Tensor | operator*= (const Tensor &value) |
| Tensor | operator*= (Scalar value) |
| Tensor | Div (const Tensor &value) const |
| Divides a tensor and returns the resulting tensor. More... | |
| Tensor | Div (Scalar value) const |
| Tensor | operator/ (const Tensor &value) const |
| Tensor | operator/ (Scalar value) const |
| Tensor | Div_ (const Tensor &value) |
| Tensor | Div_ (Scalar value) |
| Tensor | operator/= (const Tensor &value) |
| Tensor | operator/= (Scalar value) |
| Tensor | Sum (const SizeVector &dims, bool keepdim=false) const |
| Tensor | Mean (const SizeVector &dims, bool keepdim=false) const |
| Tensor | Prod (const SizeVector &dims, bool keepdim=false) const |
| Tensor | Min (const SizeVector &dims, bool keepdim=false) const |
| Tensor | Max (const SizeVector &dims, bool keepdim=false) const |
| Tensor | ArgMin (const SizeVector &dims) const |
| Tensor | ArgMax (const SizeVector &dims) const |
| Tensor | Sqrt () const |
| Element-wise square root of a tensor, returns a new tensor. More... | |
| Tensor | Sqrt_ () |
| Element-wise square root of a tensor, in-place. More... | |
| Tensor | Sin () const |
| Element-wise sine of a tensor, returning a new tensor. More... | |
| Tensor | Sin_ () |
| Element-wise sine of a tensor, in-place. More... | |
| Tensor | Cos () const |
| Element-wise cosine of a tensor, returning a new tensor. More... | |
| Tensor | Cos_ () |
| Element-wise cosine of a tensor, in-place. More... | |
| Tensor | Neg () const |
| Element-wise negation of a tensor, returning a new tensor. More... | |
| Tensor | Neg_ () |
| Element-wise negation of a tensor, in-place. More... | |
| Tensor | operator- () const |
| Unary minus of a tensor, returning a new tensor. More... | |
| Tensor | Exp () const |
| Element-wise exponential of a tensor, returning a new tensor. More... | |
| Tensor | Exp_ () |
| Element-wise base-e exponential of a tensor, in-place. More... | |
| Tensor | Abs () const |
| Element-wise absolute value of a tensor, returning a new tensor. More... | |
| Tensor | Abs_ () |
| Element-wise absolute value of a tensor, in-place. More... | |
| Tensor | IsNan () const |
| Tensor | IsInf () const |
| Tensor | IsFinite () const |
| Tensor | Clip (Scalar min_val, Scalar max_val) const |
| Tensor | Clip_ (Scalar min_val, Scalar max_val) |
| Tensor | Floor () const |
| Element-wise floor value of a tensor, returning a new tensor. More... | |
| Tensor | Ceil () const |
| Element-wise ceil value of a tensor, returning a new tensor. More... | |
| Tensor | Round () const |
| Element-wise round value of a tensor, returning a new tensor. More... | |
| Tensor | Trunc () const |
| Element-wise trunc value of a tensor, returning a new tensor. More... | |
| Tensor | LogicalNot () const |
| Tensor | LogicalNot_ () |
| Tensor | LogicalAnd (const Tensor &value) const |
| Tensor | operator&& (const Tensor &value) const |
| Tensor | LogicalAnd (Scalar value) const |
| Tensor | LogicalAnd_ (const Tensor &value) |
| Tensor | LogicalAnd_ (Scalar value) |
| Tensor | LogicalOr (const Tensor &value) const |
| Tensor | operator|| (const Tensor &value) const |
| Tensor | LogicalOr (Scalar value) const |
| Tensor | LogicalOr_ (const Tensor &value) |
| Tensor | LogicalOr_ (Scalar value) |
| Tensor | LogicalXor (const Tensor &value) const |
| Tensor | LogicalXor (Scalar value) const |
| Tensor | LogicalXor_ (const Tensor &value) |
| Tensor | LogicalXor_ (Scalar value) |
| Tensor | Gt (const Tensor &value) const |
| Element-wise greater-than of tensors, returning a new boolean tensor. More... | |
| Tensor | operator> (const Tensor &value) const |
| Tensor | Gt (Scalar value) const |
| Tensor | Gt_ (const Tensor &value) |
| Tensor | Gt_ (Scalar value) |
| Tensor | Lt (const Tensor &value) const |
| Element-wise less-than of tensors, returning a new boolean tensor. More... | |
| Tensor | operator< (const Tensor &value) const |
| Tensor | Lt (Scalar value) const |
| Tensor | Lt_ (const Tensor &value) |
| Tensor | Lt_ (Scalar value) |
| Tensor | Ge (const Tensor &value) const |
| Tensor | operator>= (const Tensor &value) const |
| Tensor | Ge (Scalar value) const |
| Tensor | Ge_ (const Tensor &value) |
| Tensor | Ge_ (Scalar value) |
| Tensor | Le (const Tensor &value) const |
| Tensor | operator<= (const Tensor &value) const |
| Tensor | Le (Scalar value) const |
| Tensor | Le_ (const Tensor &value) |
| Tensor | Le_ (Scalar value) |
| Tensor | Eq (const Tensor &value) const |
| Element-wise equals-to of tensors, returning a new boolean tensor. More... | |
| Tensor | operator== (const Tensor &value) const |
| Tensor | Eq (Scalar value) const |
| Tensor | Eq_ (const Tensor &value) |
| Tensor | Eq_ (Scalar value) |
| Tensor | Ne (const Tensor &value) const |
| Element-wise not-equals-to of tensors, returning a new boolean tensor. More... | |
| Tensor | operator!= (const Tensor &value) const |
| Tensor | Ne (Scalar value) const |
| Tensor | Ne_ (const Tensor &value) |
| Tensor | Ne_ (Scalar value) |
| std::vector< Tensor > | NonZeroNumpy () const |
| Tensor | NonZero () const |
| bool | IsNonZero () const |
| Tensor | All (const utility::optional< SizeVector > &dims=utility::nullopt, bool keepdim=false) const |
| Tensor | Any (const utility::optional< SizeVector > &dims=utility::nullopt, bool keepdim=false) const |
| bool | AllEqual (const Tensor &other) const |
| bool | AllClose (const Tensor &other, double rtol=1e-5, double atol=1e-8) const |
| Tensor | IsClose (const Tensor &other, double rtol=1e-5, double atol=1e-8) const |
| bool | IsSame (const Tensor &other) const |
| template<typename T > | |
| std::vector< T > | ToFlatVector () const |
| Retrieve all values as an std::vector, for debugging and testing. More... | |
| bool | IsContiguous () const |
| Tensor | Contiguous () const |
| Tensor | Matmul (const Tensor &rhs) const |
| Tensor | Solve (const Tensor &rhs) const |
| Tensor | LeastSquares (const Tensor &rhs) const |
| std::tuple< Tensor, Tensor, Tensor > | LU (const bool permute_l=false) const |
| Computes LU factorisation of the 2D square tensor, using A = P * L * U; where P is the permutation matrix, L is the lower-triangular matrix with diagonal elements as 1.0 and U is the upper-triangular matrix, and returns tuple (P, L, U). More... | |
| std::tuple< Tensor, Tensor > | LUIpiv () const |
Computes LU factorisation of the 2D square tensor, using A = P * L * U; where P is the permutation matrix, L is the lower-triangular matrix with diagonal elements as 1.0 and U is the upper-triangular matrix, and returns tuple output tensor of shape {n,n} and ipiv tensor of shape {n}, where {n,n} is the shape of input tensor. [ipiv, output = cloudViewer.core.lu_ipiv(a)]. More... | |
| Tensor | Triu (const int diagonal=0) const |
| Returns the upper triangular matrix of the 2D tensor, above the given diagonal index. [The value of diagonal = col - row, therefore 0 is the main diagonal (row = col), and it shifts towards right for positive values (for diagonal = 1, col - row = 1), and towards left for negative values. The value of the diagonal parameter must be between [-m, n] for a {m,n} shaped tensor. More... | |
| Tensor | Tril (const int diagonal=0) const |
| Returns the lower triangular matrix of the 2D tensor, above the given diagonal index. [The value of diagonal = col - row, therefore 0 is the main diagonal (row = col), and it shifts towards right for positive values (for diagonal = 1, col - row = 1), and towards left for negative values. The value of the diagonal parameter must be between [-m, n] where {m, n} is the shape of input tensor. More... | |
| std::tuple< Tensor, Tensor > | Triul (const int diagonal=0) const |
| Returns the tuple of upper and lower triangular matrix of the 2D tensor, above and below the given diagonal index. The diagonal elements of lower triangular matrix are taken to be unity. [The value of diagonal = col - row, therefore 0 is the main diagonal (row = col), and it shifts towards right for positive values (for diagonal = 1, col - row = 1), and towards left for negative values. The value of the diagonal parameter must be between [-m, n] where {m, n} is the shape of input tensor. More... | |
| Tensor | Inverse () const |
| std::tuple< Tensor, Tensor, Tensor > | SVD () const |
| int64_t | GetLength () const |
| SizeVector | GetShape () const |
| const SizeVector & | GetShapeRef () const |
| int64_t | GetShape (int64_t dim) const |
| SizeVector | GetStrides () const |
| const SizeVector & | GetStridesRef () const |
| int64_t | GetStride (int64_t dim) const |
| template<typename T > | |
| T * | GetDataPtr () |
| template<typename T > | |
| const T * | GetDataPtr () const |
| void * | GetDataPtr () |
| const void * | GetDataPtr () const |
| Dtype | GetDtype () const |
| Device | GetDevice () const override |
| std::shared_ptr< Blob > | GetBlob () const |
| int64_t | NumElements () const |
| int64_t | NumDims () const |
| template<typename T > | |
| void | AssertTemplateDtype () const |
| DLManagedTensor * | ToDLPack () const |
| Convert the Tensor to DLManagedTensor (DLPack v0.x). More... | |
| DLManagedTensorVersioned * | ToDLPackVersioned () const |
| Convert the Tensor to DLManagedTensorVersioned (DLPack v1.x). More... | |
| void | Save (const std::string &file_name) const |
| Save tensor to numpy's npy format. More... | |
| Iterator | begin () |
| Iterator | end () |
| ConstIterator | cbegin () const |
| ConstIterator | cend () const |
| ConstIterator | begin () const |
| ConstIterator | end () const |
| template<> | |
| Tensor (const std::vector< bool > &init_vals, const SizeVector &shape, Dtype dtype, const Device &device) | |
| template<> | |
| std::vector< bool > | ToFlatVector () const |
| template<> | |
| bool | Item () const |
Public Member Functions inherited from cloudViewer::core::IsDevice | |
| IsDevice ()=default | |
| virtual | ~IsDevice ()=default |
| bool | IsCPU () const |
| bool | IsCUDA () const |
| bool | IsSYCL () const |
Static Public Member Functions | |
| static Tensor | Empty (const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0")) |
| Create a tensor with uninitialized values. More... | |
| static Tensor | EmptyLike (const Tensor &other) |
| template<typename T > | |
| static Tensor | Full (const SizeVector &shape, T fill_value, Dtype dtype, const Device &device=Device("CPU:0")) |
| Create a tensor fill with specified value. More... | |
| static Tensor | Zeros (const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0")) |
| Create a tensor fill with zeros. More... | |
| static Tensor | Ones (const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0")) |
| Create a tensor fill with ones. More... | |
| template<typename T > | |
| static Tensor | Init (const T val, const Device &device=Device("CPU:0")) |
| template<typename T > | |
| static Tensor | Init (const std::initializer_list< T > &in_list, const Device &device=Device("CPU:0")) |
| template<typename T > | |
| static Tensor | Init (const std::initializer_list< std::initializer_list< T >> &in_list, const Device &device=Device("CPU:0")) |
| template<typename T > | |
| static Tensor | Init (const std::initializer_list< std::initializer_list< std::initializer_list< T >>> &in_list, const Device &device=Device("CPU:0")) |
| static Tensor | Eye (int64_t n, Dtype dtype, const Device &device) |
| Create an identity matrix of size n x n. More... | |
| static Tensor | Diag (const Tensor &input) |
| Create a square matrix with specified diagonal elements in input. More... | |
| static Tensor | Arange (const Scalar start, const Scalar stop, const Scalar step=1, const Dtype dtype=core::Int64, const Device &device=core::Device("CPU:0")) |
| Create a 1D tensor with evenly spaced values in the given interval. More... | |
| static Tensor | FromDLPack (const DLManagedTensor *dlmt, std::function< void(void *)> deleter=nullptr) |
| Convert DLManagedTensor to Tensor (DLPack v0.x). More... | |
| static Tensor | FromDLPackVersioned (const DLManagedTensorVersioned *dlmt, std::function< void(void *)> deleter=nullptr) |
| Convert DLManagedTensorVersioned to Tensor (DLPack v1.x). More... | |
| static Tensor | Load (const std::string &file_name) |
| Load tensor from numpy's npy format. More... | |
Protected Member Functions | |
| std::string | ScalarPtrToString (const void *ptr) const |
Protected Attributes | |
| SizeVector | shape_ = {0} |
| SizeVector of the Tensor. shape_[i] is the length of dimension i. More... | |
| SizeVector | strides_ = {1} |
| void * | data_ptr_ = nullptr |
| Dtype | dtype_ = core::Undefined |
| Data type. More... | |
| std::shared_ptr< Blob > | blob_ = nullptr |
| Underlying memory buffer for Tensor. More... | |
A Tensor is a "view" of a data Blob with shape, stride, data_ptr. Tensor can also be used to perform numerical operations.
|
inline |
Definition at line 34 of file Tensor.h.
Referenced by All(), Any(), Arange(), Empty(), GetItem(), IndexExtract(), IndexGet(), Init(), ReinterpretCast(), SetItem(), and Slice().
|
inline |
|
inline |
Constructor for creating a contiguous Tensor with initial values.
Definition at line 50 of file Tensor.h.
References blob_, cloudViewer::core::Dtype::ByteSize(), GetDevice(), LogError, cloudViewer::core::MemoryManager::MemcpyFromHost(), cloudViewer::core::SizeVector::NumElements(), and shape_.
|
inline |
Constructor from raw host buffer. The memory will be copied.
Definition at line 78 of file Tensor.h.
References blob_, cloudViewer::core::Dtype::ByteSize(), GetDevice(), cloudViewer::core::MemoryManager::MemcpyFromHost(), cloudViewer::core::SizeVector::NumElements(), and shape_.
|
inline |
|
inline |
Take ownership of data in std::vector<T>
Create a Tensor from data "moved" from an std::vector<T>. This always produces a Tensor on the CPU device.
| vec | source for the data as an r-value reference. After the Tensor is created this will not have access to or manage the data any more. |
| shape | List of dimensions of data in buffer. e.g. {640, 480, 3} for a 640x480 RGB image. A 1D {vec.size()} shape is assumed if not specified. |
|
inline |
Tensor wrapper constructor from raw host buffer.
This creates a Tensor wrapper for externally managed memory. It is the user's responsibility to keep the buffer valid during the lifetime of this Tensor and deallocate it afterwards.
| data_ptr | Pointer to externally managed buffer. |
| dtype | Tensor element data type. e.g. Float32 for single precision float. |
| shape | List of dimensions of data in buffer. e.g. {640, 480, 3} for a 640x480 RGB image. |
| strides | Number of elements to advance to reach the next element, for every dimension. This will be calculated from the shape assuming a contiguous buffer if not specified. For the above Float32 image, the value of an element will be read as: image[row, col, ch] = *(float *) (data_ptr + sizeof(float) * (row * stride[0] + col * stride[1] + ch * stride[2])); |
| device | Device containing the data buffer. |
|
default |
|
default |
|
inline |
Definition at line 1343 of file Tensor.h.
References blob_, cloudViewer::core::Dtype::ByteSize(), GetDevice(), LogError, cloudViewer::core::MemoryManager::MemcpyFromHost(), cloudViewer::core::SizeVector::NumElements(), and shape_.
| Tensor cloudViewer::core::Tensor::Abs | ( | ) | const |
Element-wise absolute value of a tensor, returning a new tensor.
Definition at line 1351 of file Tensor.cpp.
References cloudViewer::core::kernel::Abs, dtype_, GetDevice(), shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by IsClose(), cloudViewer::core::MakeOperation(), and cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Abs_ | ( | ) |
Element-wise absolute value of a tensor, in-place.
Definition at line 1357 of file Tensor.cpp.
References cloudViewer::core::kernel::Abs, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::pybind_core_tensor().
Adds a tensor and returns the resulting tensor.
Definition at line 1097 of file Tensor.cpp.
References cloudViewer::core::kernel::Add, AssertTensorDevice, AssertTensorDtype, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::shape_util::BroadcastedShape(), dtype_, GetDevice(), GetDtype(), and shape_.
Referenced by Add(), cloudViewer::t::geometry::OrientedBoundingBox::GetBoxPoints(), operator+(), and cloudViewer::ml::contrib::RadiusSearch().
Definition at line 1108 of file Tensor.cpp.
References Add(), DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), and cloudViewer::core::Scalar::To().
Inplace version of Tensor::Add. Adds a tensor to the current tensor and returns the current tensor.
Definition at line 1117 of file Tensor.cpp.
References cloudViewer::core::kernel::Add, AssertTensorDevice, AssertTensorDtype, cloudViewer::core::kernel::BinaryEW(), GetDevice(), and GetDtype().
Referenced by Add_(), cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::geometry::CreatePointCloudWithNormals(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), operator+=(), cloudViewer::t::geometry::LineSet::Scale(), cloudViewer::t::geometry::PointCloud::Scale(), and cloudViewer::t::geometry::TriangleMesh::Scale().
Definition at line 1126 of file Tensor.cpp.
References Add_(), DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), and cloudViewer::core::Scalar::To().
| Tensor cloudViewer::core::Tensor::All | ( | const utility::optional< SizeVector > & | dims = utility::nullopt, |
| bool | keepdim = false |
||
| ) | const |
Returns true if all elements in the tensor are true. Only works for boolean tensors.
Definition at line 1770 of file Tensor.cpp.
References cloudViewer::core::kernel::All, AssertTensorDtype, cloudViewer::core::Bool, dtype_, GetDevice(), cloudViewer::utility::optional< T >::has_value(), cloudViewer::core::shape_util::Iota(), NumDims(), cloudViewer::core::kernel::Reduction(), cloudViewer::core::shape_util::ReductionShape(), shape_, Tensor(), and cloudViewer::utility::optional< T >::value().
Referenced by AllClose(), cloudViewer::core::pybind_core_tensor(), and cloudViewer::t::geometry::PointCloud::RemoveNonFinitePoints().
| bool cloudViewer::core::Tensor::AllClose | ( | const Tensor & | other, |
| double | rtol = 1e-5, |
||
| double | atol = 1e-8 |
||
| ) | const |
Returns true if the two tensors are element-wise equal within a tolerance.
The equation is not symmetrical, i.e. a.AllClose(b) might not be the same as b.AllClose(a). Also see Numpy's documentation: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html.
TODO: support nan
| other | The other tensor to compare with. |
| rtol | Relative tolerance. |
| atol | Absolute tolerance. |
Definition at line 1895 of file Tensor.cpp.
References All(), IsClose(), and Item().
Referenced by cloudViewer::t::geometry::CreatePointCloudWithNormals(), cloudViewer::t::geometry::OrientedBoundingBox::Rotate(), and cloudViewer::t::geometry::OrientedBoundingBox::SetRotation().
| bool cloudViewer::core::Tensor::AllEqual | ( | const Tensor & | other | ) | const |
Returns true if the two tensors are element-wise equal.
TODO: support nan
| other | The other tensor to compare with. |
Definition at line 1885 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, GetDevice(), GetDtype(), and shape_.
| Tensor cloudViewer::core::Tensor::Any | ( | const utility::optional< SizeVector > & | dims = utility::nullopt, |
| bool | keepdim = false |
||
| ) | const |
Returns true if any elements in the tensor are true. Only works for boolean tensors.
Definition at line 1789 of file Tensor.cpp.
References cloudViewer::core::kernel::Any, AssertTensorDtype, cloudViewer::core::Bool, dtype_, GetDevice(), cloudViewer::utility::optional< T >::has_value(), cloudViewer::core::shape_util::Iota(), NumDims(), cloudViewer::core::kernel::Reduction(), cloudViewer::core::shape_util::ReductionShape(), shape_, Tensor(), and cloudViewer::utility::optional< T >::value().
Referenced by cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Append | ( | const Tensor & | other, |
| const utility::optional< int64_t > & | axis = utility::nullopt |
||
| ) | const |
Appends the other tensor, along the given axis and returns a copy of the tensor. The other tensors must have same data-type, device, and number of dimensions. All dimensions must be the same, except the dimension along the axis the tensors are to be appended.
This is the same as NumPy's semantics:
Example:
| other | Values of this tensor is appended to the tensor. |
| axis | [optional] The axis along which values are appended. If axis is not given, both tensors are flattened before use. |
values appended to axis. Note that append does not occur in-place: a new array is allocated and filled. If axis is None, out is a flattened tensor. Definition at line 622 of file Tensor.cpp.
References cloudViewer::core::Append().
|
static |
Create a 1D tensor with evenly spaced values in the given interval.
Definition at line 436 of file Tensor.cpp.
References cloudViewer::core::kernel::Arange(), cloudViewer::core::Scalar::AssertSameScalarType(), DISPATCH_DTYPE_TO_TEMPLATE, cloudViewer::core::Scalar::Equal(), Full(), LogError, Tensor(), and cloudViewer::core::Scalar::To().
Referenced by cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), cloudViewer::t::pipelines::slac::ConvertCorrespondencesTargetIndexedToCx2Form(), cloudViewer::t::pipelines::registration::CorrespondencesFromFeatures(), cloudViewer::t::geometry::VoxelBlockGrid::ExtractTriangleMesh(), cloudViewer::t::geometry::npp::FilterGaussian(), cloudViewer::core::GetColPermutation(), cloudViewer::t::geometry::VoxelBlockGrid::GetVoxelIndices(), cloudViewer::core::kernel::NonZeroSYCL(), cloudViewer::core::pybind_core_tensor(), Reverse(), cloudViewer::t::pipelines::slac::RunRigidOptimizerForFragments(), cloudViewer::t::pipelines::slac::RunSLACOptimizerForFragments(), and cloudViewer::t::geometry::SelectByIndex().
| Tensor cloudViewer::core::Tensor::ArgMax | ( | const SizeVector & | dims | ) | const |
Returns maximum index of the tensor along the given dim. The returned tensor has dtype int64_t, and has the same shape as original tensor except that the reduced dimension is removed.
| dims | dims can only contain a single dimension or all dimensions. If dims contains a single dimension, the index is along the specified dimension. If dims contains all dimensions, the index is into the flattened tensor. |
Definition at line 1289 of file Tensor.cpp.
References cloudViewer::core::kernel::ArgMax, GetDevice(), cloudViewer::core::Int64, cloudViewer::core::kernel::Reduction(), cloudViewer::core::shape_util::ReductionShape(), and shape_.
| Tensor cloudViewer::core::Tensor::ArgMin | ( | const SizeVector & | dims | ) | const |
Returns minimum index of the tensor along the given dim. The returned tensor has dtype int64_t, and has the same shape as original tensor except that the reduced dimension is removed.
| dims | dims can only contain a single dimension or all dimensions. If dims contains a single dimension, the index is along the specified dimension. If dims contains all dimensions, the index is into the flattened tensor. |
Definition at line 1282 of file Tensor.cpp.
References cloudViewer::core::kernel::ArgMin, GetDevice(), cloudViewer::core::Int64, cloudViewer::core::kernel::Reduction(), cloudViewer::core::shape_util::ReductionShape(), and shape_.
|
inline |
Convert to rvalue such that the Tensor can be assigned.
E.g. in numpy
Definition at line 558 of file Tensor.h.
Referenced by Broadcast(), CopyFrom(), Fill(), FillObject(), cloudViewer::t::geometry::LineSet::PaintUniformColor(), cloudViewer::t::geometry::PointCloud::PaintUniformColor(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::core::kernel::Reduction(), and SetItem().
|
inline |
|
inline |
Definition at line 1175 of file Tensor.h.
References cloudViewer::core::Dtype::ByteSize(), dtype_, cloudViewer::core::Dtype::IsObject(), LogError, T(), cloudViewer::core::Dtype::ToString(), and ToString().
|
inline |
Assign an object to a tensor. The tensor being assigned to must be a scalar tensor of shape {}. The element byte size of the tensor must be the same as the size of the object. The object must be a POD.
Definition at line 220 of file Tensor.h.
References GetDataPtr(), GetDevice(), LogError, cloudViewer::core::MemoryManager::MemcpyFromHost(), shape_, and cloudViewer::core::SmallVectorBase< Size_T >::size().
| Tensor cloudViewer::core::Tensor::AsStrided | ( | const SizeVector & | new_shape, |
| const SizeVector & | new_strides | ||
| ) | const |
Create a Tensor view of specified shape and strides. The underlying buffer and data_ptr offsets remain the same.
Definition at line 1061 of file Tensor.cpp.
References blob_, data_ptr_, dtype_, and result.
Referenced by Diag(), Expand(), Eye(), Permute(), Reshape(), cloudViewer::core::AdvancedIndexPreprocessor::RestrideTensor(), and View().
| Tensor::Iterator cloudViewer::core::Tensor::begin | ( | ) |
Returns the beginning of the tensor iterator. The iterator iterates over the first dimension of the tensor. The generated tensor slices share the same memory with the original tensor.
Definition at line 269 of file Tensor.cpp.
|
inline |
Returns the beginning of the const tensor iterator. The iterator iterates over the first dimension of the tensor. The generated tensor slices share the same memory with the original tensor. This is equivalent to Tensor::cbegin().
Definition at line 1284 of file Tensor.h.
References cbegin().
| Tensor cloudViewer::core::Tensor::Broadcast | ( | const SizeVector & | dst_shape | ) | const |
Broadcast Tensor to a new broadcastable shape.
Definition at line 628 of file Tensor.cpp.
References AsRvalue(), cloudViewer::core::shape_util::CanBeBrocastedToShape(), dtype_, GetDevice(), LogError, shape_, and cloudViewer::core::SizeVector::ToString().
| Tensor::ConstIterator cloudViewer::core::Tensor::cbegin | ( | ) | const |
Returns the beginning of the const tensor iterator. The iterator iterates over the first dimension of the tensor. The generated tensor slices share the same memory with the original tensor.
Definition at line 338 of file Tensor.cpp.
References LogError, and NumDims().
Referenced by begin().
| Tensor cloudViewer::core::Tensor::Ceil | ( | ) | const |
Element-wise ceil value of a tensor, returning a new tensor.
Definition at line 1417 of file Tensor.cpp.
References cloudViewer::core::kernel::Ceil, dtype_, GetDevice(), shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::MakeOperation(), and cloudViewer::core::pybind_core_tensor().
| Tensor::ConstIterator cloudViewer::core::Tensor::cend | ( | ) | const |
Element-wise clipping of tensor values so that resulting values lie in the range [min_val, max_val], returning a new tensor.
| min_val | Lower bound for output values. |
| max_val | Upper bound for output values. |
Definition at line 1392 of file Tensor.cpp.
References Clip_(), and Clone().
Referenced by cloudViewer::t::io::ConvertColorTensorToUint8().
Element-wise clipping of tensor values so that resulting values lie in the range [min_val, max_val]. In-place version.
| min_val | Lower bound for output values. |
| max_val | Upper bound for output values. |
Definition at line 1398 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE, dtype_, Full(), GetDevice(), Gt(), cloudViewer::core::TensorKey::IndexTensor(), Lt(), SetItem(), and cloudViewer::core::Scalar::To().
Referenced by Clip().
|
inline |
Copy Tensor to the same device.
Definition at line 502 of file Tensor.h.
References GetDevice(), and To().
Referenced by cloudViewer::t::geometry::PointCloud::Append(), Clip(), cloudViewer::core::TensorList::CopyFrom(), IndexGet(), cloudViewer::core::LeastSquares(), cloudViewer::core::LUIpiv(), NonZeroNumpy(), cloudViewer::core::PyArrayToTensor(), cloudViewer::core::pybind_core_tensor(), cloudViewer::core::PyHandleToTensor(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScale(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScaleHybrid(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScaleIntensity(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScalePointToPlane(), cloudViewer::t::geometry::AxisAlignedBoundingBox::SetMaxBound(), cloudViewer::t::geometry::AxisAlignedBoundingBox::SetMinBound(), cloudViewer::t::io::DepthNoiseSimulator::Simulate(), cloudViewer::core::Solve(), and cloudViewer::t::geometry::Image::To().
| Tensor cloudViewer::core::Tensor::Contiguous | ( | ) | const |
Returns a contiguous Tensor containing the same data in the same device. If self tensor is already contiguous, the same underlying memory will be used.
Definition at line 772 of file Tensor.cpp.
References GetDevice(), IsContiguous(), and To().
Referenced by cloudViewer::core::AddMM(), cloudViewer::t::geometry::RaycastingScene::AddTriangles(), cloudViewer::t::geometry::RaycastingScene::CastRays(), cloudViewer::t::geometry::PointCloud::ComputeBoundaryPoints(), cloudViewer::t::geometry::RaycastingScene::ComputeClosestPoints(), cloudViewer::t::geometry::RaycastingScene::ComputeDistance(), cloudViewer::t::pipelines::kernel::ComputeInformationMatrix(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrix(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybrid(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensity(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::t::pipelines::kernel::ComputePoseColoredICP(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), cloudViewer::t::pipelines::kernel::ComputePosePointToPlane(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::geometry::RaycastingScene::ComputeSignedDistance(), cloudViewer::t::geometry::ComputeTriangleAreasHelper(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::t::geometry::RaycastingScene::CountIntersections(), cloudViewer::t::geometry::RaycastingScene::CreateRaysPinhole(), cloudViewer::t::geometry::kernel::image::CreateVertexMap(), cloudViewer::t::geometry::kernel::pointcloud::EstimateColorGradientsUsingKNNSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateColorGradientsUsingRadiusSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateCovariancesUsingKNNSearchCPU(), cloudViewer::t::geometry::kernel::voxel_grid::EstimateRange(), cloudViewer::t::geometry::vtkutils::ExtrudeLinearPolyData(), cloudViewer::t::geometry::vtkutils::ExtrudeRotationPolyData(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), cloudViewer::io::rpc::messages::Array::FromTensor(), cloudViewer::t::pipelines::slac::ControlGrid::GetNeighborGridMap(), cloudViewer::t::geometry::TriangleMesh::GetNonManifoldEdges(), cloudViewer::t::geometry::kernel::pointcloud::GetPointMaskWithinAABB(), cloudViewer::t::geometry::kernel::pointcloud::GetPointMaskWithinOBB(), cloudViewer::t::geometry::kernel::pointcloud::GetPointMaskWithinOBBCPU(), cloudViewer::core::Inverse(), cloudViewer::ml::contrib::Iou3dCPU(), cloudViewer::ml::contrib::IouBevCPU(), cloudViewer::t::geometry::RaycastingScene::ListIntersections(), cloudViewer::core::LUIpiv(), cloudViewer::core::Matmul(), cloudViewer::t::io::NumpyArray::NumpyArray(), cloudViewer::core::OutputToPLU(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::t::pipelines::kernel::PoseToTransformation(), cloudViewer::t::geometry::kernel::pointcloud::Project(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::TriangleMesh::RemoveNonManifoldEdges(), cloudViewer::t::geometry::TriangleMesh::RemoveUnreferencedVertices(), Reshape(), cloudViewer::t::geometry::kernel::transform::RotateNormals(), cloudViewer::t::geometry::kernel::transform::RotatePoints(), cloudViewer::t::geometry::TriangleMesh::SamplePointsUniformly(), cloudViewer::core::nns::FixedRadiusIndex::SearchHybrid(), cloudViewer::core::nns::NanoFlannIndex::SearchHybrid(), cloudViewer::core::nns::KnnIndex::SearchKnn(), cloudViewer::core::nns::NanoFlannIndex::SearchKnn(), cloudViewer::core::nns::FixedRadiusIndex::SearchRadius(), cloudViewer::core::nns::NanoFlannIndex::SearchRadius(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask(), cloudViewer::core::nns::NanoFlannIndex::SetTensorData(), cloudViewer::core::nns::KnnIndex::SetTensorData(), cloudViewer::core::nns::FixedRadiusIndex::SetTensorData(), cloudViewer::t::io::DepthNoiseSimulator::Simulate(), cloudViewer::ml::contrib::Subsample(), cloudViewer::ml::contrib::SubsampleBatch(), cloudViewer::core::SVD(), cloudViewer::core::eigen_converter::TensorToEigenMatrix(), cloudViewer::core::eigen_converter::TensorToEigenVectorNxVector(), cloudViewer::t::geometry::RaycastingScene::TestOcclusions(), ToFlatVector(), ToString(), cloudViewer::t::pipelines::kernel::TransformationToPose(), cloudViewer::t::geometry::kernel::transform::TransformNormals(), cloudViewer::t::geometry::kernel::transform::TransformPoints(), cloudViewer::core::Tril(), cloudViewer::core::Triu(), cloudViewer::core::Triul(), cloudViewer::t::geometry::kernel::pointcloud::Unproject(), cloudViewer::t::pipelines::slam::Model::UpdateFramePose(), and cloudViewer::t::io::WriteNpz().
| void cloudViewer::core::Tensor::CopyFrom | ( | const Tensor & | other | ) |
Copy Tensor values to current tensor from the source tensor.
Definition at line 770 of file Tensor.cpp.
References AsRvalue().
Referenced by cloudViewer::t::geometry::kernel::minimum_obb::ComputeMinimumOBBApprox(), cloudViewer::core::kernel::CopySYCL(), and cloudViewer::core::kernel::IndexGet().
| Tensor cloudViewer::core::Tensor::Cos | ( | ) | const |
Element-wise cosine of a tensor, returning a new tensor.
Definition at line 1318 of file Tensor.cpp.
References cloudViewer::core::kernel::Cos, dtype_, GetDevice(), shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::MakeOperation(), and cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Cos_ | ( | ) |
Element-wise cosine of a tensor, in-place.
Definition at line 1324 of file Tensor.cpp.
References cloudViewer::core::kernel::Cos, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::pybind_core_tensor().
| double cloudViewer::core::Tensor::Det | ( | ) | const |
Compute the determinant of a 2D square tensor.
Definition at line 1092 of file Tensor.cpp.
References AssertTensorDtypes, cloudViewer::core::Det(), cloudViewer::core::Float32, and cloudViewer::core::Float64.
Referenced by cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), and cloudViewer::core::pybind_core_tensor().
Create a square matrix with specified diagonal elements in input.
Definition at line 424 of file Tensor.cpp.
References AsStrided(), GetDevice(), GetDtype(), GetShape(), LogError, shape_, cloudViewer::core::SmallVectorBase< Size_T >::size(), strides_, cloudViewer::core::SizeVector::ToString(), and Zeros().
Referenced by cloudViewer::core::pybind_core_tensor().
Divides a tensor and returns the resulting tensor.
Definition at line 1205 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::shape_util::BroadcastedShape(), cloudViewer::core::kernel::Div, dtype_, GetDevice(), GetDtype(), and shape_.
Referenced by Div(), cloudViewer::t::geometry::kernel::pointcloud::GetPointMaskWithinOBBCPU(), cloudViewer::t::pipelines::registration::LoadTensorPointCloudFromFile(), and operator/().
Definition at line 1216 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, Div(), dtype_, Full(), GetDevice(), and cloudViewer::core::Scalar::To().
Inplace version of Tensor::Div. Divides a tensor to the current tensor and returns the current tensor.
Definition at line 1225 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::kernel::Div, GetDevice(), and GetDtype().
Referenced by cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), Div_(), and operator/=().
Definition at line 1233 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, Div_(), dtype_, Full(), GetDevice(), and cloudViewer::core::Scalar::To().
|
static |
Create a tensor with uninitialized values.
Definition at line 400 of file Tensor.cpp.
References Tensor().
Referenced by cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocCounts(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocDistances(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocIndices(), cloudViewer::t::geometry::PointCloud::Append(), cloudViewer::t::geometry::TriangleMesh::BakeVertexAttrTextures(), cloudViewer::t::pipelines::registration::ComputeDirectionVectors(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), cloudViewer::t::pipelines::kernel::ComputeInformationMatrix(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrixCPU(), cloudViewer::t::pipelines::kernel::ComputePoseColoredICP(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), cloudViewer::t::pipelines::kernel::ComputePosePointToPlane(), cloudViewer::t::geometry::TriangleMesh::ComputeTriangleAreas(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::t::pipelines::kernel::DecodeAndSolve6x6(), cloudViewer::core::eigen_converter::EigenVectorNxVectorToTensor(), EmptyLike(), cloudViewer::t::geometry::PointCloud::EstimateColorGradients(), cloudViewer::t::geometry::PointCloud::EstimateNormals(), cloudViewer::t::geometry::Image::FilterSobel(), cloudViewer::core::TensorList::FromTensor(), Full(), cloudViewer::core::Inverse(), cloudViewer::core::LUIpiv(), cloudViewer::core::Matmul(), cloudViewer::t::io::PackColorsToFloat(), cloudViewer::t::geometry::LineSet::PaintUniformColor(), cloudViewer::t::geometry::PointCloud::PaintUniformColor(), cloudViewer::t::geometry::kernel::pcapartition::PCAPartition(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::Image::PyrDownDepth(), cloudViewer::benchmarks::Rand(), cloudViewer::t::io::ReadPCDData(), cloudViewer::t::io::ReadPointCloudFromPLY(), cloudViewer::t::io::ReadPointCloudFromSPLAT(), cloudViewer::t::io::ReadTriangleMeshUsingASSIMP(), cloudViewer::t::geometry::Image::Resize(), cloudViewer::t::geometry::Image::RGBToGray(), cloudViewer::t::geometry::kernel::trianglemesh::SamplePointsUniformlyCPU(), cloudViewer::core::nns::KnnIndex::SearchKnn(), cloudViewer::core::nns::FixedRadiusIndex::SetTensorData(), cloudViewer::core::Solve(), cloudViewer::core::SVD(), and cloudViewer::t::geometry::Image::To().
Create a tensor with uninitialized values with the same Dtype and Device as the other tensor.
Definition at line 247 of file Tensor.h.
References dtype_, Empty(), GetDevice(), and shape_.
Referenced by cloudViewer::t::geometry::Image::Dilate(), cloudViewer::t::geometry::Image::Filter(), cloudViewer::t::geometry::Image::FilterBilateral(), cloudViewer::t::geometry::Image::FilterGaussian(), and cloudViewer::t::geometry::Image::FilterSobel().
| Tensor::Iterator cloudViewer::core::Tensor::end | ( | ) |
Returns the end of the tensor iterator. The iterator iterates over the first dimension of the tensor. The generated tensor slices share the same memory with the original tensor.
Definition at line 276 of file Tensor.cpp.
|
inline |
Returns the end of the const tensor iterator. The iterator iterates over the first dimension of the tensor. The generated tensor slices share the same memory with the original tensor. This is equivalent to Tensor::cend().
Definition at line 1290 of file Tensor.h.
References cend().
Element-wise equals-to of tensors, returning a new boolean tensor.
Definition at line 1682 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), cloudViewer::core::kernel::Eq, GetDevice(), and shape_.
Referenced by cloudViewer::t::pipelines::registration::CorrespondencesFromFeatures(), Eq(), and operator==().
Definition at line 1691 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Eq(), Full(), GetDevice(), and cloudViewer::core::Scalar::To().
Element-wise equals-to of tensors, in-place. This operation won't change the tensor's dtype.
Definition at line 1700 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::kernel::Eq, and GetDevice().
Referenced by Eq_().
Definition at line 1707 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Eq_(), Full(), GetDevice(), and cloudViewer::core::Scalar::To().
| Tensor cloudViewer::core::Tensor::Exp | ( | ) | const |
Element-wise exponential of a tensor, returning a new tensor.
Definition at line 1340 of file Tensor.cpp.
References dtype_, cloudViewer::core::kernel::Exp, GetDevice(), shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::t::geometry::npp::FilterGaussian(), cloudViewer::core::MakeOperation(), and cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Exp_ | ( | ) |
Element-wise base-e exponential of a tensor, in-place.
Definition at line 1346 of file Tensor.cpp.
References cloudViewer::core::kernel::Exp, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Expand | ( | const SizeVector & | dst_shape | ) | const |
Expand Tensor to a new broadcastable shape, returning a new view.
Tensors can be expanded to broadcastable shape by setting dimension of size 1 to have stride 0, without allocating new memory.
Definition at line 638 of file Tensor.cpp.
References AsStrided(), cloudViewer::core::shape_util::CanBeBrocastedToShape(), LogError, NumDims(), shape_, cloudViewer::core::SmallVectorBase< Size_T >::size(), strides_, and cloudViewer::core::SizeVector::ToString().
Referenced by cloudViewer::core::pybind_core_linalg().
Create an identity matrix of size n x n.
Definition at line 418 of file Tensor.cpp.
References AsStrided(), Fill(), strides_, and Zeros().
Referenced by cloudViewer::t::pipelines::registration::BenchmarkDopplerICP(), cloudViewer::t::geometry::OrientedBoundingBox::Clear(), cloudViewer::t::pipelines::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::t::pipelines::registration::ComputeRegistrationResult(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPointCPU(), cloudViewer::t::geometry::OrientedBoundingBox::CreateFromAxisAlignedBoundingBox(), cloudViewer::t::geometry::kernel::image::CreateVertexMapCPU(), cloudViewer::t::geometry::CropByOrientedBox(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetBoxPoints(), cloudViewer::t::geometry::kernel::voxel_grid::IntegrateCPU(), cloudViewer::core::Inverse(), cloudViewer::core::OutputToPLU(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::pipelines::odometry::pybind_odometry(), cloudViewer::t::geometry::pybind_pointcloud(), cloudViewer::t::pipelines::registration::pybind_registration_class(), cloudViewer::t::pipelines::slam::pybind_slam(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScale(), and cloudViewer::t::pipelines::slam::Model::TrackFrameToModel().
|
inline |
Fill the whole Tensor with a scalar value, the scalar will be casted to the Tensor's Dtype.
Definition at line 1400 of file Tensor.h.
References AsRvalue(), DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, GetDevice(), and GetDtype().
Referenced by cloudViewer::t::pipelines::registration::ComputeDirectionVectors(), cloudViewer::t::pipelines::kernel::DecodeAndSolve6x6(), Eye(), Full(), operator=(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::core::HashBackendBuffer::ResetHeap(), and cloudViewer::core::TensorList::Resize().
|
inline |
Definition at line 1410 of file Tensor.h.
References AsRvalue(), GetDevice(), and GetDtype().
| Tensor cloudViewer::core::Tensor::Flatten | ( | int64_t | start_dim = 0, |
| int64_t | end_dim = -1 |
||
| ) | const |
Flattens input by reshaping it into a one-dimensional tensor. If start_dim or end_dim are passed, only dimensions starting with start_dim and ending with end_dim are flattened. The order of elements in input is unchanged.
Unlike NumPy’s flatten, which always copies input’s data, this function may return the original object, a view, or copy. If no dimensions are flattened, then the original object input is returned. Otherwise, if input can be viewed as the flattened shape, then that view is returned. Finally, only if the input cannot be viewed as the flattened shape is input’s data copied.
Ref:
| start_dim | The first dimension to flatten (inclusive). |
| end_dim | The last dimension to flatten, starting from start_dim (inclusive). |
Definition at line 685 of file Tensor.cpp.
References GetShape(), LogError, NumDims(), cloudViewer::core::SmallVectorTemplateBase< T, bool >::push_back(), Reshape(), and cloudViewer::core::shape_util::WrapDim().
Referenced by cloudViewer::t::geometry::AxisAlignedBoundingBox::FromLegacy(), cloudViewer::t::geometry::OrientedBoundingBox::FromLegacy(), cloudViewer::core::pybind_core_tensor(), and cloudViewer::t::geometry::OrientedBoundingBox::Rotate().
| Tensor cloudViewer::core::Tensor::Floor | ( | ) | const |
Element-wise floor value of a tensor, returning a new tensor.
Definition at line 1411 of file Tensor.cpp.
References dtype_, cloudViewer::core::kernel::Floor, GetDevice(), shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::MakeOperation(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::core::pybind_core_tensor(), and cloudViewer::t::geometry::PointCloud::VoxelDownSample().
|
static |
Convert DLManagedTensor to Tensor (DLPack v0.x).
Definition at line 1868 of file Tensor.cpp.
Referenced by cloudViewer::core::pybind_core_tensor().
|
static |
Convert DLManagedTensorVersioned to Tensor (DLPack v1.x).
Definition at line 1872 of file Tensor.cpp.
Referenced by cloudViewer::core::pybind_core_tensor().
|
inlinestatic |
Create a tensor fill with specified value.
Definition at line 253 of file Tensor.h.
References Empty(), and Fill().
Referenced by Add(), Add_(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocCounts(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocDistances(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocIndices(), Arange(), Clip_(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), Div(), Div_(), Eq(), Eq_(), cloudViewer::t::geometry::PointCloud::FarthestPointDownSample(), Ge(), Ge_(), Gt(), Gt_(), Le(), Le_(), LogicalAnd(), LogicalAnd_(), LogicalOr(), LogicalOr_(), LogicalXor(), LogicalXor_(), Lt(), Lt_(), Mul(), Mul_(), Ne(), Ne_(), Ones(), cloudViewer::core::operator-(), cloudViewer::core::operator/(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::t::geometry::PointCloud::RemoveNonFinitePoints(), Sub(), Sub_(), and Zeros().
Element-wise greater-than-or-equals-to of tensors, returning a new boolean tensor.
Definition at line 1618 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), cloudViewer::core::kernel::Ge, GetDevice(), and shape_.
Referenced by Ge(), operator>=(), and cloudViewer::t::geometry::PointCloud::RemoveRadiusOutliers().
Definition at line 1627 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), Ge(), GetDevice(), and cloudViewer::core::Scalar::To().
Element-wise greater-than-or-equals-to of tensors, in-place. This operation won't change the tensor's dtype.
Definition at line 1636 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::kernel::Ge, and GetDevice().
Referenced by Ge_().
Definition at line 1643 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), Ge_(), GetDevice(), and cloudViewer::core::Scalar::To().
|
inline |
Definition at line 1168 of file Tensor.h.
References blob_.
Referenced by cloudViewer::core::HashMap::GetValueTensor(), cloudViewer::t::io::NumpyArray::NumpyArray(), and cloudViewer::core::pybind_core_tensor().
|
inline |
Definition at line 1144 of file Tensor.h.
References T().
Referenced by cloudViewer::core::AddMM(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocCounts(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocDistances(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::AllocIndices(), cloudViewer::core::kernel::ArangeCPU(), cloudViewer::core::kernel::ArangeSYCL(), AssignObject(), cloudViewer::t::geometry::TriangleMesh::BakeVertexAttrTextures(), cloudViewer::core::nns::BuildSpatialHashTableCPU(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ComputeAABB(), cloudViewer::visualization::rendering::TPointCloudBuffersBuilder::ComputeAABB(), cloudViewer::visualization::rendering::TLineSetBuffersBuilder::ComputeAABB(), cloudViewer::t::geometry::PointCloud::ComputeConvexHull(), cloudViewer::t::geometry::RaycastingScene::ComputeDistance(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), cloudViewer::t::pipelines::kernel::ComputeInformationMatrixCPU(), cloudViewer::t::geometry::ComputeMetricsCommon(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrixCPU(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICPCPU(), cloudViewer::t::pipelines::kernel::ComputePosePointToPlaneCPU(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPointCPU(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeTriangleAreasCPU(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeTriangleNormalsCPU(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeVertexNormalsCPU(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::visualization::rendering::TPointCloudBuffersBuilder::ConstructBuffers(), cloudViewer::core::kernel::CopyCPU(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::t::geometry::RaycastingScene::CountIntersections(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::CountsPtr(), cloudViewer::core::CPUResetHeap(), cloudViewer::t::geometry::RaycastingScene::CreateRaysPinhole(), cloudViewer::t::geometry::vtkutils::CreateVtkCellArrayFromTensor(), cloudViewer::t::geometry::vtkutils::CreateVtkDataArrayFromTensor(), cloudViewer::t::geometry::vtkutils::CreateVtkImageDataFromTensor(), cloudViewer::t::pipelines::kernel::DecodeAndSolve6x6(), cloudViewer::core::Det(), cloudViewer::t::geometry::ipp::Dilate(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::DistancesPtr(), cloudViewer::core::HashMap::Erase(), cloudViewer::core::StdGPUHashBackend< Key, Hash, Eq >::Erase(), cloudViewer::t::geometry::kernel::pointcloud::EstimateColorGradientsUsingHybridSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateColorGradientsUsingKNNSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateColorGradientsUsingRadiusSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateCovariancesUsingHybridSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateCovariancesUsingKNNSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateCovariancesUsingRadiusSearchCPU(), cloudViewer::t::pipelines::kernel::FillInRigidAlignmentTermCPU(), cloudViewer::t::geometry::npp::Filter(), cloudViewer::t::geometry::ipp::Filter(), cloudViewer::t::geometry::ipp::FilterBilateral(), cloudViewer::t::geometry::ipp::FilterGaussian(), cloudViewer::t::geometry::ipp::FilterSobel(), cloudViewer::core::HashMap::Find(), cloudViewer::core::nns::FixedRadiusSearchCPU(), cloudViewer::core::HashMap::GetActiveIndices(), cloudViewer::core::GetColPermutation(), cloudViewer::t::geometry::Image::GetDataPtr(), cloudViewer::t::geometry::GetEdgeToTrianglesMap(), cloudViewer::core::HashMap::GetValueTensor(), cloudViewer::core::kernel::IndexAddSYCL_(), cloudViewer::core::nns::NeighborSearchAllocator< T, TIndex >::IndicesPtr(), cloudViewer::core::HashMap::InsertImpl(), cloudViewer::core::Inverse(), cloudViewer::t::geometry::InverseTransformation(), cloudViewer::ml::contrib::Iou3dCPU(), cloudViewer::ml::contrib::IouBevCPU(), cloudViewer::core::kernel::LaunchIndexReductionKernel(), cloudViewer::core::LeastSquares(), cloudViewer::t::geometry::RaycastingScene::ListIntersections(), cloudViewer::core::LUIpiv(), cloudViewer::core::Matmul(), cloudViewer::core::kernel::NonZeroSYCL(), cloudViewer::t::io::PackColorsToFloat(), cloudViewer::t::geometry::kernel::pcapartition::PCAPartition(), cloudViewer::t::geometry::kernel::voxel_grid::PointCloudTouchCPU(), cloudViewer::t::pipelines::kernel::PoseToTransformationDevice(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::t::io::ReadPCDData(), cloudViewer::t::io::ReadPointCloudFromPTS(), cloudViewer::t::io::ReadPointCloudFromSPLAT(), cloudViewer::t::io::ReadPointCloudFromTXT(), cloudViewer::t::io::ReadTriangleMeshUsingASSIMP(), cloudViewer::t::geometry::ipp::Remap(), cloudViewer::t::geometry::TriangleMesh::RemoveUnreferencedVertices(), cloudViewer::t::geometry::ipp::Resize(), cloudViewer::t::geometry::ipp::RGBToGray(), cloudViewer::core::nns::NanoFlannIndex::SearchHybrid(), cloudViewer::core::nns::NanoFlannIndex::SearchKnn(), cloudViewer::core::nns::NanoFlannIndex::SearchRadius(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask(), cloudViewer::core::nns::NanoFlannIndex::SetTensorData(), cloudViewer::core::CUDAHashBackendBufferAccessor::Setup(), cloudViewer::core::Solve(), cloudViewer::ml::contrib::Subsample(), cloudViewer::ml::contrib::SubsampleBatch(), cloudViewer::core::SVD(), cloudViewer::t::geometry::kernel::TArrayIndexer< index_t >::TArrayIndexer(), cloudViewer::core::TensorRef::TensorRef(), cloudViewer::core::eigen_converter::TensorToEigenMatrix(), cloudViewer::core::eigen_converter::TensorToEigenVectorNxVector(), cloudViewer::core::TensorToPyArray(), cloudViewer::t::geometry::ipp::To(), ToFlatVector(), cloudViewer::t::geometry::Image::ToLegacy(), cloudViewer::t::pipelines::kernel::TransformationToPoseDevice(), cloudViewer::t::geometry::kernel::TransformIndexer::TransformIndexer(), cloudViewer::visualization::rendering::FilamentScene::UpdateGeometry(), cloudViewer::t::geometry::UpdateTriangleIndicesByVertexMask(), cloudViewer::t::io::WriteNpzOneTensor(), and cloudViewer::t::io::WritePointCloudToPTS().
|
inline |
|
inline |
Definition at line 1149 of file Tensor.h.
References data_ptr_, dtype_, cloudViewer::core::Dtype::IsObject(), LogError, T(), cloudViewer::core::Dtype::ToString(), and ToString().
|
inline |
|
overridevirtual |
Implements cloudViewer::core::IsDevice.
Definition at line 1435 of file Tensor.cpp.
References blob_, and LogError.
Referenced by Abs(), Add(), Add_(), cloudViewer::core::AddMM(), All(), AllEqual(), Any(), cloudViewer::core::kernel::Arange(), cloudViewer::core::kernel::ArangeCPU(), cloudViewer::core::kernel::ArangeSYCL(), ArgMax(), ArgMin(), cloudViewer::core::AssertNotSYCL(), cloudViewer::core::tensor_check::AssertTensorDevice_(), cloudViewer::t::pipelines::registration::AssertValidCorrespondences(), AssignObject(), cloudViewer::t::geometry::AxisAlignedBoundingBox::AxisAlignedBoundingBox(), cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::kernel::BinaryEWSYCL(), Broadcast(), cloudViewer::t::geometry::RaycastingScene::CastRays(), Ceil(), Clip_(), cloudViewer::t::geometry::kernel::image::ClipTransform(), cloudViewer::t::geometry::Image::ClipTransform(), Clone(), cloudViewer::t::geometry::kernel::image::ColorizeDepth(), cloudViewer::t::pipelines::registration::ComputeDirectionVectors(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeInformationMatrix(), cloudViewer::t::geometry::ComputeMetricsCommon(), cloudViewer::t::geometry::kernel::minimum_obb::ComputeMinimumOBBJylanki(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrix(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrixCPU(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybrid(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybridCPU(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensity(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensityCPU(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlaneCPU(), cloudViewer::t::pipelines::kernel::ComputePoseColoredICP(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), cloudViewer::t::pipelines::kernel::ComputePosePointToPlane(), cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), Contiguous(), cloudViewer::t::pipelines::slac::ConvertCorrespondencesTargetIndexedToCx2Form(), cloudViewer::core::kernel::Copy(), cloudViewer::core::kernel::CopyCPU(), cloudViewer::core::kernel::CopySYCL(), Cos(), cloudViewer::t::geometry::kernel::image::CreateNormalMap(), cloudViewer::t::geometry::CreatePointCloudWithNormals(), cloudViewer::t::geometry::kernel::image::CreateVertexMap(), cloudViewer::t::geometry::vtkutils::CreateVtkDataArrayFromTensor(), cloudViewer::t::geometry::kernel::voxel_grid::DepthTouchCPU(), Diag(), cloudViewer::t::geometry::ipp::Dilate(), cloudViewer::t::geometry::npp::Dilate(), Div(), Div_(), EmptyLike(), Eq(), Eq_(), Exp(), Fill(), cloudViewer::t::pipelines::kernel::FillInRigidAlignmentTerm(), cloudViewer::t::pipelines::kernel::FillInSLACAlignmentTerm(), cloudViewer::t::pipelines::kernel::FillInSLACRegularizerTerm(), FillObject(), cloudViewer::t::geometry::npp::Filter(), cloudViewer::t::geometry::npp::FilterBilateral(), cloudViewer::t::geometry::npp::FilterGaussian(), cloudViewer::t::geometry::npp::FilterSobel(), cloudViewer::t::geometry::Image::FilterSobel(), cloudViewer::core::nns::NearestNeighborSearch::FixedRadiusSearch(), Floor(), cloudViewer::core::TensorList::FromTensor(), Ge(), Ge_(), cloudViewer::core::GetColPermutation(), cloudViewer::core::HashBackendBuffer::GetDevice(), cloudViewer::core::nns::NNSIndex::GetDevice(), cloudViewer::core::TensorList::GetDevice(), cloudViewer::t::geometry::Image::GetDevice(), cloudViewer::core::Open3DDLManagedTensor< DLMT >::getDLPackDevice(), GetItem(), cloudViewer::t::geometry::TriangleMesh::GetNonManifoldEdges(), Gt(), Gt_(), cloudViewer::core::nns::NearestNeighborSearch::HybridSearch(), cloudViewer::core::kernel::IndexAddSYCL_(), IndexGet(), cloudViewer::core::kernel::IndexGet(), cloudViewer::core::kernel::IndexGetSYCL(), cloudViewer::core::kernel::IndexSet(), cloudViewer::core::kernel::IndexSetSYCL(), cloudViewer::core::Inverse(), IsClose(), IsFinite(), IsInf(), IsNan(), IsSame(), Item(), cloudViewer::core::nns::NearestNeighborSearch::KnnSearch(), Le(), Le_(), cloudViewer::core::LeastSquares(), LeastSquares(), cloudViewer::t::geometry::LineSet::LineSet(), LogicalAnd(), LogicalAnd_(), LogicalNot(), LogicalOr(), LogicalOr_(), LogicalXor(), LogicalXor_(), Lt(), Lt_(), cloudViewer::core::LUIpiv(), cloudViewer::core::Matmul(), Matmul(), Max(), cloudViewer::core::Maximum(), Min(), cloudViewer::core::Minimum(), Mul(), Mul_(), Ne(), Ne_(), Neg(), cloudViewer::core::kernel::NonZeroSYCL(), cloudViewer::core::operator-(), cloudViewer::core::operator/(), cloudViewer::t::geometry::OrientedBoundingBox::OrientedBoundingBox(), cloudViewer::core::OutputToPLU(), cloudViewer::t::pipelines::kernel::PoseToTransformation(), cloudViewer::t::pipelines::kernel::PoseToTransformationDevice(), cloudViewer::core::HashMap::PrepareIndicesOutput(), cloudViewer::core::HashMap::PrepareMasksOutput(), Prod(), cloudViewer::t::geometry::kernel::pointcloud::Project(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::kernel::image::PyrDownDepth(), cloudViewer::core::kernel::Reduction(), cloudViewer::core::kernel::ReductionSYCL(), cloudViewer::t::geometry::PointCloud::RemoveNonFinitePoints(), cloudViewer::t::geometry::npp::Resize(), cloudViewer::t::geometry::npp::RGBToGray(), Round(), cloudViewer::t::pipelines::kernel::RtToTransformation(), cloudViewer::core::AdvancedIndexPreprocessor::RunPreprocess(), SetItem(), cloudViewer::t::geometry::PointCloud::SetPointAttr(), cloudViewer::t::io::DepthNoiseSimulator::Simulate(), Sin(), cloudViewer::core::Solve(), Solve(), Sqrt(), Sub(), Sub_(), Sum(), cloudViewer::core::SVD(), Tensor(), cloudViewer::core::TensorList::TensorList(), cloudViewer::core::eigen_converter::TensorToEigenVectorNxVector(), cloudViewer::t::geometry::RaycastingScene::TestOcclusions(), cloudViewer::t::geometry::kernel::image::To(), To(), ToFlatVector(), cloudViewer::t::geometry::Image::ToLegacy(), cloudViewer::t::geometry::TensorMap::ToString(), ToString(), cloudViewer::t::pipelines::kernel::TransformationToPose(), cloudViewer::t::geometry::TriangleMesh::TriangleMesh(), cloudViewer::core::Tril(), cloudViewer::core::TrilSYCL(), cloudViewer::core::Triu(), cloudViewer::core::Triul(), cloudViewer::core::TriulSYCL(), cloudViewer::core::TriuSYCL(), Trunc(), cloudViewer::core::kernel::UnaryEW(), cloudViewer::core::kernel::UnaryEWSYCL(), and cloudViewer::t::geometry::kernel::pointcloud::Unproject().
|
inline |
Definition at line 1164 of file Tensor.h.
References dtype_.
Referenced by Add(), Add_(), cloudViewer::core::AddMM(), cloudViewer::core::AdvancedIndexer::AdvancedIndexer(), AllEqual(), cloudViewer::core::kernel::Arange(), cloudViewer::core::kernel::ArangeCPU(), cloudViewer::core::kernel::ArangeSYCL(), cloudViewer::core::tensor_check::AssertTensorDtype_(), cloudViewer::core::tensor_check::AssertTensorDtypes_(), cloudViewer::t::geometry::AxisAlignedBoundingBox::AxisAlignedBoundingBox(), cloudViewer::t::geometry::TriangleMesh::BakeTriangleAttrTextures(), cloudViewer::t::geometry::TriangleMesh::BakeVertexAttrTextures(), cloudViewer::core::kernel::BinaryEWCPU(), cloudViewer::core::kernel::BinaryEWSYCL(), cloudViewer::t::geometry::CheckBlockCoordinates(), cloudViewer::t::geometry::CheckDepthTensor(), cloudViewer::t::geometry::CheckExtrinsicTensor(), cloudViewer::t::geometry::CheckIntrinsicTensor(), cloudViewer::core::HashMap::CheckKeyCompatibility(), cloudViewer::core::HashMap::CheckValueCompatibility(), cloudViewer::t::pipelines::registration::ComputeDirectionVectors(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeInformationMatrix(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrix(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybrid(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensity(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::t::pipelines::kernel::ComputePoseColoredICP(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), cloudViewer::t::pipelines::kernel::ComputePosePointToPlane(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPoint::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPlane::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForDopplerICP::ComputeRMSE(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPoint::ComputeTransformation(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPlane::ComputeTransformation(), cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeTransformation(), cloudViewer::t::pipelines::registration::TransformationEstimationForDopplerICP::ComputeTransformation(), cloudViewer::t::geometry::TriangleMesh::ComputeTriangleAreas(), cloudViewer::t::geometry::ComputeTriangleAreasHelper(), cloudViewer::t::geometry::TriangleMesh::ComputeTriangleNormals(), cloudViewer::t::geometry::TriangleMesh::ComputeVertexNormals(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeVertexNormalsCPU(), cloudViewer::t::io::ConvertColorTensorToUint8(), cloudViewer::core::kernel::CopyCPU(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::t::geometry::CreatePointCloudWithNormals(), cloudViewer::t::geometry::vtkutils::CreateVtkDataArrayFromTensor(), cloudViewer::t::geometry::kernel::voxel_grid::DepthTouchCPU(), cloudViewer::core::Det(), Diag(), cloudViewer::t::geometry::ipp::Dilate(), cloudViewer::t::geometry::npp::Dilate(), Div(), Div_(), cloudViewer::t::geometry::PointCloud::EstimateColorGradients(), cloudViewer::t::geometry::PointCloud::EstimateNormals(), cloudViewer::t::pipelines::registration::EvaluateRegistration(), cloudViewer::t::geometry::PointCloud::FarthestPointDownSample(), Fill(), FillObject(), cloudViewer::t::geometry::npp::Filter(), cloudViewer::t::geometry::ipp::Filter(), cloudViewer::t::geometry::ipp::FilterBilateral(), cloudViewer::t::geometry::npp::FilterBilateral(), cloudViewer::t::geometry::ipp::FilterGaussian(), cloudViewer::t::geometry::ipp::FilterSobel(), cloudViewer::t::geometry::npp::FilterSobel(), cloudViewer::core::TensorList::FromTensor(), cloudViewer::t::io::GenerateHeader(), cloudViewer::t::pipelines::slac::GetCorrespondenceSetForPointCloudPair(), cloudViewer::core::nns::NNSIndex::GetDtype(), cloudViewer::core::TensorList::GetDtype(), cloudViewer::t::geometry::Image::GetDtype(), cloudViewer::t::pipelines::registration::GetInformationMatrix(), cloudViewer::core::HashBackendBuffer::GetKeyDsize(), cloudViewer::t::geometry::TriangleMesh::GetNonManifoldEdges(), IndexAdd_(), cloudViewer::core::kernel::IndexAddCPU_(), cloudViewer::core::kernel::IndexAddSYCL_(), IndexGet(), cloudViewer::core::kernel::IndexGet(), cloudViewer::core::kernel::IndexGetCPU(), cloudViewer::core::kernel::IndexGetSYCL(), IndexSet(), cloudViewer::core::kernel::IndexSetCPU(), cloudViewer::core::kernel::IndexSetSYCL(), cloudViewer::t::geometry::kernel::voxel_grid::Integrate(), cloudViewer::core::Inverse(), IsClose(), cloudViewer::ml::contrib::KnnSearch(), cloudViewer::core::LeastSquares(), LeastSquares(), cloudViewer::t::geometry::VoxelBlockGrid::Load(), cloudViewer::core::LUIpiv(), cloudViewer::core::Matmul(), Matmul(), cloudViewer::core::Maximum(), cloudViewer::core::Minimum(), Mul(), Mul_(), cloudViewer::core::nns::NearestNeighborSearch::MultiRadiusSearch(), cloudViewer::t::pipelines::registration::MultiScaleICP(), cloudViewer::core::kernel::NonZeroCPU(), cloudViewer::core::kernel::NonZeroSYCL(), cloudViewer::core::operator-(), cloudViewer::core::operator/(), cloudViewer::t::geometry::OrientedBoundingBox::OrientedBoundingBox(), cloudViewer::core::OutputToPLU(), cloudViewer::t::io::PackColorsToFloat(), cloudViewer::t::pipelines::kernel::PoseToTransformation(), cloudViewer::core::HashMap::PrepareIndicesOutput(), cloudViewer::core::HashMap::PrepareMasksOutput(), cloudViewer::core::pybind_core_tensor(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::t::io::ReadHashMap(), cloudViewer::core::kernel::ReductionCPU(), cloudViewer::core::kernel::ReductionSYCL(), cloudViewer::t::geometry::ipp::Remap(), cloudViewer::t::geometry::PointCloud::RemoveDuplicatedPoints(), cloudViewer::t::geometry::TriangleMesh::RemoveNonManifoldEdges(), cloudViewer::t::geometry::TriangleMesh::RemoveUnreferencedVertices(), cloudViewer::t::geometry::npp::Resize(), cloudViewer::t::geometry::ipp::Resize(), cloudViewer::t::geometry::ipp::RGBToGray(), cloudViewer::t::geometry::npp::RGBToGray(), cloudViewer::t::pipelines::kernel::RtToTransformation(), cloudViewer::t::geometry::TriangleMesh::SamplePointsUniformly(), cloudViewer::t::geometry::kernel::trianglemesh::SamplePointsUniformlyCPU(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask(), cloudViewer::io::rpc::SetMeshData(), cloudViewer::t::io::DepthNoiseSimulator::Simulate(), cloudViewer::core::Solve(), Solve(), Sub(), Sub_(), cloudViewer::ml::contrib::Subsample(), cloudViewer::ml::contrib::SubsampleBatch(), cloudViewer::core::SVD(), cloudViewer::t::geometry::kernel::TArrayIndexer< index_t >::TArrayIndexer(), cloudViewer::core::TensorList::TensorList(), cloudViewer::core::TensorRef::TensorRef(), cloudViewer::core::eigen_converter::TensorToEigenVectorNxVector(), cloudViewer::core::TensorToPyArray(), cloudViewer::visualization::rendering::TLineSetBuffersBuilder::TLineSetBuffersBuilder(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::TMeshBuffersBuilder(), cloudViewer::t::geometry::ipp::To(), ToFlatVector(), cloudViewer::t::geometry::PointCloud::ToLegacy(), cloudViewer::t::geometry::TensorMap::ToString(), cloudViewer::core::ToTensorKey(), cloudViewer::visualization::rendering::TPointCloudBuffersBuilder::TPointCloudBuffersBuilder(), cloudViewer::t::geometry::Transform(), cloudViewer::t::pipelines::kernel::TransformationToPose(), cloudViewer::core::Tril(), cloudViewer::core::TrilCPU(), cloudViewer::core::TrilSYCL(), cloudViewer::core::Triu(), cloudViewer::core::TriuCPU(), cloudViewer::core::Triul(), cloudViewer::core::TriulCPU(), cloudViewer::core::TriulSYCL(), cloudViewer::core::TriuSYCL(), cloudViewer::core::kernel::UnaryEW(), cloudViewer::core::kernel::UnaryEWCPU(), cloudViewer::core::kernel::UnaryEWSYCL(), and cloudViewer::t::io::WriteNpzOneTensor().
Pythonic getitem for tensor.
Returns a view of the original tensor, if TensorKey only contains TensorKeyMode::Index or TensorKeyMode::Slice. Returns a copy if the TensorKey contains IndexTensor (advanced indexing).
For example, in numpy:
The equivalent CloudViewer C++ calls:
Definition at line 489 of file Tensor.cpp.
References GetDevice(), cloudViewer::core::TensorKey::GetIndex(), cloudViewer::core::TensorKey::GetIndexTensor(), GetItem(), cloudViewer::core::TensorKey::GetMode(), cloudViewer::core::TensorKey::GetStart(), cloudViewer::core::TensorKey::GetStep(), cloudViewer::core::TensorKey::GetStop(), cloudViewer::core::TensorKey::Index, IndexExtract(), IndexGet(), cloudViewer::core::TensorKey::IndexTensor, cloudViewer::core::TensorKey::InstantiateDimSize(), cloudViewer::core::Int64, LogError, cloudViewer::core::None, shape_, Slice(), cloudViewer::core::TensorKey::Slice(), and Tensor().
Pythonic getitem for tensor.
Returns a view of the original tensor, if TensorKey is TensorKeyMode::Index or TensorKeyMode::Slice. Returns a copy if the TensorKey contains TensorKeyMode::IndexTensor (advanced indexing).
For example, in numpy:
The equivalent CloudViewer C++ calls:
Definition at line 473 of file Tensor.cpp.
References cloudViewer::core::TensorKey::GetIndex(), cloudViewer::core::TensorKey::GetIndexTensor(), cloudViewer::core::TensorKey::GetMode(), cloudViewer::core::TensorKey::GetStart(), cloudViewer::core::TensorKey::GetStep(), cloudViewer::core::TensorKey::GetStop(), cloudViewer::core::TensorKey::Index, IndexExtract(), IndexGet(), cloudViewer::core::TensorKey::IndexTensor, cloudViewer::core::TensorKey::InstantiateDimSize(), LogError, NumDims(), shape_, Slice(), and cloudViewer::core::TensorKey::Slice.
Referenced by cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), GetItem(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::t::pipelines::kernel::PoseToTransformation(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), SetItem(), and cloudViewer::t::pipelines::kernel::TransformationToPose().
|
inline |
Returns the size of the first dimension. If NumDims() == 0, an exception will be thrown.
Definition at line 1125 of file Tensor.h.
References cloudViewer::core::SizeVector::GetLength(), and GetShape().
Referenced by cloudViewer::core::HashMap::Activate(), cloudViewer::t::geometry::RaycastingScene::AddTriangles(), cloudViewer::t::geometry::PointCloud::Append(), cloudViewer::core::kernel::ArangeCPU(), cloudViewer::core::kernel::ArangeSYCL(), cloudViewer::t::pipelines::registration::AssertValidCorrespondences(), cloudViewer::t::geometry::TriangleMesh::BakeVertexAttrTextures(), cloudViewer::core::HashMap::CheckKeyLength(), cloudViewer::core::HashMap::CheckKeyValueLengthCompatibility(), cloudViewer::t::geometry::PointCloud::ComputeBoundaryPoints(), cloudViewer::t::geometry::PointCloud::ComputeConvexHull(), cloudViewer::t::pipelines::registration::ComputeDirectionVectors(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeature(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), cloudViewer::t::pipelines::kernel::ComputeInformationMatrixCPU(), cloudViewer::t::pipelines::kernel::ComputePoseColoredICPCPU(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICPCPU(), cloudViewer::t::pipelines::kernel::ComputePosePointToPlaneCPU(), cloudViewer::t::pipelines::registration::ComputeRegistrationResult(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPoint::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPlane::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForDopplerICP::ComputeRMSE(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPointCPU(), cloudViewer::t::geometry::ComputeTriangleAreasHelper(), cloudViewer::t::geometry::TriangleMesh::ComputeTriangleNormals(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), cloudViewer::t::geometry::TriangleMesh::ComputeVertexNormals(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeVertexNormalsCPU(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::t::pipelines::slac::ControlGrid::ControlGrid(), cloudViewer::t::pipelines::slac::ConvertCorrespondencesTargetIndexedToCx2Form(), cloudViewer::t::pipelines::registration::CorrespondencesFromFeatures(), cloudViewer::core::CPUResetHeap(), cloudViewer::core::HashMap::Erase(), cloudViewer::t::geometry::PointCloud::EstimateColorGradients(), cloudViewer::t::geometry::PointCloud::EstimateNormals(), cloudViewer::t::geometry::VoxelBlockGrid::ExtractTriangleMesh(), cloudViewer::t::geometry::PointCloud::FarthestPointDownSample(), cloudViewer::core::HashMap::Find(), cloudViewer::t::geometry::PointCloud::GaussianSplatGetSHOrder(), cloudViewer::t::io::GenerateHeader(), cloudViewer::core::HashBackendBuffer::GetCapacity(), cloudViewer::t::pipelines::slac::GetCorrespondenceSetForPointCloudPair(), cloudViewer::t::geometry::GetEdgeToTrianglesMap(), cloudViewer::t::pipelines::slac::ControlGrid::GetNeighborGridMap(), cloudViewer::t::geometry::VoxelBlockGrid::GetUniqueBlockCoordinates(), cloudViewer::t::geometry::VoxelBlockGrid::GetVoxelCoordinatesAndFlattenedIndices(), cloudViewer::t::geometry::VoxelBlockGrid::GetVoxelIndices(), cloudViewer::t::geometry::LineSet::HasLineAttr(), cloudViewer::t::geometry::LineSet::HasPointAttr(), cloudViewer::t::geometry::PointCloud::HasPointAttr(), cloudViewer::t::geometry::TriangleMesh::HasTriangleAttr(), cloudViewer::t::geometry::TriangleMesh::HasVertexAttr(), cloudViewer::t::geometry::PointCloud::HiddenPointRemoval(), cloudViewer::core::HashMap::Insert(), cloudViewer::core::HashMap::InsertImpl(), cloudViewer::ml::contrib::Iou3dCPU(), cloudViewer::ml::contrib::IouBevCPU(), cloudViewer::t::geometry::PointCloud::IsGaussianSplat(), cloudViewer::t::geometry::VoxelBlockGrid::Load(), cloudViewer::t::io::PackColorsToFloat(), cloudViewer::t::geometry::LineSet::PaintUniformColor(), cloudViewer::t::geometry::PointCloud::PaintUniformColor(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::t::geometry::TriangleMesh::PCAPartition(), cloudViewer::core::HashMap::PrepareIndicesOutput(), cloudViewer::core::HashMap::PrepareMasksOutput(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::pipelines::registration::pybind_registration_class(), cloudViewer::t::geometry::PointCloud::RandomDownSample(), cloudViewer::t::io::ReadHashMap(), cloudViewer::t::io::ReadTriangleMesh(), cloudViewer::t::geometry::PointCloud::RemoveDuplicatedPoints(), cloudViewer::t::geometry::PointCloud::RemoveNonFinitePoints(), cloudViewer::t::geometry::PointCloud::RemoveRadiusOutliers(), cloudViewer::t::geometry::TriangleMesh::RemoveUnreferencedVertices(), cloudViewer::t::pipelines::slac::RunSLACOptimizerForFragments(), cloudViewer::t::pipelines::slac::SaveCorrespondencesForPointClouds(), cloudViewer::t::geometry::SelectByIndex(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), cloudViewer::t::geometry::PointCloud::SelectByIndex(), cloudViewer::t::geometry::PointCloud::SelectByMask(), cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask(), cloudViewer::core::eigen_converter::TensorToEigenVectorNxVector(), cloudViewer::t::geometry::PointCloud::ToString(), cloudViewer::t::geometry::TriangleMesh::ToString(), cloudViewer::t::pipelines::slac::ControlGrid::Touch(), cloudViewer::t::geometry::PointCloud::UniformDownSample(), cloudViewer::t::pipelines::slac::UpdateControlGrid(), cloudViewer::t::pipelines::slac::UpdatePoses(), cloudViewer::t::geometry::UpdateTriangleIndicesByVertexMask(), cloudViewer::t::pipelines::slac::VisualizeGridDeformation(), cloudViewer::t::pipelines::slac::VisualizePointCloudCorrespondences(), cloudViewer::t::geometry::PointCloud::VoxelDownSample(), cloudViewer::t::io::WritePCDData(), cloudViewer::t::io::WritePointCloud(), cloudViewer::t::io::WritePointCloudToPLY(), cloudViewer::t::io::WritePointCloudToPTS(), and cloudViewer::t::io::WritePointCloudToSPLAT().
|
inline |
Definition at line 1127 of file Tensor.h.
References shape_.
Referenced by cloudViewer::core::AddMM(), cloudViewer::core::tensor_check::AssertTensorShape_(), cloudViewer::t::pipelines::registration::AssertValidCorrespondences(), cloudViewer::core::kernel::BinaryEW(), cloudViewer::t::geometry::BufferRadiusNeighbors(), cloudViewer::core::nns::BuildSpatialHashTableCPU(), cloudViewer::t::geometry::RaycastingScene::CastRays(), cloudViewer::t::geometry::CheckExtrinsicTensor(), cloudViewer::core::CheckInput(), cloudViewer::t::geometry::CheckIntrinsicTensor(), cloudViewer::core::HashMap::CheckKeyCompatibility(), cloudViewer::core::HashMap::CheckValueCompatibility(), cloudViewer::t::geometry::RaycastingScene::ComputeClosestPoints(), cloudViewer::t::pipelines::registration::ComputeDirectionVectors(), cloudViewer::t::geometry::RaycastingScene::ComputeDistance(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeature(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::geometry::kernel::minimum_obb::ComputeMinimumOBBJylanki(), cloudViewer::t::pipelines::odometry::ComputeOdometryResultHybrid(), cloudViewer::t::pipelines::odometry::ComputeOdometryResultIntensity(), cloudViewer::t::pipelines::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::geometry::RaycastingScene::ComputeSignedDistance(), cloudViewer::core::kernel::Copy(), cloudViewer::core::kernel::CopyCPU(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::t::geometry::RaycastingScene::CountIntersections(), cloudViewer::t::geometry::vtkutils::CreateLineSetFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateVtkCellArrayFromTensor(), cloudViewer::t::geometry::vtkutils::CreateVtkDataArrayFromTensor(), cloudViewer::t::geometry::vtkutils::CreateVtkImageDataFromTensor(), cloudViewer::core::Det(), Diag(), cloudViewer::t::geometry::ipp::Dilate(), cloudViewer::t::geometry::npp::Dilate(), cloudViewer::t::geometry::kernel::pointcloud::EstimateColorGradientsUsingKNNSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateCovariancesUsingKNNSearchCPU(), cloudViewer::t::geometry::npp::Filter(), cloudViewer::t::geometry::ipp::Filter(), cloudViewer::t::geometry::ipp::FilterBilateral(), cloudViewer::t::geometry::npp::FilterBilateral(), cloudViewer::t::geometry::ipp::FilterGaussian(), cloudViewer::t::geometry::ipp::FilterSobel(), cloudViewer::t::geometry::npp::FilterSobel(), cloudViewer::t::geometry::Image::FilterSobel(), cloudViewer::core::nns::FixedRadiusSearchCPU(), Flatten(), cloudViewer::core::TensorList::FromTensor(), cloudViewer::t::geometry::PointCloud::GaussianSplatGetSHOrder(), cloudViewer::t::geometry::Image::GetChannels(), cloudViewer::t::geometry::Image::GetCols(), cloudViewer::core::nns::NNSIndex::GetDatasetSize(), cloudViewer::core::nns::NNSIndex::GetDimension(), GetLength(), cloudViewer::t::geometry::Image::GetRows(), cloudViewer::t::geometry::Image::Image(), IndexAdd_(), cloudViewer::core::kernel::IndexAddSYCL_(), cloudViewer::core::kernel::IndexGet(), cloudViewer::core::Inverse(), IsClose(), cloudViewer::ml::contrib::KnnSearch(), cloudViewer::core::kernel::LaunchIndexReductionKernel(), cloudViewer::core::LeastSquares(), cloudViewer::t::geometry::RaycastingScene::ListIntersections(), cloudViewer::t::geometry::VoxelBlockGrid::Load(), cloudViewer::core::LU(), cloudViewer::core::LUIpiv(), cloudViewer::core::Matmul(), cloudViewer::core::Maximum(), cloudViewer::core::Minimum(), cloudViewer::core::OutputToPLU(), cloudViewer::core::pybind_core_linalg(), cloudViewer::t::geometry::pybind_image(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::t::io::ReadHashMap(), cloudViewer::core::kernel::Reduction(), cloudViewer::t::geometry::ipp::Remap(), cloudViewer::t::geometry::PointCloud::RemoveStatisticalOutliers(), cloudViewer::t::geometry::npp::Resize(), cloudViewer::t::geometry::ipp::Resize(), cloudViewer::core::AdvancedIndexPreprocessor::RestrideIndexTensor(), cloudViewer::core::AdvancedIndexPreprocessor::RestrideTensor(), Reverse(), cloudViewer::t::geometry::ipp::RGBToGray(), cloudViewer::t::geometry::npp::RGBToGray(), cloudViewer::core::AdvancedIndexPreprocessor::RunPreprocess(), cloudViewer::t::geometry::kernel::trianglemesh::SamplePointsUniformlyCPU(), cloudViewer::core::nns::FixedRadiusIndex::SearchHybrid(), cloudViewer::core::nns::NanoFlannIndex::SearchHybrid(), cloudViewer::core::nns::KnnIndex::SearchKnn(), cloudViewer::core::nns::NanoFlannIndex::SearchKnn(), cloudViewer::core::nns::NanoFlannIndex::SearchRadius(), cloudViewer::core::nns::FixedRadiusIndex::SearchRadius(), cloudViewer::io::rpc::SetMeshData(), cloudViewer::core::nns::KnnIndex::SetTensorData(), cloudViewer::core::nns::NanoFlannIndex::SetTensorData(), cloudViewer::core::nns::FixedRadiusIndex::SetTensorData(), cloudViewer::core::Solve(), cloudViewer::ml::contrib::Subsample(), cloudViewer::ml::contrib::SubsampleBatch(), cloudViewer::core::SVD(), cloudViewer::t::geometry::kernel::TArrayIndexer< index_t >::TArrayIndexer(), cloudViewer::core::TensorList::TensorList(), cloudViewer::core::TensorRef::TensorRef(), cloudViewer::core::eigen_converter::TensorToEigenMatrix(), cloudViewer::core::TensorToPyArray(), cloudViewer::t::geometry::RaycastingScene::TestOcclusions(), cloudViewer::t::geometry::ipp::To(), cloudViewer::t::geometry::TensorMap::ToString(), cloudViewer::core::Tril(), cloudViewer::core::Triu(), cloudViewer::core::Triul(), cloudViewer::core::kernel::UnaryEW(), cloudViewer::t::io::WriteNpzOneTensor(), and cloudViewer::t::io::WritePointCloudToXYZI().
|
inline |
Definition at line 1131 of file Tensor.h.
References NumDims(), shape_, and cloudViewer::core::shape_util::WrapDim().
|
inline |
|
inline |
Definition at line 1139 of file Tensor.h.
References NumDims(), strides_, and cloudViewer::core::shape_util::WrapDim().
Referenced by cloudViewer::core::AddMM(), cloudViewer::t::geometry::ipp::Dilate(), cloudViewer::t::geometry::ipp::Filter(), cloudViewer::t::geometry::ipp::FilterBilateral(), cloudViewer::t::geometry::ipp::FilterGaussian(), cloudViewer::t::geometry::ipp::FilterSobel(), cloudViewer::t::geometry::ipp::Remap(), cloudViewer::t::geometry::ipp::Resize(), cloudViewer::t::geometry::ipp::RGBToGray(), cloudViewer::core::AdvancedIndexPreprocessor::RunPreprocess(), cloudViewer::core::TensorRef::TensorRef(), and cloudViewer::t::geometry::ipp::To().
|
inline |
Definition at line 1135 of file Tensor.h.
References strides_.
Referenced by cloudViewer::t::geometry::pybind_image(), cloudViewer::core::AdvancedIndexPreprocessor::RestrideTensor(), and cloudViewer::core::TensorToPyArray().
|
inline |
Element-wise greater-than of tensors, returning a new boolean tensor.
Definition at line 1554 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), GetDevice(), cloudViewer::core::kernel::Gt, and shape_.
Referenced by Clip_(), Gt(), and operator>().
Definition at line 1563 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Gt(), and cloudViewer::core::Scalar::To().
Element-wise greater-than of tensors, in-place. This operation won't change the tensor's dtype.
Definition at line 1572 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), GetDevice(), and cloudViewer::core::kernel::Gt.
Referenced by Gt_().
Definition at line 1579 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Gt_(), and cloudViewer::core::Scalar::To().
Advanced in-place reduction by index.
See https://pytorch.org/docs/stable/generated/torch.Tensor.index_add_.html
self[index[i]] = operator(self[index[i]], src[i]).
Note: Only support 1D index and src tensors now.
Definition at line 991 of file Tensor.cpp.
References AssertTensorDtype, GetDtype(), GetShape(), cloudViewer::core::kernel::IndexAdd_(), cloudViewer::core::Int64, LogError, and NumDims().
Referenced by cloudViewer::t::geometry::PointCloud::VoxelDownSample().
| Tensor cloudViewer::core::Tensor::IndexExtract | ( | int64_t | dim, |
| int64_t | idx | ||
| ) | const |
Extract the idx -th sub-tensor in dimension dim. After IndexExtract, the dimension dim will be removed.
Definition at line 841 of file Tensor.cpp.
References cloudViewer::core::SmallVectorTemplateCommon< T, typename >::begin(), blob_, cloudViewer::core::Dtype::ByteSize(), data_ptr_, dtype_, cloudViewer::core::SmallVectorImpl< T >::erase(), LogError, NumDims(), shape_, cloudViewer::core::SmallVectorBase< Size_T >::size(), strides_, Tensor(), and cloudViewer::core::shape_util::WrapDim().
Referenced by GetItem(), and operator[]().
Advanced indexing getter. This will always allocate a new Tensor.
We use the Numpy advanced indexing semantics, see: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
Definition at line 905 of file Tensor.cpp.
References AssertTensorDtype, AssertTensorShape, cloudViewer::core::Bool, Clone(), dtype_, GetDevice(), GetDtype(), cloudViewer::core::AdvancedIndexPreprocessor::GetIndexedShape(), cloudViewer::core::AdvancedIndexPreprocessor::GetIndexedStrides(), cloudViewer::core::AdvancedIndexPreprocessor::GetIndexTensors(), cloudViewer::core::AdvancedIndexPreprocessor::GetOutputShape(), cloudViewer::core::AdvancedIndexPreprocessor::GetTensor(), cloudViewer::core::kernel::IndexGet(), IsNonZero(), LogError, NumDims(), and Tensor().
Referenced by cloudViewer::t::geometry::BufferRadiusNeighbors(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPoint::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPlane::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForDopplerICP::ComputeRMSE(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::t::pipelines::slac::ConvertCorrespondencesTargetIndexedToCx2Form(), cloudViewer::t::pipelines::registration::CorrespondencesFromFeatures(), cloudViewer::t::pipelines::slac::ControlGrid::Deform(), cloudViewer::t::pipelines::slac::FillInRigidAlignmentTerm(), cloudViewer::t::pipelines::kernel::FillInRigidAlignmentTermCPU(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), cloudViewer::t::pipelines::slac::GetCorrespondenceSetForPointCloudPair(), GetItem(), cloudViewer::t::geometry::VoxelBlockGrid::GetVoxelCoordinates(), cloudViewer::t::geometry::VoxelBlockGrid::GetVoxelIndices(), cloudViewer::core::OutputToPLU(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::t::geometry::TriangleMesh::PCAPartition(), cloudViewer::t::io::ReadTriangleMeshUsingASSIMP(), cloudViewer::core::HashMap::Reserve(), Reverse(), cloudViewer::t::geometry::VoxelBlockGrid::Save(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask(), cloudViewer::core::HashMap::To(), cloudViewer::t::pipelines::slac::VisualizePointCloudDeformation(), cloudViewer::t::pipelines::slac::VisualizePointCloudEmbedding(), and cloudViewer::t::io::WriteHashMap().
| void cloudViewer::core::Tensor::IndexSet | ( | const std::vector< Tensor > & | index_tensors, |
| const Tensor & | src_tensor | ||
| ) |
Advanced indexing getter.
We use the Numpy advanced indexing semantics, see: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
Note: Only support 1D index tensors. Note: Only support advanced indices are all next to each other.
Definition at line 936 of file Tensor.cpp.
References AssertTensorDtype, AssertTensorShape, cloudViewer::core::Bool, DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, GetDtype(), cloudViewer::core::AdvancedIndexPreprocessor::GetIndexedShape(), cloudViewer::core::AdvancedIndexPreprocessor::GetIndexedStrides(), cloudViewer::core::AdvancedIndexPreprocessor::GetIndexTensors(), cloudViewer::core::AdvancedIndexPreprocessor::GetTensor(), cloudViewer::core::kernel::IndexSet(), IsNonZero(), LogError, NumDims(), and NumElements().
Referenced by cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), cloudViewer::t::pipelines::kernel::FillInRigidAlignmentTermCPU(), cloudViewer::t::pipelines::slac::RunRigidOptimizerForFragments(), cloudViewer::t::pipelines::slac::RunSLACOptimizerForFragments(), and SetItem().
|
inlinestatic |
Create a 3-D tensor with nested initializer list, e.g., core::Tensor::Init<float>({{{0, 1}, {2, 3}}, {{4, 5}, {6, 7}}});
|
inlinestatic |
Create a 2-D tensor with nested initializer list, e.g., core::Tensor::Init<float>({{0, 1, 2}, {3, 4, 5}});
|
inlinestatic |
Create a 1-D tensor with initializer list, e.g., core::Tensor::Init<float>({0, 1, 2});
|
inlinestatic |
Create a 0-D tensor (scalar) with given value, e.g., core::Tensor::Init<float>(0);
Definition at line 275 of file Tensor.h.
References Tensor(), and type.
Referenced by cloudViewer::core::pybind_getitem(), and cloudViewer::core::pybind_setitem().
| Tensor cloudViewer::core::Tensor::Inverse | ( | ) | const |
Computes the matrix inversion of the square matrix *this with LU factorization and returns the result.
Definition at line 1982 of file Tensor.cpp.
References AssertTensorDtypes, cloudViewer::core::Float32, cloudViewer::core::Float64, and cloudViewer::core::Inverse().
Referenced by cloudViewer::t::geometry::CreatePointCloudWithNormals(), cloudViewer::t::pipelines::slac::FillInRigidAlignmentTerm(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), cloudViewer::t::pipelines::slac::GetCorrespondenceSetForPointCloudPair(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::OrientedBoundingBox::Rotate(), and cloudViewer::t::geometry::OrientedBoundingBox::SetRotation().
| Tensor cloudViewer::core::Tensor::IsClose | ( | const Tensor & | other, |
| double | rtol = 1e-5, |
||
| double | atol = 1e-8 |
||
| ) | const |
Element-wise version of Tensor::AllClose().
The equation is not symmetrial, i.e. a.AllClose(b) might not be the same as b.AllClose(a). Also see Numpy's documentation: https://numpy.org/doc/stable/reference/generated/numpy.allclose.html.
TODO: support nan
| other | The other tensor to compare with. |
| rtol | Relative tolerance. |
| atol | Absolute tolerance. |
Definition at line 1900 of file Tensor.cpp.
References Abs(), AssertTensorDevice, AssertTensorDtype, AssertTensorShape, cloudViewer::core::Float64, GetDevice(), GetDtype(), GetShape(), and To().
Referenced by AllClose().
|
inline |
Returns True if the underlying memory buffer is contiguous. A contiguous Tensor's data_ptr_ does not need to point to the beginning of blob_.
Definition at line 1036 of file Tensor.h.
References cloudViewer::core::shape_util::DefaultStrides(), shape_, and strides_.
Referenced by cloudViewer::core::AddMM(), cloudViewer::t::geometry::CheckExtrinsicTensor(), cloudViewer::t::geometry::CheckIntrinsicTensor(), Contiguous(), cloudViewer::core::kernel::CopyCPU(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::t::geometry::vtkutils::CreateVtkDataArrayFromTensor(), cloudViewer::core::TensorList::FromTensor(), cloudViewer::t::geometry::Image::Image(), cloudViewer::t::geometry::InverseTransformation(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::kernel::TArrayIndexer< index_t >::TArrayIndexer(), cloudViewer::t::geometry::Image::ToLegacy(), ToString(), and cloudViewer::t::geometry::kernel::TransformIndexer::TransformIndexer().
| Tensor cloudViewer::core::Tensor::IsFinite | ( | ) | const |
Element-wise check for finite values (not Inf or NaN) in a tensor, returning a new Boolean tensor. Non-floating point tensors return all True values.
Definition at line 1382 of file Tensor.cpp.
References cloudViewer::core::Bool, dtype_, cloudViewer::core::Float32, cloudViewer::core::Float64, GetDevice(), cloudViewer::core::kernel::IsFinite, Ones(), shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::MakeOperation(), cloudViewer::core::pybind_core_tensor(), and cloudViewer::t::geometry::PointCloud::RemoveNonFinitePoints().
| Tensor cloudViewer::core::Tensor::IsInf | ( | ) | const |
Element-wise check for Infinity values in a tensor, returning a new Boolean tensor. Non-floating point tensors return all False values.
Definition at line 1372 of file Tensor.cpp.
References cloudViewer::core::Bool, dtype_, cloudViewer::core::Float32, cloudViewer::core::Float64, GetDevice(), cloudViewer::core::kernel::IsInf, shape_, cloudViewer::core::kernel::UnaryEW(), and Zeros().
Referenced by cloudViewer::core::MakeOperation(), cloudViewer::core::pybind_core_tensor(), and cloudViewer::t::geometry::PointCloud::RemoveNonFinitePoints().
| Tensor cloudViewer::core::Tensor::IsNan | ( | ) | const |
Element-wise check for NaN values in a tensor, returning a new Boolean tensor. Non-floating point tensors return all False values.
Definition at line 1362 of file Tensor.cpp.
References cloudViewer::core::Bool, dtype_, cloudViewer::core::Float32, cloudViewer::core::Float64, GetDevice(), cloudViewer::core::kernel::IsNan, shape_, cloudViewer::core::kernel::UnaryEW(), and Zeros().
Referenced by cloudViewer::core::MakeOperation(), cloudViewer::core::pybind_core_tensor(), and cloudViewer::t::geometry::PointCloud::RemoveNonFinitePoints().
| bool cloudViewer::core::Tensor::IsNonZero | ( | ) | const |
Evaluate a single-element Tensor as a boolean value. This can be used to implement Tensor.__bool__() in Python, e.g.
Definition at line 1757 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, LogError, cloudViewer::core::SizeVector::NumElements(), and shape_.
Referenced by IndexGet(), IndexSet(), and cloudViewer::core::pybind_core_tensor().
| bool cloudViewer::core::Tensor::IsSame | ( | const Tensor & | other | ) | const |
Returns true iff the tensor is the other tensor. This means that, the two tensors have the same underlying memory, device, dtype, shape, strides and etc.
Definition at line 1912 of file Tensor.cpp.
References AssertTensorDevice, blob_, data_ptr_, dtype_, GetDevice(), shape_, and strides_.
|
inline |
Helper function to return scalar value of a scalar Tensor, the Tensor must have empty shape.
Definition at line 618 of file Tensor.h.
References data_ptr_, GetDevice(), LogError, cloudViewer::core::MemoryManager::MemcpyToHost(), cloudViewer::core::SizeVector::NumElements(), shape_, and T().
Referenced by AllClose(), cloudViewer::core::kernel::Arange(), cloudViewer::core::kernel::ArangeCPU(), cloudViewer::core::kernel::ArangeSYCL(), cloudViewer::t::pipelines::registration::ComputeDirectionVectors(), cloudViewer::t::geometry::ComputeMetricsCommon(), cloudViewer::core::HashBackendBuffer::GetHeapTopIndex(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetXPercentage(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetYPercentage(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetZPercentage(), cloudViewer::t::geometry::VoxelBlockGrid::Load(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::core::nns::KnnIndex::SearchKnn(), cloudViewer::t::geometry::OrientedBoundingBox::SetExtent(), cloudViewer::core::nns::KnnIndex::SetTensorData(), cloudViewer::core::nns::FixedRadiusIndex::SetTensorData(), cloudViewer::ml::contrib::SubsampleBatch(), and cloudViewer::t::io::WritePointCloudToXYZI().
|
inline |
Definition at line 1387 of file Tensor.h.
References data_ptr_, GetDevice(), LogError, cloudViewer::core::MemoryManager::MemcpyToHost(), cloudViewer::core::SizeVector::NumElements(), and shape_.
Element-wise less-than-or-equals-to of tensors, returning a new boolean tensor.
Definition at line 1650 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), GetDevice(), cloudViewer::core::kernel::Le, and shape_.
Referenced by cloudViewer::t::pipelines::slac::GetCorrespondenceSetForPointCloudPair(), Le(), operator<=(), and cloudViewer::t::geometry::PointCloud::RemoveStatisticalOutliers().
Definition at line 1659 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Le(), and cloudViewer::core::Scalar::To().
Element-wise less-than-or-equals-to of tensors, in-place. This operation won't change the tensor's dtype.
Definition at line 1668 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), GetDevice(), and cloudViewer::core::kernel::Le.
Referenced by Le_().
Definition at line 1675 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Le_(), and cloudViewer::core::Scalar::To().
Solves the linear system AX = B with QR decomposition and returns X. A is a (m, n) matrix with m >= n.
Definition at line 1938 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, AssertTensorDtypes, cloudViewer::core::Float32, cloudViewer::core::Float64, GetDevice(), GetDtype(), and cloudViewer::core::LeastSquares().
Referenced by cloudViewer::core::pybind_core_tensor().
|
static |
Load tensor from numpy's npy format.
Definition at line 1881 of file Tensor.cpp.
References cloudViewer::t::io::ReadNpy().
Referenced by cloudViewer::t::pipelines::slac::FillInRigidAlignmentTerm(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), and cloudViewer::core::pybind_core_tensor().
Element-wise logical and of a tensor, returning a new boolean tensor.
If the tensor is not boolean, zero will be treated as False, while non-zero values will be treated as True.
Definition at line 1453 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), GetDevice(), cloudViewer::core::kernel::LogicalAnd, and shape_.
Referenced by LogicalAnd(), and operator&&().
Definition at line 1463 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), LogicalAnd(), and cloudViewer::core::Scalar::To().
Element-wise logical and of tensors, in-place. This operation won't change the tensor's dtype.
If the tensor is not boolean, 0 will be treated as False, while non-zero will be treated as True. The tensor will be filled with 0 or 1 casted to the tensor's dtype.
Definition at line 1472 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), GetDevice(), and cloudViewer::core::kernel::LogicalAnd.
Referenced by LogicalAnd_().
Definition at line 1479 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), LogicalAnd_(), and cloudViewer::core::Scalar::To().
| Tensor cloudViewer::core::Tensor::LogicalNot | ( | ) | const |
Element-wise logical not of a tensor, returning a new boolean tensor.
If the tensor is not boolean, 0 will be treated as False, while non-zero will be treated as True.
Definition at line 1442 of file Tensor.cpp.
References cloudViewer::core::Bool, GetDevice(), cloudViewer::core::kernel::LogicalNot, shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::MakeOperation(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::PointCloud::RemoveNonFinitePoints(), and cloudViewer::t::geometry::PointCloud::SelectByMask().
| Tensor cloudViewer::core::Tensor::LogicalNot_ | ( | ) |
Element-wise logical not of a tensor, in-place. This operation won't change the tensor's dtype.
If the tensor is not boolean, 0 will be treated as False, while non-zero will be treated as True. The tensor will be filled with 0 or 1 casted to the tensor's dtype.
Definition at line 1448 of file Tensor.cpp.
References cloudViewer::core::kernel::LogicalNot, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::pybind_core_tensor().
Element-wise logical or of tensors, returning a new boolean tensor.
If the tensor is not boolean, zero will be treated as False, while non-zero values will be treated as True.
Definition at line 1487 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), GetDevice(), cloudViewer::core::kernel::LogicalOr, and shape_.
Referenced by LogicalOr(), and operator||().
Definition at line 1497 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), LogicalOr(), and cloudViewer::core::Scalar::To().
Element-wise logical or of tensors, in-place. This operation won't change the tensor's dtype.
If the tensor is not boolean, 0 will be treated as False, while non-zero will be treated as True. The tensor will be filled with 0 or 1 casted to the tensor's dtype.
Definition at line 1506 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), GetDevice(), and cloudViewer::core::kernel::LogicalOr.
Referenced by LogicalOr_().
Definition at line 1513 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), LogicalOr_(), and cloudViewer::core::Scalar::To().
Element-wise logical exclusive-or of tensors, returning a new boolean tensor.
If the tensor is not boolean, zero will be treated as False, while non-zero values will be treated as True.
Definition at line 1520 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), GetDevice(), cloudViewer::core::kernel::LogicalXor, and shape_.
Referenced by LogicalXor(), and cloudViewer::core::MakeOperation().
Definition at line 1530 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), LogicalXor(), and cloudViewer::core::Scalar::To().
Element-wise logical exclusive-or of tensors, in-place. This operation won't change the tensor's dtype.
If the tensor is not boolean, zero will be treated as False, while non-zero values will be treated as True. The tensor will be filled with 0 or 1 casted to the tensor's dtype.
Definition at line 1539 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), GetDevice(), and cloudViewer::core::kernel::LogicalXor.
Referenced by LogicalXor_().
Definition at line 1546 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), LogicalXor_(), and cloudViewer::core::Scalar::To().
Element-wise less-than of tensors, returning a new boolean tensor.
Definition at line 1586 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), GetDevice(), cloudViewer::core::kernel::Lt, and shape_.
Referenced by Clip_(), Lt(), and operator<().
Definition at line 1595 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Lt(), and cloudViewer::core::Scalar::To().
Element-wise less-than of tensors, in-place. This operation won't change the tensor's dtype.
Definition at line 1604 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), GetDevice(), and cloudViewer::core::kernel::Lt.
Referenced by Lt_().
Definition at line 1611 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Lt_(), and cloudViewer::core::Scalar::To().
| std::tuple< Tensor, Tensor, Tensor > cloudViewer::core::Tensor::LU | ( | const bool | permute_l = false | ) | const |
Computes LU factorisation of the 2D square tensor, using A = P * L * U; where P is the permutation matrix, L is the lower-triangular matrix with diagonal elements as 1.0 and U is the upper-triangular matrix, and returns tuple (P, L, U).
| permute_l | [optional input] If true: returns L as P * L. |
Definition at line 1948 of file Tensor.cpp.
References AssertTensorDtypes, cloudViewer::core::Float32, cloudViewer::core::Float64, and cloudViewer::core::LU().
Computes LU factorisation of the 2D square tensor, using A = P * L * U; where P is the permutation matrix, L is the lower-triangular matrix with diagonal elements as 1.0 and U is the upper-triangular matrix, and returns tuple output tensor of shape {n,n} and ipiv tensor of shape {n}, where {n,n} is the shape of input tensor. [ipiv, output = cloudViewer.core.lu_ipiv(a)].
Definition at line 1956 of file Tensor.cpp.
References AssertTensorDtypes, cloudViewer::core::Float32, cloudViewer::core::Float64, and cloudViewer::core::LUIpiv().
Referenced by cloudViewer::core::pybind_core_tensor().
Computes matrix multiplication with *this and rhs and returns the result.
Definition at line 1919 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, GetDevice(), GetDtype(), and cloudViewer::core::Matmul().
Referenced by cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPointCPU(), cloudViewer::t::geometry::CreatePointCloudWithNormals(), cloudViewer::t::pipelines::registration::DoSingleScaleICPIterations(), cloudViewer::t::pipelines::slac::FillInRigidAlignmentTerm(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), cloudViewer::t::geometry::npp::FilterGaussian(), cloudViewer::t::geometry::OrientedBoundingBox::GetBoxPoints(), cloudViewer::t::pipelines::slac::GetCorrespondenceSetForPointCloudPair(), cloudViewer::core::MatmulAB(), cloudViewer::core::OutputToPLU(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::OrientedBoundingBox::Rotate(), and cloudViewer::t::pipelines::slac::UpdatePoses().
| Tensor cloudViewer::core::Tensor::Max | ( | const SizeVector & | dims, |
| bool | keepdim = false |
||
| ) | const |
Returns max of the tensor along the given dims.
| dims | A list of dimensions to be reduced. |
| keepdim | If true, the reduced dims will be retained as size 1. |
Definition at line 1275 of file Tensor.cpp.
References dtype_, GetDevice(), cloudViewer::core::kernel::Max, cloudViewer::core::kernel::Reduction(), cloudViewer::core::shape_util::ReductionShape(), and shape_.
Referenced by cloudViewer::t::geometry::ComputeMetricsCommon(), cloudViewer::t::geometry::OrientedBoundingBox::GetMaxBound(), cloudViewer::t::geometry::LineSet::GetMaxBound(), cloudViewer::t::geometry::PointCloud::GetMaxBound(), cloudViewer::t::geometry::TriangleMesh::GetMaxBound(), and cloudViewer::t::geometry::AxisAlignedBoundingBox::GetMaxExtent().
| Tensor cloudViewer::core::Tensor::Mean | ( | const SizeVector & | dims, |
| bool | keepdim = false |
||
| ) | const |
Returns the mean of the tensor along the given dims.
| dims | A list of dimensions to be reduced. |
| keepdim | If true, the reduced dims will be retained as size 1. |
Definition at line 1247 of file Tensor.cpp.
References AssertTensorDtypes, cloudViewer::core::Float32, cloudViewer::core::Float64, LogWarning, and NumElements().
Referenced by cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::geometry::LineSet::GetCenter(), cloudViewer::t::geometry::PointCloud::GetCenter(), cloudViewer::t::geometry::TriangleMesh::GetCenter(), and cloudViewer::t::geometry::PointCloud::RemoveStatisticalOutliers().
| Tensor cloudViewer::core::Tensor::Min | ( | const SizeVector & | dims, |
| bool | keepdim = false |
||
| ) | const |
Returns min of the tensor along the given dims.
| dims | A list of dimensions to be reduced. |
| keepdim | If true, the reduced dims will be retained as size 1. |
Definition at line 1268 of file Tensor.cpp.
References dtype_, GetDevice(), cloudViewer::core::kernel::Min, cloudViewer::core::kernel::Reduction(), cloudViewer::core::shape_util::ReductionShape(), and shape_.
Referenced by cloudViewer::t::geometry::OrientedBoundingBox::GetMinBound(), cloudViewer::t::geometry::LineSet::GetMinBound(), cloudViewer::t::geometry::PointCloud::GetMinBound(), cloudViewer::t::geometry::TriangleMesh::GetMinBound(), and cloudViewer::t::geometry::OrientedBoundingBox::SetExtent().
Multiplies a tensor and returns the resulting tensor.
Definition at line 1169 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::shape_util::BroadcastedShape(), dtype_, GetDevice(), GetDtype(), cloudViewer::core::kernel::Mul, and shape_.
Referenced by cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::io::ConvertColorTensorToUint8(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetBoxPoints(), Mul(), and operator*().
Definition at line 1180 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Mul(), and cloudViewer::core::Scalar::To().
Inplace version of Tensor::Mul. Multiplies a tensor to the current tensor and returns the current tensor.
Definition at line 1189 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, cloudViewer::core::kernel::BinaryEW(), GetDevice(), GetDtype(), and cloudViewer::core::kernel::Mul.
Referenced by cloudViewer::t::pipelines::registration::TransformationEstimationPointToPoint::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPlane::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForDopplerICP::ComputeRMSE(), Mul_(), operator*=(), cloudViewer::t::geometry::LineSet::Scale(), cloudViewer::t::geometry::PointCloud::Scale(), and cloudViewer::t::geometry::TriangleMesh::Scale().
Definition at line 1198 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Mul_(), and cloudViewer::core::Scalar::To().
Element-wise not-equals-to of tensors, returning a new boolean tensor.
Definition at line 1714 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::Bool, cloudViewer::core::shape_util::BroadcastedShape(), GetDevice(), cloudViewer::core::kernel::Ne, and shape_.
Referenced by cloudViewer::t::pipelines::registration::TransformationEstimationPointToPoint::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPlane::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForDopplerICP::ComputeRMSE(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::slac::ConvertCorrespondencesTargetIndexedToCx2Form(), Ne(), and operator!=().
Definition at line 1723 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Ne(), and cloudViewer::core::Scalar::To().
Element-wise equals-to of tensors, in-place. This operation won't change the tensor's dtype.
Definition at line 1732 of file Tensor.cpp.
References AssertTensorDevice, cloudViewer::core::kernel::BinaryEW(), GetDevice(), and cloudViewer::core::kernel::Ne.
Referenced by Ne_().
Definition at line 1739 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Ne_(), and cloudViewer::core::Scalar::To().
| Tensor cloudViewer::core::Tensor::Neg | ( | ) | const |
Element-wise negation of a tensor, returning a new tensor.
Definition at line 1329 of file Tensor.cpp.
References dtype_, GetDevice(), cloudViewer::core::kernel::Neg, shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), cloudViewer::core::MakeOperation(), operator-(), and cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Neg_ | ( | ) |
Element-wise negation of a tensor, in-place.
Definition at line 1335 of file Tensor.cpp.
References cloudViewer::core::kernel::Neg, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::t::geometry::ipp::FilterSobel(), cloudViewer::t::geometry::npp::FilterSobel(), and cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::NonZero | ( | ) | const |
Find the indices of the elements that are non-zero. Returns an int64 tensor of shape {num_dims, num_non_zeros}, where the i-th row contains the indices of the non-zero elements in i-th dimension of the original tensor.
Definition at line 1755 of file Tensor.cpp.
References cloudViewer::core::kernel::NonZero().
Referenced by cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), and cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU().
| std::vector< Tensor > cloudViewer::core::Tensor::NonZeroNumpy | ( | ) | const |
Find the indices of the elements that are non-zero. Returns a vector of int64 Tensors, each containing the indices of the non-zero elements in each dimension.
Definition at line 1746 of file Tensor.cpp.
References Clone(), cloudViewer::core::kernel::NonZero(), NumDims(), and result.
|
inline |
Definition at line 1172 of file Tensor.h.
References shape_, and cloudViewer::core::SmallVectorBase< Size_T >::size().
Referenced by All(), Any(), begin(), cbegin(), cend(), cloudViewer::core::ConcatenateImpl(), cloudViewer::t::geometry::vtkutils::CreateVtkImageDataFromTensor(), end(), Expand(), Flatten(), GetItem(), GetShape(), GetStride(), cloudViewer::t::geometry::Image::Image(), IndexAdd_(), cloudViewer::core::kernel::IndexAdd_(), cloudViewer::core::kernel::IndexAddSYCL_(), IndexExtract(), IndexGet(), IndexSet(), cloudViewer::ml::contrib::KnnSearch(), cloudViewer::core::kernel::LaunchIndexReductionKernel(), NonZeroNumpy(), Permute(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::pybind_image(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::core::kernel::Reduction(), cloudViewer::core::AdvancedIndexPreprocessor::RestrideIndexTensor(), cloudViewer::core::AdvancedIndexPreprocessor::RunPreprocess(), cloudViewer::io::rpc::SetMeshData(), cloudViewer::core::nns::NanoFlannIndex::SetTensorData(), cloudViewer::core::nns::KnnIndex::SetTensorData(), cloudViewer::core::AdvancedIndexPreprocessor::ShuffleIndexedDimsToFront(), Slice(), cloudViewer::ml::contrib::Subsample(), cloudViewer::ml::contrib::SubsampleBatch(), T(), cloudViewer::t::geometry::kernel::TArrayIndexer< index_t >::TArrayIndexer(), cloudViewer::core::TensorRef::TensorRef(), and Transpose().
|
inline |
Definition at line 1170 of file Tensor.h.
References cloudViewer::core::SizeVector::NumElements(), and shape_.
Referenced by cloudViewer::t::geometry::TriangleMesh::BakeVertexAttrTextures(), cloudViewer::t::geometry::CheckDepthTensor(), cloudViewer::t::geometry::ComputeMetricsCommon(), cloudViewer::core::kernel::CopyCPU(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::t::geometry::vtkutils::CreateVtkCellArrayFromTensor(), cloudViewer::t::geometry::vtkutils::CreateVtkDataArrayFromTensor(), cloudViewer::t::geometry::vtkutils::CreateVtkImageDataFromTensor(), IndexSet(), Mean(), cloudViewer::core::kernel::NonZeroCPU(), cloudViewer::core::kernel::NonZeroSYCL(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::core::pybind_core_tensor(), cloudViewer::benchmarks::Rand(), cloudViewer::core::kernel::Reduction(), Reshape(), Reverse(), cloudViewer::t::geometry::kernel::trianglemesh::SamplePointsUniformlyCPU(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), cloudViewer::io::rpc::SetMeshData(), cloudViewer::ml::contrib::Subsample(), cloudViewer::ml::contrib::SubsampleBatch(), cloudViewer::t::pipelines::slam::Model::SynthesizeModelFrame(), cloudViewer::core::eigen_converter::TensorToEigenVectorNxVector(), ToFlatVector(), and View().
|
static |
Create a tensor fill with ones.
Definition at line 412 of file Tensor.cpp.
References Full().
Referenced by cloudViewer::t::geometry::AxisAlignedBoundingBox::Clear(), cloudViewer::t::geometry::OrientedBoundingBox::Clear(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::geometry::ipp::Dilate(), cloudViewer::t::geometry::npp::Dilate(), IsFinite(), cloudViewer::core::MatmulAB(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::pipelines::slac::RunRigidOptimizerForFragments(), cloudViewer::t::pipelines::slac::RunSLACOptimizerForFragments(), and cloudViewer::t::geometry::PointCloud::VoxelDownSample().
Definition at line 822 of file Tensor.h.
References LogicalAnd().
|
inline |
Tensor assignment rvalue = lvalue, e.g. tensor_a[0] = tensor_b.
Tensor assignment rvalue = lvalue, e.g. tensor_a[0] = tensor_b. An actual copy of the data will be performed.
Definition at line 377 of file Tensor.cpp.
References cloudViewer::core::kernel::Copy().
Tensor assignment rvalue = rvalue, e.g. tensor_a[0] = tensor_b[0].
Tensor assignment rvalue = rvalue, e.g. tensor_a[0] = tensor_b[0]. An actual copy of the data will be performed.
Definition at line 383 of file Tensor.cpp.
References cloudViewer::core::kernel::Copy().
| Tensor cloudViewer::core::Tensor::operator[] | ( | int64_t | i | ) | const |
Extract the i-th Tensor along the first axis, returning a new view.
Definition at line 839 of file Tensor.cpp.
References IndexExtract().
Referenced by ToString().
Definition at line 839 of file Tensor.h.
References LogicalOr().
| Tensor cloudViewer::core::Tensor::Permute | ( | const SizeVector & | dims | ) | const |
Permute (dimension shuffle) the Tensor, returns a view.
| dims | The desired ordering of dimensions. |
Definition at line 1028 of file Tensor.cpp.
References AsStrided(), LogError, NumDims(), shape_, cloudViewer::core::SmallVectorBase< Size_T >::size(), strides_, and cloudViewer::core::shape_util::WrapDim().
Referenced by cloudViewer::core::kernel::IndexAdd_(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::core::AdvancedIndexPreprocessor::ShuffleIndexedDimsToFront(), and Transpose().
| Tensor cloudViewer::core::Tensor::Prod | ( | const SizeVector & | dims, |
| bool | keepdim = false |
||
| ) | const |
Returns the product of the tensor along the given dims.
| dims | A list of dimensions to be reduced. |
| keepdim | If true, the reduced dims will be retained as size 1. |
Definition at line 1261 of file Tensor.cpp.
References dtype_, GetDevice(), cloudViewer::core::kernel::Prod, cloudViewer::core::kernel::Reduction(), cloudViewer::core::shape_util::ReductionShape(), and shape_.
Referenced by cloudViewer::t::geometry::AxisAlignedBoundingBox::Volume(), and cloudViewer::t::geometry::OrientedBoundingBox::Volume().
| Tensor cloudViewer::core::Tensor::ReinterpretCast | ( | const core::Dtype & | dtype | ) | const |
Tensor reinterpret cast operator. It changes the tensor's dtype without changing the underlying memory blob itself. The byte-size of dtype must be same as the original dtype before casting.
Definition at line 388 of file Tensor.cpp.
References blob_, cloudViewer::core::Dtype::ByteSize(), data_ptr_, dtype_, LogError, shape_, strides_, Tensor(), and cloudViewer::core::Dtype::ToString().
Referenced by cloudViewer::t::geometry::PointCloud::RemoveDuplicatedPoints(), and cloudViewer::t::geometry::Image::Resize().
| Tensor cloudViewer::core::Tensor::Reshape | ( | const SizeVector & | dst_shape | ) | const |
Returns a tensor with the same data and number of elements as input, but with the specified shape. When possible, the returned tensor will be a view of input. Otherwise, it will be a copy.
Contiguous inputs and inputs with compatible strides can be reshaped without copying, but you should not depend on the copying vs. viewing behavior.
Ref:
Definition at line 671 of file Tensor.cpp.
References AsStrided(), Contiguous(), cloudViewer::core::shape_util::InferShape(), NumElements(), cloudViewer::core::shape_util::Restride(), shape_, strides_, and View().
Referenced by cloudViewer::t::geometry::ComputeMetricsCommon(), cloudViewer::t::geometry::kernel::minimum_obb::ComputeMinimumOBBApprox(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPoint::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPlane::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForDopplerICP::ComputeRMSE(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPointCPU(), cloudViewer::core::Concatenate(), cloudViewer::t::pipelines::slac::ConvertCorrespondencesTargetIndexedToCx2Form(), cloudViewer::t::geometry::vtkutils::CreateLineSetFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData(), cloudViewer::t::geometry::vtkutils::CreateVtkCellArrayFromTensor(), cloudViewer::t::geometry::vtkutils::CreateVtkImageDataFromTensor(), Flatten(), cloudViewer::t::geometry::TriangleMesh::FromLegacy(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetBoxPoints(), cloudViewer::t::geometry::Image::Image(), cloudViewer::core::pybind_core_tensor(), cloudViewer::core::kernel::Reduction(), cloudViewer::core::AdvancedIndexPreprocessor::RestrideIndexTensor(), and cloudViewer::t::pipelines::kernel::RtToTransformation().
| Tensor cloudViewer::core::Tensor::Reverse | ( | ) | const |
Reverse a Tensor's elements by viewing the tensor as a 1D array.
Definition at line 465 of file Tensor.cpp.
References Arange(), GetShape(), IndexGet(), NumElements(), and View().
Referenced by cloudViewer::t::geometry::npp::Filter().
| Tensor cloudViewer::core::Tensor::Round | ( | ) | const |
Element-wise round value of a tensor, returning a new tensor.
Definition at line 1423 of file Tensor.cpp.
References dtype_, GetDevice(), cloudViewer::core::kernel::Round, shape_, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::t::io::ConvertColorTensorToUint8(), cloudViewer::core::MakeOperation(), and cloudViewer::core::pybind_core_tensor().
| void cloudViewer::core::Tensor::Save | ( | const std::string & | file_name | ) | const |
Save tensor to numpy's npy format.
Definition at line 1877 of file Tensor.cpp.
References cloudViewer::t::io::WriteNpy().
Referenced by cloudViewer::core::pybind_core_tensor(), and cloudViewer::t::pipelines::slac::SaveCorrespondencesForPointClouds().
|
protected |
Definition at line 825 of file Tensor.cpp.
References cloudViewer::core::Bool, DISPATCH_DTYPE_TO_TEMPLATE, dtype_, format, and cloudViewer::core::Dtype::IsObject().
Referenced by ToString().
| Tensor cloudViewer::core::Tensor::SetItem | ( | const std::vector< TensorKey > & | tks, |
| const Tensor & | value | ||
| ) |
Pythonic setitem for tensor.
For example, in numpy:
The equivalent CloudViewer C++ calls:
Definition at line 578 of file Tensor.cpp.
References GetDevice(), cloudViewer::core::TensorKey::GetIndex(), cloudViewer::core::TensorKey::GetIndexTensor(), GetItem(), cloudViewer::core::TensorKey::GetMode(), cloudViewer::core::TensorKey::Index, IndexSet(), cloudViewer::core::TensorKey::IndexTensor, cloudViewer::core::Int64, LogError, cloudViewer::core::None, cloudViewer::core::TensorKey::Slice(), and Tensor().
Set all items. Equivalent to tensor[:] = value in Python.
Definition at line 564 of file Tensor.cpp.
References AsRvalue().
Referenced by cloudViewer::t::geometry::PointCloud::Append(), Clip_(), cloudViewer::core::ConcatenateImpl(), cloudViewer::t::pipelines::slac::ConvertCorrespondencesTargetIndexedToCx2Form(), cloudViewer::t::pipelines::kernel::PoseToTransformation(), cloudViewer::t::pipelines::kernel::RtToTransformation(), cloudViewer::t::geometry::PointCloud::SelectByIndex(), and cloudViewer::t::pipelines::kernel::TransformationToPose().
Pythonic setitem for tensor.
For example, in numpy:
The equivalent CloudViewer C++ calls:
Definition at line 569 of file Tensor.cpp.
References cloudViewer::core::TensorKey::GetIndexTensor(), GetItem(), cloudViewer::core::TensorKey::GetMode(), IndexSet(), and cloudViewer::core::TensorKey::IndexTensor.
| Tensor cloudViewer::core::Tensor::Sin | ( | ) | const |
Element-wise sine of a tensor, returning a new tensor.
Definition at line 1307 of file Tensor.cpp.
References dtype_, GetDevice(), shape_, cloudViewer::core::kernel::Sin, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::MakeOperation(), and cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Sin_ | ( | ) |
Element-wise sine of a tensor, in-place.
Definition at line 1313 of file Tensor.cpp.
References cloudViewer::core::kernel::Sin, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Slice | ( | int64_t | dim, |
| int64_t | start, | ||
| int64_t | stop, | ||
| int64_t | step = 1 |
||
| ) | const |
Slice Tensor.
| dim | The dimension to slice. |
| start | The start index (inclusive). |
| stop | The end index (exclusive). |
| step | Pick one element for every step elements. |
Definition at line 857 of file Tensor.cpp.
References blob_, cloudViewer::core::Dtype::ByteSize(), data_ptr_, dtype_, LogError, NumDims(), shape_, cloudViewer::core::SmallVectorBase< Size_T >::size(), strides_, Tensor(), and cloudViewer::core::shape_util::WrapDim().
Referenced by cloudViewer::core::TensorList::AsTensor(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), cloudViewer::t::geometry::LineSet::CreateCameraVisualization(), cloudViewer::core::TensorList::Extend(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), cloudViewer::core::TensorList::FromTensor(), GetItem(), cloudViewer::core::LeastSquares(), cloudViewer::core::LU(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::t::geometry::PointCloud::RemoveRadiusOutliers(), cloudViewer::core::TensorList::Resize(), cloudViewer::core::TensorList::ResizeWithExpand(), cloudViewer::t::pipelines::slac::RunSLACOptimizerForFragments(), cloudViewer::t::pipelines::slac::UpdateControlGrid(), cloudViewer::t::pipelines::slac::VisualizeGridDeformation(), and cloudViewer::t::pipelines::slac::VisualizePointCloudEmbedding().
Solves the linear system AX = B with LU decomposition and returns X. A must be a square matrix.
Definition at line 1928 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, AssertTensorDtypes, cloudViewer::core::Float32, cloudViewer::core::Float64, GetDevice(), GetDtype(), and cloudViewer::core::Solve().
Referenced by cloudViewer::t::pipelines::kernel::DecodeAndSolve6x6(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::pipelines::slac::RunRigidOptimizerForFragments(), and cloudViewer::t::pipelines::slac::RunSLACOptimizerForFragments().
| Tensor cloudViewer::core::Tensor::Sqrt | ( | ) | const |
Element-wise square root of a tensor, returns a new tensor.
Definition at line 1296 of file Tensor.cpp.
References dtype_, GetDevice(), shape_, cloudViewer::core::kernel::Sqrt, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::MakeOperation(), cloudViewer::core::pybind_core_tensor(), and cloudViewer::t::geometry::PointCloud::RemoveStatisticalOutliers().
| Tensor cloudViewer::core::Tensor::Sqrt_ | ( | ) |
Element-wise square root of a tensor, in-place.
Definition at line 1302 of file Tensor.cpp.
References cloudViewer::core::kernel::Sqrt, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::t::geometry::PointCloud::ComputeMetrics(), and cloudViewer::core::pybind_core_tensor().
Substracts a tensor and returns the resulting tensor.
Definition at line 1133 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, cloudViewer::core::kernel::BinaryEW(), cloudViewer::core::shape_util::BroadcastedShape(), dtype_, GetDevice(), GetDtype(), shape_, and cloudViewer::core::kernel::Sub.
Referenced by operator-(), cloudViewer::ml::contrib::RadiusSearch(), and Sub().
Definition at line 1144 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Sub(), and cloudViewer::core::Scalar::To().
Inplace version of Tensor::Sub. Substracts a tensor to the current tensor and returns the current tensor.
Definition at line 1153 of file Tensor.cpp.
References AssertTensorDevice, AssertTensorDtype, cloudViewer::core::kernel::BinaryEW(), GetDevice(), GetDtype(), and cloudViewer::core::kernel::Sub.
Referenced by operator-=(), cloudViewer::t::geometry::LineSet::Scale(), cloudViewer::t::geometry::PointCloud::Scale(), cloudViewer::t::geometry::TriangleMesh::Scale(), and Sub_().
Definition at line 1162 of file Tensor.cpp.
References DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL, dtype_, Full(), GetDevice(), Sub_(), and cloudViewer::core::Scalar::To().
| Tensor cloudViewer::core::Tensor::Sum | ( | const SizeVector & | dims, |
| bool | keepdim = false |
||
| ) | const |
Returns the sum of the tensor along the given dims.
| dims | A list of dimensions to be reduced. |
| keepdim | If true, the reduced dims will be retained as size 1. |
Definition at line 1240 of file Tensor.cpp.
References dtype_, GetDevice(), cloudViewer::core::kernel::Reduction(), cloudViewer::core::shape_util::ReductionShape(), shape_, and cloudViewer::core::kernel::Sum.
Referenced by cloudViewer::t::pipelines::registration::ComputeRegistrationResult(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPoint::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationPointToPlane::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForColoredICP::ComputeRMSE(), cloudViewer::t::pipelines::registration::TransformationEstimationForDopplerICP::ComputeRMSE(), cloudViewer::t::pipelines::slac::ControlGrid::Deform(), cloudViewer::t::geometry::npp::FilterGaussian(), cloudViewer::t::pipelines::slac::GetCorrespondenceSetForPointCloudPair(), cloudViewer::t::pipelines::registration::GetInformationMatrix(), cloudViewer::t::geometry::TriangleMesh::GetSurfaceArea(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::core::Reduction(), and cloudViewer::ml::contrib::SubsampleBatch().
Computes the matrix SVD decomposition A = U S VT and returns the result. Note VT (V transpose) is returned instead of V.
Definition at line 1990 of file Tensor.cpp.
References AssertTensorDtypes, cloudViewer::core::Float32, cloudViewer::core::Float64, and cloudViewer::core::SVD().
Referenced by cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPointCPU(), and cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::T | ( | ) | const |
Expects input to be <= 2-D Tensor by swapping dimension 0 and 1.
0-D and 1-D Tensor remains the same.
Definition at line 1079 of file Tensor.cpp.
References LogError, NumDims(), and Transpose().
Referenced by cloudViewer::core::AddMM(), AssertTemplateDtype(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPointCPU(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), cloudViewer::t::geometry::npp::FilterGaussian(), GetDataPtr(), cloudViewer::t::pipelines::slac::ControlGrid::GetNeighborGridMap(), cloudViewer::core::Inverse(), Item(), cloudViewer::core::LeastSquares(), cloudViewer::core::LUIpiv(), cloudViewer::core::OutputToPLU(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::OrientedBoundingBox::Rotate(), cloudViewer::t::geometry::OrientedBoundingBox::SetRotation(), cloudViewer::core::Solve(), and cloudViewer::core::SVD().
Returns a tensor with the specified device.
| device | The targeted device to convert to. |
| copy | If true, a new tensor is always created; if false, the copy is avoided when the original tensor is already on the targeted device. |
Definition at line 753 of file Tensor.cpp.
References cloudViewer::core::kernel::Copy(), copy, dtype_, GetDevice(), and shape_.
| Tensor cloudViewer::core::Tensor::To | ( | const Device & | device, |
| Dtype | dtype, | ||
| bool | copy = false |
||
| ) | const |
Returns a tensor with the specified device and dtype.
| device | The targeted device to convert to. |
| dtype | The targeted dtype to convert to. |
| copy | If true, a new tensor is always created; if false, the copy is avoided when the original tensor is already on the targeted device and have the targeted dtype. |
Definition at line 762 of file Tensor.cpp.
Returns a tensor with the specified dtype.
| dtype | The targeted dtype to convert to. |
| copy | If true, a new tensor is always created; if false, the copy is avoided when the original tensor already has the targeted dtype. |
Definition at line 739 of file Tensor.cpp.
References cloudViewer::core::kernel::Copy(), copy, dtype_, GetDevice(), cloudViewer::core::Dtype::IsObject(), LogError, shape_, and cloudViewer::core::Dtype::ToString().
Referenced by cloudViewer::core::AddMM(), cloudViewer::t::geometry::RaycastingScene::AddTriangles(), cloudViewer::t::pipelines::registration::BenchmarkDopplerICP(), cloudViewer::t::geometry::BufferRadiusNeighbors(), cloudViewer::core::CastOptionalDtypeDevice(), Clone(), cloudViewer::t::pipelines::slac::ControlGrid::Compactify(), cloudViewer::t::geometry::ComputeBoundaryPoints(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeature(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeInformationMatrixCPU(), cloudViewer::t::geometry::PointCloud::ComputeMetrics(), cloudViewer::t::geometry::kernel::minimum_obb::ComputeMinimumOBBApprox(), cloudViewer::t::geometry::kernel::minimum_obb::ComputeMinimumOBBJylanki(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryInformationMatrix(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultHybrid(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultIntensity(), cloudViewer::t::pipelines::kernel::odometry::ComputeOdometryResultPointToPlane(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), cloudViewer::t::pipelines::registration::ComputeRegistrationResult(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPoint(), cloudViewer::t::pipelines::kernel::ComputeRtPointToPointCPU(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeTriangleAreasCPU(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeTriangleNormalsCPU(), cloudViewer::t::geometry::kernel::uvunwrapping::ComputeUVAtlas(), cloudViewer::t::geometry::kernel::trianglemesh::ComputeVertexNormalsCPU(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::ConstructBuffers(), Contiguous(), cloudViewer::t::io::ConvertColorTensorToUint8(), cloudViewer::core::kernel::CopyCPU(), cloudViewer::core::kernel::CopySYCL(), cloudViewer::t::geometry::TriangleMesh::CreateBox(), cloudViewer::t::geometry::LineSet::CreateCameraVisualization(), cloudViewer::t::geometry::PointCloud::CreateFromDepthImage(), cloudViewer::t::geometry::RaycastingScene::CreateRaysPinhole(), cloudViewer::t::geometry::kernel::image::CreateVertexMap(), cloudViewer::t::pipelines::kernel::DecodeAndSolve6x6(), cloudViewer::core::Det(), cloudViewer::t::pipelines::registration::DoSingleScaleICPIterations(), cloudViewer::core::eigen_converter::EigenVectorNxVectorToTensor(), cloudViewer::t::geometry::kernel::pointcloud::EstimateColorGradientsUsingKNNSearchCPU(), cloudViewer::t::geometry::kernel::pointcloud::EstimateColorGradientsUsingRadiusSearchCPU(), cloudViewer::t::geometry::EstimateNormals(), cloudViewer::t::geometry::kernel::voxel_grid::EstimateRange(), cloudViewer::t::geometry::VoxelBlockGrid::ExtractTriangleMesh(), cloudViewer::t::geometry::vtkutils::ExtrudeLinearPolyData(), cloudViewer::t::geometry::vtkutils::ExtrudeRotationPolyData(), cloudViewer::t::pipelines::slac::FillInRigidAlignmentTerm(), cloudViewer::t::pipelines::slac::FillInSLACAlignmentTerm(), cloudViewer::t::geometry::AxisAlignedBoundingBox::FromLegacy(), cloudViewer::t::geometry::OrientedBoundingBox::FromLegacy(), cloudViewer::io::rpc::messages::Array::FromTensor(), cloudViewer::core::GetColPermutation(), cloudViewer::t::pipelines::slac::GetCorrespondenceSetForPointCloudPair(), cloudViewer::t::pipelines::registration::GetInformationMatrix(), cloudViewer::t::pipelines::slac::ControlGrid::GetNeighborGridMap(), cloudViewer::t::geometry::TriangleMesh::GetNonManifoldEdges(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetPointIndicesWithinBoundingBox(), cloudViewer::t::geometry::OrientedBoundingBox::GetPointIndicesWithinBoundingBox(), cloudViewer::t::geometry::VoxelBlockGrid::GetVoxelCoordinates(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetXPercentage(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetYPercentage(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetZPercentage(), cloudViewer::core::kernel::IndexSet(), cloudViewer::core::Inverse(), IsClose(), cloudViewer::ml::contrib::KnnSearch(), cloudViewer::t::geometry::RaycastingScene::ListIntersections(), cloudViewer::t::geometry::VoxelBlockGrid::Load(), cloudViewer::t::pipelines::registration::LoadTensorDopplerPointCloudFromFile(), cloudViewer::t::pipelines::registration::LoadTensorPointCloudFromFile(), cloudViewer::core::Matmul(), cloudViewer::t::pipelines::registration::MultiScaleICP(), cloudViewer::t::io::NumpyArray::NumpyArray(), cloudViewer::t::geometry::PointCloud::OrientNormalsToAlignWithDirection(), cloudViewer::t::geometry::PointCloud::OrientNormalsTowardsCameraLocation(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::t::geometry::TriangleMesh::PCAPartition(), cloudViewer::t::geometry::PointCloud::PCAPartition(), cloudViewer::t::geometry::kernel::pointcloud::Project(), cloudViewer::core::pybind_core_tensor(), cloudViewer::ml::contrib::RadiusSearch(), cloudViewer::benchmarks::Rand(), cloudViewer::t::geometry::TriangleMesh::RemoveNonManifoldEdges(), cloudViewer::t::geometry::PointCloud::RemoveRadiusOutliers(), cloudViewer::t::geometry::TriangleMesh::RemoveUnreferencedVertices(), cloudViewer::core::HashMap::Reserve(), cloudViewer::t::pipelines::odometry::RGBDOdometryMultiScale(), cloudViewer::t::geometry::OrientedBoundingBox::Rotate(), cloudViewer::t::geometry::kernel::transform::RotateNormals(), cloudViewer::t::geometry::kernel::transform::RotatePoints(), cloudViewer::t::geometry::TriangleMesh::SamplePointsUniformly(), cloudViewer::t::geometry::VoxelBlockGrid::Save(), cloudViewer::t::geometry::LineSet::Scale(), cloudViewer::t::geometry::PointCloud::Scale(), cloudViewer::t::geometry::TriangleMesh::Scale(), cloudViewer::t::geometry::AxisAlignedBoundingBox::Scale(), cloudViewer::t::geometry::OrientedBoundingBox::Scale(), cloudViewer::core::nns::FixedRadiusIndex::SearchRadius(), cloudViewer::core::nns::NanoFlannIndex::SearchRadius(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), cloudViewer::t::geometry::TriangleMesh::SelectFacesByMask(), cloudViewer::t::geometry::OrientedBoundingBox::SetCenter(), cloudViewer::t::pipelines::slam::Frame::SetData(), cloudViewer::t::geometry::OrientedBoundingBox::SetExtent(), cloudViewer::t::geometry::AxisAlignedBoundingBox::SetMaxBound(), cloudViewer::t::geometry::AxisAlignedBoundingBox::SetMinBound(), cloudViewer::t::geometry::OrientedBoundingBox::SetRotation(), cloudViewer::t::io::DepthNoiseSimulator::Simulate(), cloudViewer::core::eigen_converter::TensorToEigenMatrix(), cloudViewer::core::eigen_converter::TensorToEigenVectorNxVector(), cloudViewer::visualization::rendering::TLineSetBuffersBuilder::TLineSetBuffersBuilder(), cloudViewer::visualization::rendering::TMeshBuffersBuilder::TMeshBuffersBuilder(), cloudViewer::t::geometry::AxisAlignedBoundingBox::To(), cloudViewer::t::geometry::OrientedBoundingBox::To(), cloudViewer::t::geometry::Image::To(), cloudViewer::core::HashMap::To(), To(), cloudViewer::t::geometry::PointCloud::ToLegacy(), ToString(), cloudViewer::core::ToTensorKey(), cloudViewer::t::pipelines::slac::ControlGrid::Touch(), cloudViewer::visualization::rendering::TPointCloudBuffersBuilder::TPointCloudBuffersBuilder(), cloudViewer::t::geometry::OrientedBoundingBox::Transform(), cloudViewer::t::geometry::kernel::transform::TransformNormals(), cloudViewer::t::geometry::kernel::transform::TransformPoints(), cloudViewer::t::geometry::AxisAlignedBoundingBox::Translate(), cloudViewer::t::geometry::OrientedBoundingBox::Translate(), cloudViewer::t::geometry::LineSet::Translate(), cloudViewer::t::geometry::PointCloud::Translate(), cloudViewer::t::geometry::TriangleMesh::Translate(), cloudViewer::t::geometry::kernel::pointcloud::Unproject(), cloudViewer::t::pipelines::slac::UpdatePoses(), cloudViewer::t::pipelines::slac::VisualizeGridDeformation(), cloudViewer::t::pipelines::slac::VisualizePointCloudCorrespondences(), cloudViewer::t::geometry::PointCloud::VoxelDownSample(), cloudViewer::t::io::WriteHashMap(), cloudViewer::t::io::WriteNpz(), and cloudViewer::t::io::WritePointCloudToPTS().
| DLManagedTensor * cloudViewer::core::Tensor::ToDLPack | ( | ) | const |
Convert the Tensor to DLManagedTensor (DLPack v0.x).
Definition at line 1808 of file Tensor.cpp.
References cloudViewer::core::Open3DDLManagedTensor< DLMT >::Create().
| DLManagedTensorVersioned * cloudViewer::core::Tensor::ToDLPackVersioned | ( | ) | const |
Convert the Tensor to DLManagedTensorVersioned (DLPack v1.x).
Definition at line 1811 of file Tensor.cpp.
References cloudViewer::core::Open3DDLManagedTensor< DLMT >::Create().
|
inline |
Retrieve all values as an std::vector, for debugging and testing.
Definition at line 1025 of file Tensor.h.
References Contiguous(), GetDataPtr(), GetDevice(), GetDtype(), cloudViewer::core::MemoryManager::MemcpyToHost(), and NumElements().
Referenced by cloudViewer::ml::contrib::Subsample(), and cloudViewer::ml::contrib::SubsampleBatch().
|
inline |
Definition at line 1371 of file Tensor.h.
References Contiguous(), GetDataPtr(), GetDevice(), GetDtype(), cloudViewer::core::MemoryManager::MemcpyToHost(), and NumElements().
| std::string cloudViewer::core::Tensor::ToString | ( | bool | with_suffix = true, |
| const std::string & | indent = "" |
||
| ) | const |
Definition at line 780 of file Tensor.cpp.
References cloudViewer::core::Dtype::ByteSize(), Contiguous(), data_ptr_, dtype_, format, GetDevice(), IsContiguous(), cloudViewer::core::IsDevice::IsCUDA(), cloudViewer::core::IsDevice::IsSYCL(), cloudViewer::core::SizeVector::NumElements(), operator[](), ScalarPtrToString(), shape_, cloudViewer::core::SmallVectorBase< Size_T >::size(), strides_, To(), cloudViewer::core::Dtype::ToString(), cloudViewer::core::SizeVector::ToString(), and ToString().
Referenced by AssertTemplateDtype(), GetDataPtr(), cloudViewer::core::TensorKey::IndexTensorImpl::ToString(), and ToString().
| Tensor cloudViewer::core::Tensor::Transpose | ( | int64_t | dim0, |
| int64_t | dim1 | ||
| ) | const |
Transpose a Tensor by swapping dimension dim0 and dim1.
| dim0 | The first dimension to be transposed. |
| dim1 | The second dimension to be transposed. |
Definition at line 1068 of file Tensor.cpp.
References cloudViewer::core::SmallVectorTemplateCommon< T, typename >::begin(), cloudViewer::core::SmallVectorTemplateCommon< T, typename >::end(), NumDims(), Permute(), and cloudViewer::core::shape_util::WrapDim().
Referenced by cloudViewer::t::geometry::kernel::pointcloud::GetPointMaskWithinOBBCPU(), and T().
| Tensor cloudViewer::core::Tensor::Tril | ( | const int | diagonal = 0 | ) | const |
Returns the lower triangular matrix of the 2D tensor, above the given diagonal index. [The value of diagonal = col - row, therefore 0 is the main diagonal (row = col), and it shifts towards right for positive values (for diagonal = 1, col - row = 1), and towards left for negative values. The value of the diagonal parameter must be between [-m, n] where {m, n} is the shape of input tensor.
| diagonal | value of [col - row], below which the elements are to be taken for lower triangular matrix. |
Definition at line 1970 of file Tensor.cpp.
References cloudViewer::core::Tril().
Referenced by cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Triu | ( | const int | diagonal = 0 | ) | const |
Returns the upper triangular matrix of the 2D tensor, above the given diagonal index. [The value of diagonal = col - row, therefore 0 is the main diagonal (row = col), and it shifts towards right for positive values (for diagonal = 1, col - row = 1), and towards left for negative values. The value of the diagonal parameter must be between [-m, n] for a {m,n} shaped tensor.
| diagonal | value of [col - row], above which the elements are to be taken for upper triangular matrix. |
Definition at line 1964 of file Tensor.cpp.
References cloudViewer::core::Triu().
Referenced by cloudViewer::core::pybind_core_tensor().
Returns the tuple of upper and lower triangular matrix of the 2D tensor, above and below the given diagonal index. The diagonal elements of lower triangular matrix are taken to be unity. [The value of diagonal = col - row, therefore 0 is the main diagonal (row = col), and it shifts towards right for positive values (for diagonal = 1, col - row = 1), and towards left for negative values. The value of the diagonal parameter must be between [-m, n] where {m, n} is the shape of input tensor.
| diagonal | value of [col - row], above and below which the elements are to be taken for upper (diag. included) and lower triangular matrix. |
Definition at line 1976 of file Tensor.cpp.
References cloudViewer::core::Triul().
Referenced by cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::Trunc | ( | ) | const |
Element-wise trunc value of a tensor, returning a new tensor.
Definition at line 1429 of file Tensor.cpp.
References dtype_, GetDevice(), shape_, cloudViewer::core::kernel::Trunc, and cloudViewer::core::kernel::UnaryEW().
Referenced by cloudViewer::core::MakeOperation(), and cloudViewer::core::pybind_core_tensor().
| Tensor cloudViewer::core::Tensor::View | ( | const SizeVector & | dst_shape | ) | const |
Returns a new tensor view with the same data but of a different shape.
The returned tensor shares the same data and must have the same number of elements, but may have a different size. For a tensor to be viewed, the new view size must be compatible with its original size and stride, i.e., each new view dimension must either be a subspace of an original dimension, or only span across original dimensions d, d+1, ..., d+kd,d+1, ..., d+k that satisfy the following contiguity-like condition that for all i = 0, ..., k-1, strides[i] = stride[i + 1] * shape[i + 1].
Otherwise, Contiguous() needs to be called before the tensor can be viewed. See also: Reshape(), which returns a view if the shapes are compatible, and copies (equivalent to calling Contiguous()) otherwise.
Ref:
Definition at line 721 of file Tensor.cpp.
References AsStrided(), cloudViewer::core::shape_util::InferShape(), LogError, NumElements(), cloudViewer::core::shape_util::Restride(), shape_, and strides_.
Referenced by cloudViewer::t::geometry::BufferRadiusNeighbors(), cloudViewer::t::pipelines::registration::CorrespondencesFromFeatures(), cloudViewer::t::pipelines::slac::ControlGrid::Deform(), cloudViewer::t::pipelines::kernel::FillInRigidAlignmentTermCPU(), cloudViewer::t::geometry::npp::FilterGaussian(), cloudViewer::t::pipelines::slac::ControlGrid::GetNeighborGridMap(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::ml::contrib::RadiusSearch(), Reshape(), Reverse(), cloudViewer::core::nns::FixedRadiusIndex::SearchHybrid(), cloudViewer::core::nns::NanoFlannIndex::SearchHybrid(), cloudViewer::core::nns::NanoFlannIndex::SearchKnn(), cloudViewer::t::pipelines::slac::ControlGrid::Touch(), cloudViewer::t::pipelines::slac::UpdateControlGrid(), and cloudViewer::t::pipelines::slac::UpdatePoses().
|
static |
Create a tensor fill with zeros.
Definition at line 406 of file Tensor.cpp.
References Full().
Referenced by cloudViewer::t::geometry::AxisAlignedBoundingBox::Clear(), cloudViewer::t::geometry::OrientedBoundingBox::Clear(), cloudViewer::t::geometry::PointCloud::ComputeBoundaryPoints(), cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), cloudViewer::t::pipelines::kernel::ComputeInformationMatrixCPU(), cloudViewer::t::pipelines::kernel::ComputePoseColoredICPCPU(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICPCPU(), cloudViewer::t::pipelines::kernel::ComputePosePointToPlaneCPU(), cloudViewer::t::geometry::TriangleMesh::ComputeVertexNormals(), cloudViewer::t::io::DepthNoiseSimulator::DepthNoiseSimulator(), Diag(), cloudViewer::t::geometry::kernel::voxel_grid::ExtractTriangleMeshCPU(), Eye(), cloudViewer::t::geometry::PointCloud::FarthestPointDownSample(), cloudViewer::t::pipelines::kernel::FillInRigidAlignmentTermCPU(), cloudViewer::t::geometry::Image::GetMinBound(), cloudViewer::t::geometry::RGBDImage::GetMinBound(), cloudViewer::t::geometry::AxisAlignedBoundingBox::GetPointIndicesWithinBoundingBox(), cloudViewer::t::geometry::OrientedBoundingBox::GetPointIndicesWithinBoundingBox(), cloudViewer::core::Inverse(), IsInf(), IsNan(), cloudViewer::t::pipelines::kernel::PoseToTransformation(), cloudViewer::t::geometry::TriangleMesh::ProjectImagesToAlbedo(), cloudViewer::t::geometry::PointCloud::ProjectToDepthImage(), cloudViewer::t::geometry::PointCloud::ProjectToRGBDImage(), cloudViewer::core::pybind_core_tensor(), cloudViewer::t::geometry::pybind_pointcloud(), cloudViewer::t::geometry::TriangleMesh::RemoveUnreferencedVertices(), cloudViewer::t::pipelines::kernel::RtToTransformation(), cloudViewer::t::pipelines::slac::RunRigidOptimizerForFragments(), cloudViewer::t::pipelines::slac::RunSLACOptimizerForFragments(), cloudViewer::t::geometry::VoxelBlockGrid::Save(), cloudViewer::t::geometry::PointCloud::SegmentPlane(), cloudViewer::t::geometry::TriangleMesh::SelectByIndex(), cloudViewer::t::geometry::PointCloud::SelectByIndex(), cloudViewer::t::pipelines::kernel::TransformationToPose(), cloudViewer::core::Tril(), cloudViewer::core::Triu(), cloudViewer::core::Triul(), cloudViewer::t::geometry::PointCloud::VoxelDownSample(), and cloudViewer::core::Zeros().
|
protected |
Underlying memory buffer for Tensor.
Definition at line 1339 of file Tensor.h.
Referenced by AsStrided(), GetBlob(), GetDevice(), IndexExtract(), IsSame(), operator=(), ReinterpretCast(), Slice(), and Tensor().
|
protected |
Data pointer pointing to the beginning element of the Tensor.
Note that this is not necessarily the same as blob_.GetDataPtr(). When this happens, it means that the beginning element of the Tensor is not located a the beginning of the underlying blob. This could happen, for instance, at slicing:
Definition at line 1333 of file Tensor.h.
Referenced by AsStrided(), GetDataPtr(), IndexExtract(), IsSame(), Item(), operator=(), ReinterpretCast(), Slice(), Tensor(), and ToString().
|
protected |
Data type.
Definition at line 1336 of file Tensor.h.
Referenced by Abs(), Add(), Add_(), All(), Any(), AssertTemplateDtype(), AsStrided(), Broadcast(), Ceil(), Clip_(), Cos(), Div(), Div_(), EmptyLike(), Eq(), Eq_(), Exp(), Floor(), Ge(), Ge_(), GetDataPtr(), GetDtype(), Gt(), Gt_(), IndexExtract(), IndexGet(), IsFinite(), IsInf(), IsNan(), IsNonZero(), IsSame(), Le(), Le_(), LogicalAnd(), LogicalAnd_(), LogicalOr(), LogicalOr_(), LogicalXor(), LogicalXor_(), Lt(), Lt_(), Max(), Min(), Mul(), Mul_(), Ne(), Ne_(), Neg(), operator=(), Prod(), ReinterpretCast(), Round(), ScalarPtrToString(), Sin(), Slice(), Sqrt(), Sub(), Sub_(), Sum(), To(), ToString(), and Trunc().
|
protected |
SizeVector of the Tensor. shape_[i] is the length of dimension i.
Definition at line 1309 of file Tensor.h.
Referenced by Abs(), Add(), All(), AllEqual(), Any(), ArgMax(), ArgMin(), AssignObject(), Broadcast(), Ceil(), cend(), Cos(), Diag(), Div(), EmptyLike(), end(), Eq(), Exp(), Expand(), Floor(), Ge(), GetItem(), GetShape(), GetShapeRef(), Gt(), IndexExtract(), IsContiguous(), IsFinite(), IsInf(), IsNan(), IsNonZero(), IsSame(), Item(), Le(), LogicalAnd(), LogicalNot(), LogicalOr(), LogicalXor(), Lt(), Max(), Min(), Mul(), Ne(), Neg(), NumDims(), NumElements(), operator=(), Permute(), Prod(), ReinterpretCast(), Reshape(), Round(), Sin(), Slice(), Sqrt(), Sub(), Sum(), Tensor(), To(), ToString(), Trunc(), and View().
|
protected |
Stride of a Tensor. The stride of a n-dimensional tensor is also n-dimensional. Stride(i) is the number of elements (not bytes) to jump in a continuous memory space before reaching the next element in dimension i. For example, a 2x3x4 float32 dense tensor has shape(2, 3, 4) and stride(12, 4, 1). A slicing operation performed on the tensor can change the shape and stride.
Definition at line 1318 of file Tensor.h.
Referenced by Diag(), Expand(), Eye(), GetStride(), GetStrides(), GetStridesRef(), IndexExtract(), IsContiguous(), IsSame(), operator=(), Permute(), ReinterpretCast(), Reshape(), Slice(), ToString(), and View().