tensor inplace methods alter internal state and also return self
(self)
| 189 | self.matmul_high_dim_helper(gpu_dev) |
| 190 | |
| 191 | def test_tensor_inplace_api(self): |
| 192 | """ tensor inplace methods alter internal state and also return self |
| 193 | """ |
| 194 | x = tensor.Tensor((3,)) |
| 195 | y = x.set_value(1) |
| 196 | self.assertTrue(y is x) |
| 197 | |
| 198 | x = tensor.Tensor((3,)) |
| 199 | y = x.uniform(1, 2) |
| 200 | self.assertTrue(y is x) |
| 201 | |
| 202 | x = tensor.Tensor((3,)) |
| 203 | y = x.bernoulli(1) |
| 204 | self.assertTrue(y is x) |
| 205 | |
| 206 | x = tensor.Tensor((3,)) |
| 207 | y = x.gaussian(1, 2) |
| 208 | self.assertTrue(y is x) |
| 209 | |
| 210 | def test_numpy_convert(self): |
| 211 | a = np.asarray([[1, 0, 0], [0, 1, 0]], dtype=np.int) |