Class Primitive
- Defined in File primitive.h 
Inheritance Relationships
Base Type
- public mindspore::api::Value(Class Value)
Derived Type
- public mindspore::ops::BaseOperator(Class BaseOperator)
Class Documentation
- 
class Primitive : public mindspore::api::Value
- Primitive defines a primitive operator. - Subclassed by mindspore::ops::BaseOperator - Public Functions - 
explicit Primitive(const std::string &name)
- Create primitive with the given name. - 参数
- name – [in] The primitive name. 
 
 - 
const std::string &name() const
- Get name of the primitive. - 返回
- The name of primitive. 
 
 - 
Primitive &AddAttr(const std::string &name, const ValuePtr &attr)
- Add attribute to primitive. - 参数
- name – [in] The attribute name. 
- attr – [in] The attribute value. 
 
- 返回
- The primitive to which attribute has been added. 
 
 - 
Primitive &SetAttrs(const std::unordered_map<std::string, ValuePtr> &attrs)
- Add attributes by using a map, all elements of the map will be added to this primitive. - 参数
- attrs – [in] The attribute map needs to be added in the primitive attribute. 
- 返回
- The primitive to which attribute has been added. 
 
 - 
void EraseAttr(const std::string &name)
- Erase attribute to the primitive attribute map. - 参数
- name – [in] The attribute name. 
 
 - 
ValuePtr GetAttr(const std::string &name) const
- Get attribute value by name. - 参数
- name – [in] the attribute name. 
- 返回
- The value of the attribute, null if attribute name not found. 
 
 - 
bool HasAttr(const std::string &name) const
- Check If Primitive has an attribute with then given name. - 参数
- name – [in] The attribute name. 
- 返回
- True if there is an attribute with the given name, otherwise false. 
 
 - 
std::unordered_map<std::string, ValuePtr> attrs() const
- Get all attributes of this primitive as a map. - 返回
- The attribute map of this primitive. 
 
 
- 
explicit Primitive(const std::string &name)