使用Paddle时遇到的一个很坑的错误:
必须要记录一下!!!!
ValueError: (InvalidArgument) The type of data we are trying to retrieve does not match the type of data currently contained in the container. [Hint: Expected dtype() == paddle::experimental::CppTypeToDataType<T>::Type(), but received dtype():13 != paddle::experimental::CppTypeToDataType<T>::Type():12.] (at /Users/paddle/xly/workspace/0e927451-9b24-4f4c-91d8-7f5f62245df4/Paddle/paddle/phi/core/dense_tensor.cc:137) [operator < elementwise_sub > error]
正确代码:
x_data = paddle.to_tensor(np.array(df_x),dtype="float32")
y_data = paddle.to_tensor(np.array(df_y),dtype="float32")
dtype=float32
不想多说了,看图看图!!!!float64就会报错!!!!!