mirror of
https://github.com/wassname/pytorch-ts.git
synced 2026-07-12 13:09:21 +08:00
initial modules
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user