Class AbstractBase

Inheritance Relationships

Base Type

Derived Types

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.