def add_to_queue(self, trainer: "pl.Trainer", queue: torch.multiprocessing.SimpleQueue) -> None: """Appends the :attr:`trainer.callback_metrics` dictionary to the given queue. To avoid issues with memory sharing, we cast the data to numpy. Args: queue: the instance of the queue to append the data. """ callback_metrics: dict = apply_to_collection( trainer.callback_metrics, torch.Tensor, lambda x: x.cpu().numpy( )) # send as numpy to avoid issues with memory sharing queue.put(callback_metrics)
def add_to_queue(self, trainer: Trainer, queue: torch.multiprocessing.SimpleQueue) -> None: queue.put("new_test_val") return super().add_to_queue(trainer, queue)
def add_to_queue(self, queue: torch.multiprocessing.SimpleQueue) -> None: queue.put("test_val") return super().add_to_queue(queue)