nicholas-leonard/dp

:cuda() support for target_module in dp.Experiment or dp.Propagator

Vladimir-Yashin opened this issue · 0 comments

dp.Experiment can be parametrized with target_module which is just passed to dp.Propagator instances.
dp.Propagator has :type() function which is used to convert _loss (Criterion), but not target_module.

The problem is that when dp.Experiment:cuda() is called the target_module is not modified, so execution fails unless targetModule:cuda() call is done manually in addition to dp.Experiment:cuda()

It would be nice for dp.Propagator to handle target_module conversion too:

function Propagator:type(new_type)
   if self._loss then
      self._loss:type(new_type)
   end
   -- here goes support for target_module
   if self._target_module then
      self._target_module:type(new_type)
   end
end

Alternatively this can be done in dp.Experiment.

Thanks.