Home / Function/ testChannelsLastConv3d() — pytorch Function Reference

testChannelsLastConv3d() — pytorch Function Reference

Architecture documentation for the testChannelsLastConv3d() function in PytorchTestBase.java from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  4dd563d1_31f4_a7b3_750a_66a63f8affdc["testChannelsLastConv3d()"]
  fd3711c0_c2a1_0848_309d_ba2ef1be4466["loadModel()"]
  4dd563d1_31f4_a7b3_750a_66a63f8affdc -->|calls| fd3711c0_c2a1_0848_309d_ba2ef1be4466
  076e553b_79aa_4059_bfb2_6682a21ae462["assertIValueTensor()"]
  4dd563d1_31f4_a7b3_750a_66a63f8affdc -->|calls| 076e553b_79aa_4059_bfb2_6682a21ae462
  style 4dd563d1_31f4_a7b3_750a_66a63f8affdc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

android/pytorch_android/src/androidTest/java/org/pytorch/PytorchTestBase.java lines 408–486

  @Test
  public void testChannelsLastConv3d() throws IOException {
    long[] inputShape = new long[] {1, 3, 2, 2, 2};
    long[] dataNCDHW = new long[] {
      1111, 1112,
      1121, 1122,
      1211, 1212,
      1221, 1222,

      2111, 2112,
      2121, 2122,
      2211, 2212,
      2221, 2222,

      3111, 3112,
      3121, 3122,
      3211, 3212,
      3221, 3222};
    Tensor inputNCDHW = Tensor.fromBlob(dataNCDHW, inputShape, MemoryFormat.CONTIGUOUS);
    long[] dataNDHWC = new long[] {
      1111, 2111, 3111,
      1112, 2112, 3112,

      1121, 2121, 3121,
      1122, 2122, 3122,

      1211, 2211, 3211,
      1212, 2212, 3212,

      1221, 2221, 3221,
      1222, 2222, 3222};

    Tensor inputNDHWC = Tensor.fromBlob(dataNDHWC, inputShape, MemoryFormat.CHANNELS_LAST_3D);

    long[] weightShape = new long[] {3, 3, 1, 1, 1};
    long[] dataWeightOIDHW = new long[] {
      2, 0, 0,
      0, 1, 0,
      0, 0, -1,
    };
    Tensor wNCDHW = Tensor.fromBlob(dataWeightOIDHW, weightShape, MemoryFormat.CONTIGUOUS);
    long[] dataWeightODHWI = new long[] {
      2, 0, 0,
      0, 1, 0,
      0, 0, -1,
    };
    Tensor wNDHWC = Tensor.fromBlob(dataWeightODHWI, weightShape, MemoryFormat.CHANNELS_LAST_3D);

    final Module module = loadModel(TEST_MODULE_ASSET_NAME);

    final IValue outputNCDHW =
        module.runMethod("conv3d", IValue.from(inputNCDHW), IValue.from(wNCDHW), IValue.from(false));
    assertIValueTensor(
        outputNCDHW,
        MemoryFormat.CONTIGUOUS,
        new long[] {1, 3, 2, 2, 2},
        new long[] {
          2*1111, 2*1112,     2*1121, 2*1122,
          2*1211, 2*1212,     2*1221, 2*1222,

          2111, 2112,     2121, 2122,
          2211, 2212,     2221, 2222,

          -3111, -3112,     -3121, -3122,
          -3211, -3212,     -3221, -3222});

    final IValue outputNDHWC =
        module.runMethod("conv3d", IValue.from(inputNDHWC), IValue.from(wNDHWC), IValue.from(true));
    assertIValueTensor(
        outputNDHWC,
        MemoryFormat.CHANNELS_LAST_3D,
        new long[] {1, 3, 2, 2, 2},
        new long[] {
          2*1111, 2111, -3111,      2*1112, 2112, -3112,
          2*1121, 2121, -3121,      2*1122, 2122, -3122,

          2*1211, 2211, -3211,      2*1212, 2212, -3212,
          2*1221, 2221, -3221,      2*1222, 2222, -3222});
  }

Subdomains

Frequently Asked Questions

What does testChannelsLastConv3d() do?
testChannelsLastConv3d() is a function in the pytorch codebase.
What does testChannelsLastConv3d() call?
testChannelsLastConv3d() calls 2 function(s): assertIValueTensor, loadModel.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free