rfho/hyper_gradients.py
def _create_z(self, hyper):
        """
        Initializer for Z-variables. Used internally.

        :param hyper:
        :return:
        """
        shape_h = hyper.get_shape().as_list()
        assert len(shape_h) < 2, 'only scalar or vector hyper-parameters are accepted: %s shape: %s' % (hyper, shape_h)
        dim_h = shape_h[0] if shape_h else 1

        components = self.w.var_list(VlMode.TENSOR) if isinstance(self.w, MergedVariable) else [self.w_t]

        # print('components', components)

        z_components = [tf.Variable(tf.zeros([c.get_shape().as_list()[0], dim_h]),
                                    name=simple_name(hyper))
                        for c in components]
        mvz = ZMergedMatrix(z_components, name='Z_' + simple_name(hyper))
        return mvz

        Initializer for Z-variables. Used internally.

        :param hyper:
        :return:
        
Initializer for Z-variables. Used internally.
Initializer for Z - variables . Used internally .
def _create_z(self, hyper):
        shape_h = hyper.get_shape().as_list()
        assert len(shape_h) < 2, 'only scalar or vector hyper-parameters are accepted: %s shape: %s' % (hyper, shape_h)
        dim_h = shape_h[0] if shape_h else 1
        components = self.w.var_list(VlMode.TENSOR) if isinstance(self.w, MergedVariable) else [self.w_t]
        z_components = [tf.Variable(tf.zeros([c.get_shape().as_list()[0], dim_h]),
                                    name=simple_name(hyper))
                        for c in components]
        mvz = ZMergedMatrix(z_components, name='Z_' + simple_name(hyper))
        return mvz
def _create_z ( self , hyper ) : shape_h = hyper . get_shape ( ) . as_list ( ) assert len ( shape_h ) < 2 , 'only scalar or vector hyper-parameters are accepted: %s shape: %s' % ( hyper , shape_h ) dim_h = shape_h [ 0 ] if shape_h else 1 components = self . w . var_list ( VlMode . TENSOR ) if isinstance ( self . w , MergedVariable ) else [ self . w_t ] z_components = [ tf . Variable ( tf . zeros ( [ c . get_shape ( ) . as_list ( ) [ 0 ] , dim_h ] ) , name = simple_name ( hyper ) ) for c in components ] mvz = ZMergedMatrix ( z_components , name = 'Z_' + simple_name ( hyper ) ) return mvz
Initializer for Z-variables.
Initializer for Z - variables .
"""
        Initializer for Z-variables. Used internally.

        :param hyper:
        :return:
        """ # print('components', components)
None
self
hyper
None