Hi,
The input to a linear layer should be a tensor of size [batch_size, input_size] where input_size is the same size as the first layer in your network (so in your case it’s num_letters).
The problem appears in the line:
tensor = torch.zeros(len(name), 1, num_letters)

which should actually just be:
tensor = torch.zeros(len(name), num_letters)

As an easy example:
input_size = 8
output_size = 14
batch_size = 64

net = nn.Linear(input_size, output_size)
input = Variable(torch.FloatTensor(batch_size, input_size))

output = net(input)

print("Output size:", output.size())


Output size: (64, 14)

Hope this helps,
Jordan