Replace deprecated np.asscalar with .item()

This commit is contained in:
Lukas Geiger 2020-06-22 15:46:12 +02:00
parent 2624f6c405
commit 15691d14b4

View File

@ -282,7 +282,7 @@ class ndarray(composite_tensor.CompositeTensor): # pylint: disable=invalid-name
# TODO(wangpeng): Handle graph mode
if not isinstance(self.data, ops.EagerTensor):
raise TypeError('Indexing using symbolic tensor is not allowed')
return np.asscalar(self.data.numpy())
return self.data.numpy().item()
def tolist(self):
return self.data.numpy().tolist()