Пример #1
0
 def test_Mean1D(self):
     npr = np.divide(np.add(self.np_a, self.np_b), 2.)
     dcr = dc.mean(dc.vectorTensorFloat([self.dc_a, self.dc_b]))
     np.testing.assert_allclose(npr,
                                np.array(dcr.data()).astype(np.float32),
                                rtol=1e-3,
                                atol=1e-3)
Пример #2
0
 def test_Mean2D(self):
     np_a = np.reshape(self.np_a, (6, 4))
     np_b = np.reshape(self.np_b, (6, 4))
     dc_a = dc.reshape(self.dc_a, (6, 4))
     dc_b = dc.reshape(self.dc_b, (6, 4))
     npr = np.divide(np.add(np_a, np_b), 2.)
     dcr = dc.mean(dc.vectorTensorFloat([dc_a, dc_b]))
     np.testing.assert_allclose(npr.flatten(),
                                np.array(dcr.data()).astype(np.float32),
                                rtol=1e-3,
                                atol=1e-3)
Пример #3
0
 def test_Mean2D (self):
     np_a = np.reshape(self.np_a, (3,4))
     np_b = np.reshape(self.np_b, (3,4))
     dc_a = dc.reshape(self.dc_a, (3,4));
     dc_b = dc.reshape(self.dc_b, (3,4));
     lst=[]
     lst.append(dc_a)
     lst.append(dc_b)
     npr =  np.divide(np.add(np_a,np_b), 2.)
     dcr = dc.mean(lst);
     np.testing.assert_allclose(npr.flatten(), np.array(dcr.data()).astype(np.float32),
             rtol=1e-3, atol=1e-3)