I want to append a numpy array(matrix) into an array through a loop
data=[[2 2 2] [3 3 3]]
Weights=[[4 4 4] [4 4 4] [4 4 4]]
All=np.array([])
for i in data:
Adam, how about just using a pair of nested loops? I believe this code will do what you want.
import numpy as np
data = ([2,2,2],[3,3,3])
weights = ([4,4,4],[4,4,4],[4,4,4])
output=np.array([])
for each_array in data:
for weight in weights:
each_multiplication = np.multiply(each_array, weight)
output = np.append(output,each_multiplication)
print output
np.multiply() performs element wise multiplication instead of matrix multiplication. As best as I can understand from your sample input and output, this is what you're trying to accomplish.