Ascend / pytorch

Ascend PyTorch adapter (torch_npu). Mirror of https://gitee.com/ascend/pytorch
https://ascend.github.io/docs/
Other
259 stars 15 forks source link

创建一npu上的empty tensor #39

Open nihao1997 opened 5 months ago

nihao1997 commented 5 months ago

我想要创建一个空的npu tensor给Silu函数,这个Silunpu上的函数。我应该怎么办?

include

include

include

include <torch/extension.h>

include <torch/torch.h>

void Silu(at::Tensor X); int main() { at::Tensor H = torch::empty({2, 2 2}, at::device().dtype());

Silu(H);
return 0;

}

yunyiyun commented 5 months ago

如果是在c++侧使用,可以参考该用例 https://github.com/Ascend/pytorch/tree/master/examples/libtorch_resnet