Skip to content

Commit

Permalink
maks sure we don't change dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed Jul 15, 2021
1 parent 51ac596 commit 3b1d274
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tiktorch/runner/prediction_pipeline/_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def zero_mean_unit_variance(tensor: xr.DataArray, axes=None, eps=1.0e-6, mode="p
if mode != "per_sample":
raise NotImplementedError(f"Unsupported mode for zero_mean_unit_variance: {mode}")

return (tensor - mean) / (std + 1.0e-6)
ret = (tensor - mean) / (std + 1.0e-6)

# monkey patch: maks sure we don't change dtype
# todo: allow preprocessing to change dtype?
return ret.astype(tensor.dtype)


def binarize(tensor: xr.DataArray, *, threshold) -> xr.DataArray:
Expand Down

0 comments on commit 3b1d274

Please sign in to comment.