Class TensorData

Class Documentation

class TensorData

Public Functions

virtual ~TensorData() = default

Virtual destructor is required for base classes.

virtual ssize_t size() const = 0

Get total number of elements.

Returns

Total number of elements.

virtual ssize_t itemsize() const = 0

Get byte size of a single element.

Returns

Byte size of a single element.

virtual ssize_t nbytes() const = 0

Get total number of bytes.

Returns

Total number of bytes.

virtual ssize_t ndim() const = 0

Get number of dimensions.

Returns

Number of dimensions.

virtual void *data() = 0

Get data pointer.

Returns

Data pointer.

virtual const void *const_data() const = 0

Get const data pointer.

Returns

Const data pointer.

inline virtual bool equals(const TensorData &other) const

Whether the data are equal.

Parameters

other[in] Another TensorData.

Returns

Ture if the two data are equal, otherwise false.

virtual std::string ToString(const TypeId type, const ShapeVector &shape, bool use_comma) const = 0

Get display information about this TensorData.

Parameters
  • type[in] The type of tensor data.

  • shape[in] The shape of tensor data.

  • use_comma[in] Whether to use comma.

Returns

The display information.