code: def test_type_change():
      size = (5, 6)
      param = torch.rand(size, requires_grad=True)
      param_ = param.clone()
  
      bucket = ParamBucket(30, param.dtype, param.device)
      bucket.add_param(param)
  
      # Move the bucket to fp16 and back
      bucket.to(dtype=torch.float16, device=param.device)
      assert bucket.buffer.dtype == torch.float16
  
      bucket.to(
          dtype=torch.float32,
          device=param.device,
          keep_param_alignment=True,
      )
      assert bucket.buffer.dtype == torch.float32
  
      # Same with the reference tensor
      param_.to(dtype=torch.float16)
      param_.to(dtype=torch.float32)
  
      torch.allclose(param, param_)
  
imports: import pytest
  import torch
  from fairscale.nn.misc import ParamBucket
label_desc: Use image node_id 4 for calling a global function with example usage: test_type_change() without return types