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') |