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 

Member Function Documentation

◆ ExpandBoolTensors()

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

Expand boolean tensor to integer index.

◆ ExpandToCommonShapeExceptZeroDim()

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

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

◆ GetIndexedStrides()

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

◆ GetIndexTensors()

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

◆ GetOutputShape()

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

◆ GetTensor()

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

◆ IsIndexSplittedBySlice()

bool open3d::core::AdvancedIndexPreprocessor::IsIndexSplittedBySlice ( const std::vector< Tensor > &  index_tensors)

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 

◆ RestrideTensor()

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

◆ RunPreprocess()

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

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 

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_

The processed index tensors.

◆ indexed_shape_

SizeVector open3d::core::AdvancedIndexPreprocessor::indexed_shape_

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

◆ indexed_strides_

SizeVector open3d::core::AdvancedIndexPreprocessor::indexed_strides_

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_

Output shape.

◆ tensor_

Tensor open3d::core::AdvancedIndexPreprocessor::tensor_

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: