Class MetaSparseTensor

Inheritance Relationships

Base Type

  • public mindspore::Value

Derived Type

Class Documentation

class MetaSparseTensor : public mindspore::Value

Subclassed by mindspore::tensor::CSRTensor

Public Functions

MetaSparseTensor()

Construction.

MetaSparseTensor(const TypeId data_type, const ShapeVector &shape)

Constructs a meta SparseTensor having data_type data and shape. The constructed MetaSparseTensor contains the data type and shape information of a SparseTensor.

Parameters
  • data_type[in] The data type of the SparseTensor.

  • shape[in] The shape of the SparseTensor.

MetaSparseTensor(const MetaSparseTensor &meta_sparse_tensor)

Copy constructor. The constructed MetaSparseTensor object will have the same data type and shape as the meta_sparse_tensor.

Parameters

meta_tensor[in] An existing MetaSparseTensor object.

~MetaSparseTensor() override = default

Destrustor of MetaSparseTensor.

MS_DECLARE_PARENT (MetaSparseTensor, Value) virtual bool operator

Compares two MetaSparseTensor objects. The constructed MetaSparseTensor object has the same type and shape with meta_sparse_tensor.

Parameters

meta_sparse_tensor[in] The MetaSparseTensor object to be compared.

Returns

Return true if having same type and shape, otherwise return false.

TypePtr Dtype() const

Get the data type of the sparse tensor. All the types are defined in “ir/dtype.h”.

Returns

The data type of the sparse tensor.

inline TypeId data_type() const

Get the data type of a sparse tensor.

Returns

The data type.

inline void set_data_type(const TypeId data_type)

Set the data type of a sparse tensor.

Parameters

data_type[in] The data type of the tensor to be set.

inline const ShapeVector &shape() const

Get sparsetensor’s shape.

Returns

A const vector<int> which represents the shape of the tensor.

inline void set_shape(const ShapeVector &shape)

Sets the shape of a sparsetensor.

Parameters

shape[in] The shape of the tensor.