PyNorch/norch/norchvision/transforms.py
2024-05-25 11:55:59 -03:00

22 lines
437 B
Python

import norch
class ToTensor:
def __call__(self, x):
return norch.Tensor(x)
class Reshape:
def __init__(self, shape):
self.shape = shape
def __call__(self, x):
return x.reshape(self.shape)
class Compose:
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, x):
for transform in self.transforms:
x = transform(x)
return x