Tensara Logo

tensara

4D Tensor-Matrix Multiplication

HARD

Perform 4D tensor-matrix multiplication of two tensors:

C[b][i][j][k]=l=0L1A[b][i][j][l]B[l][k]C[b][i][j][k] = \sum_{l=0}^{L-1} A[b][i][j][l] \cdot B[l][k]

Input

  • Tensor AA of size B×I×J×LB \times I \times J \times L
  • Matrix BB of size L×KL \times K

Output

  • Tensor CC of size B×I×J×KB \times I \times J \times K

Notes:

  • All tensors A\text{A}, B\text{B}, and C\text{C} are stored in row-major order
  • This problem is adapted from KernelBench

GPU Type

Language

Data Type

Loading...

Loading editor...

CUDA C++ environment

Sample Run Results

Hit "Run" to test your code with sample inputs

Desktop Required for Code Submission

For the best coding experience, please switch to a desktop device to write and submit your solution.