SetListTensor
Description
Sets an attribute value in the form of list of tensors.
Prototype
uint32_t SetListTensor(const std::vector<Tensor *> &tensor)
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
tensor |
Input |
Attribute value in the form of list of tensors. |
Returns
uint32_t for the number of successfully set elements.
Restrictions
None
Example
The following gives the prototype definition of an operator whose OpType is A, with attribute name set to attr1 and type ListTensor.
For details about the supported data types of the attribute in the .ATTR API, see API Description.
REG_OP(A)
.INPUT(x, TensorType({ DT_FLOAT }))
.OUTPUT(y, TensorType({ DT_FLOAT }))
.ATTR(attr1, ListTensor, {})
.OP_END_FACTORY_REG(A)
In this case, you can use the following API during operator implementation to set operator A's attribute value.
std::vector<Tensor *> vals; vals.push_back(tensor); uint32_t successNum = attr->SetListTensor(vals);
Parent topic: Class AttrValue