![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
TensorKey is used to represent single index, slice or advanced indexing on a Tensor. More...
#include <TensorKey.h>
Classes | |
| class | Impl |
| class | IndexImpl |
| class | IndexTensorImpl |
| class | SliceImpl |
Public Types | |
| enum class | TensorKeyMode { Index , Slice , IndexTensor } |
Public Member Functions | |
| ~TensorKey () | |
| TensorKeyMode | GetMode () const |
| Returns TensorKey mode. More... | |
| std::string | ToString () const |
| Convert TensorKey to a string representation. More... | |
| int64_t | GetIndex () const |
| int64_t | GetStart () const |
| int64_t | GetStop () const |
| int64_t | GetStep () const |
| TensorKey | InstantiateDimSize (int64_t dim_size) const |
| Tensor | GetIndexTensor () const |
Static Public Member Functions | |
| static TensorKey | Index (int64_t index) |
| static TensorKey | Slice (utility::optional< int64_t > start, utility::optional< int64_t > stop, utility::optional< int64_t > step) |
| static TensorKey | IndexTensor (const Tensor &index_tensor) |
TensorKey is used to represent single index, slice or advanced indexing on a Tensor.
See https://numpy.org/doc/stable/reference/arrays.indexing.html for details.
Definition at line 26 of file TensorKey.h.
|
strong |
| Enumerator | |
|---|---|
| Index | |
| Slice | |
| IndexTensor | |
Definition at line 67 of file TensorKey.h.
|
inline |
Definition at line 68 of file TensorKey.h.
| int64_t cloudViewer::core::TensorKey::GetIndex | ( | ) | const |
Get (single) index. For TensorKeyMode::Index only.
Definition at line 148 of file TensorKey.cpp.
References LogError.
Referenced by cloudViewer::core::Tensor::GetItem(), and cloudViewer::core::Tensor::SetItem().
| Tensor cloudViewer::core::TensorKey::GetIndexTensor | ( | ) | const |
Get advanced indexing tensor. For TensorKeyMode::IndexTensor only.
Definition at line 186 of file TensorKey.cpp.
References LogError.
Referenced by cloudViewer::core::Tensor::GetItem(), and cloudViewer::core::Tensor::SetItem().
| TensorKey::TensorKeyMode cloudViewer::core::TensorKey::GetMode | ( | ) | const |
Returns TensorKey mode.
Definition at line 130 of file TensorKey.cpp.
Referenced by cloudViewer::core::Tensor::GetItem(), and cloudViewer::core::Tensor::SetItem().
| int64_t cloudViewer::core::TensorKey::GetStart | ( | ) | const |
Get start index. Throws exception if start is None. For TensorKeyMode::Slice only.
Definition at line 156 of file TensorKey.cpp.
References LogError.
Referenced by cloudViewer::core::Tensor::GetItem().
| int64_t cloudViewer::core::TensorKey::GetStep | ( | ) | const |
Get step index. Throws exception if step is None. For TensorKeyMode::Slice only.
Definition at line 170 of file TensorKey.cpp.
References LogError.
Referenced by cloudViewer::core::Tensor::GetItem().
| int64_t cloudViewer::core::TensorKey::GetStop | ( | ) | const |
Get stop index. Throws exception if stop is None. For TensorKeyMode::Slice only.
Definition at line 163 of file TensorKey.cpp.
References LogError.
Referenced by cloudViewer::core::Tensor::GetItem().
|
static |
Instantiates a TensorKey with single index mode.
| index | Index to the tensor. |
Definition at line 134 of file TensorKey.cpp.
Referenced by cloudViewer::t::pipelines::registration::ComputeFPFHFeature(), cloudViewer::t::pipelines::kernel::ComputeFPFHFeatureCPU(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::core::ToTensorKey(), and cloudViewer::t::geometry::OrientedBoundingBox::Transform().
Instantiates a TensorKey with tensor-index (advanced indexing) mode.
| index_tensor | Indexing tensor of dtype int64_t or bool. |
Definition at line 144 of file TensorKey.cpp.
Referenced by cloudViewer::core::Tensor::Clip_(), cloudViewer::t::geometry::PointCloud::SelectByIndex(), and cloudViewer::core::ToTensorKey().
| TensorKey cloudViewer::core::TensorKey::InstantiateDimSize | ( | int64_t | dim_size | ) | const |
When dim_size is know, convert the None values in start, stop, step with to concrete values and returns a new TensorKey.
For TensorKeyMode::Slice only.
Definition at line 177 of file TensorKey.cpp.
References LogError.
Referenced by cloudViewer::core::Tensor::GetItem().
|
static |
Instantiates a TensorKey with slice mode.
| start | Start index. None means starting from the 0-th element. |
| stop | Stop index. None means stopping at the last element. |
| step | Step size. None means step size 1. |
Definition at line 138 of file TensorKey.cpp.
Referenced by cloudViewer::t::geometry::PointCloud::Append(), cloudViewer::t::pipelines::kernel::ComputePoseDopplerICP(), cloudViewer::core::ConcatenateImpl(), cloudViewer::t::pipelines::slac::ConvertCorrespondencesTargetIndexedToCx2Form(), cloudViewer::core::Tensor::GetItem(), cloudViewer::t::pipelines::slac::ControlGrid::Parameterize(), cloudViewer::t::pipelines::kernel::PoseToTransformation(), cloudViewer::t::pipelines::kernel::RtToTransformation(), cloudViewer::core::Tensor::SetItem(), cloudViewer::core::ToTensorKey(), cloudViewer::t::geometry::OrientedBoundingBox::Transform(), and cloudViewer::t::pipelines::kernel::TransformationToPose().
| std::string cloudViewer::core::TensorKey::ToString | ( | ) | const |
Convert TensorKey to a string representation.
Definition at line 132 of file TensorKey.cpp.