Multi-task training - weighting one task more than the other

Hi,
I have a multi-task netweok similar to this:

loss1 = mx.sym.SoftmaxOutput(data1, name=‘softmax1’)
loss2 = mx.sym.SoftmaxOutput(data2, name=‘softmax2’)

loss_comb = mx.sym.Group(loss1, loss2)

Can do I something like:
loss_comb = mx.sym.Group(loss1, 5*loss2)
where 5 is a constant multiplier

I may be misunderstanding the eventual use-case, but it’s legal to multiply symbols by constants. You would create a new symbol. See: http://mxnet.apache.org/api/python/symbol/symbol.html

   a = mx.sym.Variable('a')
   b = mx.sym.Variable('b') 
   c = 2 * a + b
   type(c)
   <class 'mxnet.symbol.symbol.Symbol'>

Note: The syntax for group is mx.sym.Group([loss1, 5*loss2]).

1 Like