PrivateAttr

Description

Registers private attributes of an operator.

The operator attributes include the attribute name and attribute value.

Generally, when registering the private attributes of an operator, you need to specify the private attribute name private_attr and the attribute value private_attr_val. This scenario is called scenario 1. However, in the scenario where an operator may have an attribute, you can set only the attribute name. This scenario is called scenario 2. Therefore, two types of registration functions are provided for the preceding two scenarios.

In scenario 1, if an operator already has an attribute and the attribute value is reset, the existing attribute value of the operator will be overwritten by the attribute value registered by the user.

In scenario 2, if an operator does not have an attribute and only the attribute name is set, the attribute cannot be found when the private attribute list of the operator is obtained.

Prototype

  • APIs for setting only private attribute names

    OpImplRegisterV2 &PrivateAttr(const ge::char_t *private_attr)

  • APIs for setting both attribute names and attribute values

    OpImplRegisterV2 &PrivateAttr(const ge::char_t *private_attr, int64_t private_attr_val)

    OpImplRegisterV2 &PrivateAttr(const ge::char_t *private_attr, const std::vector<int64_t> &private_attr_val)

    OpImplRegisterV2 &PrivateAttr(const ge::char_t *private_attr, const ge::char_t *private_attr_val)

    OpImplRegisterV2 &PrivateAttr(const ge::char_t *private_attr, ge::float32_t private_attr_val)

    OpImplRegisterV2 &PrivateAttr(const ge::char_t *private_attr, bool private_attr_val)

    OpImplRegisterV2 &PrivateAttr(const ge::char_t *private_attr, const std::vector<ge::float32_t> &private_attr_val)

Parameters

Parameter

Input/Output

Description

private_attr

Input

Name of the private attribute to be registered.

private_attr_val

Input

Attribute value corresponding to the private attribute to be registered.

Returns

OpImplRegisterV2 object of the operator, in which the private attributes are newly registered.

Restrictions

None