逐元素运算和规约#
逐元素运算#
逐元素运算在两个张量之间执行元素级操作。使用的操作由逐元素模式 cudnn_frontend::PointwiseMode_t
控制。
C++ API#
std::shared_ptr<Tensor_attributes>
pointwise(std::shared_ptr<Tensor_attributes>,
Pointwise_attributes);
std::shared_ptr<Tensor_attributes>
pointwise(std::shared_ptr<Tensor_attributes>,
std::shared_ptr<Tensor_attributes>,
Pointwise_attributes);
std::shared_ptr<Tensor_attributes>
pointwise(std::shared_ptr<Tensor_attributes>,
std::shared_ptr<Tensor_attributes>,
std::shared_ptr<Tensor_attributes>,
Pointwise_attributes);
逐元素模式决定了上述选择中的 API。 有关详细信息,请参阅 cudnn_frontend::PointwiseMode_t
的文档。
逐元素属性是一个带有 setter 的轻量级结构
Pointwise_attributes&
set_mode(PointwiseMode_t)
Pointwise_attributes&
set_axis(int64_t)
Pointwise_attributes&
set_relu_lower_clip(float)
Pointwise_attributes&
set_relu_upper_clip(float)
Pointwise_attributes&
set_relu_lower_clip_slope(float)
Pointwise_attributes&
set_name(std::string const&)
Pointwise_attributes&
set_compute_data_type(DataType_t value)
Python API#
添加
a
b
计算数据类型
名称
偏置
输入
偏置
计算数据类型
名称
rsqrt
输入
计算数据类型
名称
减法
a
b
计算数据类型
名称
乘法
a
b
计算数据类型
名称
缩放
输入
缩放
计算数据类型
名称
ReLU
输入
计算数据类型
名称
GELU
输入
计算数据类型
名称
ELU
输入
计算数据类型
名称
cmp_gt
输入
比较
计算数据类型
名称
规约#
规约操作使用由 cudnn_frontend::ReductionMode_t
控制的操作来规约输入张量。要规约的输入张量中的维度是使用输出张量维度推导出来的。
C++ API#
std::shared_ptr<Tensor_attributes>
reduction(std::shared_ptr<Tensor_attributes> input, Reduction_attributes);
规约属性是一个带有 setter 的轻量级结构
Reduction_attributes&
set_mode(ReductionMode_t)
Reduction_attributes&
set_name(std::string const&)
Reduction_attributes&
set_compute_data_type(DataType_t value)