文档首页> Atlas 500应用> TE API参考> compute接口> te.lang.cce.round(raw_tensor)
更新时间:2021-03-18 GMT+08:00
分享

te.lang.cce.round(raw_tensor)

对raw_tensor中的每个元素四舍六入,0.5取偶数,例如`1.5->2.0,2.5->2.0`,支持的类型:float16。float32类型会被转换为float16。结果为int32。

该接口在cast_compute.py中定义。

参数说明

raw_tensor:输入tensor,tvm.tensor类型

返回值

res_tensor:表示round(raw_tensor),tvm.tensor类型

调用示例

shape = (1024,1024)
input_dtype = "float16"
data = tvm.placeholder(shape, name="data", dtype=input_dtype)
res = te.lang.cce.round(data)
分享:

    相关文档

    相关产品