'Pack separate weight matrices into a single packed
weight.
Parameters
args : dict of str -> NDArray
Dictionary containing unpacked weights.
Returns
args : dict of str -> NDArray
Dictionary with packed weights associated with
this cell.'

def pack_weights(self, args):

    args = args.copy()
    if (not self._gate_names):
        return args
    for group_name in ['i2h', 'h2h']:
        weight = []
        bias = []
        for gate in self._gate_names:
            wname = ('%s%s%s_weight' % (self._prefix, group_name, gate))
            weight.append(args.pop(wname))
            bname = ('%s%s%s_bias' % (self._prefix, group_name, gate))
            bias.append(args.pop(bname))
        args[('%s%s_weight' % (self._prefix, group_name))] = ndarray.concatenate(weight)
        args[('%s%s_bias' % (self._prefix, group_name))] = ndarray.concatenate(bias)
    return args
