Date: Dec. 8th, 2019
Lecturer: Chia
import tensorflow as tf
tf.test.gpu_device_name()
#Output: ''
import tensorflow as tf
tf.test.gpu_device_name()
#Output: '/device:GPU:0'
from tensorflow.python.client import device_lib
device_lib.list_local_devices()
from google.colab import drive
drive.mount('/content/drive/')
!ls "/content/drive/My Drive/"
!python3 "/content/drive/My Drive/Colab Notebooks/print_abc.py"
from google.colab import files
files.download('/content/drive/My Drive/Colab Notebooks/print_abc.py')
import os
os.chdir("/content/drive/My Drive/Colab Notebooks")
!ls
from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
print('User uploaded file "{name}" with length {length} bytes'.format(name=fn, length=len(uploaded[fn])))
# -P => 指定存放路徑
!wget https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/datasets/Titanic.csv \
-P "/content/drive/My Drive/Colab Notebooks"
import pandas as pd
titanic = pd.read_csv("/content/drive/My Drive/Colab Notebooks/Titanic.csv")
titanic.head(5)
!git clone https://github.com/wxs/keras-mnist-tutorial.git
import os
os.chdir("/content/drive/My Drive/Colab Notebooks")
!ls
# 到上一層目錄
#os.chdir("../")
#!ls
%%bash
pip freeze
# -q, --quiet => Give less output.
!pip install -q keras
import keras
%%bash
# For a specific version:
pip install -q tensorflow==1.2
# To determine which version you're using:
pip show tensorflow
%%bash
# For the current version:
pip install --upgrade -q tensorflow
# To determine which version you're using:
pip show tensorflow