'How to convert an array of numpy.float64 into an array of float64?

I have a np.array containing several other np.arrays, themselves containing objects of type numpy.float64, which cause the following issue with one of my methods:

TypeError: can't convert np.ndarray of type numpy.object_. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.

The error is on this line of my code specifically:

self.x = torch.from_numpy(X_train)[train]

Is there a way to convert the content of a np.array to a regular type instead of a numpy object?



Solution 1:[1]

Ok, I investigated and it is a problem of dimension of one of the elements of my array. Thanks for your answers everyone.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MVMV