This is an IndexError
in python, which means that we're trying to access an index which isn't there in the tensor. Below is a very simple example to understand this error.
# create an empty array of dimension `0`
In [14]: arr = np.array([], dtype=np.int64)
# check its shape
In [15]: arr.shape
Out[15]: (0,)
with this array arr
in place, if we now try to assign any value to some index, for example to the index 0
as in the case below
In [16]: arr[0] = 23
Then, we will get an IndexError
, as below:
IndexError Traceback (most recent call last) <ipython-input-16-0891244a3c59> in <module> ----> 1 arr[0] = 23 IndexError: index 0 is out of bounds for axis 0 with size 0
The reason is that we are trying to access an index (here at 0th position), which is not there (i.e. it doesn't exist because we have an array of size 0
).
In [19]: arr.size * arr.itemsize
Out[19]: 0
So, in essence, such an array is useless and cannot be used for storing anything. Thus, in your code, you've to follow the traceback and look for the place where you're creating an array/tensor of size 0
and fix that.