I have a very simple network model: two named input ports, one summing layer, one linear layer and a scalar output. Despite many attempts, I cannot select a suitable data format that would be accepted by NetTrain. I get the message:
Data provided to port “Input1” should be a non-empty list of length-1 vectors, but was a length-2 vector of real numbers ”
Code attached
Module[{mData, mNetwork},
mData = Dataset[{Association["Input1" -> 1, "Input2" -> 2,
"Output" -> 3],
Association["Input1" -> 2, "Input2" -> 3, "Output" -> 4]}];
mNetwork = NetGraph[{
LinearLayer[1, "Input" -> 1, "Weights" -> {{1}}, "Biases" -> None],
ThreadingLayer[Plus, InputPorts -> 2]
},
{{NetPort["Input1"], NetPort["Input2"]} -> 2 -> 1}
];
mNetwork = NetInitialize[mNetwork];
NetTrain[mNetwork, mData, "TrainedNet",`MaxTrainingRounds -> 3, LossFunction -> MeanSquaredLossLayer[]];`
]