initial modules

This commit is contained in:
Dr. Kashif Rasul
2019-10-28 11:59:13 +01:00
parent c96a340d84
commit 6e5c356320
3 changed files with 43 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
import torch
import torch.nn as nn
class Lambda(nn.Module):
def __init(self, function):
super().__init__()
func_dict = {sym: getattr(sym, function), Tensor: getattr(torch.Tensor, function)}
self._func = lambda *args: func_dict(*args)
def forward(self, x, *args):
return self._func(x, *args)