Abjindal/torch api change gelu (#10833)

* changing gelu backward op and adding required files

* cleaning up file and adding comments

* version comparison issue
This commit is contained in:
Abhishek Jindal 2022-03-10 11:56:30 -08:00 committed by GitHub
parent 1d545dfe87
commit 3ae2bfaefe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,7 +11,7 @@ from opgen.onnxops import *
import torch
from packaging import version
TORCH_API_CHANGE_VERSION = "1.11.0"
TORCH_API_CHANGE_VERSION = "1.11.1"
kMSDomain = 'onnxruntime::kMSDomain'
@ -101,7 +101,7 @@ hand_implemented = {
# Signature of gelu_backward was changed in this commit id 983ba5e585485ed61a0c0012ef6944f5685e3d97 and PR 61439
# This is done to make sure it is backward and future compatible
if version.parse(torch.__version__) <= version.parse(TORCH_API_CHANGE_VERSION):
if version.parse(torch.__version__) < version.parse(TORCH_API_CHANGE_VERSION):
hand_implemented['aten::gelu_backward'] = GeluGrad('grad', 'self')
else:
hand_implemented['aten::gelu_backward'] = GeluGrad('grad_output', 'self')