本文整理汇总了Python中object_detection.utils.variables_helper.multiply_gradients_matching_regex方法的典型用法代码示例。如果您正苦于以下问题:Python variables_helper.multiply_gradients_matching_regex方法的具体用法?Python variables_helper.multiply_gradients_matching_regex怎么用?Python variables_helper.multiply_gradients_matching_regex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object_detection.utils.variables_helper
的用法示例。
在下文中一共展示了variables_helper.multiply_gradients_matching_regex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiply_all_feature_extractor_variables
# 需要导入模块: from object_detection.utils import variables_helper [as 别名]
# 或者: from object_detection.utils.variables_helper import multiply_gradients_matching_regex [as 别名]
def test_multiply_all_feature_extractor_variables(self):
grads_and_vars = self._create_grads_and_vars()
regex_list = ['FeatureExtractor/.*']
multiplier = 0.0
grads_and_vars = variables_helper.multiply_gradients_matching_regex(
grads_and_vars, regex_list, multiplier)
exp_output = [(0.0, 1.0), (0.0, 2.0), (3.0, 3.0), (4.0, 4.0)]
init_op = tf.global_variables_initializer()
with self.test_session() as sess:
sess.run(init_op)
output = sess.run(grads_and_vars)
self.assertItemsEqual(output, exp_output)
示例2: test_multiply_all_bias_variables
# 需要导入模块: from object_detection.utils import variables_helper [as 别名]
# 或者: from object_detection.utils.variables_helper import multiply_gradients_matching_regex [as 别名]
def test_multiply_all_bias_variables(self):
grads_and_vars = self._create_grads_and_vars()
regex_list = ['.*/biases']
multiplier = 0.0
grads_and_vars = variables_helper.multiply_gradients_matching_regex(
grads_and_vars, regex_list, multiplier)
exp_output = [(1.0, 1.0), (0.0, 2.0), (3.0, 3.0), (0.0, 4.0)]
init_op = tf.global_variables_initializer()
with self.test_session() as sess:
sess.run(init_op)
output = sess.run(grads_and_vars)
self.assertItemsEqual(output, exp_output)