arangasa opened a new pull request, #15367:
URL: https://github.com/apache/tvm/pull/15367
When one of the inputs to Mul and Sub are constant scalars, we have the
following algebraic identity:
Let res[p,q,r,s] denote the result of Mul(a, c1)->Sub(c2)->Conv(W) pattern
res[p,q,r,s] = Conv(a*c1 - c2, W)
= SUM{i=[0,c-1], j=[0,kh-1], k=[0,kw-1]}
{(a[p,i,r+j,s+k] * c1 - c2) * W[q,i,j,k]}
= SUM{i=[0,c-1], j=[0,kh-1], k=[0,kw-1]}
{a[p,i,r+j,s+k] * c1 * W[q,i,j,k]} - c2 * W[q,i,j,k]}
= Conv(a, W*c1) + Conv(0-c2, W)
Since Conv(0-c2,W) and W*c1 are constant terms, they could be computed
during compile time.
--
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]