FunFact icon indicating copy to clipboard operation
FunFact copied to clipboard

[REQ] Index arithmetics

Open yhtang opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. The FunFact tensor expression syntax lacks a way to express convolutions and tensor reshaping in a convenient manner.

Describe the solution you'd like We could use index addition to denote convolution, e.g.

A[i+p, j+q] B[p, q]  #convolving A with B using B as a filter.

Following a similar line of thought, index multiplication can denote both reshaping and Kronecker product (since Kronecker product can be thought of as outer product + reshaping):

A[i] B[j] >> [i*j]  # Kronecker product between A and B
A[i, j, k] >> [i*j, k]  #reshape two first dimensions of A to a vector

Describe alternatives you've considered Currently, we have the unary * operator to denote Kronecker product, e.g.:

A[[*i]] B[[*i]]  # Kronecker product between A

but we do not have the means to express reshaping or convolution yet.

Additional context #216.

yhtang avatar Mar 28 '22 04:03 yhtang