def unbroadcast(out, in_sh):
    sum_axis = (tuple([i for i in range(len(in_sh)) if ((in_sh[i] == 1) and (out.shape[i] > 1))]) if (in_sh != (1,)) else None)
    return out.sum(axis=sum_axis).reshape(in_sh)
def unbroadcast(out, in_sh):
    sum_axis = (tuple([i for i in range(len(in_sh)) if ((in_sh[i] == 1) and (out.shape[i] > 1))]) if (in_sh != (1,)) else None)
    return out.sum(axis=sum_axis).reshape(in_sh)