paddle2.x报错The type of data we are trying to retrieve does not match the type of data currently cont

1. 报错信息

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::Type(), 
  but received dtype():11 != paddle::experimental::CppTypeToDataType::Type():10.] 
  (at ..\paddle\phi\core\dense_tensor.cc:143)

2. 解决办法

这个一般是自定义的数据类型与model接收的类型不一致,训练时的数据类型是float32。所以将自定义的DataSet中返回的numpy数组的类型转为float32类型就可以了。

你可能感兴趣的:(paddle,深度学习)