pytorch出现UserWarning: torch.range is deprecated in favor of torch.arange and will be removed in 0.5.

今天使用torch出现了这样的警告,

UserWarning: torch.range is deprecated in favor of torch.arange and will be removed in 0.5. Note that arange generates values in [start; end), not [start; end].
代码如下:

	a = torch.range(1,16).reshape(4,4)
	print(a,a.size())
	b = torch.prod(a,1,True)
	print(b,b.size())

查询过后是这样的原因:区间不符合主流

a = torch.arange(0,16).reshape(4,4)

这样改动后便好了

你可能感兴趣的:(pytorch出现UserWarning: torch.range is deprecated in favor of torch.arange and will be removed in 0.5.)