PyTorch

class todd.patches.torch.ModuleDict[source]

Bases: ModuleDict

forward(*args, **kwargs)[source]
Return type:

dict[str, Module]

class todd.patches.torch.ModuleList[source]

Bases: ModuleList

forward(*args, **kwargs)[source]
Return type:

list[Module]

class todd.patches.torch.PrefetchDataLoader[source]

Bases: DataLoader[T]

__init__(*args, **kwargs)[source]
Return type:

None

build_pre_hook(registry, item)
Parameters:
  • config (Config)

  • registry (RegistryMeta)

  • item (Item)

Return type:

Config

class todd.patches.torch.Sequential[source]

Bases: Sequential

__init__(*args, unpack_args=False, **kwargs)[source]
Parameters:

unpack_args (bool)

Return type:

None

forward(*args, **kwargs)[source]
Return type:

tuple[Any, …]

todd.patches.torch.all_close(x, y, *args, **kwargs)[source]
Parameters:
Return type:

bool

todd.patches.torch.all_gather(tensor, world_size, *args, **kwargs)[source]
Parameters:
Return type:

list[Tensor]

todd.patches.torch.all_gather_object(tensor, world_size, *args, **kwargs)[source]
Parameters:
Return type:

list[Tensor]

todd.patches.torch.cosine_similarity(x, y)[source]
Parameters:
Return type:

Tensor

todd.patches.torch.get_device()[source]
Return type:

str

todd.patches.torch.get_local_rank(*args, **kwargs)[source]
Return type:

int

todd.patches.torch.get_rank(*args, **kwargs)[source]
Return type:

int

todd.patches.torch.get_world_size(*args, **kwargs)[source]
Return type:

int

todd.patches.torch.load(f, *args, directory=None, **kwargs)[source]
Parameters:
Return type:

Any

todd.patches.torch.load_state_dict(module, state_dict, *args, logger=None, **kwargs)[source]
Parameters:
Return type:

None

todd.patches.torch.load_state_dict_(f, *args, logger=None, **kwargs)[source]
Parameters:
Return type:

dict[str, Any]

todd.patches.torch.named_trainable_parameters(module, *args, **kwargs)[source]
Parameters:

module (Module)

Return type:

Generator[tuple[str, Parameter], None, None]

todd.patches.torch.named_training_modules(module, *args, **kwargs)[source]
Parameters:

module (Module)

Return type:

Generator[tuple[str, Module], None, None]

todd.patches.torch.random_int()[source]
Return type:

int

todd.patches.torch.set_epoch(dataloader, epoch)[source]
Parameters:
Return type:

None

todd.patches.torch.trainable_parameters(module, *args, **kwargs)[source]
Parameters:

module (Module)

Return type:

Generator[Parameter, None, None]

todd.patches.torch.training_modules(module, *args, **kwargs)[source]
Parameters:

module (Module)

Return type:

Generator[Module, None, None]