TensorKey is used to represent single index, slice or advanced indexing on a Tensor.
More...
#include <TensorKey.h>
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.
◆ TensorKeyMode
Enumerator |
---|
Index | |
Slice | |
IndexTensor | |
◆ ~TensorKey()
open3d::core::TensorKey::~TensorKey |
( |
| ) |
|
|
inline |
◆ GetIndex()
int64_t open3d::core::TensorKey::GetIndex |
( |
| ) |
const |
◆ GetIndexTensor()
Tensor open3d::core::TensorKey::GetIndexTensor |
( |
| ) |
const |
◆ GetMode()
◆ GetStart()
int64_t open3d::core::TensorKey::GetStart |
( |
| ) |
const |
◆ GetStep()
int64_t open3d::core::TensorKey::GetStep |
( |
| ) |
const |
◆ GetStop()
int64_t open3d::core::TensorKey::GetStop |
( |
| ) |
const |
◆ Index()
TensorKey open3d::core::TensorKey::Index |
( |
int64_t |
index | ) |
|
|
static |
Instantiates a TensorKey with single index mode.
static TensorKey Index(int64_t index)
Definition: TensorKey.cpp:133
- Parameters
-
index | Index to the tensor. |
◆ IndexTensor()
TensorKey open3d::core::TensorKey::IndexTensor |
( |
const Tensor & |
index_tensor | ) |
|
|
static |
Instantiates a TensorKey with tensor-index (advanced indexing) mode.
[[1, 2], [3:]]: advanced indexing on dim-0, slicing on dim-1.
t.GetItem({
});
static TensorKey Slice(utility::optional< int64_t > start, utility::optional< int64_t > stop, utility::optional< int64_t > step)
Definition: TensorKey.cpp:137
static TensorKey IndexTensor(const Tensor &index_tensor)
Definition: TensorKey.cpp:143
constexpr utility::nullopt_t None
Definition: TensorKey.h:20
- Parameters
-
index_tensor | Indexing tensor of dtype int64_t or bool. |
◆ InstantiateDimSize()
TensorKey open3d::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.
E.g. if t.shape == (5,), t[:4]:
after compute :
Slice( 0, 4, 1)
E.g. if t.shape == (5,), t[1:]:
after compute :
Slice( 1, 5, 1)
For TensorKeyMode::Slice only.
◆ Slice()
Instantiates a TensorKey with slice mode.
- Parameters
-
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. |
◆ ToString()
std::string open3d::core::TensorKey::ToString |
( |
| ) |
const |
Convert TensorKey to a string representation.
The documentation for this class was generated from the following files: