Tensor and tf.constant
Tensorflow session
python with
with statement is actually very simple, once you understand the problem it’s trying to solve. Consider this piece of code:
set things up
try:
do something
finally:
tear things down
Here, “set things up” could be opening a file, or acquiring some sort of external resource, and “tear things down” would then be closing the file, or releasing or removing the resource. The try-finally construct guarantees that the “tear things down” part is always executed, even if the code that does the work doesn’t finish.tf.placeholder()
tensor math operations
x = tf.add(5, 2) # 7 x = tf.subtract(10, 4) # 6 y = tf.multiply(2, 5) # 10
Creating a variable in tensorflow
- To initialize call tf.global_variables_initializer()
Interesting functions