# pypto.copysign【免费下载链接】pyptoPyPTO发音: pai p-t-oParallel Tensor/Tile Operation编程范式。项目地址: https://gitcode.com/cann/pypto产品支持情况产品是否支持Ascend 950PR/Ascend 950DT√Atlas A3 训练系列产品/Atlas A3 推理系列产品√Atlas A2 训练系列产品/Atlas A2 推理系列产品√功能说明逐元素地取input的数值和other的符号。计算公式如下$$ res_i input_i * sign(other_i) $$函数原型copysign(input: Tensor, other: Tensor) - Tensor参数说明参数名输入/输出说明input输入源操作数。支持的类型为Tensor类型。Tensor支持的数据类型为DT_FP32, DT_FP16, DT_BF16, DT_INT32, DT_INT16。不支持空TensorShape仅支持1-4维支持按照单个维度广播到相同形状Shape Size不大于2147483647即INT32_MAX。other输入源操作数。支持的类型为Tensor类型。Tensor支持的数据类型为DT_FP32, DT_FP16, DT_BF16, DT_INT32, DT_INT16。不支持空TensorShape仅支持1-4维支持按照单个维度广播到相同形状Shape Size不大于2147483647即INT32_MAX。返回值说明返回输出TensorTensor的数据类型和input、other相同Shape为input和other广播后大小。约束说明input 和 other 类型应该相同。调用示例TileShape设置示例说明调用该operation接口前应通过set_vec_tile_shapes设置TileShape。TileShape维度应和输出一致。如非广播场景输入input shape为[m, n]other为[m, n]输出为[m, n]TileShape设置为[m1, n1], 则m1, n1分别用于切分m, n轴。广播场景输入input shape为[m, n]other为[m, 1]输出为[m, n]TileShape设置为[m1, n1], 则m1, n1分别用于切分m, n轴。pypto.set_vec_tile_shapes(4, 16)接口调用示例a pypto.tensor([3, 3], pypto.DT_FP32) b pypto.tensor([3, 3], pypto.DT_FP32) out pypto.copysign(a, b)结果示例如下Input x : [[1 -2 3], [4 5 -6], [-7 8 9]] Input y : [[-1 6 -8], [1 -1 0], [7 -8 9]] Output out:[[-1 2 -3], [4 -5 6], [7 -8 9]]【免费下载链接】pyptoPyPTO发音: pai p-t-oParallel Tensor/Tile Operation编程范式。项目地址: https://gitcode.com/cann/pypto创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考