You are currently passing x as the target, so I’m not sure why you are normalizing it.
Also, I don’t think that the current value range calculates what you expect given in the binary cross entropy formula.



 alexobrads:

If this is correct are there any reasons to why the data wouldn’t scale to the correct range [0, 1]?


The posted formula will not normalize the tensor to the range [0, 1], but will standardize it to a zero mean and unit variance.



 alexobrads:

If you have any suggestion to correct my initial scaling or if something else appears wrong please let me know,


I wouldn’t try to normalize the target, but leave it in the range [0, 1].
Let me know, if I misunderstand your use case or code, please.