Home / Function/ imageYUV420CenterCropToFloat32Tensor() — pytorch Function Reference

imageYUV420CenterCropToFloat32Tensor() — pytorch Function Reference

Architecture documentation for the imageYUV420CenterCropToFloat32Tensor() function in TensorImageUtils.java from the pytorch codebase.

Entity Profile

Dependency Diagram

graph TD
  e7383de7_aca7_58ff_fd0d_6065330d96d2["imageYUV420CenterCropToFloat32Tensor()"]
  05a4bac3_dc7f_c9e5_0d8d_97a63304a618["checkNormMeanArg()"]
  e7383de7_aca7_58ff_fd0d_6065330d96d2 -->|calls| 05a4bac3_dc7f_c9e5_0d8d_97a63304a618
  e79553c3_aa4f_f1b9_50e7_c07930a30ab1["checkNormStdArg()"]
  e7383de7_aca7_58ff_fd0d_6065330d96d2 -->|calls| e79553c3_aa4f_f1b9_50e7_c07930a30ab1
  59a3758a_6352_bb5a_8fba_62fd7f7216df["checkRotateCWDegrees()"]
  e7383de7_aca7_58ff_fd0d_6065330d96d2 -->|calls| 59a3758a_6352_bb5a_8fba_62fd7f7216df
  091f809b_08d7_75e4_b6a4_9d012fd740cb["checkTensorSize()"]
  e7383de7_aca7_58ff_fd0d_6065330d96d2 -->|calls| 091f809b_08d7_75e4_b6a4_9d012fd740cb
  033b0d29_939c_36ed_1162_fbed5ef045ff["allocateFloatBuffer()"]
  e7383de7_aca7_58ff_fd0d_6065330d96d2 -->|calls| 033b0d29_939c_36ed_1162_fbed5ef045ff
  fff97aed_e384_1976_ed4b_d94a2ed220dd["fromBlob()"]
  e7383de7_aca7_58ff_fd0d_6065330d96d2 -->|calls| fff97aed_e384_1976_ed4b_d94a2ed220dd
  5ed98bb2_a3e0_69aa_a5c4_dffa35d89514["imageYUV420CenterCropToFloatBuffer()"]
  e7383de7_aca7_58ff_fd0d_6065330d96d2 -->|calls| 5ed98bb2_a3e0_69aa_a5c4_dffa35d89514
  style e7383de7_aca7_58ff_fd0d_6065330d96d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

android/pytorch_android_torchvision/src/main/java/org/pytorch/torchvision/TensorImageUtils.java lines 195–226

  public static Tensor imageYUV420CenterCropToFloat32Tensor(
      final Image image,
      int rotateCWDegrees,
      final int tensorWidth,
      final int tensorHeight,
      float[] normMeanRGB,
      float[] normStdRGB,
      MemoryFormat memoryFormat) {
    if (image.getFormat() != ImageFormat.YUV_420_888) {
      throw new IllegalArgumentException(
          String.format(
              Locale.US, "Image format %d != ImageFormat.YUV_420_888", image.getFormat()));
    }

    checkNormMeanArg(normMeanRGB);
    checkNormStdArg(normStdRGB);
    checkRotateCWDegrees(rotateCWDegrees);
    checkTensorSize(tensorWidth, tensorHeight);

    final FloatBuffer floatBuffer = Tensor.allocateFloatBuffer(3 * tensorWidth * tensorHeight);
    imageYUV420CenterCropToFloatBuffer(
        image,
        rotateCWDegrees,
        tensorWidth,
        tensorHeight,
        normMeanRGB,
        normStdRGB,
        floatBuffer,
        0,
        memoryFormat);
    return Tensor.fromBlob(floatBuffer, new long[] {1, 3, tensorHeight, tensorWidth}, memoryFormat);
  }

Subdomains

Frequently Asked Questions

What does imageYUV420CenterCropToFloat32Tensor() do?
imageYUV420CenterCropToFloat32Tensor() is a function in the pytorch codebase.
What does imageYUV420CenterCropToFloat32Tensor() call?
imageYUV420CenterCropToFloat32Tensor() calls 7 function(s): allocateFloatBuffer, checkNormMeanArg, checkNormStdArg, checkRotateCWDegrees, checkTensorSize, fromBlob, imageYUV420CenterCropToFloatBuffer.

Analyze Your Own Codebase

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

Try Supermodel Free