文档
注册

beta)torch_npu.npu_reshape

该接口计划废弃,可以使用torch.reshape接口进行替换。

接口原型

torch_npu.npu_reshape(self, shape, bool can_refresh=False) -> Tensor

功能描述

reshape张量。仅更改张量shape,其数据不变。

参数说明

  • self (Tensor) - 输入张量。
  • shape (ListInt) - 定义输出张量的shape。
  • can_refresh (Bool,默认值为False) - 是否就地刷新reshape。

约束说明

该运算符不能被aclopExecute API直接调用。

调用示例

>>> a=torch.rand(2,8).npu()
>>> out=torch_npu.npu_reshape(a,(4,4))
>>> out
tensor([[0.6657, 0.9857, 0.7614, 0.4368],
        [0.3761, 0.4397, 0.8609, 0.5544],
        [0.7002, 0.3063, 0.9279, 0.5085],
        [0.1009, 0.7133, 0.8118, 0.6193]], device='npu:0')
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词