SetInputAttr
产品支持情况
头文件和库文件
- 头文件:#include <graph/operator.h>
- 库文件:libgraph.so
功能说明
设置算子输入Tensor属性的属性值。
算子可以包括多个属性,初次设置值后,算子属性值的类型固定,算子属性值的类型包括:
-
整型:接受int64_t、uint32_t、int32_t类型的整型值
以int64_t为例,使用:
SetInputAttr(const char_t *dst_name, const char_t *name, int64_t attr_value);
SetInputAttr(const int32_t index, const char_t *name, int64_t attr_value);
设置属性值,以:
GetInputAttr(const int32_t index, const char_t *name, int64_t &attr_value) const;
GetInputAttr(const char_t *dst_name, const char_t *name, int64_t &attr_value) const
取值时,用户需保证整型数据没有截断,同理针对int32_t和uint32_t混用时需要保证不被截断。
-
整型列表:接受std::vector<int64_t>、std::vector<int32_t>、std::vector<uint32_t>、std::initializer_list<int64_t>&&表示的整型列表数据
-
浮点数:float32_t
-
浮点数列表:std::vector<float32_t>
-
字符串:string
-
布尔:bool
-
布尔列表:std::vector<bool>
函数原型
Operator &SetInputAttr(const int32_t index, const char_t *name, const char_t *attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const char_t *attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, const AscendString &attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const AscendString &attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, int64_t attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, int64_t attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, int32_t attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, int32_t attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, uint32_t attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, uint32_t attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, bool attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, bool attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, float32_t attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, float32_t attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<AscendString> &attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<AscendString> &attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<int64_t> &attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<int64_t> &attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<int32_t> &attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<int32_t> &attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<uint32_t> &attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<uint32_t> &attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<bool> &attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<bool> &attr_value)
Operator &SetInputAttr(const int32_t index, const char_t *name, const std::vector<float32_t> &attr_value)
Operator &SetInputAttr(const char_t *dst_name, const char_t *name, const std::vector<float32_t> &attr_value)
参数说明
返回值说明
Operator对象本身。
异常处理
无。
约束说明
无。