def compute_max_unpooling_nd(data, pooling, size, step, dimension: int):
result = []
data_prefix_shape = data.shape[:-dimension]
kernel_prefix_shape = pooling.shape[:-dimension]
final_shape = element_wise_shape(data_prefix_shape, kernel_prefix_shape)[0]
data = numpy.broadcast_to(data, final_shape + data.shape[-dimension:])
pooling = numpy.broadcast_to(pooling, final_shape + pooling.shape[-dimension:])
if final_shape:
for key in array_index_traversal(final_shape):
result.append(__compute_max_unpooling_nd(data[key], pooling[key], size, step, dimension))
return numpy.array(result).reshape(final_shape + result[0].shape)
else:
return __compute_max_unpooling_nd(data, pooling, size, step, dimension)
评论列表
文章目录