locnd182644 opened a new pull request, #18668:
URL: https://github.com/apache/tvm/pull/18668
This PR supported Local Response Normalization operator for ONNX.
### Description
Implement and Test Local Response Normalization operator for ONNX frontend.
### Implement
- Using avg_pool operator to compute LRN
- Pseudocode:
```
def local_response_norm(input, size, alpha, beta, k):
dim = input.dim()
check_only_support_3D_4D()
div = input.mul(input)
div = expand_dim(div, 1)
pad_len = size // 2
if dim == 3:
div = avg_pool2d(div,
(size, 1),
stride=1,
padding=(pad_len, 0, pad_len, 0))
else:
div = avg_pool3d(div,
(size, 1, 1),
stride=1,
padding=(pad_len, 0, 0, pad_len, 0, 0))
div = squeeze_dim(div, 1)
div = div.mul(alpha).add(k).pow(beta)
return input / div
```
### Reference
Implement same as Pytorch:
https://discuss.pytorch.org/t/why-use-avgpool2d-and-avgpool3d-in-local-response-norm/97236
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]