...to add the optimizer, loss, and eventually, metrics, to the network.
These are only needed in training. For that reason, we don't require them at model creation (good!), but that also means that because we don't have a separate network % compile() step, we need to set them either in network % train() or network % update() (in case of optimizer) or network % backward() (in case of loss) methods. It's complicating the code and making it more difficult to understand and maintain.
...to add the optimizer, loss, and eventually, metrics, to the network.
These are only needed in training. For that reason, we don't require them at model creation (good!), but that also means that because we don't have a separate
network % compile()
step, we need to set them either innetwork % train()
ornetwork % update()
(in case of optimizer) ornetwork % backward()
(in case of loss) methods. It's complicating the code and making it more difficult to understand and maintain.Then, we wouldn't need to do any special bookkeeping regarding whether loss or optimizer are set in
train()
,update()
, orbackward()
methods.