mapping_networks.trainers.MappingBatchAdapter

class mapping_networks.trainers.MappingBatchAdapter(input_key: str = 'input', target_key: str = 'target')

Unpack dict batches with configurable key names.

Example:

adapter = MappingBatchAdapter(input_key="image", target_key="label")
# batch = {"image": tensor, "label": tensor}
inputs, targets = adapter.unpack(batch)
__init__(input_key: str = 'input', target_key: str = 'target') None

Methods

__init__([input_key, target_key])

unpack(batch)

Return ((input_arg1, ...), targets) from a dataloader batch.