mighty.utils.common.batch_to_cuda

mighty.utils.common.batch_to_cuda(batch)[source]

Transfers the batch to CUDA.

This function is used when you don’t know what is the structure of a batch.

Parameters:
batchtorch.Tensor or iterable

A tensor or an iterable of tensors.

Returns:
batchtorch.Tensor or tuple

Transferred to CUDA batch.