'Infers shape of Parameters from inputs.'

def infer_shape(self, *args):

    (inputs, out) = self._get_graph(*args)
    (args, _) = _flatten(args)
    (arg_shapes, _, aux_shapes) = out.infer_shape(**{i.name: j.shape for (i, j) in zip(inputs, args)})
    sdict = {i: j for (i, j) in zip(out.list_arguments(), arg_shapes)}
    sdict.update({name: shape for (name, shape) in zip(out.list_auxiliary_states(), aux_shapes)})
    for i in self.collect_params().values():
        i.shape = sdict[i.name]
