Class AbstractSparseTensor

Inheritance Relationships

Base Type

Class Documentation

class AbstractSparseTensor : public mindspore::abstract::AbstractUndetermined

Class AbstractSparseTensor describes a SparseTensor’s abstract value.

Public Functions

inline explicit AbstractSparseTensor(const AbstractBasePtr &element, const BaseShapePtr &shape = std::make_shared<Shape>())

Constructor of AbstractSparseTensor.

Parameters
  • element[in] The abstract which is wrapped to be the abstract value of SparseTensor.

  • shape[in] The dimension of the abstract.

inline AbstractSparseTensor(const TypePtr &element_type, const ShapeVector &shape)

Constructor of AbstractSparseTensor.

Parameters
  • element_type[in] The type of SparseTensor.

  • shape[in] The dimension of SparseTensor.

~AbstractSparseTensor() override = default

Destructor of AbstractSparseTensor.

inline  MS_DECLARE_PARENT (AbstractSparseTensor, AbstractUndetermined) const AbstractTensorPtr indices() const

Get the indices of SparseTensor.

Returns

A pointer to the abstract tensor.

inline void set_indices(const AbstractTensorPtr &indices)

Set the indices for the abstract.

Parameters

indices[in] The indices.

inline const AbstractTensorPtr values() const

Get the values.

Returns

A pointer to the abstract tensor.

inline void set_values(const AbstractTensorPtr &values)

Set the values.

Parameters

values[in] The values of SparseTensor.

inline const AbstractTuplePtr dense_shape() const

Get the dense shape.

Returns

A pointer to the tuple of abstracts.

inline void set_dense_shape(const AbstractTuplePtr &dense_shape)

Set the dense shape.

Parameters

dense_shape[in] The dense shape of SparseTensor.

virtual TypePtr BuildType() const override

Build the type of the abstract.

Note

Use this function to get the actual type, while track type is not enough accurate.

Returns

A pointer to the Type.

virtual AbstractBasePtr Clone() const override

Clone an abstract from the abstract.

Returns

A pointer to the cloned abstract.

virtual AbstractBasePtr Broaden() const override

Broaden the abstract. It will upgrade the abstract to a higher level.

Returns

A pointer to the broadened abstract.

AbstractBasePtr BroadenWithShape() const

Broaden the abstract with the shape not changing.

Returns

A pointer to the broadened abstract.

virtual std::string ToString() const override

Get the string representation of this object.

Returns

The string representation.