Message Boards Message Boards

0
|
5100 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Get right list of tensors data to port "Input" in NetTrain?

Posted 5 years ago

Dear all, my input and target data is prepared in tensor, which is filled from a file. Dimensions[input] yields {398,6,24,24}. First index is the training set number, second is channels (6) and 24 x 24 is my "image" size. In the same way I have prepared the target data, which is in a {398,6} tensor. When I try to invoke NetTrain, it complains:

NetTrain[Net,{"Inputs"->input,"Targets"->target},{MaxTrainingRounds->1}]

NetTrain: Data provided to port "Input" should be a list of 6×24×243-tensors.

Obviously my understanding of tensors and lists seems to be flawed, why is {398,6,24,24} not a list of {6,24,24} tensors?

The network is defined as follows, just two fully connected layers.

linear1 = LinearLayer[{6,24,24}, "Input"->{6,24,24}];
linear1 = NetInitialize[linear1];
linear2 = LinearLayer[{6}, "Input"->{6,24,24}];
linear2 = NetInitialize[linear2];
Net = NetChain[{linear1, linear2}];
POSTED BY: Markus Lenzing
2 Replies

Markus, the following code seems to work.

NetTrain[Net, <|"Input" -> input, 
  "Output" -> target|>, {MaxTrainingRounds -> 1}]
POSTED BY: Kotaro Okazaki
Posted 5 years ago

Hello Kotaro, in fact that seems to work! Thank you very much!

POSTED BY: Markus Lenzing
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract