# How can we compute batch matrix-matrix product of matrices (3-D tensors) in MATLAB?

15 views (last 30 days)

Show older comments

##### 0 Comments

### Accepted Answer

Bruno Luong
on 5 Dec 2023

b = 2;

n = 3;

m = 4;

p = 5;

A = rand(b,n,m);

B = rand(b, m,p);

AA = permute(A, [2 3 1]);

BB = permute(B, [2 4 1 3]);

AB=pagemtimes(AA, BB);

AB=permute(AB,[3 1 4 2]);

size(AB)

AB

##### 5 Comments

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!