def _get_func(self, attr):
custom_func = object.__getattribute__(self, 'CUSTOM_FUNC')
custom_func_names = [f.__name__ for f in custom_func]
if attr in custom_func_names: # is it one of the custom functions?
func = custom_func[custom_func_names.index(attr)]
else:
func = getattr(tf.nn, attr) # ok, so it is a tf.nn function
return func
评论列表
文章目录