示例#1
0
 def test_DequantizeLinear1D(self):
     npr = temp_dequantize_linear(self.np_x, self.np_x_scale,
                                  self.np_x_zero_point)
     dcr = dc.dequantize_linear(self.dc_x, self.dc_x_scale,
                                self.dc_x_zero_point)
     np.testing.assert_allclose(npr,
                                np.array(dcr.data()).astype(np.float32),
                                rtol=1e-3,
                                atol=1e-3)
示例#2
0
 def test_DequantizeLinear3D_2(self):
     np_x = np.reshape(self.np_x, (4, 2, 3))
     dc_x = dc.reshape(self.dc_x, (4, 2, 3))
     npr = temp_dequantize_linear(np_x, self.np_x_scale,
                                  self.np_x_zero_point)
     dcr = dc.dequantize_linear(dc_x, self.dc_x_scale, self.dc_x_zero_point)
     np.testing.assert_allclose(npr.flatten(),
                                np.array(dcr.data()).astype(np.float32),
                                rtol=1e-3,
                                atol=1e-3)