I am trying to train a model. Training Labels are stored in training_labels
which is a <class 'numpy.ndarray'>
. Each item in labels array has the following format of a 2d numpy array
with shape of M * 5
.
M
has a different value for each training example.( for example (8, 5)
for first training example, (3, 5)
for second training example).
I need to convert my labels to tensors and then use padding
to have kind of a rectangular tensors.
Now i try to use tensorflow.convert_to_tensor
to try to convert the training_labels
to tensors, but it throws a ValueError
exception like this :
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type numpy.ndarray)
.
Now when i try to convert each of the training_labels
to tensors individually,(for example
tensorflow.convert_to_tensor(training_labels[0])
)
it works perfectly since it is just a one 2d numpy array
.
Now how can i convert my training_labels
to tensors?