'Load the model on the GPU.'

def LoadModelOnGPU(self, batchsize=(-1)):

    if (batchsize < 0):
        if self.t_op:
            batchsize = self.t_op.batchsize
        else:
            batchsize = self.e_op.batchsize
    for layer in self.net.layer:
        layer.hyperparams.MergeFrom(LoadMissing(layer.hyperparams, self.net.hyperparams))
        if (not layer.prefix):
            layer.prefix = self.net.prefix
        tied_to = None
        if layer.tied:
            tied_to = next((l for l in self.layer if (l.name == layer.tied_to)))
        self.layer.append(CreateLayer(Layer, layer, self.t_op, tied_to=tied_to))
    for edge in self.net.edge:
        hyp = deepnet_pb2.Hyperparams()
        hyp.CopyFrom(self.net.hyperparams)
        hyp.MergeFrom(edge.hyperparams)
        edge.hyperparams.MergeFrom(hyp)
        try:
            node1 = next((layer for layer in self.layer if (layer.name == edge.node1)))
        except StopIteration:
            print edge.node1, [l.name for l in self.layer]
        node2 = next((layer for layer in self.layer if (layer.name == edge.node2)))
        if (not edge.prefix):
            edge.prefix = self.net.prefix
        tied_to = None
        if edge.tied:
            tied_to = next((e for e in self.edge if ((e.node1.name == edge.tied_to_node1) and (e.node2.name == edge.tied_to_node2))))
        self.edge.append(CreateEdge(Edge, edge, node1, node2, self.t_op, tied_to=tied_to))
    self.input_datalayer = [node for node in self.layer if node.is_input]
    self.output_datalayer = [node for node in self.layer if node.is_output]
    self.node_list = self.Sort()
