<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _quantize_channelwise_linear(weight, nbits, axis=0):
 """ Linearly quantize weight blob. :param weight: numpy.array Weight to be quantized. :param nbits: int Number of bits per weight element :param axis: int Axis of the weight blob to compute channel-wise quantization, can be 0 or 1 Returns ------- quantized_weight: numpy.array quantized weight as float numpy array, with the same shape as weight scale: numpy.array per channel scale bias: numpy.array per channel bias """

    if len(weight.shape) == 1: # vector situation, treat as 1 channel
        weight = weight.reshape((1, weight.shape[0]))

    rank = len(weight.shape)
    if axis == 1:
        transposed_axis_order = (1,0) + tuple(range(2,rank))
        weight = _np.transpose(weight, transposed_axis_order)

    num_channels = weight.shape[0]
    shape = weight.shape
    weight = weight.reshape((num_channels, -1)) # [C, L]
    a = _np.amin(weight, axis=-1) # [C,]
    b = _np.amax(weight, axis=-1) # [C,]

    # Quantize weights to full range [0, (1 << nbits) - 1]
    qa = 0
    qb = (1 << nbits) - 1
    # Use a mask to filter out channels with very close weight values
    mask = (b - a) > 1e-5 # [C,1] (normal channels)
    r_mask = ~mask # (all-same-value) channels

    qw = _np.zeros_like(weight) # [C, L]
    scale = _np.ones((num_channels,))
    bias = _np.zeros((num_channels,))

    if _np.any(mask): # normal channels
        qw[mask] = (weight[mask] - a[mask][:,None]) / (b[mask] - a[mask])[:,None] * (qb - qa) + qa
        scale[mask] = (b[mask] - a[mask]) / (qb - qa)
        bias[mask] = - scale[mask] * qa + a[mask]
    if _np.any(r_mask): # singular channels
        qw[r_mask] = qa
        scale[r_mask] = 0
        bias[r_mask] = a[r_mask]

    # Reshape
    quantized_weight = qw.reshape(shape)
    if axis == 1:
        quantized_weight = _np.transpose(quantized_weight, transposed_axis_order)

    return (quantized_weight, scale, bias)