【发布时间】:2019-02-20 18:27:57
【问题描述】:
以下代码:
ux = torch.tensor(np.array([[255,1,255],[255,1,255]])).float()
print(ux)
ux = F.normalize(ux, p=2, dim=1)
print(ux)
打印:
tensor([[ 255., 1., 255.],
[ 255., 1., 255.]])
tensor([[ 0.7071, 0.0028, 0.7071],
[ 0.7071, 0.0028, 0.7071]])
如何取消规范化 ux 以返回值
tensor([[ 255., 1., 255.],
[ 255., 1., 255.]])
来自
tensor([[ 0.7071, 0.0028, 0.7071],
[ 0.7071, 0.0028, 0.7071]])
有各种资源详细说明了此过程,例如https://discuss.pytorch.org/t/simple-way-to-inverse-normalize-a-batch-of-input-variable/12385/3,但没有详细说明F.normalize 的非规范化结果
【问题讨论】:
标签: pytorch