# Using LinearLayer for NetEncode[{“Characters”}]

So, I'm trying to make a net to translate a phrase. But I'm uncertain of the use of LinearLayer for a NetEncoder for Characters and getting some error in the training process. Here a toy example of the net with the first error

trainingdata = Dataset[{<|"Linha" -> 1,
"portugues" ->
"F: Myne resolve os problemas familiares que Lutz enfrentava.",
"ingles" ->
"F: Main somehow managed to help resolve Lutz's family issues."|>, \
<|"Linha" -> 2,
"portugues" ->
"F: Contudo, novas preocupações emergem em seu próprio lar.",
"ingles" ->
"F: However, she starts to have concerns in her own home."|>, \
<|"Linha" -> 3,
"portugues" ->
"M: Ainda está enjoada, mamãe? Está tudo bem com você?",
"ingles" ->
"M: Are you still not feeling well, Mom? Are you really okay?"|>, \
<|"Linha" -> 4, "portugues" -> "E: Myne...",
"ingles" -> "E: Main..."|>}]

ptenconder = NetEncoder[{"Characters"}];
ptdecoder = NetDecoder[{"Characters"}];

net = NetGraph[{LinearLayer[], LinearLayer[], LinearLayer[],
LinearLayer[], CatenateLayer[],
LinearLayer[]}, {NetPort["portugues"] -> {1, 2, 3, 4} ->
5 -> 6 -> NetPort["ingles"]}, "portugues" -> ptenconder,
"ingles" -> ptdecoder]



Then

translator = NetTrain[net, trainingdata]


If I change LinearLayer[] to LinearLayer[100] the error changes and I got it:

• Have you tried the tutorials? reference.wolfram.com/language/tutorial/… . They are super easy to follow and cover almost all of Mathematica's deep learning functionality. For your task, see Sequence Learning and NLP. – aooiiii May 17 at 10:29
• I have tried, but the documentation isn't much clear about their choices. I've even had a look in the answer for this question mathematica.stackexchange.com/questions/143609/…, but even been more clear than the mathematica documentation wasn't enough for me to undertand how to do it. – bruno henrique May 17 at 19:25