Open3D (C++ API)  0.18.0+5c982c7
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
open3d::core::AdvancedIndexPreprocessor Class Reference

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< TensorGetIndexTensors () 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 >, SizeVectorExpandToCommonShapeExceptZeroDim (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< TensorExpandBoolTensors (const std::vector< Tensor > &index_tensors)
 Expand boolean tensor to integer index. More...
 

Protected Attributes

Tensor tensor_
 
std::vector< Tensorindex_tensors_
 The processed index tensors. More...
 
SizeVector output_shape_
 Output shape. More...
 
SizeVector indexed_shape_
 
SizeVector indexed_strides_
 

Detailed Description

This class is based on PyTorch's aten/src/ATen/native/Indexing.cpp.

Constructor & Destructor Documentation

◆ AdvancedIndexPreprocessor()

open3d::core::AdvancedIndexPreprocessor::AdvancedIndexPreprocessor ( const Tensor tensor,
const std::vector< Tensor > &  index_tensors 
)
inline

Member Function Documentation

◆ ExpandBoolTensors()

std::vector< Tensor > open3d::core::AdvancedIndexPreprocessor::ExpandBoolTensors ( const std::vector< Tensor > &  index_tensors)
staticprotected

Expand boolean tensor to integer index.

◆ ExpandToCommonShapeExceptZeroDim()

std::pair< std::vector< Tensor >, SizeVector > open3d::core::AdvancedIndexPreprocessor::ExpandToCommonShapeExceptZeroDim ( const std::vector< Tensor > &  index_tensors)
static

Expand all tensors to the broadcasted shape, 0-dim tensors are ignored. Throws exception if the common broadcasted shape does not exist.

◆ GetIndexedShape()

SizeVector open3d::core::AdvancedIndexPreprocessor::GetIndexedShape ( ) const
inline

◆ GetIndexedStrides()

SizeVector open3d::core::AdvancedIndexPreprocessor::GetIndexedStrides ( ) const
inline

◆ GetIndexTensors()

std::vector<Tensor> open3d::core::AdvancedIndexPreprocessor::GetIndexTensors ( ) const
inline

◆ GetOutputShape()

SizeVector open3d::core::AdvancedIndexPreprocessor::GetOutputShape ( ) const
inline

◆ GetTensor()

Tensor open3d::core::AdvancedIndexPreprocessor::GetTensor ( ) const
inline

◆ IsIndexSplittedBySlice()

bool open3d::core::AdvancedIndexPreprocessor::IsIndexSplittedBySlice ( const std::vector< Tensor > &  index_tensors)
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

◆ RestrideIndexTensor()

Tensor open3d::core::AdvancedIndexPreprocessor::RestrideIndexTensor ( const Tensor index_tensor,
int64_t  dims_before,
int64_t  dims_after 
)
static

◆ RestrideTensor()

Tensor open3d::core::AdvancedIndexPreprocessor::RestrideTensor ( const Tensor tensor,
int64_t  dims_before,
int64_t  dims_indexed,
SizeVector  replacement_shape 
)
static

◆ RunPreprocess()

void open3d::core::AdvancedIndexPreprocessor::RunPreprocess ( )
protected

Preprocess tensor and index tensors.

◆ ShuffleIndexedDimsToFront()

std::pair< Tensor, std::vector< Tensor > > open3d::core::AdvancedIndexPreprocessor::ShuffleIndexedDimsToFront ( const Tensor tensor,
const std::vector< Tensor > &  index_tensors 
)
static

Shuffle indexed dimensions in front of the slice dimensions for the tensor and index tensors.

Field Documentation

◆ index_tensors_

std::vector<Tensor> open3d::core::AdvancedIndexPreprocessor::index_tensors_
protected

The processed index tensors.

◆ indexed_shape_

SizeVector open3d::core::AdvancedIndexPreprocessor::indexed_shape_
protected

The shape of the indexed dimensions. See the docstring of RestrideTensor for details.

◆ indexed_strides_

SizeVector open3d::core::AdvancedIndexPreprocessor::indexed_strides_
protected

The strides for indexed dimensions, in element numbers (not byte size). See the docstring of RestrideTensor for details.

◆ output_shape_

SizeVector open3d::core::AdvancedIndexPreprocessor::output_shape_
protected

Output shape.

◆ tensor_

Tensor open3d::core::AdvancedIndexPreprocessor::tensor_
protected

The processed tensors being indexed. The tensor still uses the same underlying memory, but it may have been reshaped and restrided.


The documentation for this class was generated from the following files: