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

オープン
#20,971 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.
主要言語
Python
スター
13.9k
フォーク
4.1k
平均マージ
4日 22時間
マージ済み PR(30日)
22

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/tvm のほかの issue

apache/tvm の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。