コード例 #1
0
    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)
コード例 #2
0
 def add_to_queue(self, trainer: Trainer,
                  queue: torch.multiprocessing.SimpleQueue) -> None:
     queue.put("new_test_val")
     return super().add_to_queue(trainer, queue)
コード例 #3
0
 def add_to_queue(self, queue: torch.multiprocessing.SimpleQueue) -> None:
     queue.put("test_val")
     return super().add_to_queue(queue)