code: def test_dwconv1d_fold(
      channels, input_size, kernel_size, padding, dilation, bias, dtype
  ):
      device = "cuda"
      rtol, atol = (
          (1e-5, 1e-6) if dtype == torch.float32 else (1e-3, 1e-3)
      )
      # set seed
      torch.random.manual_seed(0)
      batch_size = 32
      x = torch.randn(
          batch_size, channels, input_size, device=device, dtype=dtype
      )
      w = torch.randn(
          channels, 1, kernel_size, device=device, dtype=dtype
      )
      bias = (
          torch.randn(channels, device=device, dtype=dtype)
          if bias
          else None
      )
      out_ref = F.conv1d(
          x,
          w,
          bias,
          padding=padding,
          dilation=dilation,
          groups=w.shape[0],
      )
      out = dwconv1d_fold(x, w, bias, padding, dilation)
      assert torch.allclose(out, out_ref, rtol=rtol, atol=atol)
  
file_path: zoo/tests/ops/test_dwconv.py
imports: import math
  import torch
  import torch.nn.functional
  import pytest
  from einops import rearrange
  from src.ops.dwconv import dwconv2d_ref, dwconv2d_unfold, dwconv1d_fold, dwconv2d_fold, dwconv2d_fft
label_desc: Use image node_id 2 for calling a global function with example usage: test_dwconv1d_fold(channels, input_size, kernel_size, padding, dilation, bias, dtype) without return types