'Get a sample from the curren model.
! Only works for output layers'

def get_sample(self, **kwargs):

    if (not hasattr(self, 'get_cost')):
        raise TypeError('Non-output    layer    does    not    support    this    method')
    new_obj = utils.copy(self)
    try:
        (o_args, o_kwargs) = new_obj.prev_args
    except:
        (o_args, o_kwargs) = ([], {})
    kwargs = dict([(k, new_obj.tensor_from_layer(v)) for (k, v) in kwargs.items()])
    for (k, v) in kwargs.items():
        o_kwargs[k] = v
    new_obj.prev_args = (o_args, o_kwargs)
    sample = new_obj.compute_sample(*o_args, **o_kwargs)
    return sample
