'Get the activation outputs of the final model layer for the dataset
Arguments:
dataset (NervanaDataIterator): Dataset iterator to perform fit on
Returns:
Host numpy array: the output of the final layer for the entire Dataset'

def get_outputs(self, dataset):

    self.initialize(dataset)
    dataset.reset()
    n = dataset.nbatches
    x = self.layers.layers[(-1)].outputs
    assert (not isinstance(x, list)), 'Can    not    get_outputs    with    Branch    terminal'
    Ypred = None
    for (idx, input_data) in enumerate(dataset):
        x = self.fprop(input_data[0], inference=True)
        if (Ypred is None):
            (dim0, dim1) = x.shape
            Ypred = np.empty(((n * dim1), dim0), dtype=x.dtype)
            nsteps = (dim1 // self.be.bsz)
        cur_batch = slice((idx * dim1), ((idx + 1) * dim1))
        Ypred[cur_batch] = x.get().T
    if (nsteps != 1):
        (b, s) = (self.be.bsz, nsteps)
        Ypred = Ypred.reshape((n, s, b, (-1))).transpose(0, 2, 1, 3).copy().reshape((n * b), s, (-1))
    return Ypred[:dataset.ndata]
