[math] Fix TensorFlow shape() device
@@ -354,6 +354,9 @@ class TFBackend(Backend):
return a
def shape(self, tensor):
+ if isinstance(tensor, np.ndarray):
+ return tensor.shape
+ else:
with tf.device(tensor.device):
return tf.shape(tensor)
