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

Aperta
#20,971 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
Python
Stelle
13.9k
Fork
4.1k
Merge medio
4g 22h
PR unite (30g)
22

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/tvm

Tutte le issue di apache/tvm

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.