def validate(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)
        new_obj.get_cost(*o_args, **o_kwargs)
        return new_obj
Recompute the cost error (without the gradients)
dataset/ETHPy150Open pascanur/GroundHog/groundhog/layers/basic.py/Layer.validate