onnx2pytorch icon indicating copy to clipboard operation
onnx2pytorch copied to clipboard

A lot of Ops with their implementations.

Open ZhangZhiPku opened this issue 2 years ago • 0 comments

Hi, developer team of onnx2pytorch. I am currently developing an neural network quantization framework: https://github.com/openppl-public/ppq/tree/master/ppq. The really interesting part is that we both need to run an onnx model with pytorch : ) I am glad to share our operator implementations with you: https://github.com/openppl-public/ppq/blob/master/ppq/executor/op/torch/default.py

We support following onnx operators by now(Still work in progress):

  1. 'Abs': Abs_forward,
  2. 'AdaptiveAvgPool2d': AdaptiveAvgPool2d_forward,
  3. 'And':And_forward,
  4. 'Add': Add_forward,
  5. 'ArgMax': ArgMax_forward,
  6. 'AveragePool': AveragePool_forward,
  7. 'BatchNormalization': BatchNormalization_forward,
  8. 'Cast': Cast_forward,
  9. 'Clip': Clip_forward,
  10. 'Concat': Concat_forward,
  11. 'Constant': Constant_forward,
  12. 'ConstantOfShape': ConstantOfShape_forward,
  13. 'Conv': Conv_forward,
  14. 'ConvTranspose': ConvTranspose_forward,
  15. 'Cos': Cos_forward,
  16. 'Div': Eltwise_forward,
  17. 'Equal': Equal_forward,
  18. 'Exp': UnaryEltwise_forward,
  19. 'Expand': Expand_forward,
  20. 'Flatten': Flatten_forward,
  21. 'Gather': Gather_forward,
  22. 'GatherElements': Gather_forward,
  23. 'GatherND': GatherND_forward,
  24. 'Gelu': Gelu_forward,
  25. 'Gemm': Gemm_forward,
  26. 'grid_sampler': Grid_sampler_forward,
  27. 'GlobalAveragePool': AveragePool_forward,
  28. 'GlobalMaxPool': MaxPool2d_forward,
  29. 'Greater': Greater_forward,
  30. 'LayerNorm': LayerNorm_forward,
  31. 'LeakyRelu': LeakyRelu_forward,
  32. 'Less': Less_forward,
  33. 'LogSoftmax': LogSoftmax_forward,
  34. 'MatMul': MatMul_forward,
  35. 'Max': Eltwise_forward,
  36. 'MaxPool': MaxPool2d_forward,
  37. 'Min': Eltwise_forward,
  38. 'Mul': Mul_forward,
  39. 'MultiHeadAttention': MultiHeadAttention_forward,
  40. 'NonMaxSuppression': _NMS_forward,
  41. 'NonZero': NonZero_forward,
  42. 'Not': Not_forward,
  43. 'Pad': Pad_forward,
  44. 'PRelu': PRelu_forward,
  45. 'Range': Range_forward,
  46. 'ReduceL2': ReduceL2_forward,
  47. 'ReduceMax': ReduceMax_forward,
  48. 'ReduceMean': ReduceMean_forward,
  49. 'ReduceSum': ReduceSum_forward,
  50. 'Relu': UnaryEltwise_forward,
  51. 'Reshape': Reshape_forward,
  52. 'Resize': Resize_forward,
  53. 'ScatterElements': ScatterElements_forward,
  54. 'ScatterND': ScatterND_forward,
  55. 'Shape': Shape_forward,
  56. 'Sigmoid': UnaryEltwise_forward,
  57. 'Sin': Sin_forward,
  58. 'Slice': Slice_forward,
  59. 'Softmax': Softmax_forward,
  60. 'Softplus': Softplus_forward,
  61. 'Split': Split_forward,
  62. 'Squeeze': Squeeze_forward,
  63. 'Sub': Eltwise_forward,
  64. 'Tile': Tile_forward,
  65. 'TopK': TopK_forward,
  66. 'Transpose': Transpose_forward,
  67. 'Unsqueeze': Unsqueeze_forward,
  68. 'Where': Where_forward,
  69. 'Sqrt': Sqrt_forward,
  70. 'Log': Log_forward,
  71. 'Floor': Floor_forward,
  72. 'RoiAlign': RoiAlign_forward,
  73. 'MMCVRoiAlign': MMCVRoiAlign_forward,
  74. 'SpaceToDepth': SpaceToDepth_forward,
  75. 'DepthToSpace': DepthToSpace_forward,
  76. 'Scale': Scale_forward, # caffe op
  77. 'Tanh': Tanh_forward,
  78. 'Pow': Pow_forward,
  79. 'Crop': Crop_forward, # caffe op
  80. 'ChannelShuffle': ChannelShuffle_forward, # caffe op
  81. 'InstanceNormalization': InstanceNormalization_forward,
  82. 'Parameter': Parameter_forward, # caffe op
  83. 'Interp': Interp_forward, # caffe op
  84. 'CaffeArgMax': CaffeArgMax_forward, # caffe op
  85. 'HardSigmoid': HardSigmoid_forward,
  86. 'HardSwish': HardSwish_forward,
  87. 'Neg': Neg_forward,
  88. 'GRU': GRU_forward,
  89. 'PPQDeviceSwitch': PPQDeviceSwitch_forward,
  90. 'Identity': Identity_forward,
  91. 'OneHot': Onehot_forward,
  92. 'Reciprocal': Reciprocal_forward,
  93. 'LSTM': LSTM_forward,

ZhangZhiPku avatar Jul 01 '22 14:07 ZhangZhiPku