CausalController.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:CausalGAN 作者: mkocaoglu 项目源码 文件源码
def setup_tensor(self):
        if self._label is not None:#already setup
            if debug:
                #Notify that already setup (normal behavior)
                print('self.',self.name,' has refuted setting up tensor')
            return

        tf_parents=[self.z]+[node.label for node in self.parents]


        with tf.variable_scope(self.name) as vs:
            h=tf.concat(tf_parents,-1)#tensor of parent values
            for l in range(self.n_layers-1):
                h=slim.fully_connected(h,self.n_hidden,activation_fn=lrelu,scope='layer'+str(l))

            self._label_logit = slim.fully_connected(h,1,activation_fn=None,scope='proj')
            self._label=tf.nn.sigmoid( self._label_logit )
            if debug:
                print('self.',self.name,' has setup _label=',self._label)

            #There could actually be some (quiet) error here I think if one of the
            #names in the causal graph is a substring of some other name.
                #e.g. 'hair' and 'black_hair'
            #Sorry, not coded to anticipate corner case
            self.setup_var=tf.contrib.framework.get_variables(vs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号