Class AbstractTensor
Defined in File abstract_value.h
Inheritance Relationships
Base Type
public mindspore::abstract::AbstractUndetermined
(Class AbstractUndetermined)
Derived Type
public mindspore::abstract::AbstractRef
(Class AbstractRef)
Class Documentation
-
class AbstractTensor : public mindspore::abstract::AbstractUndetermined
Class AbstractTensor describes a tensor’s type, shape and value.
Subclassed by mindspore::abstract::AbstractRef
Public Functions
-
inline explicit AbstractTensor(const AbstractBasePtr &element, const BaseShapePtr &shape = std::make_shared<Shape>())
Constructor of AbstractTensor.
- Parameters
element – [in] The abstract to be wrapper as a abstract tensor.
shape – [in] The dimension of abstract tensor.
-
inline AbstractTensor(const TypePtr &element_type, const ShapeVector &shape)
Constructor of AbstractScalar.
- Parameters
element_type – [in] The type of abstract tensor.
shape – [in] A vector of the tensor’s shape.
-
inline explicit AbstractTensor(const tensor::TensorPtr &tensor)
Constructor of AbstractScalar.
- Parameters
tensor – [in] The tensor to be abstracted.
-
inline explicit AbstractTensor(const TypePtr &element_type, const BaseShapePtr &shape = std::make_shared<Shape>())
Constructor of AbstractScalar.
- Parameters
element_type – [in] The type of a tensor.
shape – [in] The dimension of a tensor.
-
~AbstractTensor() override = default
Destructor of AbstractTensor.
- MS_DECLARE_PARENT (AbstractTensor, AbstractUndetermined) void set_value_range(const ValuePtr &min_value
Set min value and max value.
- Parameters
min_value – [in] The min value of tensor.
max_value – [in] The max value of tensor.
-
inline const ValuePtr &get_min_value() const
Get the min value.
- Returns
A pointer to a value.
-
inline const ValuePtr &get_max_value() const
Get the max value.
- Returns
A pointer to a value.
-
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 BaseShapePtr BuildShape() const override
Build the shape of the abstract.
Note
Use this function to get the actual shape, while track shape is not enough accurate.
- Returns
A pointer to the BaseShape.
-
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. It will upgrade the abstract to a higher level.
Note
The shape will be remained.
- Returns
A pointer to the broadened abstract.
-
virtual AbstractBasePtr Join(const AbstractBasePtr &other) override
Combine two abstracts. If two abstracts are different, it will broaden the abstract value.
- Parameters
other – [in] The other abstract to be joined.
- Returns
A pointer to the combined abstract.
-
virtual std::string ToString() const override
Get the string representation of this object.
- Returns
The string representation.
-
inline virtual std::size_t hash() const override
Get the hash value of this object.
- Returns
The hash value.
-
virtual AbstractBasePtr PartialBroaden() const override
Broaden abstract with constraints.
- Returns
A pointer to the broadened abstract.
-
inline explicit AbstractTensor(const AbstractBasePtr &element, const BaseShapePtr &shape = std::make_shared<Shape>())