(to_replace, batch, idx, key_or_idx)
| 30 | |
| 31 | |
| 32 | def 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 | |
| 44 | class PadListDataCollate(InvertibleTransform): |
no outgoing calls
no test coverage detected
searching dependent graphs…