Skip to content

Instantly share code, notes, and snippets.

@kimishpatel
Created August 10, 2023 15:09
Show Gist options
  • Save kimishpatel/b241207b03e7d9caeb3e27a064bd2004 to your computer and use it in GitHub Desktop.
Save kimishpatel/b241207b03e7d9caeb3e27a064bd2004 to your computer and use it in GitHub Desktop.
import torch
self = torch.rand((10, 1))
print(self.stride())
order =[i[0] for i in sorted(
enumerate(self.stride()), key=lambda x: x[1], reverse=True
)]
print(order)
self_permuted = self.permute((1, 0))
print(self_permuted.stride())
order =[i[0] for i in sorted(
enumerate(self_permuted.stride()), key=lambda x: x[1], reverse=True
)]
print(order)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment