Skip to content

Instantly share code, notes, and snippets.

@tonyroberts
Last active November 29, 2019 15:39
Show Gist options
  • Save tonyroberts/ce967d6db5d2f71d94b85f1f3dfacff5 to your computer and use it in GitHub Desktop.
Save tonyroberts/ce967d6db5d2f71d94b85f1f3dfacff5 to your computer and use it in GitHub Desktop.
from pyxll import xl_func
import torch.nn as nn
class NN(nn.Module):
"""Neural networks with Sequential layers"""
def __init__(self, layers):
super(NN, self).__init__()
self.layers = nn.Sequential(*layers)
def forward(self, x):
return self.layers(x)
@xl_func("object[]: object")
def nn_Sequential(layers):
"""Create a neural network from a list of layers."""
return NN(layers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment