GetAttr
Description
Obtains an attribute of an operator.
The name argument must be valid. If the operation fails, a null pointer is returned.
Prototype
AttrValue *GetAttr(std::string name) const
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
name |
Input |
Supports the following inputs:
|
Returns
An AttrValue * for the pointer to the AttrValue. If the operation fails, a null pointer is returned.
Restrictions
None
Examples
- Obtain the value of the seed attribute.
AttrValue *seed0 = ctx.GetAttr("seed"); - Obtain the number of blocks and the block ID of the current computation in the parallel computing scenario.
uint32_t blockdim = ctx.GetAttr("block_num")->GetInt(); uint32_t blockid = ctx.GetAttr("block_id")->GetInt();
Parent topic: Class CpuKernelContext