I’m trying to run a easy deep learning model on embedding system without any framework
I have trained below model with my own dataset and quantize to int8
class Net(torch.nn.Module):
def __init__(self, n_feature, n_hidden, n_output, quant=False):
super(Net, self).__init__()
self.fc1 = torch.nn.Linear(n_feature, n_hidden, bias=False)
self.fc2 = torch.nn.Linear(n_hidden, n_output, bias=False)
self.relu = torch.nn.ReLU()
self.quant = quant
if self.quant:
self.quant = torch.quantization.QuantStub()
self.dequant = torch.quantization.DeQuantStub()
def forward(self, input):
if self.quant:
x = self.quant(input)
else:
x = input
x = self.fc1(x)
x = self.relu(x)
x = self.fc2(x)
if self.quant:
x = self.dequant(x)
return x
I can get each layer’s int8 weight as fc1.weight().int_repr()
But how to use these parameter to reproduce result like net.forward()?