本文整理匯總了Python中dragnn.python.network_units.convert_network_state_tensorarray方法的典型用法代碼示例。如果您正苦於以下問題:Python network_units.convert_network_state_tensorarray方法的具體用法?Python network_units.convert_network_state_tensorarray怎麽用?Python network_units.convert_network_state_tensorarray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dragnn.python.network_units
的用法示例。
在下文中一共展示了network_units.convert_network_state_tensorarray方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testConvertNetworkStateTensorarray
# 需要導入模塊: from dragnn.python import network_units [as 別名]
# 或者: from dragnn.python.network_units import convert_network_state_tensorarray [as 別名]
def testConvertNetworkStateTensorarray(self):
with self.test_session() as session:
ta = tf.TensorArray(
dtype=tf.float32,
size=0,
dynamic_size=True,
clear_after_read=False,
infer_shape=False)
# Create a 3-step x 2-stride x 2-feature-dim source array.
ta = ta.write(0, [[0., 0.]] * 2) # The zeroth step will be removed.
ta = ta.write(1, [[1., 10.]] * 2)
ta = ta.write(2, [[2., 20.]] * 2)
ta = ta.write(3, [[3., 30.]] * 2)
tensor = network_units.convert_network_state_tensorarray(ta)
actual = session.run(tensor)
self.assertEqual(actual.shape, (6, 2))
# The arrangement of the values is expected to be stride * steps.
expected = [[1., 10.], [2., 20.], [3., 30.], [1., 10.], [2., 20.],
[3., 30.]]
self.assertAllEqual(actual, expected)