(self, inputs)
| 3178 | return loss |
| 3179 | |
| 3180 | def _cast_inputs_half(self, inputs): |
| 3181 | if isinstance(inputs, (list, tuple)): |
| 3182 | new_inputs = [] |
| 3183 | for v in inputs: |
| 3184 | new_inputs.append(self._cast_inputs_half(v)) |
| 3185 | return inputs.__class__(new_inputs) |
| 3186 | elif isinstance(inputs, dict): |
| 3187 | new_inputs = {} |
| 3188 | for k, v in inputs.items(): |
| 3189 | new_inputs[k] = self._cast_inputs_half(v) |
| 3190 | return new_inputs |
| 3191 | elif hasattr(inputs, 'half') and inputs.is_floating_point(): |
| 3192 | return inputs.half() |
| 3193 | else: |
| 3194 | return inputs |
| 3195 | |
| 3196 | def print_forward_breakdown(self, fwd_time): |
| 3197 | gate_time = 0.0 |
no test coverage detected