beta)torch_npu.npu_sign_bits_unpack

接口原型

torch_npu.npu_sign_bits_unpack(x, size, dtype) -> Tensor

功能描述

将uint8类型1位Adam拆包为float。

参数说明

约束说明

size可被uint8s拆包的输出整除。输出大小为(size of x) * 8。

支持的型号

调用示例

1
2
3
4
5
>>> a = torch.tensor([159, 15], dtype=torch.uint8).npu()
>>> b = torch_npu.npu_sign_bits_unpack(a, 2, torch.float32)
>>> b
tensor([[ 1.,  1.,  1.,  1.,  1., -1., -1.,  1.],
        [ 1.,  1.,  1.,  1., -1., -1., -1., -1.]], device='npu:0')