'Converting PyTorch transforms.compose method into Keras

I understand that we use transforms.compose to transform images via torch.transforms. I want to do the same in Keras and spending hours on internet I couldnt get how to write a method in keras that can do the same. Below is the Torch way:

# preprocessing
data_transform = transforms.Compose([
   transforms.ToTensor(),
   transforms.Normalize(mean=[.5], std=[.5])
])

Can someone please point me in the right direction.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source