Computer Vision News - August 2019
We Tried for You: 20 TensorFlow is an end-to-end open source platform for implementing deep learning models. It allows the user flexibility and custom-made operation, which is not always possible in some higher-level packages. However, until recently, the execution of operations in TensorFlow was clumsy and not intuitive. When executing a piece of code, TensorFlow has built behind the scene a computation graph in order to perform the operation more efficiently. This computation graph restricted the user access to the tensors and made it difficult to debug and to understand what's going on in the network's parameters. Meanwhile, practitioners began to use packages like Keras and PyTorch which made Deep Learning programming much more intuitive and simpler. To solve the above issues, and to make TensorFlow execution more 'Pythonic' and intuitive, Google has introduced eager execution in TensorFlow 2.0. This new execution builds the computation graph on the fly and allows the user to define the network in a Keras-like manner. Then, the training is performed without the tf.session commands and the user gets full access to the network variables on run time. A simple demonstration of the change can be seen below. This code snippet outputs the value of a constant tensor with the old execution scheme: 1 2 3 4 const = tf . constant([[ 1 , 2 ],[ 3 , 4 ]]) with tf . Session() as sess: output = sess . run(const) print (output) But if we enable the eager execution, we can print the same variable more easily by just writing: 1 2 3 tf . enable_eager_execution() const = tf . constant([[ 1 , 2 ],[ 3 , 4 ]]) print (const)
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=