Skip to content

Instantly share code, notes, and snippets.

@alkalait
Created March 6, 2021 14:25
Show Gist options
  • Save alkalait/e4db42c6e428ba4a0e8a5ded1440f545 to your computer and use it in GitHub Desktop.
Save alkalait/e4db42c6e428ba4a0e8a5ded1440f545 to your computer and use it in GitHub Desktop.
Yet another pretty shape print
import torch
import numpy
def shape(name : str) -> None:
'''
yaarr = torch.ones(25, 1, 1, 5, 5) # or np.ones
shape('yaarr')
>> yaarr : (25, 1, 1, 5, 5)
'''
val = eval(name)
print(f'{name} : {tuple(val.shape)}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment