Python 是否可以在Tensorflow中更新哈希表中的一个特定值
我想有一些整数及其相应偏差的查找表。当神经元被激活时,我想更新代表变量中整数的特定键的“一”特定值。是否可以在向前和向后传递一次后更新该值Python 是否可以在Tensorflow中更新哈希表中的一个特定值,python,python-3.x,tensorflow,neural-network,hashtable,Python,Python 3.x,Tensorflow,Neural Network,Hashtable,我想有一些整数及其相应偏差的查找表。当神经元被激活时,我想更新代表变量中整数的特定键的“一”特定值。是否可以在向前和向后传递一次后更新该值 import tensorflow as tf table = tf.contrib.lookup.MutableHashTable(key_dtype=tf.int64, value_dtype=tf.float64, default_value=-1) with tf.Session() as sess: keys = tf.constant(
import tensorflow as tf
table = tf.contrib.lookup.MutableHashTable(key_dtype=tf.int64, value_dtype=tf.float64, default_value=-1)
with tf.Session() as sess:
keys = tf.constant([1, 2, 3], dtype=tf.int64)
vals = tf.constant([-0.1, 2.3, 0.4], dtype=tf.float64)
# Insert values to hash table and run the op.
insert_op = table.insert(keys, vals)
sess.run(insert_op)
# Print hash table lookups.
print(sess.run(table.lookup(keys)))