本文整理匯總了Python中object_detection.utils.variables_helper.freeze_gradients_matching_regex方法的典型用法代碼示例。如果您正苦於以下問題:Python variables_helper.freeze_gradients_matching_regex方法的具體用法?Python variables_helper.freeze_gradients_matching_regex怎麽用?Python variables_helper.freeze_gradients_matching_regex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類object_detection.utils.variables_helper
的用法示例。
在下文中一共展示了variables_helper.freeze_gradients_matching_regex方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_freeze_all_feature_extractor_variables
# 需要導入模塊: from object_detection.utils import variables_helper [as 別名]
# 或者: from object_detection.utils.variables_helper import freeze_gradients_matching_regex [as 別名]
def test_freeze_all_feature_extractor_variables(self):
grads_and_vars = self._create_grads_and_vars()
regex_list = ['FeatureExtractor/.*']
grads_and_vars = variables_helper.freeze_gradients_matching_regex(
grads_and_vars, regex_list)
exp_output = [(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_freeze_all_feature_extractor_variables
# 需要導入模塊: from object_detection.utils import variables_helper [as 別名]
# 或者: from object_detection.utils.variables_helper import freeze_gradients_matching_regex [as 別名]
def test_freeze_all_feature_extractor_variables(self):
grads_and_vars = self._create_grads_and_vars()
regex_list = ['FeatureExtractor/.*']
grads_and_vars = variables_helper.freeze_gradients_matching_regex(
grads_and_vars, regex_list)
exp_output = [(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.assertCountEqual(output, exp_output)