[Feature][Relax][ONNX] Support CenterCropPad operator in Relax ONNX frontend

Đang mở
#20,971 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend-api-design

Hướng nghiên cứu

Start with python/tvm/relax/frontend/onnx/onnx_frontend.py and read how the Relax ONNX frontend translates operators using slicing and padding. Check the ONNX CenterCropPad specification for opset 18+, especially axes defaults and symmetric crop or pad behavior. Done means the frontend handles the operator and produces the requested output shape for both cropping and padding.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Feature Description

Support the ONNX CenterCropPad operator in the Apache TVM Relax ONNX frontend (python/tvm/relax/frontend/onnx/onnx_frontend.py).

Motivation

CenterCropPad crops and/or pads input tensors centered along specified axes to reach a desired spatial shape. It is a standard building block in computer vision data pipelines and end-to-end vision inference models where image preprocessing is embedded directly into the ONNX graph.

Standardized in ONNX opset 18+, CenterCropPad is currently not supported in the Relax ONNX frontend, resulting in:

NotImplementedError: The following operators are not supported: ['CenterCropPad']

This operator was also highlighted in the ONNX operator coverage RFC tracking issue #20124 under Cropping / Sequence operators.

Operator Specification (ONNX Opset 18+)
  • Inputs:
    1. input_data: N-D input tensor (float32, float16, uint8, etc.).
    2. shape: 1D integer tensor specifying the target shape along the specified axes.
  • Attributes:
    • axes: list of ints (optional) - the axes along which to crop/pad (defaults to [-2, -1] for spatial dims).
  • Outputs:
    1. output_data: Cropped and/or padded tensor matching the target shape.
Expected Behavior

The Relax ONNX frontend should implement CenterCropPad by comparing input dimensions with target dimensions:

  1. For dimensions where target < input: compute symmetric start/end indices and apply relax.op.strided_slice.
  2. For dimensions where target > input: compute symmetric left/right pad widths and apply relax.op.pad.
Ngôn ngữ chính
Python
Star
13.9k
Fork
4.1k
Merge trung bình
4 ngày 22 giờ
Pull request đã merge (30 ngày)
22

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/tvm

Tất cả issue của apache/tvm

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.