ONE - On-device Neural Engine
Loading...
Searching...
No Matches
RandomDataGenerator.RandomDataGenerator Class Reference

Public Member Functions

 __init__ (self, shape)
 
 gen (self, dtype)
 

Data Fields

 shape
 

Protected Member Functions

 _unsupported_types (self)
 
 _gen_uint8 (self)
 
 _gen_int16 (self)
 
 _gen_float32 (self)
 

Protected Attributes

 _unsupported_types
 

Detailed Description

Definition at line 22 of file RandomDataGenerator.py.

Constructor & Destructor Documentation

◆ __init__()

RandomDataGenerator.RandomDataGenerator.__init__ (   self,
  shape 
)

Definition at line 23 of file RandomDataGenerator.py.

23 def __init__(self, shape):
24 self.shape = shape
25

Member Function Documentation

◆ _gen_float32()

RandomDataGenerator.RandomDataGenerator._gen_float32 (   self)
protected

Definition at line 35 of file RandomDataGenerator.py.

35 def _gen_float32(self):
36 return np.array(10 * np.random.random_sample(self.shape) - 5, np.float32)
37

References onert::ir::OperandInfo.shape(), RunTimeOperandInfo.shape(), RandomDataGenerator.RandomDataGenerator.shape, luci_interpreter::Tensor.shape(), luci_interpreter::kernels::BroadcastTo.shape(), luci_interpreter::kernels::Reshape.shape(), nnkit::support::tftestinfo::ParsedTensor.shape(), onert::ir::OperandInfo.shape(), locomotiv::NodeData.shape(), ndarray::Array< T >.shape(), locomotiv::NodeDataImpl.shape(), loco::DepthwiseFilterDecoder.shape(), loco::PermutingDecoder< Domain::DepthwiseFilter >.shape(), loco::FeatureDecoder.shape(), loco::PermutingDecoder< Domain::Feature >.shape(), loco::FilterDecoder.shape(), loco::PermutingDecoder< Domain::Filter >.shape(), onert::ir::OperandInfo.shape(), moco::TensorPackEnumerator.shape(), loco::MatrixDecoder.shape(), loco::PermutingDecoder< Domain::Matrix >.shape(), moco::ModelSignature.shape(), moco::ModelSignature.shape(), loco::DepthwiseFilterEncoder.shape(), loco::FeatureEncoder.shape(), loco::FilterEncoder.shape(), loco::MatrixEncoder.shape(), loco::PermutingEncoder< Domain::Feature >.shape(), loco::PermutingEncoder< Domain::Filter >.shape(), loco::PermutingEncoder< Domain::DepthwiseFilter >.shape(), loco::PermutingEncoder< Domain::Matrix >.shape(), locoex::TFLReshape.shape(), luci::CircleBroadcastTo.shape(), luci::CircleReshape.shape(), luci::CircleScatterNd.shape(), moco::TensorSliceEnumerator.shape(), moco::TFReshape.shape(), loco::Mixin< Trait::TensorShaped >.shape(), circle_eval_diff::TensorShape.shape(), loco::NodeMixin< NodeTrait::TensorShape >.shape(), InputLayer::Return.shape(), FixedReshapeLayer::Return.shape(), loco::Mixin< Trait::TensorShaped >.shape(), nnkit::TensorContext.shape(), nnkit::support::caffe::TensorContext< DType >.shape(), nnkit::support::moco::tf::TensorContext.shape(), nnkit::support::onnx::TensorContext.shape(), nnkit::support::tf::TensorContext.shape(), nnkit::support::tflite::TensorContext.shape(), tflimport::TensorContext.shape(), nncc::core::ADT::feature::View< T >.shape(), nncc::core::ADT::kernel::ViewImpl< float >.shape(), nncc::core::ADT::kernel::ViewImpl< T >.shape(), nncc::core::ADT::tensor::View< T >.shape(), coco::Arg.shape(), coco::FeatureObject.shape(), coco::KernelObject.shape(), ann::TensorOperand.shape(), locoex::TFLReshape.shape(), loco::Mixin< Trait::TensorShaped >.shape(), luci::CircleBroadcastTo.shape(), luci::CircleReshape.shape(), luci::CircleScatterNd.shape(), ParamType.shape, moco::TFReshape.shape(), nnc::sir::TensorDescriptor.shape, onnx_legalizer._TensorInfo.shape, record_minmax::DataBuffer.shape, nnfw::cker::InputTensor< T >.shape, nnfw::cker::Tensor.shape, nnfw::misc::feature::Object< T >.shape(), nnfw::misc::feature::TextFormatter< T >.shape(), nnfw::misc::tensor::Object< T >.shape(), onert::ir::Operand.shape(), nncc::core::ADT::kernel::View< T >.shape(), coco::FeatureLayout.shape(), coco::KernelLayout.shape(), nncc::core::ADT::kernel::Buffer< float >.shape(), nncc::core::ADT::kernel::Buffer< T >.shape(), nncc::core::ADT::kernel::Overlay< T, InputIt >.shape(), coco::FeatureLayouts::BCHW.shape(), coco::FeatureLayouts::BHWC.shape(), coco::FeatureLayouts::BC.shape(), coco::FeatureLayouts::Generic.shape(), coco::KernelLayouts::NCHW.shape(), coco::KernelLayouts::NHWC.shape(), coco::KernelLayouts::Generic.shape(), nncc::core::ADT::kernel::View< float >.shape(), and onert::backend::custom::TypeInfo.shape.

Referenced by RandomDataGenerator.RandomDataGenerator.gen().

◆ _gen_int16()

RandomDataGenerator.RandomDataGenerator._gen_int16 (   self)
protected

Definition at line 32 of file RandomDataGenerator.py.

32 def _gen_int16(self):
33 return np.random.randint(-32767, high=32768, size=self.shape, dtype=np.int16)
34

References onert::ir::OperandInfo.shape(), RunTimeOperandInfo.shape(), RandomDataGenerator.RandomDataGenerator.shape, luci_interpreter::Tensor.shape(), luci_interpreter::kernels::BroadcastTo.shape(), luci_interpreter::kernels::Reshape.shape(), nnkit::support::tftestinfo::ParsedTensor.shape(), onert::ir::OperandInfo.shape(), locomotiv::NodeData.shape(), ndarray::Array< T >.shape(), locomotiv::NodeDataImpl.shape(), loco::DepthwiseFilterDecoder.shape(), loco::PermutingDecoder< Domain::DepthwiseFilter >.shape(), loco::FeatureDecoder.shape(), loco::PermutingDecoder< Domain::Feature >.shape(), loco::FilterDecoder.shape(), loco::PermutingDecoder< Domain::Filter >.shape(), onert::ir::OperandInfo.shape(), moco::TensorPackEnumerator.shape(), loco::MatrixDecoder.shape(), loco::PermutingDecoder< Domain::Matrix >.shape(), moco::ModelSignature.shape(), moco::ModelSignature.shape(), loco::DepthwiseFilterEncoder.shape(), loco::FeatureEncoder.shape(), loco::FilterEncoder.shape(), loco::MatrixEncoder.shape(), loco::PermutingEncoder< Domain::Feature >.shape(), loco::PermutingEncoder< Domain::Filter >.shape(), loco::PermutingEncoder< Domain::DepthwiseFilter >.shape(), loco::PermutingEncoder< Domain::Matrix >.shape(), locoex::TFLReshape.shape(), luci::CircleBroadcastTo.shape(), luci::CircleReshape.shape(), luci::CircleScatterNd.shape(), moco::TensorSliceEnumerator.shape(), moco::TFReshape.shape(), loco::Mixin< Trait::TensorShaped >.shape(), circle_eval_diff::TensorShape.shape(), loco::NodeMixin< NodeTrait::TensorShape >.shape(), InputLayer::Return.shape(), FixedReshapeLayer::Return.shape(), loco::Mixin< Trait::TensorShaped >.shape(), nnkit::TensorContext.shape(), nnkit::support::caffe::TensorContext< DType >.shape(), nnkit::support::moco::tf::TensorContext.shape(), nnkit::support::onnx::TensorContext.shape(), nnkit::support::tf::TensorContext.shape(), nnkit::support::tflite::TensorContext.shape(), tflimport::TensorContext.shape(), nncc::core::ADT::feature::View< T >.shape(), nncc::core::ADT::kernel::ViewImpl< float >.shape(), nncc::core::ADT::kernel::ViewImpl< T >.shape(), nncc::core::ADT::tensor::View< T >.shape(), coco::Arg.shape(), coco::FeatureObject.shape(), coco::KernelObject.shape(), ann::TensorOperand.shape(), locoex::TFLReshape.shape(), loco::Mixin< Trait::TensorShaped >.shape(), luci::CircleBroadcastTo.shape(), luci::CircleReshape.shape(), luci::CircleScatterNd.shape(), ParamType.shape, moco::TFReshape.shape(), nnc::sir::TensorDescriptor.shape, onnx_legalizer._TensorInfo.shape, record_minmax::DataBuffer.shape, nnfw::cker::InputTensor< T >.shape, nnfw::cker::Tensor.shape, nnfw::misc::feature::Object< T >.shape(), nnfw::misc::feature::TextFormatter< T >.shape(), nnfw::misc::tensor::Object< T >.shape(), onert::ir::Operand.shape(), nncc::core::ADT::kernel::View< T >.shape(), coco::FeatureLayout.shape(), coco::KernelLayout.shape(), nncc::core::ADT::kernel::Buffer< float >.shape(), nncc::core::ADT::kernel::Buffer< T >.shape(), nncc::core::ADT::kernel::Overlay< T, InputIt >.shape(), coco::FeatureLayouts::BCHW.shape(), coco::FeatureLayouts::BHWC.shape(), coco::FeatureLayouts::BC.shape(), coco::FeatureLayouts::Generic.shape(), coco::KernelLayouts::NCHW.shape(), coco::KernelLayouts::NHWC.shape(), coco::KernelLayouts::Generic.shape(), nncc::core::ADT::kernel::View< float >.shape(), and onert::backend::custom::TypeInfo.shape.

Referenced by RandomDataGenerator.RandomDataGenerator.gen().

◆ _gen_uint8()

RandomDataGenerator.RandomDataGenerator._gen_uint8 (   self)
protected

Definition at line 29 of file RandomDataGenerator.py.

29 def _gen_uint8(self):
30 return np.random.randint(0, high=256, size=self.shape, dtype=np.uint8)
31

References onert::ir::OperandInfo.shape(), RunTimeOperandInfo.shape(), RandomDataGenerator.RandomDataGenerator.shape, luci_interpreter::Tensor.shape(), luci_interpreter::kernels::BroadcastTo.shape(), luci_interpreter::kernels::Reshape.shape(), nnkit::support::tftestinfo::ParsedTensor.shape(), onert::ir::OperandInfo.shape(), locomotiv::NodeData.shape(), ndarray::Array< T >.shape(), locomotiv::NodeDataImpl.shape(), loco::DepthwiseFilterDecoder.shape(), loco::PermutingDecoder< Domain::DepthwiseFilter >.shape(), loco::FeatureDecoder.shape(), loco::PermutingDecoder< Domain::Feature >.shape(), loco::FilterDecoder.shape(), loco::PermutingDecoder< Domain::Filter >.shape(), onert::ir::OperandInfo.shape(), moco::TensorPackEnumerator.shape(), loco::MatrixDecoder.shape(), loco::PermutingDecoder< Domain::Matrix >.shape(), moco::ModelSignature.shape(), moco::ModelSignature.shape(), loco::DepthwiseFilterEncoder.shape(), loco::FeatureEncoder.shape(), loco::FilterEncoder.shape(), loco::MatrixEncoder.shape(), loco::PermutingEncoder< Domain::Feature >.shape(), loco::PermutingEncoder< Domain::Filter >.shape(), loco::PermutingEncoder< Domain::DepthwiseFilter >.shape(), loco::PermutingEncoder< Domain::Matrix >.shape(), locoex::TFLReshape.shape(), luci::CircleBroadcastTo.shape(), luci::CircleReshape.shape(), luci::CircleScatterNd.shape(), moco::TensorSliceEnumerator.shape(), moco::TFReshape.shape(), loco::Mixin< Trait::TensorShaped >.shape(), circle_eval_diff::TensorShape.shape(), loco::NodeMixin< NodeTrait::TensorShape >.shape(), InputLayer::Return.shape(), FixedReshapeLayer::Return.shape(), loco::Mixin< Trait::TensorShaped >.shape(), nnkit::TensorContext.shape(), nnkit::support::caffe::TensorContext< DType >.shape(), nnkit::support::moco::tf::TensorContext.shape(), nnkit::support::onnx::TensorContext.shape(), nnkit::support::tf::TensorContext.shape(), nnkit::support::tflite::TensorContext.shape(), tflimport::TensorContext.shape(), nncc::core::ADT::feature::View< T >.shape(), nncc::core::ADT::kernel::ViewImpl< float >.shape(), nncc::core::ADT::kernel::ViewImpl< T >.shape(), nncc::core::ADT::tensor::View< T >.shape(), coco::Arg.shape(), coco::FeatureObject.shape(), coco::KernelObject.shape(), ann::TensorOperand.shape(), locoex::TFLReshape.shape(), loco::Mixin< Trait::TensorShaped >.shape(), luci::CircleBroadcastTo.shape(), luci::CircleReshape.shape(), luci::CircleScatterNd.shape(), ParamType.shape, moco::TFReshape.shape(), nnc::sir::TensorDescriptor.shape, onnx_legalizer._TensorInfo.shape, record_minmax::DataBuffer.shape, nnfw::cker::InputTensor< T >.shape, nnfw::cker::Tensor.shape, nnfw::misc::feature::Object< T >.shape(), nnfw::misc::feature::TextFormatter< T >.shape(), nnfw::misc::tensor::Object< T >.shape(), onert::ir::Operand.shape(), nncc::core::ADT::kernel::View< T >.shape(), coco::FeatureLayout.shape(), coco::KernelLayout.shape(), nncc::core::ADT::kernel::Buffer< float >.shape(), nncc::core::ADT::kernel::Buffer< T >.shape(), nncc::core::ADT::kernel::Overlay< T, InputIt >.shape(), coco::FeatureLayouts::BCHW.shape(), coco::FeatureLayouts::BHWC.shape(), coco::FeatureLayouts::BC.shape(), coco::FeatureLayouts::Generic.shape(), coco::KernelLayouts::NCHW.shape(), coco::KernelLayouts::NHWC.shape(), coco::KernelLayouts::Generic.shape(), nncc::core::ADT::kernel::View< float >.shape(), and onert::backend::custom::TypeInfo.shape.

Referenced by RandomDataGenerator.RandomDataGenerator.gen().

◆ _unsupported_types()

RandomDataGenerator.RandomDataGenerator._unsupported_types (   self)
protected

Definition at line 26 of file RandomDataGenerator.py.

26 def _unsupported_types(self):
27 raise RuntimeError('Unsupported data type')
28

◆ gen()

RandomDataGenerator.RandomDataGenerator.gen (   self,
  dtype 
)

Definition at line 38 of file RandomDataGenerator.py.

38 def gen(self, dtype):
39 gen_book = dict()
40 gen_book[TensorType.UINT8] = self._gen_uint8
41 gen_book[TensorType.INT16] = self._gen_int16
42 gen_book[TensorType.FLOAT32] = self._gen_float32
43
44 return gen_book.get(dtype, self._unsupported_types)()

References RandomDataGenerator.RandomDataGenerator._gen_float32(), RandomDataGenerator.RandomDataGenerator._gen_int16(), and RandomDataGenerator.RandomDataGenerator._gen_uint8().

Field Documentation

◆ _unsupported_types

RandomDataGenerator.RandomDataGenerator._unsupported_types
protected

Definition at line 44 of file RandomDataGenerator.py.

◆ shape


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