为什么从Lua torch加载.mat文件后,矩阵与使用scipy的pytorch之间存在差异?

为什么从Lua torch加载.mat文件后,矩阵与使用scipy的pytorch之间存在差异?,lua,scipy,pytorch,torch,mat,Lua,Scipy,Pytorch,Torch,Mat,我有一个.mat文件的输出矩阵,它使用LuaTorch 7和pytorch以及scipy。我在使用pytorch时得到了一个不同的矩阵。请有人给我解释一下为什么?在pytorch中,矩阵是浮点数,但在Lua torch中,它有固定点。如何在pytorch中固定点 这是矩阵 根据Scipy和pytorch结果: tensor([[[112., -1., -1., -1., -1., -1.], [ -1., -1., 130., 138., -1., -1.]],

我有一个.mat文件的输出矩阵,它使用LuaTorch 7和pytorch以及scipy。我在使用pytorch时得到了一个不同的矩阵。请有人给我解释一下为什么?在pytorch中,矩阵是浮点数,但在Lua torch中,它有固定点。如何在pytorch中固定点

这是矩阵

根据Scipy和pytorch结果:

tensor([[[112.,  -1.,  -1.,  -1.,  -1.,  -1.],
     [ -1.,  -1., 130., 138.,  -1.,  -1.]],

    [[ 57.,  -1.,  -1.,  -1.,  -1.,  -1.],
     [ -1.,  -1.,  11.,  53.,  -1.,  -1.]],

    [[ 58.,  -1.,  -1.,  -1.,  -1.,  -1.],
     [ -1.,  -1.,  31.,  28.,  -1.,  -1.]],

    [[ 46.,  -1.,  -1.,  -1.,  -1.,  -1.],
     [ -1.,  -1.,  24.,  28.,  -1.,  -1.]]])
来自Lua火炬7的结果

[[[113   -1   -1   -1   -1   -1]
   [-1   -1  131  139   -1   -1]],
   [[57   -1   -1   -1   -1   -1],
   [-1   -1   11   53   -1   -1]],
   [[58   -1   -1   -1   -1   -1],
   [-1   -1   31   29   -1   -1]],
   [[47   -1   -1   -1   -1   -1],
   -[1   -1   24   28   -1   -1]]]
您可以在pytorch中看到第一个元素
112
,但在lua torch中可以看到
113
。类似的
130和131
138和139
28和29
以及
46和47
。我想要的结果类似于Lua torch,它是第二个矩阵。还有什么方法可以在pytorch中获得固定点吗。请帮帮我。谢谢