Shortcuts

data

Functions

extract_batch_size

Unpack a batch to find a torch.Tensor.

has_len_all_ranks

Checks if a given object has __len__ method implemented on all ranks.

lightning.pytorch.utilities.data.extract_batch_size(batch)[소스]

Unpack a batch to find a torch.Tensor.

반환 형식

int

반환

len(tensor) when found, or 1 when it hits an empty or non iterable.

lightning.pytorch.utilities.data.has_len_all_ranks(dataloader, strategy, allow_zero_length_dataloader_with_multiple_devices=False)[소스]

Checks if a given object has __len__ method implemented on all ranks.

반환 형식

TypeGuard[Sized]