PyTorch 代码优化:使用 repeat 函数替代 tile 和 expand_dims
import torch
multiples = torch.tensor([1, 1] + list(spatial_dims) + [1], dtype=torch.int32) bvec = bvec.repeat(*multiples)
原文地址: https://www.cveoy.top/t/topic/bmm8 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
import torch
multiples = torch.tensor([1, 1] + list(spatial_dims) + [1], dtype=torch.int32) bvec = bvec.repeat(*multiples)
原文地址: https://www.cveoy.top/t/topic/bmm8 著作权归作者所有。请勿转载和采集!