def rnn_param_type(param):
    """
    Distinguish between bias and state weight params inside an RNN.
    Criterion: biases are vectors, weights are matrices.
    """
    if len(param.size()) == 2:
        return 'weight'
    elif len(param.size()) == 1:
        return 'bias'
    raise ValueError('Unkown param shape of size [%d]' % param.size())
