tahamajs's picture
download
raw
903 Bytes
import torch
class MLP(torch.nn.Module):
def __init__(self, dim, out_dim=None, w=64, time_varying=False):
super().__init__()
self.time_varying = time_varying
if out_dim is None:
out_dim = dim
self.net = torch.nn.Sequential(
torch.nn.Linear(dim + (1 if time_varying else 0), w),
torch.nn.SELU(),
torch.nn.Linear(w, w),
torch.nn.SELU(),
torch.nn.Linear(w, w),
torch.nn.SELU(),
torch.nn.Linear(w, out_dim),
)
def forward(self, x):
return self.net(x)
class GradModel(torch.nn.Module):
def __init__(self, action):
super().__init__()
self.action = action
def forward(self, x):
x = x.requires_grad_(True)
grad = torch.autograd.grad(torch.sum(self.action(x)), x, create_graph=True)[0]
return grad[:, :-1]

Xet Storage Details

Size:
903 Bytes
·
Xet hash:
c13f1a8d6076d348ede68c10dccc0c3a7f19a7126c4090af8347b20ce3ebd3f6

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.