Tensorflow study notes (4) ------ matrix multiplication

foreword

The previous mathematical knowledge was completely returned to the teacher, so I forgot even the basic "Matrix Multiplication". I want to use this to make up for the loopholes in my knowledge, and to help you find the lost ones. memory.

deal with

rule

In fact, the reason why matrices can be multiplied is because certain rules must be followed. The following rules are emphasized:

The number of columns of matrix A is equal to the number of rows of matrix B, and A and B can be multiplied;
the result of multiplying matrix A and matrix B is matrix C, then the number of rows of matrix C is the number of rows of matrix A and the number of columns of C is the number of columns of matrix B;

accomplish

Adding matrix A is m * p, that is, m rows and p columns, and matrix B is p * n, that is, p rows and n columns, as shown in the following example:
write picture description here

First, the number of columns of matrix A is equal to the number of rows of matrix B, which satisfies the multiplication condition;
secondly, in the calculation process, the first row of matrix A is multiplied by the first column of matrix B and summed, and then the first row of matrix A is Then multiply and sum with the second column of matrix B, and so on;
finally, the characteristics of result C are the number of rows of matrix A and the number of columns of matrix B;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325959162&siteId=291194637