This code worked for me in December 2017, but with the latest release of Deeplearn.js, it stopped working:
math.scope(function(keep, track) {
var i = track(dl.Array3D.fromPixels(rawImageData, 4));
i = math.multiply(i, track(dl.Scalar.new(1/255, "float32")));
[ . . . ]
}
It now fails with this message:
The dtypes of the first (int32) and second (float32) input must match
How can I turn my image into float32 values between 0.0 and 1.0?
Use the
cast
function: