code: def check_linear_conv_1d_row(lazy_init: bool, seq_parallel: bool):
      ctx = LazyInitContext() if lazy_init else nullcontext()
  
      linear = Conv1D(192, 48).cuda()
      with ctx:
          linear_copy = Conv1D(192, 48).cuda()
      linear_row = GPT2FusedLinearConv1D_Row.from_native_module(
          linear_copy,
          process_group=None,
          parallel_input=False,
          seq_parallel=seq_parallel,
      )
  
      assert linear.weight.shape == torch.Size([48, 192])
      assert linear_row.weight.shape == torch.Size([24, 192])
      assert linear_row.bias.shape == torch.Size([192])
      assert linear_copy.weight is linear_row.weight
      assert linear_copy.bias is linear_row.bias
  
      # ensure weights are reversibly loadable
      linear_row.load_state_dict(linear.state_dict())
      linear.load_state_dict(linear_row.state_dict())
  
      # check computation correctness
      x = torch.rand(1, 4, 48).cuda()
      out = linear(x)
      gather_out = linear_row(x)
      target_out = (
          out
          if seq_parallel is False
          else torch.chunk(out.clone(), 2, dim=1)[dist.get_rank()]
      )
      assert_close(target_out, gather_out)
  
      # check backward correctness
      out.sum().backward()
      gather_out.sum().backward()
  
      rank = dist.get_rank()
      target_grad = torch.chunk(linear.weight.grad, 2, dim=0)[rank]
      assert_close(target_grad, linear_row.weight.grad)
  
file_path: colossalai/tests/test_shardformer/test_layer/test_gpt2_qkv_fused_linear_1d.py
imports: from contextlib import nullcontext
  import torch
  import torch.distributed
  import torch.nn
  from torch.testing import assert_close
  import colossalai
  from colossalai.lazy import LazyInitContext
  from colossalai.shardformer.layer import GPT2FusedLinearConv1D_Col, GPT2FusedLinearConv1D_Row
  from colossalai.shardformer.layer.qkv_fused_linear import split_fused_qkv_in_gpt2_style
  from colossalai.testing import parameterize, rerun_if_address_is_in_use, spawn
label_desc: Use image node_id 3 for calling a global function with example usage: check_linear_conv_1d_row(lazy_init, seq_parallel) without return types