(self, pipe_schedule)
| 1378 | } |
| 1379 | |
| 1380 | def _exec_schedule(self, pipe_schedule): |
| 1381 | # Reserve and reset buffers. |
| 1382 | self._reserve_pipe_buffers(pipe_schedule.num_pipe_buffers()) |
| 1383 | self.fwd_outputs = [] |
| 1384 | |
| 1385 | # For each step in the schedule |
| 1386 | for step_cmds in pipe_schedule: |
| 1387 | # For each instruction in the step |
| 1388 | for cmd in step_cmds: |
| 1389 | if type(cmd) not in self._INSTRUCTION_MAP: |
| 1390 | raise RuntimeError(f'{self.__class__.__name__} does not understand instruction {repr(cmd)}') |
| 1391 | |
| 1392 | # Equivalent to: self._exec_forward_pass(buffer_id=0) |
| 1393 | self._exec_instr = MethodType(self._INSTRUCTION_MAP[type(cmd)], self) |
| 1394 | self._exec_instr(**cmd.kwargs) |
| 1395 | |
| 1396 | def get_additional_losses(self): |
| 1397 | return self.agg_additional_losses |
no test coverage detected