tensorflow.python.framework.errors_impl.InvalidArgumentError: required broadcastable shapes [Op:Sub]
时间: 2023-11-13 20:27:25 浏览: 184
tensorflow报错
This error occurs when you are trying to subtract two tensors with incompatible shapes. The two tensors need to have the same shape or shapes that can be broadcasted together.
To fix this error, you can check the shape of the tensors before performing the subtraction operation and reshape them if necessary to make them compatible. Alternatively, you can use functions like `tf.broadcast_to` or `tf.tile` to broadcast the tensors to the required shape before performing the subtraction operation.
阅读全文