You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
inferno/io/trasnform/generic.py
class Normalize(Transform)
def tensor_function(self, tensor):
mean = np.asarray(tensor.mean()) if self.mean is None else self.mean
std = np.asarray(tensor.std()) if self.std is None else self.std
# Figure out how to reshape mean and std
reshape_as = [-1] + [1] * (tensor.ndim - 1)
# Normalize
tensor = (tensor - mean.reshape(*reshape_as))/(std.reshape(*reshape_as) + self.eps)
return tensor
Issue
I am not sure I'm getting the intentions here, but I guess this reshaping the mean and std part is meant to apply separate means and stds for channels, right?
In this case it looks like it wouldn't work if the mean and std were not supplied as arguments (tensor.mean() would return the mean of a flattened array by default?)
Was it meant like this?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
inferno/io/trasnform/generic.py
class Normalize(Transform)
Issue
I am not sure I'm getting the intentions here, but I guess this reshaping the mean and std part is meant to apply separate means and stds for channels, right?
In this case it looks like it wouldn't work if the mean and std were not supplied as arguments (tensor.mean() would return the mean of a flattened array by default?)
Was it meant like this?
The text was updated successfully, but these errors were encountered: