How to change the permute pytorch version into keras?

Hi All,

I am new to Pytorch. I was trying to convert the below code into Keras.

self.f_key = nn.Sequential(
nn.Conv2d(in_channels=self.in_channels, out_channels=self.key_channels, kernel_size=1, stride=1, padding=0),
ActivatedBatchNorm(self.key_channels)
)

self.f_query = self.f_key

self.f_value = nn.Conv2d(in_channels=self.in_channels, out_channels=self.value_channels,
kernel_size=1, stride=1, padding=0)
self.W = nn.Conv2d(in_channels=self.value_channels, out_channels=self.out_channels,
kernel_size=1, stride=1, padding=0)
nn.init.constant(self.W.weight, 0)

“”""

How to convert the value.permute code in keras. I used keras.layers.permute layer, but it is not working.

value = self.f_value(x).view(batch_size, self.value_channels, -1)
value = value.permute(0, 2, 1)
query = self.f_query(x).view(batch_size, self.key_channels, -1)
query = query.permute(0, 2, 1)
key = self.f_key(x).view(batch_size, self.key_channels, -1)

“”""

Please give me a suggestion.