2
我不能將double轉換爲Nd4j.INDArray而不會丟失精度。Java雙向INDArray丟失精度
double[] weight = new double[]{-0.13404223866376802,-0.11294084872465669,0.11232944517596409,-0.01687720880184701,0.13288394029423414,-0.06916641552096867,0.1518882606786481};
INDArray array = Nd4j.create(weight, new int[]{1, 7});
System.out.println(array);
輸出是
[-0.13, -0.11, 0.11, -0.02, 0.13, -0.07, 0.15]
所需的輸出應該是
[-0.13404223866376802,-0.11294084872465669,0.11232944517596409,-0.01687720880184701,0.13288394029423414,-0.06916641552096867,0.1518882606786481]
如何與全精度轉換?
@LeoAso所說的背後是INDArray並非_actually_正在截斷數據 - 它存儲和操作整個double。這正是它的toString()方法所做的。他的回答允許你以你想要的精度格式化INDArray。 – andrewm921