Google ColaboratoryでTensorFlow2.xを使う
概要
Google Colabでは、TensorFlowのバージョンが現時点の(2019/12/15)デフォルトで1.15.0となっている。 TF2.0系を試す場合の方法を示す。
TensorFlow2.x系への切り替え方法
現時点のバージョンを確認
import tensorflow as tf tf.__version__ # '1.15.0'
切り替え
!pip install tensorflow==2.*
切り替え後は、ランタイムの再起動が必要となる。
切り替え後のバージョンを確認
import tensorflow as tf tf.__version__ # '2.0.0'