TypeError: ufunc ‘true_divide’ output (typecode ‘d’) could not be coerced to provided output parameter (typecode ‘B’) according to the casting rule ”same_kind”
I was using: p /= 255. and getting an error as: TypeError: ufunc ‘true_divide’ output (typecode ‘d’) could not be coerced to provided output parameter (typecode ‘B’) according to the casting rule ”same_kind” when using Keras with the tensorflow backend.
Solution:
Using np.true_divide() solves the problem.
The complete syntax for above problem will be:
import numpy as np p = np.true_divide(p, 255)