Multiply matrix with vector(element wise) Tensorflow -


i not sure on way put question title. show example on thing need in using tensorflow.

for example:

matrix_1 shape = [4,2] matrix_2 shape  = [4,1]  matrix_1 * matrix 2 [[1,2],  [3,4],  [5,6],  [7,8]]   *  [[0.1],  [0.2],  [0.3],  [0.4]]   = [[0.1,0.2],     [0.6,0.8],     [1.5,1.8],     [2.8,3.2]] 

is there algorithm achieve this?

thank you

this error getting simplified problem example above:

valueerror: dimensions must equal, 784 , 100 'mul_13' (op: 'mul') input shapes: [100,784], [100]

the standard tf.multiply(matrix_1, matrix_2) operation (or shorthand syntax matrix_1 * matrix_2) perform computation want on matrix_1 , matrix_2.

however, looks error message seeing because matrix_2 has shape [100], whereas must [100, 1] elementwise broadcasting behavior. use tf.reshape(matrix_2, [100, 1]) or tf.expand_dims(matrix_2, 1) convert correct shape.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -