Group Abstract Group Abstract

Message Boards Message Boards

Normalized softmax in ElementwiseLayer?

Posted 4 years ago
POSTED BY: Pei Hsuan Shen
2 Replies
Posted 4 years ago

Thank you.

POSTED BY: Pei Hsuan Shen

ElementwiseLayer applies the function to each element of the inputlist. so it cannot calculate the mean.

You have to use FunctionLayer

In[39]:= soft = FunctionLayer[Exp[#]/Total[Exp[#]] &]
list = N@{1, 2, 3, 4, 5};
Exp[list]/Total[Exp[list]]
soft[list]

Out[39]= FunctionLayer[ <> ]

Out[41]= {0.0116562, 0.0316849, 0.0861285, 0.234122, 0.636409}

Out[42]= {0.0116562, 0.0316849, 0.0861285, 0.234122, 0.636409}
POSTED BY: Martijn Froeling
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard