本文整理汇总了Python中tensorflow.contrib.specs.python.summaries.tf_spec_structure函数的典型用法代码示例。如果您正苦于以下问题:Python tf_spec_structure函数的具体用法?Python tf_spec_structure怎么用?Python tf_spec_structure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tf_spec_structure函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testStructureFromTensor
def testStructureFromTensor(self):
with self.test_session():
inputs = tf.constant(_rand(1, 18, 19, 5))
spec = "net = Cr(64, [5, 5])"
outputs = specs.create_net(spec, inputs)
tf.global_variables_initializer().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (1, 18, 19, 64))
self.assertEqual(summaries.tf_spec_structure(spec, inputs),
"_ variablev2 conv variablev2 biasadd relu")
示例2: testSimpleConv
def testSimpleConv(self):
with self.test_session():
inputs = tf.constant(_rand(1, 18, 19, 5))
spec = "net = Cr(64, [5, 5])"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [1, 18, 19, 64])
tf.initialize_all_variables().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (1, 18, 19, 64))
self.assertEqual(summaries.tf_spec_structure(spec, inputs),
"_ var conv var biasadd relu")
示例3: testMpPower
def testMpPower(self):
with self.test_session():
inputs = tf.constant(_rand(1, 64, 64, 5))
spec = "M2 = Mp([2, 2]); net = M2**3"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [1, 8, 8, 5])
tf.initialize_all_variables().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (1, 8, 8, 5))
self.assertEqual(summaries.tf_spec_structure(spec, inputs),
"_ maxpool maxpool maxpool")
示例4: testImport
def testImport(self):
with self.test_session():
inputs = constant_op.constant(_rand(10, 20))
spec = ("S = Import('from tensorflow.python.ops" +
" import math_ops; f = math_ops.sigmoid')")
spec += "; net = S | S"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [10, 20])
variables.global_variables_initializer().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (10, 20))
self.assertEqual(summaries.tf_spec_structure(spec, inputs), "_ sig sig")
示例5: testAdd
def testAdd(self):
with self.test_session():
inputs = tf.constant(_rand(17, 55))
spec = "net = Fs(10) + Fr(10)"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [17, 10])
tf.initialize_all_variables().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (17, 10))
self.assertEqual(summaries.tf_spec_structure(spec, inputs),
"_ var dot var biasadd sig "
"<> var dot var biasadd relu add")
示例6: testImport
def testImport(self):
with self.test_session():
inputs = tf.constant(_rand(10, 20))
spec = "S = Import('import tensorflow as tf; f = tf.nn.sigmoid')"
spec += "; net = S | S"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [10, 20])
tf.initialize_all_variables().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (10, 20))
self.assertEqual(summaries.tf_spec_structure(spec, inputs),
"_ sig sig")
示例7: testConc
def testConc(self):
with self.test_session():
inputs = tf.constant(_rand(10, 20))
spec = "net = Conc(1, Fs(20), Fs(10))"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [10, 30])
tf.initialize_all_variables().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (10, 30))
self.assertEqual(summaries.tf_spec_structure(spec, inputs),
"_ _ var dot var biasadd sig "
"<> var dot var biasadd sig concat")
示例8: testAbbrevPower
def testAbbrevPower(self):
with self.test_session():
inputs = tf.constant(_rand(1, 64, 64, 5))
spec = "C3 = Cr([3, 3]); M2 = Mp([2, 2]); net = (C3(5) | M2)**3"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [1, 8, 8, 5])
tf.initialize_all_variables().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (1, 8, 8, 5))
self.assertEqual(summaries.tf_spec_structure(spec, inputs),
"_ var conv var biasadd relu maxpool var conv var"
" biasadd relu maxpool var conv var"
" biasadd relu maxpool")
示例9: testAutoFunction
def testAutoFunction(self):
with self.test_session():
inputs = tf.constant(_rand(1, 18, 19, 5))
with specs.ops:
# pylint: disable=undefined-variable
net = SL.conv2d(64, 5)
outputs = net.funcall(inputs)
self.assertEqual(outputs.get_shape().as_list(), [1, 18, 19, 64])
tf.initialize_all_variables().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (1, 18, 19, 64))
self.assertEqual(summaries.tf_spec_structure("net = Cr(64, 5)", inputs),
"_ var conv var biasadd relu")
示例10: testConc
def testConc(self):
with self.cached_session():
inputs = constant_op.constant(_rand(10, 20))
spec = "net = Conc(1, Fs(20), Fs(10))"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [10, 30])
variables.global_variables_initializer().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (10, 30))
self.assertEqual(
summaries.tf_spec_structure(spec, inputs),
"_ variablev2 dot variablev2 biasadd sig "
"<> variablev2 dot variablev2 biasadd sig _ concatv2")
示例11: testAbbrevPower2
def testAbbrevPower2(self):
with self.test_session():
inputs = constant_op.constant(_rand(1, 64, 64, 5))
spec = "C3 = Cr(_1=[3, 3]); M2 = Mp([2, 2]);"
spec += "net = (C3(_0=5) | M2)**3"
outputs = specs.create_net(spec, inputs)
self.assertEqual(outputs.get_shape().as_list(), [1, 8, 8, 5])
variables.global_variables_initializer().run()
result = outputs.eval()
self.assertEqual(tuple(result.shape), (1, 8, 8, 5))
self.assertEqual(
summaries.tf_spec_structure(spec, inputs),
"_ variablev2 conv variablev2 biasadd relu maxpool"
" variablev2 conv variablev2 biasadd relu"
" maxpool variablev2 conv variablev2 biasadd relu"
" maxpool")