當前位置: 首頁>>代碼示例>>Python>>正文


Python shapes.transposing_reshape方法代碼示例

本文整理匯總了Python中shapes.transposing_reshape方法的典型用法代碼示例。如果您正苦於以下問題:Python shapes.transposing_reshape方法的具體用法?Python shapes.transposing_reshape怎麽用?Python shapes.transposing_reshape使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在shapes的用法示例。


在下文中一共展示了shapes.transposing_reshape方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testTransposingReshape_2_2_3_2_1

# 需要導入模塊: import shapes [as 別名]
# 或者: from shapes import transposing_reshape [as 別名]
def testTransposingReshape_2_2_3_2_1(self):
    """Case: dest_a == src, dest_b < src: Split with Least sig part going left.
    """
    with self.test_session() as sess:
      fake = tf.placeholder(
          tf.float32, shape=(None, None, None, 2), name='inputs')
      outputs = shapes.transposing_reshape(
          fake, src_dim=2, part_a=2, part_b=3, dest_dim_a=2, dest_dim_b=1)
      # Make real inputs. The tensor looks like this:
      # tensor=[[[[0, 1][2, 3][4, 5][6, 7][8, 9][10, 11]]
      #          [[12, 13][14, 15][16, 17][18, 19][20, 21][22, 23]]
      #         [[[24, 25]...
      real = np.arange(120).reshape((5, 2, 6, 2))
      np_array = sess.run([outputs], feed_dict={fake: real})[0]
      self.assertEqual(tuple(np_array.shape), (5, 6, 2, 2))
      self.assertAllEqual(np_array[0, :, :, :],
                          [[[0, 1], [6, 7]], [[12, 13], [18, 19]],
                           [[2, 3], [8, 9]], [[14, 15], [20, 21]],
                           [[4, 5], [10, 11]], [[16, 17], [22, 23]]]) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:21,代碼來源:shapes_test.py

示例2: testTransposingReshape_2_2_3_2_3

# 需要導入模塊: import shapes [as 別名]
# 或者: from shapes import transposing_reshape [as 別名]
def testTransposingReshape_2_2_3_2_3(self):
    """Case: dest_a == src, dest_b > src: Split with Least sig part going right.
    """
    with self.test_session() as sess:
      fake = tf.placeholder(
          tf.float32, shape=(None, None, None, 2), name='inputs')
      outputs = shapes.transposing_reshape(
          fake, src_dim=2, part_a=2, part_b=3, dest_dim_a=2, dest_dim_b=3)
      # Make real inputs. The tensor looks like this:
      # tensor=[[[[0, 1][2, 3][4, 5][6, 7][8, 9][10, 11]]
      #          [[12, 13][14, 15][16, 17][18, 19][20, 21][22, 23]]
      #         [[[24, 25]...
      real = np.arange(120).reshape((5, 2, 6, 2))
      np_array = sess.run([outputs], feed_dict={fake: real})[0]
      self.assertEqual(tuple(np_array.shape), (5, 2, 2, 6))
      self.assertAllEqual(
          np_array[0, :, :, :],
          [[[0, 1, 2, 3, 4, 5], [6, 7, 8, 9, 10, 11]],
           [[12, 13, 14, 15, 16, 17], [18, 19, 20, 21, 22, 23]]]) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:21,代碼來源:shapes_test.py

示例3: testTransposingReshape_2_2_3_1_2

# 需要導入模塊: import shapes [as 別名]
# 或者: from shapes import transposing_reshape [as 別名]
def testTransposingReshape_2_2_3_1_2(self):
    """Case: dest_a < src, dest_b == src. Split with Most sig part going left.
    """
    with self.test_session() as sess:
      fake = tf.placeholder(
          tf.float32, shape=(None, None, None, 2), name='inputs')
      outputs = shapes.transposing_reshape(
          fake, src_dim=2, part_a=2, part_b=3, dest_dim_a=1, dest_dim_b=2)
      # Make real inputs. The tensor looks like this:
      # tensor=[[[[0, 1][2, 3][4, 5][6, 7][8, 9][10, 11]]
      #          [[12, 13][14, 15][16, 17][18, 19][20, 21][22, 23]]
      #         [[[24, 25]...
      real = np.arange(120).reshape((5, 2, 6, 2))
      np_array = sess.run([outputs], feed_dict={fake: real})[0]
      self.assertEqual(tuple(np_array.shape), (5, 4, 3, 2))
      self.assertAllEqual(np_array[0, :, :, :],
                          [[[0, 1], [2, 3], [4, 5]],
                           [[12, 13], [14, 15], [16, 17]],
                           [[6, 7], [8, 9], [10, 11]],
                           [[18, 19], [20, 21], [22, 23]]]) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:22,代碼來源:shapes_test.py

示例4: testTransposingReshape_2_2_3_3_2

# 需要導入模塊: import shapes [as 別名]
# 或者: from shapes import transposing_reshape [as 別名]
def testTransposingReshape_2_2_3_3_2(self):
    """Case: dest_a < src, dest_b == src. Split with Most sig part going right.
    """
    with self.test_session() as sess:
      fake = tf.placeholder(
          tf.float32, shape=(None, None, None, 2), name='inputs')
      outputs = shapes.transposing_reshape(
          fake, src_dim=2, part_a=2, part_b=3, dest_dim_a=3, dest_dim_b=2)
      # Make real inputs. The tensor looks like this:
      # tensor=[[[[0, 1][2, 3][4, 5][6, 7][8, 9][10, 11]]
      #          [[12, 13][14, 15][16, 17][18, 19][20, 21][22, 23]]
      #         [[[24, 25]...
      real = np.arange(120).reshape((5, 2, 6, 2))
      np_array = sess.run([outputs], feed_dict={fake: real})[0]
      self.assertEqual(tuple(np_array.shape), (5, 2, 3, 4))
      self.assertAllEqual(
          np_array[0, :, :, :],
          [[[0, 1, 6, 7], [2, 3, 8, 9], [4, 5, 10, 11]],
           [[12, 13, 18, 19], [14, 15, 20, 21], [16, 17, 22, 23]]]) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:21,代碼來源:shapes_test.py


注:本文中的shapes.transposing_reshape方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。