-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Hello,
I am trying to use EVA for a simple and encrypted MNIST model classifier.
The code for my ConvNet is the following
class ConvNet(torch.nn.Module):
def __init__(self, hidden=64, output=10):
super(ConvNet, self).__init__()
torch.nn.Sequential()
self.conv1 = torch.nn.Conv2d(1, 4, kernel_size=7, padding=0, stride=3)
self.fc1 = torch.nn.Linear(256, hidden)
self.fc2 = torch.nn.Linear(hidden, output)
def forward(self, x):
x = self.conv1(x)
x = x * x
x = x.view(-1, 256)
x = self.fc1(x)
x = x * x
x = self.fc2(x)
return x
However, having this simple piece of code
prog = EvaProgram('prog', vec_size=32*32)
with prog:
image = Input('image')
result = model(image)
probs = torch.softmax(torch.tensor(result), 0)
label_max = torch.argmax(probs)
print(f'label_max type {type(label_max)}')
print(f'label_max value {label_max}')
Output('label_max', label_max.numpy())
Throws me this error: TypeError: conv2d(): argument 'input' (position 1) must be Tensor, not Expr
If however I replace the code for EVA with:
prog = EvaProgram('prog', vec_size=32*32)
with prog:
result = model(image)
probs = torch.softmax(torch.tensor(result), 0)
label_max = torch.argmax(probs)
print(f'label_max type {type(label_max)}')
print(f'label_max value {label_max}')
Output('label_max', label_max.numpy())
It gives me TypeError: No conversion to Term available for 0.
I get what both errors mean but I couldn't find any way of how to solve them. I was wondering if EVA supports ML tasks and if there any concrete examples other the one with image_processing, Thanks a lot!
Metadata
Metadata
Assignees
Labels
No labels