Takes one 3-dimensional array. Pad the instances from the end position as shown in the example below. That is, I need to pad the reflection of the utterance mirrored along the edge values of the array.
Array a:
array ([array([[3, 1, 4, 1],
[5, 9, 2, 6],
[5, 3, 5, 8]]),
array([[9, 7, 9, 3],
[2, 3, 8, 4]]),
array([[6, 2, 6, 4],
[3, 3, 8, 3],
[2, 7, 9, 5],
[0, 2, 8, 8]])], dtype=object)
dim1 = a.shape[0] # n
dim2 = max([i.shape[0] for i in a]) # m
dim3 = a[0].shape[1] # k
Dimension of final matrix after padding:
result = np.zeros((dim1, dim2, dim3))
Output:
[[[3. 1. 4. 1.]
[5. 9. 2. 6.]
[5. 3. 5. 8.]
[5. 3. 5. 8.]]
[[9. 7. 9. 3.]
[2. 3. 8. 4.]
[2. 3. 8. 4.]
[9. 7. 9. 3.]]
[[6. 2. 6. 4.]
[3. 3. 8. 3.]
[2. 7. 9. 5.]
[0. 2. 8. 8.]]]
how can I get the output using numpy.pad?