Hi, Donna.
Your reshape and transpose logic looks right to me. My guess is that your problem is to do with the way you used TF functions to compute the scaling factor that includes only integer types. The type coercion rules in TF are different than base python and numpy and I think that gets you in trouble. Here’s a thread which demonstrates one version of the issue. Please have a look at that and see if that sheds any light. Let us know one way or the other!