Converting Numpy text array to

Converting Numpy text array to

Problem Description:

i have 2 a numpy nd arrays of shape (2000,) where each element is a list containing words as items. Thus each list is a sentence. The other nd array are just the binary labels.
I want to convert this to tensorflow data Dataset where each item is a sentence with a label.
I tried:, labels))

but i get :

ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list).

How could this be done?

Solution – 1

This error usually occurs when each list in your array has a different number of elements (words). Try using a ragged representation:, labels))
Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.