1
$\begingroup$

I am unable to determine where this error is coming from:

AttentionLayer::netmissio: Net specified for the scoring net (argument 1) is missing required input port Query.

scoringNet = NetGraph[ { "queryLinear" -> LinearLayer[64, "Input" -> 64], "keyLinear" -> LinearLayer[64, "Input" -> 64], "valueLinear" -> LinearLayer[64, "Input" -> 64],(* Add this line for the Value input *) "add" -> ThreadingLayer[Plus], "activation" -> ElementwiseLayer[Tanh], "output" -> LinearLayer[1] }, { NetPort["Query"] -> "queryLinear", NetPort["Key"] -> "keyLinear", NetPort["Value"] -> "valueLinear",(* Connect Value port *) {"queryLinear", "keyLinear", "valueLinear"} -> "add" -> "activation" -> "output" }, "Query" -> {64}, "Key" -> {64}, "Value" -> {64} (* Add this line *) ] 

Which shows no errors. Errors show in my net:

seq2seqNet = NetGraph[{"queryTransform" -> LinearLayer[64, "Input" -> {5, 1}], "encoder" -> LongShortTermMemoryLayer[64], "attention" -> AttentionLayer[{"Query" -> 64, "Key" -> 64, "Value" -> 64}, "ScoringFunction" -> scoringNet], "decoder" -> LongShortTermMemoryLayer[64], "output" -> LinearLayer[5]}, {NetPort["Input"] -> "queryTransform", NetPort["Input"] -> "encoder", "encoder" -> NetPort["attention", "Key"], "queryTransform" -> NetPort["attention", "Query"], "encoder" -> NetPort["attention", "Value"], {"encoder", "attention"} -> "decoder", "decoder" -> "output"}, "Input" -> {5, 1}, "Output" -> {5}] 
$\endgroup$
1
  • $\begingroup$ The scoring net should take 2 inputs: "Input" and "Query", and output a scalar (which is distinct from a lenght-1 vector, use "output" -> LinearLayer[{}] instead of "output" -> LinearLayer[1]} in your example). Use NetExtract[AttentionLayer[], "ScoringNet"] to see the default scoring net as an example. Also, the syntax for the AttentionLayer should be AttentionLayer[scoringNet] $\endgroup$ Commented Jul 15 at 7:10

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.