2017-01-14 44 views

回答

0

這是不是很方便結合起來,但你可以使用tf.variable_scope定義custom_getter

def make_local_getter(getter, *args, **kwargs): 
    if kwargs['collections'] is None: 
     kwargs['collections'] = [] 
    kwargs['collections'] += [tf.GraphKeys.LOCAL_VARIABLES] 
    return getter(*args, **kwargs) 

with tf.variable_scope(scope, custom_getter=make_local_getter): 
    tf.get_variable(...) 
相關問題