code: def test_step_mixed_precision_inferred():
      weight, bias, input = make_half_precision_params()
      optimizer = Adam([weight, bias], lr=1e-3)
      step_test(optimizer, weight, bias, input)
  
      assert len(optimizer.fp32_param_groups) == len(
          optimizer.param_groups
      )
  
      for fp32_group, fp16_group in zip(
          optimizer.fp32_param_groups, optimizer.param_groups
      ):
          for fp32_p, fp16_p in zip(
              fp32_group["params"], fp16_group["params"]
          ):
  
              def assert_almost_zero(x):
                  assert abs(x) < 1e-3
                  return 1.0
  
              assert fp32_p.dtype == torch.float32
              if fp16_p.requires_grad:
                  assert fp16_p.dtype == torch.float16
                  (fp32_p - fp16_p).to("cpu").detach().apply_(
                      assert_almost_zero
                  )
  
      assert optimizer.state[weight]["exp_avg"].dtype == torch.float32
      assert (
          optimizer.state[weight]["exp_avg_sq"].dtype == torch.float32
      )
      assert optimizer.state[bias]["exp_avg"].dtype == torch.float32
      assert optimizer.state[bias]["exp_avg_sq"].dtype == torch.float32
  
imports: from copy import deepcopy
  import functools
  import pytest
  import torch
label_desc: Use image node_id 8 for calling a global function with example usage: test_step_mixed_precision_inferred() and returns: int