本文整理匯總了Python中vgsl_model._PadLabels2d方法的典型用法代碼示例。如果您正苦於以下問題:Python vgsl_model._PadLabels2d方法的具體用法?Python vgsl_model._PadLabels2d怎麽用?Python vgsl_model._PadLabels2d使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vgsl_model
的用法示例。
在下文中一共展示了vgsl_model._PadLabels2d方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testPadLabels2d
# 需要導入模塊: import vgsl_model [as 別名]
# 或者: from vgsl_model import _PadLabels2d [as 別名]
def testPadLabels2d(self):
"""Must pad timesteps in labels to match logits.
"""
with self.test_session() as sess:
# Make placeholders for logits and labels.
ph_logits = tf.placeholder(tf.float32, shape=(None, None, 42))
ph_labels = tf.placeholder(tf.int64, shape=(None, None))
padded_labels = vgsl_model._PadLabels2d(tf.shape(ph_logits)[1], ph_labels)
# Make actual inputs.
real_logits = _rand(4, 97, 42)
real_labels = _rand(4, 85)
np_array = sess.run([padded_labels],
feed_dict={ph_logits: real_logits,
ph_labels: real_labels})[0]
self.assertEqual(tuple(np_array.shape), (4, 97))
real_labels = _rand(4, 97)
np_array = sess.run([padded_labels],
feed_dict={ph_logits: real_logits,
ph_labels: real_labels})[0]
self.assertEqual(tuple(np_array.shape), (4, 97))
real_labels = _rand(4, 100)
np_array = sess.run([padded_labels],
feed_dict={ph_logits: real_logits,
ph_labels: real_labels})[0]
self.assertEqual(tuple(np_array.shape), (4, 97))