Skip to content

Pad operator: Negative pads value not supported. #2433

@FlorentGuinier

Description

@FlorentGuinier

Describe the bug
Pad operator: Negative pads value not supported (shape is correct values look like garbage memory).

Urgency
Pad node with a negative pad amount are usefull to perform crop. As negative pad is relative to the size of the input while, a slice operation is hard-coded, meaning a network cannot change input resolution later. ONNX specs support negative pad amount, having ONNX runtime support it as well is a must have for us.

System information

  • OS: Windows 10
  • ONNX Runtime installed from (source or binary): From binary (pip)
  • ONNX Runtime version: tryed both 0.5 and 1.0 (ie same problem with both)
  • ONNX version : 1.2.2
  • Python version: Python 3.6.8
  • Visual Studio version (if applicable): NA
  • GCC/Compiler version (if compiling from source): NA
  • CUDA/cuDNN version: NA
  • GPU model and memory: NA

To Reproduce
Run the attached python script negative_pad_onnxruntime_repro_bug.py.txt
Look at output tensor values.

Expected behavior
According to ONNX Negative Padding should be supported:
https://github.com/onnx/onnx/blob/master/docs/Operators.md#Pad

Running the script attached shows that it is not the case, ie the output tensor shape is correct while values look like uninitialized memory.

Screenshots
image

Additional context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions