Spaces:
Runtime error
Runtime error
File size: 502 Bytes
97a6728 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from typing import Dict
import torch
import tops
import torch.nn as nn
class Sequential(nn.Sequential):
def forward(self, x: Dict[str, torch.Tensor], **kwargs) -> Dict[str, torch.Tensor]:
for module in self:
x = module(x, **kwargs)
return x
class Module(nn.Module):
def __init__(self, *args, **kwargs):
super().__init__()
def extra_repr(self):
num_params = tops.num_parameters(self) / 10**6
return f"Num params: {num_params:.3f}M"
|