code: def test_4bit_warnings():
      dim1 = 64
  
      with pytest.warns(UserWarning, match=r"inference or training"):
          net = nn.Sequential(
              *[
                  bnb.nn.Linear4bit(
                      dim1, dim1, compute_dtype=torch.float32
                  )
                  for i in range(10)
              ]
          )
          net = net.cuda()
          inp = torch.rand(10, dim1).cuda().half()
          net(inp)
      with pytest.warns(UserWarning, match=r"inference."):
          net = nn.Sequential(
              *[
                  bnb.nn.Linear4bit(
                      dim1, dim1, compute_dtype=torch.float32
                  )
                  for i in range(10)
              ]
          )
          net = net.cuda()
          inp = torch.rand(1, dim1).cuda().half()
          net(inp)
  
      with pytest.warns(UserWarning) as record:
          net = nn.Sequential(
              *[
                  bnb.nn.Linear4bit(
                      dim1, dim1, compute_dtype=torch.float32
                  )
                  for i in range(10)
              ]
          )
          net = net.cuda()
          inp = torch.rand(10, dim1).cuda().half()
          net(inp)
  
          net = nn.Sequential(
              *[
                  bnb.nn.Linear4bit(
                      dim1, dim1, compute_dtype=torch.float32
                  )
                  for i in range(10)
              ]
          )
          net = net.cuda()
          inp = torch.rand(1, dim1).cuda().half()
          net(inp)
  
      assert len(record) == 2
  
imports: from itertools import product
  import pytest
  import torch
  from torch import nn
  import bitsandbytes
label_desc: Use image node_id 9 for calling a global function with example usage: test_4bit_warnings() without return types