'Get the representation at layer \'layername\'.'

def GetRepresentation(self, layername, numbatches, inputlayername=[], validation=True):

    step = 0
    self.rep_pos = 0
    inputlayer = []
    self.inputs = []
    layer_to_tap = self.GetLayerByName(layername)
    self.rep = np.zeros(((numbatches * self.e_op.batchsize), layer_to_tap.state.shape[0]))
    for (i, lname) in enumerate(inputlayername):
        l = self.GetLayerByName(lname)
        inputlayer.append(l)
        self.inputs.append(np.zeros(((numbatches * self.e_op.batchsize), l.state.shape[0])))
    if validation:
        datagetter = self.GetValidationBatch
    else:
        datagetter = self.GetTestBatch
    for batch in range(numbatches):
        datagetter()
        self.GetRepresentationOneBatch(layer_to_tap, inputlayer)
    return (self.rep, self.inputs)
