**Question: ** I’m encountering an InvalidArgumentError in TensorFlow when trying to perform a multiplication operation (Mul) during the training process of a neural network. The error message is:
InvalidArgumentError: cannot compute Mul as input #1(zero-based) was expected to be a uint8 tensor but is a float tensor [Op:Mul]
Images of code snippets
[Accuracy Metric and Running training model](https://i.sstatic.net/Jff3wuL2.png) -> Code for Prepare MNIST data.
Tried: I’ve tried casting the input tensors to uint8 using tf.cast, but the error persists. I’ve also checked the tensor shapes and data types, but everything seems correct.
Could someone please explain what might be causing this error and how I can resolve it? Any help or guidance would be greatly appreciated.
Additional Details
Provide any additional relevant code snippets or error tracebacks that could help others understand the issue better.
Mention any specific steps you’ve taken to troubleshoot the problem, such as checking tensor shapes, data types, or consulting documentation.
Tumuluri Yashasvi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.