trw.transforms.normalize

Module Contents

Functions

normalize_numpy(array: trw.basic_typing.NumpyTensorNCX, mean: Sequence[float], std: Sequence[float]) → trw.basic_typing.NumpyTensorNCX

Normalize a tensor image with mean and standard deviation.

normalize_torch(array: trw.basic_typing.TorchTensorNCX, mean: Sequence[float], std: Sequence[float]) → trw.basic_typing.TorchTensorNCX

Normalize a tensor image with mean and standard deviation.

normalize(array: trw.basic_typing.TensorNCX, mean: Sequence[float], std: Sequence[float]) → trw.basic_typing.TensorNCX

Normalize a tensor image with mean and standard deviation.

trw.transforms.normalize.normalize_numpy(array: trw.basic_typing.NumpyTensorNCX, mean: Sequence[float], std: Sequence[float]) trw.basic_typing.NumpyTensorNCX

Normalize a tensor image with mean and standard deviation.

Given mean: (M1,…,Mn) and std: (S1,..,Sn) for n channels, this transform will normalize each channel of the input torch.Tensor, input[channel] = (input[channel] - mean[channel]) / std[channel]

Parameters
  • array – the numpy array to normalize. Expected layout is (sample, filter, d0, … dN)

  • mean – a N-dimensional sequence

  • std – a N-dimensional sequence

Returns

A normalized tensor such that the mean is 0 and std is 1

trw.transforms.normalize.normalize_torch(array: trw.basic_typing.TorchTensorNCX, mean: Sequence[float], std: Sequence[float]) trw.basic_typing.TorchTensorNCX

Normalize a tensor image with mean and standard deviation.

Given mean: (M1,…,Mn) and std: (S1,..,Sn) for n channels, this transform will normalize each channel of the input torch.Tensor, input[channel] = (input[channel] - mean[channel]) / std[channel]

Parameters
  • array – the torch array to normalize. Expected layout is (sample, filter, d0, … dN)

  • mean – a N-dimensional sequence

  • std – a N-dimensional sequence

Returns

A normalized tensor such that the mean is 0 and std is 1

trw.transforms.normalize.normalize(array: trw.basic_typing.TensorNCX, mean: Sequence[float], std: Sequence[float]) trw.basic_typing.TensorNCX

Normalize a tensor image with mean and standard deviation.

Given mean: (M1,…,Mn) and std: (S1,..,Sn) for n channels, this transform will normalize each channel of the input torch.Tensor, input[channel] = (input[channel] - mean[channel]) / std[channel]

Parameters
  • array – the torch array to normalize. Expected layout is (sample, filter, d0, … dN)

  • mean – a N-dimensional sequence

  • std – a N-dimensional sequence

Returns

A normalized tensor such that the mean is 0 and std is 1