Pytorch:张量归一化,结果不良
我有一个要标准化的纵向/纬度的张量。我想使用此张量来执行它的神经网络算法,这使我在这些不同的长/lat之间最好的旅行返回了我。 我使用了此功能:
from torch.nn.functional import normalize
t=normalize(locations)
这是我的张量 [0.0000,36.4672,36.4735,36.4705,36.4638,36.4671], [0.0000,10.7637,10.7849,10.7822,10.7821,10.7637]],
这是在归一化之后: [0.0000,0.2181,0.2181,0.2181,0.2179,0.2179], [0.0000,0.2186,0.2194,0.2194,0.2196,0.2188]],
因为您可以看到结果不好,因为重复的值很多,这会影响我的结果。 有其他方法可以使我的张量标准化吗?我在这个项目中使用了Pytorch。
I have a tensor of longitudes/latitudes that i want to normalize. I want to use this tensor to perform a neural network algorithm on it that returns me the best trip between these different long/lat.
I used this function:
from torch.nn.functional import normalize
t=normalize(locations)
This is a lign in my tensor
[ 0.0000, 36.4672, 36.4735, 36.4705, 36.4638, 36.4671],
[ 0.0000, 10.7637, 10.7849, 10.7822, 10.7821, 10.7637]],
This is after normalization:
[0.0000, 0.2181, 0.2181, 0.2181, 0.2179, 0.2179],
[0.0000, 0.2186, 0.2194, 0.2194, 0.2196, 0.2188]],
As you can see the result is not good because there are many values repeating and this is affecting my results.
Is there another way to normalize my tensor? I'm using pytorch in this project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
代码> TORCH.NN.FUSSTIONS.Normalize 工作。
我认为,您应该将原始张量值与纵向/纬度的最大值分配,从而使张量具有
[0,1]
的值范围。此外,我尝试过:
结果是:
您是如何获得结果的?
This is how
torch.nn.functional.normalize
works.In my opinion, you should divide your original tensor value with the maximum value of longitudes/latitudes can have, making the tensor to have values range of
[0, 1]
.Additionally, I've tried:
and the results was:
How did you get your results?