AI::MXNet::LinAlg - Linear Algebra routines for NDArray and Symbol.
The Linear Algebra API, provides imperative/symbolic linear algebra tensor operations on CPU/GPU. mx->linalg-><sym|nd>->gemm Performs general matrix multiplication and accumulation. mx->linalg-><sym|nd>->gemm2 Performs general matrix multiplication. mx->linalg-><sym|nd>->potrf Performs Cholesky factorization of a symmetric positive-definite matrix. mx->linalg-><sym|nd>->potri Performs matrix inversion from a Cholesky factorization. mx->linalg-><sym|nd>->trmm Performs multiplication with a lower triangular matrix. mx->linalg-><sym|nd>->trsm Solves matrix equation involving a lower triangular matrix. mx->linalg-><sym|nd>->sumlogdiag Computes the sum of the logarithms of the diagonal elements of a square matrix. mx->linalg-><sym|nd>->syrk Multiplication of matrix with its transpose. mx->linalg-><sym|nd>->gelqf LQ factorization for general matrix. mx->linalg-><sym|nd>->syevd Eigendecomposition for symmetric matrix. L<NDArray Python Docs|http://mxnet.incubator.apache.org/api/python/ndarray/linalg.html> L<Symbol Python Docs|http://mxnet.incubator.apache.org/api/python/symbol/linalg.html> Examples: ## NDArray my $A = mx->nd->array([[1.0, 1.0], [1.0, 1.0]]); my $B = mx->nd->array([[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]]); ok(almost_equal( mx->nd->linalg->gemm2($A, $B, transpose_b=>1, alpha=>2.0)->aspdl, pdl([[4.0, 4.0, 4.0], [4.0, 4.0, 4.0]]) )); ## Symbol my $sym_gemm2 = mx->sym->linalg->gemm2( mx->sym->var('A'), mx->sym->var('B'), transpose_b => 1, alpha => 2.0 ); my $A = mx->nd->array([[1.0, 1.0], [1.0, 1.0]]); my $B = mx->nd->array([[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]]); ok(almost_equal( $sym_gemm2->eval(args => { A => $A, B => $B })->[0]->aspdl, pdl([[4.0, 4.0, 4.0], [4.0, 4.0, 4.0]]) ));
To install AI::MXNet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AI::MXNet
CPAN shell
perl -MCPAN -e shell install AI::MXNet
For more information on module installation, please visit the detailed CPAN module installation guide.