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


Python shape_utils.assert_shape_equal_along_first_dimension方法代碼示例

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


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

示例1: test_unequal_static_shape_along_first_dim_raises_exception

# 需要導入模塊: from object_detection.utils import shape_utils [as 別名]
# 或者: from object_detection.utils.shape_utils import assert_shape_equal_along_first_dimension [as 別名]
def test_unequal_static_shape_along_first_dim_raises_exception(self):
    shape_a = tf.constant(np.zeros([4, 2, 2, 1]))
    shape_b = tf.constant(np.zeros([6, 2, 3, 1]))
    with self.assertRaisesRegexp(
        ValueError, 'Unequal first dimension'):
      shape_utils.assert_shape_equal_along_first_dimension(
          shape_utils.combined_static_and_dynamic_shape(shape_a),
          shape_utils.combined_static_and_dynamic_shape(shape_b)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:10,代碼來源:shape_utils_test.py

示例2: test_equal_static_shape_along_first_dim_succeeds

# 需要導入模塊: from object_detection.utils import shape_utils [as 別名]
# 或者: from object_detection.utils.shape_utils import assert_shape_equal_along_first_dimension [as 別名]
def test_equal_static_shape_along_first_dim_succeeds(self):
    shape_a = tf.constant(np.zeros([4, 2, 2, 1]))
    shape_b = tf.constant(np.zeros([4, 7, 2]))
    with self.test_session() as sess:
      op = shape_utils.assert_shape_equal_along_first_dimension(
          shape_utils.combined_static_and_dynamic_shape(shape_a),
          shape_utils.combined_static_and_dynamic_shape(shape_b))
      sess.run(op) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:10,代碼來源:shape_utils_test.py

示例3: test_unequal_dynamic_shape_along_first_dim_raises_tf_assert

# 需要導入模塊: from object_detection.utils import shape_utils [as 別名]
# 或者: from object_detection.utils.shape_utils import assert_shape_equal_along_first_dimension [as 別名]
def test_unequal_dynamic_shape_along_first_dim_raises_tf_assert(self):
    tensor_a = tf.placeholder(tf.float32, shape=[None, None, None, 3])
    tensor_b = tf.placeholder(tf.float32, shape=[None, None, 3])
    op = shape_utils.assert_shape_equal_along_first_dimension(
        shape_utils.combined_static_and_dynamic_shape(tensor_a),
        shape_utils.combined_static_and_dynamic_shape(tensor_b))
    with self.test_session() as sess:
      with self.assertRaises(tf.errors.InvalidArgumentError):
        sess.run(op, feed_dict={tensor_a: np.zeros([1, 2, 2, 3]),
                                tensor_b: np.zeros([2, 4, 3])}) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:12,代碼來源:shape_utils_test.py

示例4: test_equal_dynamic_shape_along_first_dim_succeeds

# 需要導入模塊: from object_detection.utils import shape_utils [as 別名]
# 或者: from object_detection.utils.shape_utils import assert_shape_equal_along_first_dimension [as 別名]
def test_equal_dynamic_shape_along_first_dim_succeeds(self):
    tensor_a = tf.placeholder(tf.float32, shape=[None, None, None, 3])
    tensor_b = tf.placeholder(tf.float32, shape=[None])
    op = shape_utils.assert_shape_equal_along_first_dimension(
        shape_utils.combined_static_and_dynamic_shape(tensor_a),
        shape_utils.combined_static_and_dynamic_shape(tensor_b))
    with self.test_session() as sess:
      sess.run(op, feed_dict={tensor_a: np.zeros([5, 2, 2, 3]),
                              tensor_b: np.zeros([5])}) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:11,代碼來源:shape_utils_test.py


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