本文整理汇总了Python中tensorflow.python.framework.error_interpolation.interpolate函数的典型用法代码示例。如果您正苦于以下问题:Python interpolate函数的具体用法?Python interpolate怎么用?Python interpolate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了interpolate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testNoInputs
def testNoInputs(self):
two_tags_with_seps = ";;;{{node One}},,,{{node Two}};;;"
interpolated_string = error_interpolation.interpolate(
two_tags_with_seps, self.graph)
expected_regex = (
r"^;;;.*constant_op.py:[0-9]+\) ,,,.*constant_op.py:[0-9]+\) ;;;$")
self.assertRegexpMatches(interpolated_string, expected_regex)
示例2: testBasicInputs
def testBasicInputs(self):
tag = ";;;{{node Three}};;;"
interpolated_string = error_interpolation.interpolate(tag, self.graph)
expected_regex = re.compile(
r"^;;;.*op_def_library.py:[0-9]+\) ;;;.*Input.*constant_op.py:[0-9]+\)",
re.DOTALL)
self.assertRegexpMatches(interpolated_string, expected_regex)
示例3: testOneTag
def testOneTag(self):
one_tag_string = "^^node:Two:${file}^^"
interpolated_string = error_interpolation.interpolate(one_tag_string,
self.graph)
self.assertTrue(interpolated_string.endswith("constant_op.py"),
"interpolated_string '%s' did not end with constant_op.py"
% interpolated_string)
示例4: testTwoTagsWithSeps
def testTwoTagsWithSeps(self):
two_tags_with_seps = ";;;^^node:Two^^,,,^^node:Three^^;;;"
interpolated_string = error_interpolation.interpolate(
two_tags_with_seps, self.graph)
expected_regex = (
r"^;;;.*constant_op.py:[0-9]+\) ,,,.*constant_op.py:[0-9]*\) ;;;$")
self.assertRegexpMatches(interpolated_string, expected_regex)
示例5: testNodeTwoHasTwoInterpolatedDevice
def testNodeTwoHasTwoInterpolatedDevice(self):
message = "^^node:two:${devices}^^"
result = error_interpolation.interpolate(message, self.graph)
num_devices = result.count("tf.device")
self.assertEqual(2, num_devices)
self.assertIn("tf.device(/cpu)", result)
self.assertIn("tf.device(/cpu:0)", result)
示例6: testNodeFourHasColocationInterpolationForNodeThreeOnly
def testNodeFourHasColocationInterpolationForNodeThreeOnly(self):
message = "^^colocation_node:Four_with_three^^"
result = error_interpolation.interpolate(message, self.graph)
self.assertIn("colocate_with(Three_with_one)", result)
self.assertNotIn(
"One", result,
"Node One should not appear in Four_with_three's summary:\n%s" % result)
示例7: testNodeThreeHasFancyFunctionDisplayNameForInterpolatedDevice
def testNodeThreeHasFancyFunctionDisplayNameForInterpolatedDevice(self):
message = "^^colocation_node:three^^"
result = error_interpolation.interpolate(message, self.graph)
num_devices = result.count("tf.device")
self.assertEqual(2, num_devices)
name_re = r"_fancy_device_function<.*error_interpolation_test.py, [0-9]+>"
expected_re = r"with tf.device\(.*%s\)" % name_re
self.assertRegexpMatches(result, expected_re)
示例8: testNodeTwoHasTwoInterpolatedDevice
def testNodeTwoHasTwoInterpolatedDevice(self):
message = "^^colocation_node:two^^"
result = error_interpolation.interpolate(message, self.graph)
self.assertEqual(2, result.count("tf.device(/cpu)"))
self.assertEqual(2, result.count("tf.device(/cpu:0)"))
示例9: testNewLine
def testNewLine(self):
newline = "\n\n{{node One}}"
interpolated_string = error_interpolation.interpolate(newline, self.graph)
self.assertRegexpMatches(interpolated_string, "constant_op.py:[0-9]+.*")
示例10: testNodeZeroHasNoDeviceSummaryInfo
def testNodeZeroHasNoDeviceSummaryInfo(self):
message = "^^colocation_node:zero^^"
result = error_interpolation.interpolate(message, self.graph)
self.assertIn("No device assignments were active", result)
示例11: testNodeOneHasExactlyOneInterpolatedDevice
def testNodeOneHasExactlyOneInterpolatedDevice(self):
message = "^^colocation_node:one^^"
result = error_interpolation.interpolate(message, self.graph)
self.assertEqual(2, result.count("tf.device(/cpu)"))
示例12: testTwoTagsNoSeps
def testTwoTagsNoSeps(self):
two_tags_no_seps = "^^node:One^^^^node:Three^^"
interpolated_string = error_interpolation.interpolate(
two_tags_no_seps, self.graph)
self.assertRegexpMatches(interpolated_string,
"constant_op.py:[0-9]+.*constant_op.py:[0-9]+")
示例13: testTwoTagsWithSeps
def testTwoTagsWithSeps(self):
two_tags_with_seps = "123^^node:Foo:${file}^^456^^node:Bar:${line}^^789"
interpolated_string = error_interpolation.interpolate(two_tags_with_seps)
self.assertEqual(interpolated_string, "123${file}456${line}789")
示例14: testTwoTagsNoSeps
def testTwoTagsNoSeps(self):
two_tags_no_seps = "^^node:Foo:${file}^^^^node:Bar:${line}^^"
interpolated_string = error_interpolation.interpolate(two_tags_no_seps)
self.assertEqual(interpolated_string, "${file}${line}")
示例15: testNodeFiveHasColocationInterpolationForNodeOneAndTwo
def testNodeFiveHasColocationInterpolationForNodeOneAndTwo(self):
message = "^^colocation_node:Five_with_one_with_two^^"
result = error_interpolation.interpolate(message, self.graph)
self.assertIn("colocate_with(One)", result)
self.assertIn("colocate_with(Two)", result)