gcloud compute ssh instance-0 --ssh-flag="-L 8888:localhost:8888"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://help.ubuntu.com/community/AptGet/Howto | |
| # run after changing /etc/apt/sources.list or /etc/apt/preferences | |
| apt-get update | |
| # upgrade all installed packages | |
| apt-get upgrade | |
| # upgrade all installed packages with "smart" conflict resolution | |
| apt-get dist-upgrade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %env CUDA_VISIBLE_DEVICES=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| writer = tf.summary.FileWriter(logdir='checkpoints', graph=sess.graph) | |
| writer.flush() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pip install -U pip setuptools twine | |
| Edit ~/.pypirc and comment out or remove repository: | |
| [pypi] | |
| #repository:https://pypi.python.org/pypi | |
| Use twine to upload your module to pypi from within the folder containing the module source, setup.py, and other files: | |
| python setup.py sdist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cuda 9 | |
| wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64-deb | |
| sudo dpkg -i cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64-deb | |
| sudo apt-key adv --fetch-keys \ | |
| http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub | |
| sudo apt-get update | |
| sudo apt-get install cuda-9-0 | |
| # cuDNN 7.05 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tensorflow as tf | |
| train_dataset = tf.data.Dataset.range(10) | |
| train_iterator = train_dataset.make_one_shot_iterator() | |
| train_next = train_iterator.get_next() | |
| test_dataset = tf.data.Dataset.range(10, 20) | |
| test_iterator = test_dataset.make_one_shot_iterator() | |
| test_next = test_iterator.get_next() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from https://stackoverflow.com/questions/42463172/how-to-perform-max-mean-pooling-on-a-2d-array-using-numpy | |
| import numpy as np | |
| def asStride(arr,sub_shape,stride): | |
| '''Get a strided sub-matrices view of an ndarray. | |
| See also skimage.util.shape.view_as_windows() | |
| ''' | |
| s0,s1=arr.strides[:2] | |
| m1,n1=arr.shape[:2] | |
| m2,n2=sub_shape | |
| view_shape=(1+(m1-m2)//stride[0],1+(n1-n2)//stride[1],m2,n2)+arr.shape[2:] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !pip3 install datalab | |
| from google.datalab.ml import TensorBoard | |
| TensorBoard().start('./model_dir/') | |
| for pid in TensorBoard.list()['pid']: | |
| TensorBoard().stop(pid) | |
| print('Stopped TensorBoard with pid {}'.format(pid)) |