Class AbstractBase
Defined in File abstract_value.h
Inheritance Relationships
Base Type
public mindspore::Base
(Class Base)
Derived Types
public mindspore::abstract::AbstractClass
(Class AbstractClass)public mindspore::abstract::AbstractDictionary
(Class AbstractDictionary)public mindspore::abstract::AbstractEllipsis
(Class AbstractEllipsis)public mindspore::abstract::AbstractError
(Class AbstractError)public mindspore::abstract::AbstractFunction
(Class AbstractFunction)public mindspore::abstract::AbstractJTagged
(Class AbstractJTagged)public mindspore::abstract::AbstractKeywordArg
(Class AbstractKeywordArg)public mindspore::abstract::AbstractMonad
(Class AbstractMonad)public mindspore::abstract::AbstractNone
(Class AbstractNone)public mindspore::abstract::AbstractNull
(Class AbstractNull)public mindspore::abstract::AbstractRefKey
(Class AbstractRefKey)public mindspore::abstract::AbstractScalar
(Class AbstractScalar)public mindspore::abstract::AbstractScript
(Class AbstractScript)public mindspore::abstract::AbstractSequence
(Class AbstractSequence)public mindspore::abstract::AbstractSlice
(Class AbstractSlice)public mindspore::abstract::AbstractTimeOut
(Class AbstractTimeOut)public mindspore::abstract::AbstractType
(Class AbstractType)public mindspore::abstract::AbstractUndetermined
(Class AbstractUndetermined)
Class Documentation
-
class AbstractBase : public mindspore::Base
The base class for abstract value of an anf node.
The abstract value is used in evaluator to express the type, shape and value of an anf node.
Subclassed by mindspore::abstract::AbstractClass, mindspore::abstract::AbstractDictionary, mindspore::abstract::AbstractEllipsis, mindspore::abstract::AbstractError, mindspore::abstract::AbstractFunction, mindspore::abstract::AbstractJTagged, mindspore::abstract::AbstractKeywordArg, mindspore::abstract::AbstractMonad, mindspore::abstract::AbstractNone, mindspore::abstract::AbstractNull, mindspore::abstract::AbstractRefKey, mindspore::abstract::AbstractScalar, mindspore::abstract::AbstractScript, mindspore::abstract::AbstractSequence, mindspore::abstract::AbstractSlice, mindspore::abstract::AbstractTimeOut, mindspore::abstract::AbstractType, mindspore::abstract::AbstractUndetermined
Public Functions
-
inline explicit AbstractBase(const ValuePtr &value = nullptr, const TypePtr &type = kAnyType, const BaseShapePtr &shape = kNoShape)
Constructor of AbstractBase.
- Parameters
value – [in] The real value (if any) of an anf node. Default: nullptr.
type – [in] The type of an anf node. Default: kAnyType.
shape – [in] The dimension of an anf node. Default: kNoShape.
-
~AbstractBase() override = default
Destructor of AbstractBase.
- virtual MS_DECLARE_PARENT(AbstractBase, Base) std std::string ToString (bool verbose) const
Get the hash number of the abstract.
Get the formatted text to describe the abstract.
Get the formatted text to describe the abstract.
- Returns
The hash of the object.
- Returns
A string.
- Returns
A string.
-
inline void set_value(const ValuePtr &value)
Set the value for the AbstractBase.
- Parameters
value – [in] The value of an anf node.
-
inline void set_type(const TypePtr &type)
Set the type for the AbstractBase.
- Parameters
value – [in] The type of an anf node.
-
inline virtual void set_shape(const BaseShapePtr &shape)
Set the shape for the AbstractBase.
- Parameters
value – [in] The shape of an anf node.
-
inline void set_value_desc(const std::string &desc)
Set the value description for the AbstractBase.
- Parameters
desc – [in] The description of value.
-
inline const std::string &value_desc() const
Get the value description.
- Returns
A string of the value description.
-
inline ValuePtr GetValueTrack() const
Get the abstract value, which is tracked.
- Returns
A pointer to the Value.
-
inline TypePtr GetTypeTrack() const
Get the abstract type, which is tracked.
- Returns
A pointer to the Type.
-
inline BaseShapePtr GetShapeTrack() const
Get the abstract shape, which is tracked.
- Returns
A pointer to the BaseShape.
-
ValuePtr BuildValue() const
Try to build a real value from an abstract value.
Note
If the value cannot be built, a default value (AnyValue) is returned.
- Returns
A pointer to the Value.
-
virtual TypePtr BuildType() const = 0
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.
-
inline virtual BaseShapePtr BuildShape() const
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 = 0
Clone an abstract from the abstract.
- Returns
A pointer to the cloned abstract.
-
virtual AbstractBasePtr Broaden() const
Broaden the abstract. It will upgrade the abstract to a higher level.
- Returns
A pointer to the broadened abstract.
-
inline virtual AbstractBasePtr Join(const AbstractBasePtr&)
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 AbstractBasePtr PartialBroaden() const
Broaden abstract with constraints.
- Returns
A pointer to the broadened abstract.
Public Static Functions
-
static inline void set_trace_node_provider(const TraceNodeProvider &trace_node_provider)
Set the function, which prints the debug info.
- Parameters
trace_node_provider – [in] The function.
-
inline explicit AbstractBase(const ValuePtr &value = nullptr, const TypePtr &type = kAnyType, const BaseShapePtr &shape = kNoShape)