(self, pipe_schedule)
| 1394 | } |
| 1395 | |
| 1396 | def _exec_schedule(self, pipe_schedule): |
| 1397 | # Reserve and reset buffers. |
| 1398 | self._reserve_pipe_buffers(pipe_schedule.num_pipe_buffers()) |
| 1399 | self.fwd_outputs = [] |
| 1400 | |
| 1401 | # For each step in the schedule |
| 1402 | for step_cmds in pipe_schedule: |
| 1403 | # For each instruction in the step |
| 1404 | for cmd in step_cmds: |
| 1405 | if type(cmd) not in self._INSTRUCTION_MAP: |
| 1406 | raise RuntimeError(f'{self.__class__.__name__} does not understand instruction {repr(cmd)}') |
| 1407 | |
| 1408 | # Equivalent to: self._exec_forward_pass(buffer_id=0) |
| 1409 | self._exec_instr = MethodType(self._INSTRUCTION_MAP[type(cmd)], self) |
| 1410 | self._exec_instr(**cmd.kwargs) |
| 1411 | |
| 1412 | def get_additional_losses(self): |
| 1413 | return self.agg_additional_losses |
no test coverage detected