So @piiswrong, if I have a class like
class MyGluonHybrid(HybridBlock):
def __init__(self, in_units=0, **kwargs):
super(MyGluonHybrid, self).__init__(**kwargs)
with self.name_scope():
self.units = in_units
self._in_units = in_units
self.weight = self.params.get(
'weight', init=mx.init.Xavier(magnitude=2.24),
shape=(1, in_units))
def hybrid_forward(self, F, x, weight):
return F.broadcast_mul(x, weight)
Can I do something like:
l1_reg = mx.sym.sum(mx.sym.abs(MyGluonHybrid().weight).var())