用法
partial_run(
handle, fetches, feed_dict=None
)
參數
-
handle
一係列部分運行的句柄。 -
fetches
單個圖形元素、圖形元素列表或其值為圖形元素或圖形元素列表的字典(請參閱run
的文檔)。 -
feed_dict
將圖形元素映射到值的字典(如上所述)。
返回
-
如果
fetches
是單個圖形元素,則為單個值;如果fetches
是列表,則為值列表;如果是字典,則為與fetches
具有相同鍵的字典(請參閱run
的文檔)。
拋出
-
tf.errors.OpError
或其子類之一出錯。
繼續執行更多的提要和獲取。
這是實驗性的,可能會發生變化。
要使用部分執行,用戶首先調用 partial_run_setup()
,然後調用 partial_run()
序列。 partial_run_setup
指定將在後續 partial_run
調用中使用的提要和提取列表。
可選的 feed_dict
參數允許調用者覆蓋圖中張量的值。有關詳細信息,請參閱run()。
下麵是一個簡單的例子:
a = array_ops.placeholder(dtypes.float32, shape=[])
b = array_ops.placeholder(dtypes.float32, shape=[])
c = array_ops.placeholder(dtypes.float32, shape=[])
r1 = math_ops.add(a, b)
r2 = math_ops.multiply(r1, c)
h = sess.partial_run_setup([r1, r2], [a, b, c])
res = sess.partial_run(h, r1, feed_dict={a:1, b:2})
res = sess.partial_run(h, r2, feed_dict={c:res})
相關用法
- Python tf.compat.v1.Session.list_devices用法及代碼示例
- Python tf.compat.v1.Session.as_default用法及代碼示例
- Python tf.compat.v1.Session.run用法及代碼示例
- Python tf.compat.v1.Session用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代碼示例
- Python tf.compat.v1.distribute.MirroredStrategy.experimental_distribute_dataset用法及代碼示例
- Python tf.compat.v1.data.TFRecordDataset.interleave用法及代碼示例
- Python tf.compat.v1.distributions.Bernoulli.cross_entropy用法及代碼示例
- Python tf.compat.v1.Variable.eval用法及代碼示例
- Python tf.compat.v1.train.FtrlOptimizer.compute_gradients用法及代碼示例
- Python tf.compat.v1.layers.conv3d用法及代碼示例
- Python tf.compat.v1.strings.length用法及代碼示例
- Python tf.compat.v1.data.Dataset.snapshot用法及代碼示例
- Python tf.compat.v1.data.experimental.SqlDataset.reduce用法及代碼示例
- Python tf.compat.v1.feature_column.categorical_column_with_vocabulary_file用法及代碼示例
- Python tf.compat.v1.data.TextLineDataset.from_tensors用法及代碼示例
- Python tf.compat.v1.variable_scope用法及代碼示例
- Python tf.compat.v1.data.experimental.SqlDataset.as_numpy_iterator用法及代碼示例
- Python tf.compat.v1.distributions.Bernoulli.covariance用法及代碼示例
- Python tf.compat.v1.placeholder用法及代碼示例
注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.compat.v1.Session.partial_run。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。