(self, inputs)
| 3105 | return loss |
| 3106 | |
| 3107 | def _cast_inputs_half(self, inputs): |
| 3108 | if isinstance(inputs, (list, tuple)): |
| 3109 | new_inputs = [] |
| 3110 | for v in inputs: |
| 3111 | new_inputs.append(self._cast_inputs_half(v)) |
| 3112 | return inputs.__class__(new_inputs) |
| 3113 | elif isinstance(inputs, dict): |
| 3114 | new_inputs = {} |
| 3115 | for k, v in inputs.items(): |
| 3116 | new_inputs[k] = self._cast_inputs_half(v) |
| 3117 | return new_inputs |
| 3118 | elif hasattr(inputs, 'half') and inputs.is_floating_point(): |
| 3119 | return inputs.half() |
| 3120 | else: |
| 3121 | return inputs |
| 3122 | |
| 3123 | def print_forward_breakdown(self, fwd_time): |
| 3124 | gate_time = 0.0 |
no test coverage detected