[Python] Matrix Multiply with Vector and Tensor in Python

Discussão em 'Python' iniciado por Stack, Julho 13, 2025.

  1. Stack

    Stack Membro Participativo

    I have a Vector, M, with size N and a Tensor, d, with size NxNxD.

    My aim is to perform the matrix multication M*d[i,:,:] for each i to get a new matrix with size nxD.

    Now I could just do it like this:

    a = np.zeros((n,D))
    for i in range(n):
    a = G*np.matmul(M,d[i,:,:])


    but I'd prefer a one line solution if it exists. Anyone got any ideas?

    Continue reading...

Compartilhe esta Página