Message Boards Message Boards


Neural Networks calling NetTrain with All

Posted 10 months ago
0 Replies
1 Total Likes

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.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract