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
  e1bd8518_ad6a_02fc_6465_54e0b305a8a6["testChannelsLast()"]
  fd3711c0_c2a1_0848_309d_ba2ef1be4466["loadModel()"]
  e1bd8518_ad6a_02fc_6465_54e0b305a8a6 -->|calls| fd3711c0_c2a1_0848_309d_ba2ef1be4466
  076e553b_79aa_4059_bfb2_6682a21ae462["assertIValueTensor()"]
  e1bd8518_ad6a_02fc_6465_54e0b305a8a6 -->|calls| 076e553b_79aa_4059_bfb2_6682a21ae462
  style e1bd8518_ad6a_02fc_6465_54e0b305a8a6 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);
  }

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