I have the following arrays:
from mxnet import nd
A=nd.array([[1,1,1,1],[2,2,2,2]])
B=nd.array([[11,11,11,11],[22,22,22,22]])
Y=nd.array([[91,91,91,91],[92,92,92,92]])
Imagine that each list whithin each array corresponds to a client. So [1,1,1,1] is the result of operation A to client 1 and [2,2,2,2] is the result of operation A to client 2. Then I have another array with a diferent operation that is applied to all the clients. [11,11,11,11] is the result of operation B to client 1 and so on.
And I need to get the following result:
D=nd.array( [ [[1,1,1,1],[11,11,11,11]],[[2,2,2,2],[22,22,22,22]] ])
list([D,Y])
This returns:
[
[[[ 1. 1. 1. 1.]
[11. 11. 11. 11.]]
[[ 2. 2. 2. 2.]
[22. 22. 22. 22.]]]
<NDArray 2x2x4 @cpu(0)>,
[[91. 91. 91. 91.]
[92. 92. 92. 92.]]
<NDArray 2x4 @cpu(0)>]
As you can see, the operations (A and B) are grouped for each client.
I tried:
list([list(zip(A,B)),Y])
And I get:
[[(
[1. 1. 1. 1.]
<NDArray 4 @cpu(0)>,
[11. 11. 11. 11.]
<NDArray 4 @cpu(0)>), (
[2. 2. 2. 2.]
<NDArray 4 @cpu(0)>,
[22. 22. 22. 22.]
<NDArray 4 @cpu(0)>)],
[[91. 91. 91. 91.]
[92. 92. 92. 92.]]
<NDArray 2x4 @cpu(0)>]
Which is not what I need. Plus, arrays A and B are really big, so I don't want to use a loop or something that will take too long.
Thanks.