Class AbstractSequence
Defined in File abstract_value.h
Inheritance Relationships
Base Type
public mindspore::abstract::AbstractBase
(Class AbstractBase)
Derived Types
public mindspore::abstract::AbstractList
(Class AbstractList)public mindspore::abstract::AbstractTuple
(Class AbstractTuple)
Class Documentation
-
class AbstractSequence : public mindspore::abstract::AbstractBase
Class AbstractSequence describes the abstract value of a tuple or list.
Subclassed by mindspore::abstract::AbstractList, mindspore::abstract::AbstractTuple
Public Functions
-
explicit AbstractSequence(const AbstractBasePtrList &elements, const std::shared_ptr<AnfNodeWeakPtrList> &sequence_nodes)
Constructor of AbstractSequence.
- Parameters
elements – [in] A list of abstracts.
sequence_nodes – [in] The nodes of tuple/list, usually are MakeTuple/MakeList CNodes or tuple/list ValueNodes.
-
~AbstractSequence() override = default
Destructor of AbstractSequence.
- MS_DECLARE_PARENT (AbstractSequence, AbstractBase) TypePtrList ElementsType() const
Get the all of types.
- Returns
A vector of types.
-
BaseShapePtrList ElementsShape() const
Get the all of shapes.
- Returns
A vector of shapes.
-
AbstractBasePtrList ElementsClone() const
Clone all of the abstracts.
- Returns
A vector of the cloned abstracts.
-
AbstractBasePtrList ElementsBroaden() const
Broaden the list of abstracts.
- Returns
A vector of the broadened abstracts.
-
AbstractBasePtrList ElementsPartialBroaden() const
Broaden abstract with constraints, only when cond_func is true.
- Returns
A pointer to the broadened abstract.
-
template<typename T>
ValuePtr ElementsBuildValue() const Get real value by specific template.
- Template Parameters
T – the class type of value.
- Returns
A point to value.
-
template<typename T>
AbstractBasePtr ElementsJoin(const AbstractBasePtr &other) Combine other abstract to the sequence of abstracts.
- Template Parameters
T – param other’s class type.
- Parameters
other – [in] The other abstract to be joined.
- Returns
A pointer to the combined abstract.
-
AnfNodeWeakPtrList SequenceNodesJoin(const AbstractBasePtr &other)
Combine other sequence nodes with this one.
- Parameters
other – [in] The other abstract to be joined.
- Returns
A sequence nodes list combined.
-
inline std::size_t size() const
Get the size of the stored elements.
- Returns
A size_t.
-
inline const AbstractBasePtrList &elements() const
Get the stored elements.
- Returns
A vector of elements.
-
bool PurifyElements()
Purify the elements list, and clean unused elements.
- Returns
A boolean, which indicates whether success.
-
inline const std::shared_ptr<AnfNodeWeakPtrList> &sequence_nodes() const
Get the sequence nodes where these ‘AbstractSequence’ evaluated from.
- Returns
The nodes of tuple/list, usually are MakeTuple/MakeList CNodes or tuple/list ValueNodes.
-
inline void set_sequence_nodes(const std::shared_ptr<AnfNodeWeakPtrList> &sequence_nodes)
Set the sequence nodes where these ‘AbstractSequence’ evaluated from.
- Parameters
sequence_nodes – [in] The nodes of tuple/list, usually are MakeTuple/MakeList CNodes or tuple/list ValueNodes.
-
void InsertSequenceNode(const AnfNodePtr &sequence_node)
Insert a node into the sequence nodes.
- Parameters
sequence_node – [in] The node to intert into sequence nodes.
-
void InsertSequenceNodes(const AnfNodeWeakPtrList &sequence_nodes)
Insert nodes into the sequence nodes.
- Parameters
sequence_nodes – [in] The nodes to intert into sequence nodes.
-
void UpdateSequenceNode(const AnfNodePtr &old_sequence_node, const AnfNodePtr &new_sequence_node)
Update the sequence nodes.
- Parameters
old_sequence_node – [in] The old node in sequence nodes.
new_sequence_node – [in] The new node to replace old node in sequence nodes.
-
virtual std::size_t hash() const override
Get the hash value of this object.
- Returns
The hash value.
-
virtual std::string ToString() const override
Get the string representation of this object.
- Returns
The string representation.
-
explicit AbstractSequence(const AbstractBasePtrList &elements, const std::shared_ptr<AnfNodeWeakPtrList> &sequence_nodes)