Exemple #1
0
 def test_eye_2d_n2(self):
     eye = initializers.Eye()
     # yapf: disable
     desired = np.array([[1, 0],
                         [0, 1]], dtype='float32')
     actual = eye(shape=(2, 2))
     # yapf: enable
     self.assertIsNone(np.testing.assert_array_almost_equal(
         actual, desired))
Exemple #2
0
 def test_eye_dtype_float64(self):
     eye = initializers.Eye()
     desired = 'float64'
     actual = eye(shape=(4, 4), dtype=desired).dtype
     self.assertEqual(actual, desired)
Exemple #3
0
 def test_eye_2d_rectangular(self):
     with self.assertRaises(ValueError):
         eye = initializers.Eye()
         _ = eye(shape=(2, 3))