2
$\begingroup$

Recently, I have become addicted to Mathematica's support for neural networks. As I learn those commands that are prefixed with "Net", I can't tell the difference between using NetMapOperator, and not using it. For example,

enter image description here

From the help information, I just think that this command only serves to normalize the input and output formats. Can anyone point out its substantive functions?

$\endgroup$
2
  • $\begingroup$ Please make sure to include your code as text, rather than as images. $\endgroup$
    – MarcoB
    Commented Jun 28, 2018 at 16:26
  • $\begingroup$ I will pay attention next time. @MarcoB $\endgroup$
    – PokerN
    Commented Jun 29, 2018 at 17:25

1 Answer 1

6
$\begingroup$
NetChain[
 {
  LinearLayer[3]
  },
 "Input" -> 2
 ]

enter image description here

NetChain[
 {
  NetMapOperator[LinearLayer[3]]
  },
 "Input" -> 2
 ]

enter image description here

In the first network LinearLinear is applying to the whole input sequence and output has size 3.

In the second network LinearLinear is applying to the every element of sequence and output has size 2*3. This is the same as TimeDistributed in Keras.

In your examples try1 was evaluated on the batch of data (batch = 4, size of the data point = 2) and try2 was evaluated on the single data point with dimension {4,2}.

$\endgroup$
1
  • $\begingroup$ Thank you for your explanation. I think I understand. try1 is just like a function with Listable attribute. try2 is just like a function map on a list. So, the results is the same! $\endgroup$
    – PokerN
    Commented Jun 29, 2018 at 17:22

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.