jikechao opened a new pull request, #14796: URL: https://github.com/apache/tvm/pull/14796
The calculation formula of `CELU` is wrong. This pr fix it. From the [pytorch documentation](https://pytorch.org/docs/1.7.1/generated/torch.nn.CELU.html?highlight=celu#torch.nn.CELU), we can get the calculating logic of CELU.  ### Reproducable Script ``` import torch from tvm import relay import tvm import numpy as np m = torch.nn.CELU() input_data = torch.tensor([[-1.0, 2.0]], dtype=torch.float32) torch_outputs = m(input_data) trace = torch.jit.trace(m, input_data) input_shapes = [('input0', torch.Size([1, 2]))] mod, params = relay.frontend.from_pytorch(trace, input_shapes) with tvm.transform.PassContext(opt_level=3): exe = relay.create_executor('graph', mod=mod, params=params, device=tvm.device('llvm', 0), target='llvm').evaluate() input_tvm = dict(zip(['input0'], [inp.clone().cpu().numpy() for inp in input_data])) tvm_outputs = exe(**input_tvm).asnumpy() np.testing.assert_allclose(torch_outputs, tvm_outputs, rtol=1e-3, atol=1e-3) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
