本文整理匯總了Python中inception.slim.ops.flatten方法的典型用法代碼示例。如果您正苦於以下問題:Python ops.flatten方法的具體用法?Python ops.flatten怎麽用?Python ops.flatten使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類inception.slim.ops
的用法示例。
在下文中一共展示了ops.flatten方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testFlatten4D
# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import flatten [as 別名]
def testFlatten4D(self):
height, width = 3, 3
with self.test_session():
images = tf.random_uniform((5, height, width, 3), seed=1, name='images')
output = ops.flatten(images)
self.assertEquals(output.get_shape().num_elements(),
images.get_shape().num_elements())
self.assertEqual(output.get_shape()[0], images.get_shape()[0])
示例2: testFlatten3D
# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import flatten [as 別名]
def testFlatten3D(self):
height, width = 3, 3
with self.test_session():
images = tf.random_uniform((5, height, width), seed=1, name='images')
output = ops.flatten(images)
self.assertEquals(output.get_shape().num_elements(),
images.get_shape().num_elements())
self.assertEqual(output.get_shape()[0], images.get_shape()[0])
示例3: testFlattenBatchSize
# 需要導入模塊: from inception.slim import ops [as 別名]
# 或者: from inception.slim.ops import flatten [as 別名]
def testFlattenBatchSize(self):
height, width = 3, 3
with self.test_session() as sess:
images = tf.random_uniform((5, height, width, 3), seed=1, name='images')
inputs = tf.placeholder(tf.int32, (None, height, width, 3))
output = ops.flatten(inputs)
self.assertEquals(output.get_shape().as_list(),
[None, height * width * 3])
output = sess.run(output, {inputs: images.eval()})
self.assertEquals(output.size,
images.get_shape().num_elements())
self.assertEqual(output.shape[0], images.get_shape()[0])