You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@mxnet.apache.org by Antonie Lin via MXNet Forum <mx...@discoursemail.com.INVALID> on 2021/05/03 16:00:16 UTC
[MXNet Forum] [Gluon] How to apply F.softmax to Gluon Parameters
`hybrid_forward` passes the parameters as part of the function arguments, so you would access them by defining them or using `kwargs`. Then we can use them as usual for both hybridized and non-hybridized versions.
```
class ElmoEmbedding(gluon.HybridBlock):
def __init__(self):
...
def hybrid_forward(self, F, x, *args, **kwargs):
weights = kwargs['weights']
scales = kwargs['scales']
normalized_weights = F.softmax(weights)
...
```
---
[Visit Topic](https://discuss.mxnet.apache.org/t/how-to-apply-f-softmax-to-gluon-parameters/6930/3) or reply to this email to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from these emails, [click here](https://discuss.mxnet.apache.org/email/unsubscribe/53ea94e87ad8805344f741777f41d4c406ca72079ba1973e7dbbd93a433b7ce7).