Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 是否可以在Tensorflow中更新哈希表中的一个特定值_Python_Python 3.x_Tensorflow_Neural Network_Hashtable - Fatal编程技术网

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)))