r"""Move all halfs to float. Args: data (dict, list or tensor): Input data.
(data)
| 104 | |
| 105 | |
| 106 | def to_float(data): |
| 107 | r"""Move all halfs to float. |
| 108 | |
| 109 | Args: |
| 110 | data (dict, list or tensor): Input data. |
| 111 | """ |
| 112 | if isinstance(data, torch.Tensor) and torch.is_floating_point(data): |
| 113 | data = data.float() |
| 114 | return data |
| 115 | elif isinstance(data, container_abcs.Mapping): |
| 116 | return {key: to_float(data[key]) for key in data} |
| 117 | elif isinstance(data, container_abcs.Sequence) and \ |
| 118 | not isinstance(data, string_classes): |
| 119 | return [to_float(d) for d in data] |
| 120 | else: |
| 121 | return data |
| 122 | |
| 123 | |
| 124 | def get_and_setattr(cfg, name, default): |
nothing calls this directly
no outgoing calls
no test coverage detected