I'm trying to make a net graph where the input (a pair of objects of distinct but fixed types) will be passed simultaneously trough two net encoders. One will get an array from the image (the first object), the other will get an array of different shape from the sound (the second object). The two resulting arrays will then be fed further in the graph as if they were distinct input ports. However, as far as I can tell, Mathematica only allows one net-encoder per input and does not allow a net-encoder to have multiple outputs. Should I give up this approach and just make the net have multiple input ports, or is there a non-hackish way to make neural nets have such "packaged" input?

  • $\begingroup$ Why do you want to "package" the inputs in a tuple in the first place? It looks like your network has two distinct inputs, and you should treat them separately using one NetEncoder for each. You could use a "Function" NetEncoder to unpack the input tuple, but this is indeed hackish and has no real advantage I can see $\endgroup$ Jun 2, 2021 at 9:03
  • $\begingroup$ Generally speaking, being able to use "structured" inputs seemed nice, especially when the objects of the pair may have some strong correlation that the network is expected to respond to . But, in this particular case, I was just hoping to be able to train my network without having to convent my training set from a list of pairs to an association. $\endgroup$ Jun 2, 2021 at 12:44
  • 1
    $\begingroup$ I think associations provide much richer structural possibilities than tuples, though, and separating inputs is also probably beneficial for preprocessing purposes (i.e. Mathematica needs to batch and pre-encode inputs for training, and it's nicer if the unpacking is already done and does not need to be repeated every epoch) $\endgroup$ Jun 2, 2021 at 13:17
  • $\begingroup$ Still, it would be nice to be able to have separation of the components of the pair (or more generally, the n-tuple) as part of the pre-encoding. $\endgroup$ Jun 2, 2021 at 13:32


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.