I know one can use the statement x.assign(1)
followed by a call to Operation.run()
or Session.run()
to assign the value 1
to the TensorFlow variable x
.
However, this solution stores 1
twice in the memory. This can be an issue when the value to assign is large (e.g., word embeddings).
How to assign a value from a file to a TensorFlow variable without storing 2 copies of the value in memory?