MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / replace_element

Function replace_element

monai/transforms/croppad/batch.py:32–41  ·  view source on GitHub ↗
(to_replace, batch, idx, key_or_idx)

Source from the content-addressed store, hash-verified

30
31
32def replace_element(to_replace, batch, idx, key_or_idx):
33 # since tuple is immutable we'll have to recreate
34 if isinstance(batch[idx], tuple):
35 batch_idx_list = list(batch[idx])
36 batch_idx_list[key_or_idx] = to_replace
37 batch[idx] = tuple(batch_idx_list)
38 # else, replace
39 else:
40 batch[idx][key_or_idx] = to_replace
41 return batch
42
43
44class PadListDataCollate(InvertibleTransform):

Callers 1

__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…