rfho/utils.py
def hv_1(_dyn, _lv, _v):  # NOTE this is not an efficient implementation
    """Computes hessian-vector product (without storing the Hessian)
    in a naive way. If _lv is a list of tensor, then vectorizes them with vectorize_all"""
    res = []
    for i in range(_v.get_shape()[0].value):
        _hvi = tf.gradients(_dyn[i], _lv)
        if isinstance(_lv, list):
            _hvi = vectorize_all(_hvi)
        res.append(
            tf.reduce_sum(_hvi * _v)
        )
    return tf.stack(res)
Computes hessian-vector product (without storing the Hessian)
    in a naive way. If _lv is a list of tensor, then vectorizes them with vectorize_all
Computes hessian-vector product (without storing the Hessian)
in a naive way. If _lv is a list of tensor, then vectorizes them with vectorize_all
Computes hessian - vector product ( without storing the Hessian ) in a naive way . If _lv is a list of tensor then vectorizes them with vectorize_all
def hv_1(_dyn, _lv, _v):  
    res = []
    for i in range(_v.get_shape()[0].value):
        _hvi = tf.gradients(_dyn[i], _lv)
        if isinstance(_lv, list):
            _hvi = vectorize_all(_hvi)
        res.append(
            tf.reduce_sum(_hvi * _v)
        )
    return tf.stack(res)
def hv_1 ( _dyn , _lv , _v ) : res = [ ] for i in range ( _v . get_shape ( ) [ 0 ] . value ) : _hvi = tf . gradients ( _dyn [ i ] , _lv ) if isinstance ( _lv , list ) : _hvi = vectorize_all ( _hvi ) res . append ( tf . reduce_sum ( _hvi * _v ) ) return tf . stack ( res )
Computes hessian-vector product (without storing the Hessian)
in a naive way.
Computes hessian - vector product ( without storing the Hessian ) in a naive way .
# NOTE this is not an efficient implementation """Computes hessian-vector product (without storing the Hessian)
    in a naive way. If _lv is a list of tensor, then vectorizes them with vectorize_all"""
_dyn
_lv
_v