(mem_format, obj)
| 635 | |
| 636 | # Called after _check_dims, when we know that >= 1 tensor can be converted to mem_format |
| 637 | def _to_mem_format(mem_format, obj): |
| 638 | def inner_to_mem_format(obj): |
| 639 | d = obj.dim() |
| 640 | if ((mem_format == torch.channels_last and d != 4) |
| 641 | or (mem_format == torch.channels_last_3d and d != 5)): |
| 642 | return obj.clone().detach().requires_grad_(obj.requires_grad) |
| 643 | return obj.clone().to(memory_format=mem_format).detach().requires_grad_(obj.requires_grad) |
| 644 | |
| 645 | return self._traverse_obj(obj, inner_to_mem_format) |
| 646 | |
| 647 | def _check_out_mem_format(output, input_mem_format, module_mem_format): |
| 648 | def inner_check_out_mem_format(output): |
nothing calls this directly
no test coverage detected