torch_npu.empty_with_format

API接口

torch_npu.empty_with_format(size, dtype, layout, device, pin_memory, acl_format)

功能描述

返回一个填充未初始化数据的张量。

参数说明

示例

>>> torch_npu.empty_with_format((2, 3), dtype=torch.float32, device="npu")
tensor([[1., 1., 1.],
        [1., 1., 1.]], device='npu:0')