PyEtaler can't convert et.Tensor into np.ndarray using np.array. (NOTE: et.Tensor.numpy() works) This is caused by Elater handles scalars as a 1D, length 1 tensor and have no concept of a 0D tensor. Leading to numpy wrongfully assuming Etaler's tensors are infinite in dimension.
a = et::ones({4, 4});
cout << a[0][0] << endl; // prints 1
// But numpy is not expecting this behavior.
// Caused by a[0][0] is a 1D tensor. Then indexing into it still returns a 1D tensor.
// NOTE: a[0, 0, 0] will correctly throw an exception
cout << a[0][0][0] << endl; // also prints 1
Numpy is expecting the behavior of:
a = np.ones((4, 4))
print(a[0][0]) # prints 1
# This fails because indexing a 0D array makes no sense
print(a[0][0][0])
Actions:
[x] Make indexing return a 0D tensor when the result is a scalar
[x] Indexing 0D tensor should always fail
[x] Add tests for this
[x] Make sure the tensor operators can handle 0D tenors
[x] Handle potential NULL pointer deref due to 0D shapes
Related to: etaler/PyEtaler#4
PyEtaler can't convert
et.Tensor
intonp.ndarray
usingnp.array
. (NOTE:et.Tensor.numpy()
works) This is caused by Elater handles scalars as a 1D, length 1 tensor and have no concept of a 0D tensor. Leading to numpy wrongfully assuming Etaler's tensors are infinite in dimension.Numpy is expecting the behavior of:
Actions: