Skip to content

Commit

Permalink
Merge pull request #180 from FynnBe/double_vs_float
Browse files Browse the repository at this point in the history
 maks sure we don't change dtype in zero_mean preprocessing
  • Loading branch information
constantinpape committed Jul 15, 2021
2 parents 51ac596 + b32e75c commit 2a7a0cd
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("float32")


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

0 comments on commit 2a7a0cd

Please sign in to comment.