HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
onnxruntime::TensorShape Class Reference

#include <tensor_shape.h>

Public Member Functions

 TensorShape ()=default
 
 TensorShape (const TensorShape &other)
 
TensorShapeoperator= (const TensorShape &other)
 
TensorShapeoperator= (const gsl::span< const int64_t > &dims)
 
 TensorShape (TensorShape &&other) noexcept
 
TensorShapeoperator= (TensorShape &&other) noexcept
 
 TensorShape (gsl::span< const int64_t > dims)
 
 TensorShape (const TensorShapeVector &dims)
 
 TensorShape (std::initializer_list< int64_t > dims)
 
 TensorShape (const int64_t *dimension_sizes, size_t dimension_count)
 
 TensorShape (const std::vector< int64_t > &dims, size_t start, size_t end)
 
int64_t operator[] (size_t idx) const
 
int64_t & operator[] (size_t idx)
 
bool operator== (const TensorShape &other) const noexcept
 
bool operator!= (const TensorShape &other) const noexcept
 
size_t NumDimensions () const noexcept
 
void CopyDims (int64_t *dims, size_t num_dims) const
 
void CopyDims (int64_t *dims, size_t start_dim, size_t num_dims) const
 
gsl::span< const int64_t > GetDims () const
 
TensorShapeVector AsShapeVector () const
 
int64_t Size () const
 
int64_t SizeToDimension (size_t dimension) const
 
int64_t SizeFromDimension (size_t dimension) const
 
TensorShape Slice (size_t dimstart, size_t dimend) const
 
TensorShape Slice (size_t dimstart) const
 
std::string ToString () const
 
int64_t SizeHelper (size_t start, size_t end) const
 
bool IsScalar () const
 

Static Public Member Functions

static const TensorShape FromExistingBuffer (const std::vector< int64_t > &data)
 

Friends

struct ProviderHostImpl
 

Detailed Description

Definition at line 68 of file tensor_shape.h.

Constructor & Destructor Documentation

onnxruntime::TensorShape::TensorShape ( )
default
onnxruntime::TensorShape::TensorShape ( const TensorShape other)
inline

Definition at line 74 of file tensor_shape.h.

onnxruntime::TensorShape::TensorShape ( TensorShape &&  other)
inlinenoexcept

Definition at line 81 of file tensor_shape.h.

onnxruntime::TensorShape::TensorShape ( gsl::span< const int64_t >  dims)
onnxruntime::TensorShape::TensorShape ( const TensorShapeVector dims)
inline

Definition at line 85 of file tensor_shape.h.

onnxruntime::TensorShape::TensorShape ( std::initializer_list< int64_t >  dims)
inline

Definition at line 86 of file tensor_shape.h.

onnxruntime::TensorShape::TensorShape ( const int64_t *  dimension_sizes,
size_t  dimension_count 
)
inline

Definition at line 87 of file tensor_shape.h.

onnxruntime::TensorShape::TensorShape ( const std::vector< int64_t > &  dims,
size_t  start,
size_t  end 
)
inline

Definition at line 88 of file tensor_shape.h.

Member Function Documentation

TensorShapeVector onnxruntime::TensorShape::AsShapeVector ( ) const
inline

Definition at line 129 of file tensor_shape.h.

void onnxruntime::TensorShape::CopyDims ( int64_t *  dims,
size_t  num_dims 
) const
inline

Copy dims into an array with given size

Definition at line 111 of file tensor_shape.h.

void onnxruntime::TensorShape::CopyDims ( int64_t *  dims,
size_t  start_dim,
size_t  num_dims 
) const
inline

Copy dims from a specific start dim into an array with given size start_dim is expected to be in the inclusive range [0, NumDimensions() - 1] and this function does no checks to ensure that

Definition at line 120 of file tensor_shape.h.

static const TensorShape onnxruntime::TensorShape::FromExistingBuffer ( const std::vector< int64_t > &  data)
inlinestatic

Definition at line 91 of file tensor_shape.h.

gsl::span<const int64_t> onnxruntime::TensorShape::GetDims ( ) const
inline

Return underlying vector representation.

Definition at line 127 of file tensor_shape.h.

bool onnxruntime::TensorShape::IsScalar ( ) const
inline

empty shape or 1D shape (1) is regarded as scalar tensor

Definition at line 180 of file tensor_shape.h.

size_t onnxruntime::TensorShape::NumDimensions ( ) const
inlinenoexcept

Definition at line 104 of file tensor_shape.h.

bool onnxruntime::TensorShape::operator!= ( const TensorShape other) const
inlinenoexcept

Definition at line 102 of file tensor_shape.h.

TensorShape& onnxruntime::TensorShape::operator= ( const TensorShape other)
TensorShape& onnxruntime::TensorShape::operator= ( const gsl::span< const int64_t > &  dims)
inline

Definition at line 76 of file tensor_shape.h.

TensorShape& onnxruntime::TensorShape::operator= ( TensorShape &&  other)
noexcept
bool onnxruntime::TensorShape::operator== ( const TensorShape other) const
inlinenoexcept

Definition at line 101 of file tensor_shape.h.

int64_t onnxruntime::TensorShape::operator[] ( size_t  idx) const
inline

Return the dimension specified by <idx>.

Definition at line 98 of file tensor_shape.h.

int64_t& onnxruntime::TensorShape::operator[] ( size_t  idx)
inline

Definition at line 99 of file tensor_shape.h.

int64_t onnxruntime::TensorShape::Size ( ) const

Return the total number of elements. Returns 1 for an empty (rank 0) TensorShape.

May return -1

int64_t onnxruntime::TensorShape::SizeFromDimension ( size_t  dimension) const

Return the total number of elements from the specified dimension to the end of the tensor shape. If the dimension interval is empty (dimension == this->NumDimensions()), return 1.

Parameters
dimensionReturn size from this dimension to the end. Value must be between 0 and this->NumDimensions(), inclusive.
int64_t onnxruntime::TensorShape::SizeHelper ( size_t  start,
size_t  end 
) const

Calculate size between start and end. Assumes start and end are between 0 and this->NumDimensions(), inclusive, and that start < end.

int64_t onnxruntime::TensorShape::SizeToDimension ( size_t  dimension) const

Return the total number of elements up to the specified dimension. If the dimension interval is empty (dimension == 0), return 1.

Parameters
dimensionReturn size up to this dimension. Value must be between 0 and this->NumDimensions(), inclusive.
TensorShape onnxruntime::TensorShape::Slice ( size_t  dimstart,
size_t  dimend 
) const

Return a new TensorShape of the dimensions from dimstart to dimend.

TensorShape onnxruntime::TensorShape::Slice ( size_t  dimstart) const
inline

Return a new TensorShape of the dimensions from dimstart to end.

Definition at line 163 of file tensor_shape.h.

std::string onnxruntime::TensorShape::ToString ( ) const

output dimensions nicely formatted

Friends And Related Function Documentation

friend struct ProviderHostImpl
friend

Definition at line 195 of file tensor_shape.h.


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