shape = [len(seqs)]
// Find the maximum dimension along each axis. That"s what we"ll pad to.
dim_sizes = zip(*[seq.shape for seq in seqs])
shape.extend(max(sizes) for sizes in dim_sizes)
// Now copy the data into our new buffer.
output: Array = self.alloc(tuple(shape), dtype=seqs[0].dtype)
for i, arr in enumerate(seqs):
// TODO: It would be nice to generalize this to work along different
After Change
shapes = [tuple(s.shape) for s in seqs]
dim_sizes = zip(*[shape for shape in shapes])
max_dims = [max(sizes) for sizes in dim_sizes]
final_shape = (len(seqs),) + tuple(max_dims)
output = self.alloc(final_shape, dtype=seqs[0].dtype)
for i, arr in enumerate(seqs):
region = [i] + [slice(0, dim) for dim in arr.shape]
output[region] = arr