Home / Function/ testChannelsLast() — pytorch Function Reference

testChannelsLast() — pytorch Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2c58f1a1_7185_7051_7e46_cc91578abcf3["testChannelsLast()"]
  9f728842_eeeb_dcbf_a87a_1decf4b380f8["loadModel()"]
  2c58f1a1_7185_7051_7e46_cc91578abcf3 -->|calls| 9f728842_eeeb_dcbf_a87a_1decf4b380f8
  85d31af6_c650_49cb_5d35_da29aa71d31c["assertIValueTensor()"]
  2c58f1a1_7185_7051_7e46_cc91578abcf3 -->|calls| 85d31af6_c650_49cb_5d35_da29aa71d31c
  style 2c58f1a1_7185_7051_7e46_cc91578abcf3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

android/pytorch_android/src/androidTest/java/org/pytorch/PytorchTestBase.java lines 315–329

  @Test
  public void testChannelsLast() throws IOException {
    long[] inputShape = new long[] {1, 3, 2, 2};
    long[] data = new long[] {1, 11, 101, 2, 12, 102, 3, 13, 103, 4, 14, 104};
    Tensor inputNHWC = Tensor.fromBlob(data, inputShape, MemoryFormat.CHANNELS_LAST);
    final Module module = loadModel(TEST_MODULE_ASSET_NAME);
    final IValue outputNCHW = module.runMethod("contiguous", IValue.from(inputNHWC));
    assertIValueTensor(
        outputNCHW,
        MemoryFormat.CONTIGUOUS,
        new long[] {1, 3, 2, 2},
        new long[] {1, 2, 3, 4, 11, 12, 13, 14, 101, 102, 103, 104});
    final IValue outputNHWC = module.runMethod("contiguousChannelsLast", IValue.from(inputNHWC));
    assertIValueTensor(outputNHWC, MemoryFormat.CHANNELS_LAST, inputShape, data);
  }

Domain

Subdomains

Frequently Asked Questions

What does testChannelsLast() do?
testChannelsLast() is a function in the pytorch codebase.
What does testChannelsLast() call?
testChannelsLast() 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