ArmNN
 24.02
TensorInfo Class Reference

#include <Tensor.hpp>

Public Types

using DifferenceType = std::vector< TensorInfo >::difference_type
 

Public Member Functions

 TensorInfo ()
 Empty (invalid) constructor. More...
 
 TensorInfo (const TensorShape &shape, DataType dataType, float quantizationScale=1.0f, int32_t quantizationOffset=0, bool isConstant=false)
 
 TensorInfo (unsigned int numDimensions, const unsigned int *dimensionSizes, DataType dataType, float quantizationScale=1.0f, int32_t quantizationOffset=0, bool isConstant=false)
 
 TensorInfo (const TensorShape &shape, DataType dataType, const std::vector< float > &quantizationScales, unsigned int quantizationDim, bool isConstant=false)
 
 TensorInfo (unsigned int numDimensions, const unsigned int *dimensionSizes, DataType dataType, const std::vector< float > &quantizationScales, unsigned int quantizationDim, bool isConstant=false)
 
 TensorInfo (const TensorInfo &other)
 
TensorInfooperator= (const TensorInfo &other)
 
bool operator== (const TensorInfo &other) const
 
bool operator!= (const TensorInfo &other) const
 
const TensorShapeGetShape () const
 
TensorShapeGetShape ()
 
void SetShape (const TensorShape &newShape)
 
unsigned int GetNumDimensions () const
 
unsigned int GetNumElements () const
 
DataType GetDataType () const
 
void SetDataType (DataType type)
 
bool HasMultipleQuantizationScales () const
 
bool HasPerAxisQuantization () const
 
std::vector< float > GetQuantizationScales () const
 
void SetQuantizationScales (const std::vector< float > &scales)
 
float GetQuantizationScale () const
 
void SetQuantizationScale (float scale)
 
int32_t GetQuantizationOffset () const
 
void SetQuantizationOffset (int32_t offset)
 
Optional< unsigned int > GetQuantizationDim () const
 
void SetQuantizationDim (const Optional< unsigned int > &quantizationDim)
 
bool IsQuantized () const
 
bool IsConstant () const
 
void SetConstant (const bool IsConstant=true)
 Marks the data corresponding to this tensor info as constant. More...
 
bool IsTypeSpaceMatch (const TensorInfo &other) const
 Check that the types are the same and, if quantize, that the quantization parameters are the same. More...
 
unsigned int GetNumBytes () const
 

Detailed Description

Member Typedef Documentation

◆ DifferenceType

using DifferenceType = std::vector<TensorInfo>::difference_type

Definition at line 191 of file Tensor.hpp.

Constructor & Destructor Documentation

◆ TensorInfo() [1/6]

Empty (invalid) constructor.

Definition at line 341 of file Tensor.cpp.

342 : m_DataType(DataType::Float32), m_IsConstant(false)
343 {
344 }

References armnn::Float32.

◆ TensorInfo() [2/6]

TensorInfo ( const TensorShape shape,
DataType  dataType,
float  quantizationScale = 1.0f,
int32_t  quantizationOffset = 0,
bool  isConstant = false 
)

Definition at line 346 of file Tensor.cpp.

351  : m_Shape(shape)
352  , m_DataType(dataType)
353  , m_IsConstant(isConstant)
354 {
355  SetQuantizationScale(quantizationScale);
356  SetQuantizationOffset(quantizationOffset);
357 }

References TensorInfo::SetQuantizationOffset(), and TensorInfo::SetQuantizationScale().

◆ TensorInfo() [3/6]

TensorInfo ( unsigned int  numDimensions,
const unsigned int *  dimensionSizes,
DataType  dataType,
float  quantizationScale = 1.0f,
int32_t  quantizationOffset = 0,
bool  isConstant = false 
)

Definition at line 359 of file Tensor.cpp.

365  : m_Shape(numDimensions, dimensionSizes), m_DataType(dataType), m_IsConstant(isConstant)
366 {
367  SetQuantizationScale(quantizationScale);
368  SetQuantizationOffset(quantizationOffset);
369 }

References TensorInfo::SetQuantizationOffset(), and TensorInfo::SetQuantizationScale().

◆ TensorInfo() [4/6]

TensorInfo ( const TensorShape shape,
DataType  dataType,
const std::vector< float > &  quantizationScales,
unsigned int  quantizationDim,
bool  isConstant = false 
)

Definition at line 371 of file Tensor.cpp.

376  : m_Shape(shape)
377  , m_DataType(dataType)
378  , m_IsConstant(isConstant)
379 {
380  SetQuantizationScales(quantizationScales);
381  SetQuantizationDim(MakeOptional<unsigned int>(quantizationDim));
382 }

References TensorInfo::SetQuantizationDim(), and TensorInfo::SetQuantizationScales().

◆ TensorInfo() [5/6]

TensorInfo ( unsigned int  numDimensions,
const unsigned int *  dimensionSizes,
DataType  dataType,
const std::vector< float > &  quantizationScales,
unsigned int  quantizationDim,
bool  isConstant = false 
)

Definition at line 384 of file Tensor.cpp.

390  : m_Shape(numDimensions, dimensionSizes)
391  , m_DataType(dataType)
392  , m_IsConstant(isConstant)
393 {
394  SetQuantizationScales(quantizationScales);
395  SetQuantizationDim(MakeOptional<unsigned int>(quantizationDim));
396 }

References TensorInfo::SetQuantizationDim(), and TensorInfo::SetQuantizationScales().

◆ TensorInfo() [6/6]

TensorInfo ( const TensorInfo other)

Definition at line 398 of file Tensor.cpp.

399 : m_Shape(other.m_Shape)
400 , m_DataType(other.m_DataType)
401 , m_IsConstant(other.m_IsConstant)
402 , m_Quantization(other.m_Quantization)
403 {}

Member Function Documentation

◆ GetDataType()

DataType GetDataType ( ) const
inline

Definition at line 200 of file Tensor.hpp.

200 { return m_DataType; }

Referenced by BiasAndWeightsTypesMatch::BiasAndWeightsTypesMatch(), armnnUtils::CalculateReducedOutputTensoInfo(), armnnUtils::CalculateStridedSliceOutputTensorInfo(), TosaRefTensorHandle::CanBeImported(), RefTensorHandle::CanBeImported(), armnn::ClConvertFp16ToFp32WorkloadValidate(), armnn::ClConvertFp32ToFp16WorkloadValidate(), ConvertQuantizeToTosaOperator(), armnn_driver::ConvertToLayerInputHandle(), Layer::GetDataType(), BaseTensor< void * >::GetDataType(), armnn::GetLayerInOutDatatype(), armnn::optimizations::pad_fold::GetLowestElement(), armnn::GetUnpaddedTensorStrides(), armnn::InitializeArmComputeTensorData(), armnn::InsertConvertFp16ToFp32LayersBefore(), armnn::InsertConvertFp32ToFp16LayersAfter(), SampleDynamicLayerSupport::IsAdditionSupported(), RefLayerSupport::IsConvertFp16ToFp32Supported(), RefLayerSupport::IsConvertFp32ToFp16Supported(), RefLayerSupport::IsConvolution2dSupported(), RefLayerSupport::IsConvolution3dSupported(), RefLayerSupport::IsDepthwiseConvolutionSupported(), NeonLayerSupport::IsFloorSupported(), NeonLayerSupport::IsQLstmSupported(), ClLayerSupport::IsQLstmSupported(), RefLayerSupport::IsTransposeConvolution2dSupported(), NeonLayerSupport::IsUnidirectionalSequenceLstmSupported(), armnn::LstmImpl(), armnn::Pad(), armnn::PermuteTensor(), ConvertFp32NetworkToFp16Impl::Run(), armnn_driver::SwizzleAndroidNn4dTensorToArmNn(), armnnUtils::ToFloatArray(), ArgMinMaxQueueDescriptor::Validate(), FullyConnectedQueueDescriptor::Validate(), Convolution2dQueueDescriptor::Validate(), Convolution3dQueueDescriptor::Validate(), DepthwiseConvolution2dQueueDescriptor::Validate(), QuantizeQueueDescriptor::Validate(), EqualQueueDescriptor::Validate(), ConvertFp16ToFp32QueueDescriptor::Validate(), ConvertFp32ToFp16QueueDescriptor::Validate(), GreaterQueueDescriptor::Validate(), GatherNdQueueDescriptor::Validate(), GatherQueueDescriptor::Validate(), TransposeConvolution2dQueueDescriptor::Validate(), ComparisonQueueDescriptor::Validate(), and LogicalBinaryQueueDescriptor::Validate().

◆ GetNumBytes()

◆ GetNumDimensions()

unsigned int GetNumDimensions ( ) const
inline

Definition at line 197 of file Tensor.hpp.

197 { return m_Shape.GetNumDimensions(); }

References TensorShape::GetNumDimensions().

Referenced by armnn::ArgMinMax(), armnn::BatchToSpaceNd(), armnn::CalculateGatherNdKeyIndices(), armnnUtils::CalculateReducedOutputTensoInfo(), armnnUtils::CalculateStridedSliceOutputTensorInfo(), armnn::CollapseLeadingUnitDimensions(), armnn::ComputeAclAxis(), armnn::ComputeReductionTensorShape(), armnn::ComputeSoftmaxAclAxis(), armnn::Concatenate(), armnn::ConnectedToLayerType(), armnn_driver::ConvertReduce(), armnn::Gather(), armnn::GetNumActivations(), BaseTensor< void * >::GetNumDimensions(), armnn_driver::IsDynamicTensor(), RefLayerSupport::IsMeanSupported(), armnn::LogSoftmax(), TfLiteParserImpl::OutputShapeOfSqueeze(), armnn::PrintOutput(), armnnUtils::ProcessConcatInputTensorInfo(), armnn::Reduce(), armnn::ReverseV2(), PermuteAndBatchToSpaceAsDepthToSpaceImpl< PermuteType >::Run(), AddBroadcastReshapeLayerImpl::Run(), armnn::Softmax(), armnn::SpaceToBatchNd(), armnn::Split(), armnn::Splitter(), armnn::Stack(), armnn_driver::SwizzleAndroidNn4dTensorToArmNn(), armnn::Tile(), FullyConnectedQueueDescriptor::Validate(), MeanQueueDescriptor::Validate(), PadQueueDescriptor::Validate(), InstanceNormalizationQueueDescriptor::Validate(), L2NormalizationQueueDescriptor::Validate(), SpaceToBatchNdQueueDescriptor::Validate(), StridedSliceQueueDescriptor::Validate(), GatherNdQueueDescriptor::Validate(), GatherQueueDescriptor::Validate(), SliceQueueDescriptor::Validate(), BatchMatMulQueueDescriptor::Validate(), ReverseV2QueueDescriptor::Validate(), TileQueueDescriptor::Validate(), QueueDescriptor::ValidateTensorNumDimensions(), and ReduceLayer::ValidateTensorShapesFromInputs().

◆ GetNumElements()

◆ GetQuantizationDim()

Optional< unsigned int > GetQuantizationDim ( ) const

Definition at line 494 of file Tensor.cpp.

495 {
496  return m_Quantization.m_QuantizationDim;
497 }

Referenced by armnnUtils::ToFloatArray().

◆ GetQuantizationOffset()

int32_t GetQuantizationOffset ( ) const

Definition at line 478 of file Tensor.cpp.

479 {
480  if (!m_Quantization.m_Offset.has_value())
481  {
482  // NOTE: old default for backward compatibility
483  return 0;
484  }
485 
486  return m_Quantization.m_Offset.value();
487 }

Referenced by ConvertQuantizeToTosaOperator(), armnn::optimizations::pad_fold::GetLowestElement(), armnn::optimizations::pad_fold::GetZeroElement(), TensorInfo::IsTypeSpaceMatch(), QuantizationParametersAreEqual::QuantizationParametersAreEqual(), armnnUtils::ToFloatArray(), and QLstmQueueDescriptor::Validate().

◆ GetQuantizationScale()

float GetQuantizationScale ( ) const

Definition at line 461 of file Tensor.cpp.

462 {
463  if (m_Quantization.m_Scales.empty())
464  {
465  // NOTE: old default for backward compatibility
466  return 1.0f;
467  }
468 
470  return m_Quantization.m_Scales[0];
471 }

References ARMNN_ASSERT, and TensorInfo::HasMultipleQuantizationScales().

Referenced by ConvertQuantizeToTosaOperator(), armnn::optimizations::pad_fold::GetLowestElement(), TensorInfo::IsTypeSpaceMatch(), QuantizationParametersAreEqual::QuantizationParametersAreEqual(), armnnUtils::ToFloatArray(), and QLstmQueueDescriptor::Validate().

◆ GetQuantizationScales()

std::vector< float > GetQuantizationScales ( ) const

Definition at line 451 of file Tensor.cpp.

452 {
453  return m_Quantization.m_Scales;
454 }

Referenced by armnnUtils::ToFloatArray().

◆ GetShape() [1/2]

TensorShape& GetShape ( )
inline

Definition at line 194 of file Tensor.hpp.

194 { return m_Shape; }

◆ GetShape() [2/2]

const TensorShape& GetShape ( ) const
inline

Definition at line 193 of file Tensor.hpp.

193 { return m_Shape; }

Referenced by armnn::ArgMinMax(), BatchMatMul::BatchMatMul(), armnn::BatchNormImpl(), armnn::BatchToSpaceNd(), armnn::CalculateGatherNdKeyIndices(), armnnUtils::CalculateReducedOutputTensoInfo(), armnnUtils::CalculateStridedSliceOutputTensorInfo(), armnn::ClUnidirectionalSequenceLstmFloatWorkloadValidate(), armnn::CollapseLeadingUnitDimensions(), armnn::Concatenate(), armnn::Convert1HWOTensorInfoToAcl(), armnn::Convert1HWOTensorToAcl(), armnn::Convert1HWOtoMIHW(), armnn_driver::ConvertPooling2d(), ConvertQuantizeToTosaOperator(), armnn::ConvertWeightTensorFromArmnnToAcl(), armnn::CreateAclNormalizationLayerInfoForL2Normalization(), armnnOnnxParser::CreateConstTensorImpl(), armnn::DepthToSpace(), armnn::DetectionPostProcess(), armnn::ExecuteFunction(), armnn::Gather(), armnn::GetNumActivations(), TosaRefTensorHandle::GetShape(), SampleTensorHandle::GetShape(), RefTensorHandle::GetShape(), ConstTensorHandle::GetShape(), RefTensorHandleDecorator::GetShape(), BaseTensor< void * >::GetShape(), armnn::GetUnpaddedTensorStrides(), armnn::InstanceNorm(), armnn_driver::IsDynamicTensor(), ClLayerSupport::IsSplitterSupported(), NeonLayerSupport::IsSplitterSupported(), armnn::LogSoftmax(), armnn::LstmImpl(), armnn::MirrorPad(), armnn::NeonUnidirectionalSequenceLstmFloatWorkloadValidate(), armnn::NeonUnidirectionalSequenceLstmWorkloadValidate(), TfLiteParserImpl::OutputShapeOfSqueeze(), armnn::Pad(), armnn::PermuteTensor(), armnn::Pooling2d(), armnn::Pooling3d(), armnn::PreluImpl(), armnn::PrintOutput(), armnnUtils::ProcessConcatInputTensorInfo(), armnn::Reduce(), armnnUtils::ReduceDims(), RefTransposeConvolution2dWorkload::RefTransposeConvolution2dWorkload(), armnn::ReshapeWeightsForAcl(), armnn::Resize(), armnn::ReverseV2(), PermuteAsReshapeImpl::Run(), TransposeAsReshapeImpl::Run(), OptimizeConsecutiveReshapesImpl::Run(), AddBroadcastReshapeLayerImpl::Run(), FuseBatchNorm< ConvLayer, ArmnnType, T >::Run(), Convolution2dLayer::SerializeLayerParameters(), Convolution3dLayer::SerializeLayerParameters(), DepthwiseConvolution2dLayer::SerializeLayerParameters(), Graph::SerializeToDot(), ShapesAreBroadcastCompatible::ShapesAreBroadcastCompatible(), ShapesAreSameRank::ShapesAreSameRank(), armnn::Slice(), armnn::Softmax(), armnn::SpaceToBatchNd(), armnn::SpaceToDepth(), armnn::Split(), armnn::Splitter(), armnn::Stack(), armnn::StridedSlice(), armnn_driver::SwizzleAndroidNn4dTensorToArmNn(), armnn::Tile(), armnnUtils::ToFloatArray(), ArgMinMaxQueueDescriptor::Validate(), PermuteQueueDescriptor::Validate(), DepthwiseConvolution2dQueueDescriptor::Validate(), DetectionPostProcessQueueDescriptor::Validate(), ResizeQueueDescriptor::Validate(), SpaceToBatchNdQueueDescriptor::Validate(), SpaceToDepthQueueDescriptor::Validate(), BatchToSpaceNdQueueDescriptor::Validate(), TransposeQueueDescriptor::Validate(), QLstmQueueDescriptor::Validate(), QuantizedLstmQueueDescriptor::Validate(), SliceQueueDescriptor::Validate(), DepthToSpaceQueueDescriptor::Validate(), BatchMatMulQueueDescriptor::Validate(), QueueDescriptor::ValidateTensorNumDimensions(), OutputSlot::ValidateTensorShape(), ElementwiseBaseLayer::ValidateTensorShapesFromInputs(), QuantizeLayer::ValidateTensorShapesFromInputs(), ChannelShuffleLayer::ValidateTensorShapesFromInputs(), ActivationLayer::ValidateTensorShapesFromInputs(), FillLayer::ValidateTensorShapesFromInputs(), ConvertFp32ToFp16Layer::ValidateTensorShapesFromInputs(), RankLayer::ValidateTensorShapesFromInputs(), CastLayer::ValidateTensorShapesFromInputs(), SoftmaxLayer::ValidateTensorShapesFromInputs(), AbsLayer::ValidateTensorShapesFromInputs(), StackLayer::ValidateTensorShapesFromInputs(), TransposeLayer::ValidateTensorShapesFromInputs(), FakeQuantizationLayer::ValidateTensorShapesFromInputs(), BatchToSpaceNdLayer::ValidateTensorShapesFromInputs(), FloorLayer::ValidateTensorShapesFromInputs(), SwitchLayer::ValidateTensorShapesFromInputs(), ResizeLayer::ValidateTensorShapesFromInputs(), Pooling3dLayer::ValidateTensorShapesFromInputs(), InstanceNormalizationLayer::ValidateTensorShapesFromInputs(), DequantizeLayer::ValidateTensorShapesFromInputs(), Pooling2dLayer::ValidateTensorShapesFromInputs(), SliceLayer::ValidateTensorShapesFromInputs(), MemImportLayer::ValidateTensorShapesFromInputs(), L2NormalizationLayer::ValidateTensorShapesFromInputs(), DebugLayer::ValidateTensorShapesFromInputs(), NormalizationLayer::ValidateTensorShapesFromInputs(), PermuteLayer::ValidateTensorShapesFromInputs(), ShapeLayer::ValidateTensorShapesFromInputs(), RsqrtLayer::ValidateTensorShapesFromInputs(), ConvertFp16ToFp32Layer::ValidateTensorShapesFromInputs(), MemCopyLayer::ValidateTensorShapesFromInputs(), MergeLayer::ValidateTensorShapesFromInputs(), MeanLayer::ValidateTensorShapesFromInputs(), PadLayer::ValidateTensorShapesFromInputs(), LogSoftmaxLayer::ValidateTensorShapesFromInputs(), ReshapeLayer::ValidateTensorShapesFromInputs(), BroadcastToLayer::ValidateTensorShapesFromInputs(), DepthwiseConvolution2dLayer::ValidateTensorShapesFromInputs(), Convolution2dLayer::ValidateTensorShapesFromInputs(), FullyConnectedLayer::ValidateTensorShapesFromInputs(), Convolution3dLayer::ValidateTensorShapesFromInputs(), GatherNdLayer::ValidateTensorShapesFromInputs(), ElementwiseBinaryLayer::ValidateTensorShapesFromInputs(), TileLayer::ValidateTensorShapesFromInputs(), BatchMatMulLayer::ValidateTensorShapesFromInputs(), GatherLayer::ValidateTensorShapesFromInputs(), DetectionPostProcessLayer::ValidateTensorShapesFromInputs(), ArgMinMaxLayer::ValidateTensorShapesFromInputs(), StridedSliceLayer::ValidateTensorShapesFromInputs(), ReduceLayer::ValidateTensorShapesFromInputs(), ElementwiseUnaryLayer::ValidateTensorShapesFromInputs(), ReverseV2Layer::ValidateTensorShapesFromInputs(), PreluLayer::ValidateTensorShapesFromInputs(), LogicalBinaryLayer::ValidateTensorShapesFromInputs(), ComparisonLayer::ValidateTensorShapesFromInputs(), TransposeConvolution2dLayer::ValidateTensorShapesFromInputs(), SpaceToBatchNdLayer::ValidateTensorShapesFromInputs(), SpaceToDepthLayer::ValidateTensorShapesFromInputs(), DepthToSpaceLayer::ValidateTensorShapesFromInputs(), SplitterLayer::ValidateTensorShapesFromInputs(), UnidirectionalSequenceLstmLayer::ValidateTensorShapesFromInputs(), LstmLayer::ValidateTensorShapesFromInputs(), ConcatLayer::ValidateTensorShapesFromInputs(), BatchNormalizationLayer::ValidateTensorShapesFromInputs(), QuantizedLstmLayer::ValidateTensorShapesFromInputs(), and QLstmLayer::ValidateTensorShapesFromInputs().

◆ HasMultipleQuantizationScales()

bool HasMultipleQuantizationScales ( ) const
inline

Definition at line 203 of file Tensor.hpp.

203 { return m_Quantization.m_Scales.size() > 1; }

Referenced by TensorInfo::GetQuantizationScale(), TensorInfo::HasPerAxisQuantization(), and TensorInfo::IsTypeSpaceMatch().

◆ HasPerAxisQuantization()

bool HasPerAxisQuantization ( ) const

Definition at line 446 of file Tensor.cpp.

447 {
448  return HasMultipleQuantizationScales() || m_Quantization.m_QuantizationDim.has_value();
449 }

References TensorInfo::HasMultipleQuantizationScales().

Referenced by armnn::Convert1HWOtoMIHW(), and armnnUtils::ToFloatArray().

◆ IsConstant()

◆ IsQuantized()

bool IsQuantized ( ) const

◆ IsTypeSpaceMatch()

bool IsTypeSpaceMatch ( const TensorInfo other) const

Check that the types are the same and, if quantize, that the quantization parameters are the same.

Definition at line 432 of file Tensor.cpp.

433 {
434  bool match = true;
435 
436  match &= m_DataType == other.m_DataType;
437 
439  {
440  match &= GetQuantizationScale() == other.GetQuantizationScale() &&
441  GetQuantizationOffset() == other.GetQuantizationOffset();
442  }
443  return match;
444 }

References TensorInfo::GetQuantizationOffset(), TensorInfo::GetQuantizationScale(), TensorInfo::HasMultipleQuantizationScales(), and TensorInfo::IsQuantized().

Referenced by ClLayerSupport::IsConcatSupported(), NeonLayerSupport::IsConcatSupported(), NeonLayerSupport::IsSplitterSupported(), and ClLayerSupport::IsSplitterSupported().

◆ operator!=()

bool operator!= ( const TensorInfo other) const

Definition at line 422 of file Tensor.cpp.

423 {
424  return !(*this == other);
425 }

◆ operator=()

TensorInfo & operator= ( const TensorInfo other)

Definition at line 405 of file Tensor.cpp.

406 {
407  m_Shape = other.m_Shape;
408  m_DataType = other.m_DataType;
409  m_Quantization = other.m_Quantization;
410  m_IsConstant = other.m_IsConstant;
411  return *this;
412 }

◆ operator==()

bool operator== ( const TensorInfo other) const

Definition at line 414 of file Tensor.cpp.

415 {
416  return ((m_Shape == other.m_Shape) &&
417  (m_DataType == other.m_DataType) &&
418  (m_Quantization == other.m_Quantization) &&
419  (m_IsConstant == other.m_IsConstant));
420 }

◆ SetConstant()

void SetConstant ( const bool  IsConstant = true)

Marks the data corresponding to this tensor info as constant.

: This can allow further optimization on execution @Note: The user has to ensure that the underlying data actually is constant.

Examples
AsyncExecutionSample.cpp, DynamicSample.cpp, and SimpleSample.cpp.

Definition at line 514 of file Tensor.cpp.

515 {
516  m_IsConstant = IsConstant;
517 }

References TensorInfo::IsConstant().

Referenced by ConstTensor::ConstTensor(), armnn_driver::ConvertOperandToConstTensorPin(), ArmnnPreparedModel::ExecuteWithDummyInputs(), TfLiteParserImpl::GetNetworkInputBindingInfo(), armnnUtils::MakeInputTensors(), armnn::PermuteTensor(), and armnnDeserializer::ToConstTensor().

◆ SetDataType()

◆ SetQuantizationDim()

void SetQuantizationDim ( const Optional< unsigned int > &  quantizationDim)

Definition at line 499 of file Tensor.cpp.

500 {
501  m_Quantization.m_QuantizationDim = quantizationDim;
502 }

Referenced by armnnUtils::Permuted(), and TensorInfo::TensorInfo().

◆ SetQuantizationOffset()

void SetQuantizationOffset ( int32_t  offset)

Definition at line 489 of file Tensor.cpp.

490 {
491  m_Quantization.m_Offset = MakeOptional<int32_t>(offset);
492 }

Referenced by TensorInfo::TensorInfo().

◆ SetQuantizationScale()

void SetQuantizationScale ( float  scale)

Definition at line 473 of file Tensor.cpp.

474 {
475  m_Quantization.m_Scales = { scale };
476 }

Referenced by TensorInfo::TensorInfo().

◆ SetQuantizationScales()

void SetQuantizationScales ( const std::vector< float > &  scales)

Definition at line 456 of file Tensor.cpp.

457 {
458  m_Quantization.m_Scales = scales;
459 }

Referenced by TensorInfo::TensorInfo().

◆ SetShape()


The documentation for this class was generated from the following files:
ARMNN_ASSERT
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
armnn::TensorInfo::SetQuantizationDim
void SetQuantizationDim(const Optional< unsigned int > &quantizationDim)
Definition: Tensor.cpp:499
armnn::TensorInfo::GetNumElements
unsigned int GetNumElements() const
Definition: Tensor.hpp:198
armnn::TensorInfo::GetQuantizationScale
float GetQuantizationScale() const
Definition: Tensor.cpp:461
armnn::DataType::Float32
@ Float32
armnn::TensorInfo::IsConstant
bool IsConstant() const
Definition: Tensor.cpp:509
armnn::TensorInfo::SetQuantizationScale
void SetQuantizationScale(float scale)
Definition: Tensor.cpp:473
armnn::TensorInfo::SetQuantizationScales
void SetQuantizationScales(const std::vector< float > &scales)
Definition: Tensor.cpp:456
armnn::TensorShape::GetNumDimensions
unsigned int GetNumDimensions() const
Function that returns the tensor rank.
Definition: Tensor.cpp:174
armnn::TensorInfo::HasMultipleQuantizationScales
bool HasMultipleQuantizationScales() const
Definition: Tensor.hpp:203
armnn::TensorInfo::IsQuantized
bool IsQuantized() const
Definition: Tensor.cpp:504
armnn::GetDataTypeSize
constexpr unsigned int GetDataTypeSize(DataType dataType)
Definition: TypesUtils.hpp:182
armnn::TensorInfo::SetQuantizationOffset
void SetQuantizationOffset(int32_t offset)
Definition: Tensor.cpp:489
armnn::IsQuantizedType
constexpr bool IsQuantizedType()
Definition: TypesUtils.hpp:311
armnn::TensorInfo::GetQuantizationOffset
int32_t GetQuantizationOffset() const
Definition: Tensor.cpp:478
armnn::TensorShape::GetNumElements
unsigned int GetNumElements() const
Function that calculates the tensor elements by multiplying all dimension size which are Specified.
Definition: Tensor.cpp:181