Open3D (C++ API)
|
This class is based on PyTorch's aten/src/ATen/native/Indexing.cpp. More...
#include <AdvancedIndexing.h>
Public Member Functions | |
AdvancedIndexPreprocessor (const Tensor &tensor, const std::vector< Tensor > &index_tensors) | |
Tensor | GetTensor () const |
std::vector< Tensor > | GetIndexTensors () const |
SizeVector | GetOutputShape () const |
SizeVector | GetIndexedShape () const |
SizeVector | GetIndexedStrides () const |
Static Public Member Functions | |
static bool | IsIndexSplittedBySlice (const std::vector< Tensor > &index_tensors) |
static std::pair< Tensor, std::vector< Tensor > > | ShuffleIndexedDimsToFront (const Tensor &tensor, const std::vector< Tensor > &index_tensors) |
static std::pair< std::vector< Tensor >, SizeVector > | ExpandToCommonShapeExceptZeroDim (const std::vector< Tensor > &index_tensors) |
static Tensor | RestrideTensor (const Tensor &tensor, int64_t dims_before, int64_t dims_indexed, SizeVector replacement_shape) |
static Tensor | RestrideIndexTensor (const Tensor &index_tensor, int64_t dims_before, int64_t dims_after) |
Protected Member Functions | |
void | RunPreprocess () |
Preprocess tensor and index tensors. More... | |
Static Protected Member Functions | |
static std::vector< Tensor > | ExpandBoolTensors (const std::vector< Tensor > &index_tensors) |
Expand boolean tensor to integer index. More... | |
Protected Attributes | |
Tensor | tensor_ |
std::vector< Tensor > | index_tensors_ |
The processed index tensors. More... | |
SizeVector | output_shape_ |
Output shape. More... | |
SizeVector | indexed_shape_ |
SizeVector | indexed_strides_ |
This class is based on PyTorch's aten/src/ATen/native/Indexing.cpp.
|
inline |
|
staticprotected |
Expand boolean tensor to integer index.
|
static |
Expand all tensors to the broadcasted shape, 0-dim tensors are ignored. Thorws exception if the common broadcasted shape does not exist.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
Returns true if the indexed dimension is splitted by (full) slice. E.g. A[[1, 2], :, [1, 2]] returns true A[[1, 2], [1, 2], :] returns false
|
static |
|
static |
|
protected |
Preprocess tensor and index tensors.
|
static |
Shuffle indexed dimensions in front of the slice dimensions for the tensor and index tensors.
|
protected |
The processed index tensors.
|
protected |
The shape of the indexed dimensions. See the docstring of RestrideTensor for details.
|
protected |
The strides for indexed dimensions, in element numbers (not byte size). See the docstring of RestrideTensor for details.
|
protected |
Output shape.
|
protected |
The processed tensors being indexed. The tensor still uses the same underlying memory, but it may have been reshaped and restrided.