docstr: Test ConvReduce3D.
docstr_tok: ["Test","ConvReduce3D","."]
code: def test_create_stack_conv(self):
      """
      Test ConvReduce3D.
      """
      for input_dim, output_dim in itertools.product(
          (2, 4), (4, 8, 16)
      ):
          model = ConvReduce3D(
              in_channels=input_dim,
              out_channels=output_dim,
              kernel_size=((1, 1, 1), (3, 3, 3), (1, 3, 3)),
              stride=((1, 1, 1), (1, 1, 1), None),
              padding=((0, 0, 0), (1, 1, 1), (0, 1, 1)),
              dilation=((2, 2, 2), (1, 1, 1), None),
              groups=(1, 2, None),
              bias=(True, False, None),
          )
          model_gt_list = [
              nn.Conv3d(
                  in_channels=input_dim,
                  out_channels=output_dim,
                  kernel_size=(1, 1, 1),
                  stride=(1, 1, 1),
                  padding=(0, 0, 0),
                  dilation=(2, 2, 2),
                  groups=1,
                  bias=True,
              ),
              nn.Conv3d(
                  in_channels=input_dim,
                  out_channels=output_dim,
                  kernel_size=(3, 3, 3),
                  stride=(1, 1, 1),
                  padding=(1, 1, 1),
                  dilation=(1, 1, 1),
                  groups=2,
                  bias=False,
              ),
              nn.Conv3d(
                  in_channels=input_dim,
                  out_channels=output_dim,
                  kernel_size=(1, 3, 3),
                  padding=(0, 1, 1),
              ),
          ]
          model.convs[0].load_state_dict(
              model_gt_list[0].state_dict(), strict=True
          )  # explicitly use strict mode.
          model.convs[1].load_state_dict(
              model_gt_list[1].state_dict(), strict=True
          )  # explicitly use strict mode.
          model.convs[2].load_state_dict(
              model_gt_list[2].state_dict(), strict=True
          )  # explicitly use strict mode.
  
          # Test forwarding.
          for tensor in TestConvReduce3D._get_inputs(input_dim):
              if tensor.shape[1] != input_dim:
                  with self.assertRaises(RuntimeError):
                      output_tensor = model(tensor)
                  continue
              else:
                  output_tensor = model(tensor)
                  output_gt = []
                  for ind in range(3):
                      output_gt.append(model_gt_list[ind](tensor))
                  output_tensor_gt = torch.stack(output_gt, dim=0).sum(
                      dim=0, keepdim=False
                  )
  
              self.assertEqual(
                  output_tensor.shape,
                  output_tensor_gt.shape,
                  "Output shape {} is different from expected shape {}".format(
                      output_tensor.shape, output_tensor_gt.shape
                  ),
              )
  
file_path: pytorchvideo/tests/test_layers_convolutions.py
imports: import itertools
  import unittest
  import numpy
  import torch
  from pytorchvideo.layers.convolutions import Conv2plus1d, ConvReduce3D, create_conv_2plus1d
  from torch import nn
label_desc: Use image node_id 2 for calling the TestConvReduce3D obj's underlying member method code with example usage: obj.test_create_stack_conv() without return types