Message Boards Message Boards

Neural Networks calling NetTrain with All


I initialized a simple neural network wit a single DotPlusLayer:

resource = ResourceObject["MNIST"];
trainingData = ResourceData[resource, "TrainingData"];
testData = ResourceData[resource, "TestData"];

(* Neural Network creation *)
lenet = NetChain[
   {FlattenLayer[], 10, SoftmaxLayer[]},
   "Output" -> NetDecoder[{"Class", Range[0, 9]}],
   "Input" -> NetEncoder[{"Image", {28, 28}, "Grayscale"}]

(* Neural Network initialization *)

lenet = NetInitialize[lenet]

then trained it (successfully) with:

result = NetTrain[lenet, trainingData, ValidationSet -> testData]

when trying to obtain a NetTrainResultsObject[…] by adding the all specifier it stopped being compileable, even when removing all additional parameters (ValidationSet).

result = NetTrain[lenet, trainingData, All]

This returned an error about the loss port, which didn't occur before adding the All. This seems odd to me since All should only change the return type if I am not mistaken.

Entire notebook in attachments.

POSTED BY: Simon Blank
1 month ago

Group Abstract Group Abstract