diff options
author | Vijay Vasudevan <vrv@google.com> | 2015-11-08 11:37:26 -0800 |
---|---|---|
committer | Vijay Vasudevan <vrv@google.com> | 2015-11-08 11:37:26 -0800 |
commit | e28c1dbab3506d536ded7f1b1f0a527d4cad1b14 (patch) | |
tree | 7d64cecfb4ce522f878b328b154158559b4bd9f7 /tensorflow/g3doc/get_started | |
parent | ec490db88a1b624157f24a61dee0bd7d3c2630de (diff) |
TensorFlow: Upstream latest changes to git.
Changes:
- Documentation changes: adding some examples
for adding_an_op, fixes to some of the markdown,
updates to docstrings, etc.
- Remove Dockerfile for now -- still undergoing
changes.
Base CL: 107341050
Diffstat (limited to 'tensorflow/g3doc/get_started')
-rw-r--r-- | tensorflow/g3doc/get_started/basic_usage.md | 2 | ||||
-rw-r--r-- | tensorflow/g3doc/get_started/index.md | 8 | ||||
-rw-r--r-- | tensorflow/g3doc/get_started/os_setup.md | 126 |
3 files changed, 97 insertions, 39 deletions
diff --git a/tensorflow/g3doc/get_started/basic_usage.md b/tensorflow/g3doc/get_started/basic_usage.md index a41ec36d56..7616c3f7ea 100644 --- a/tensorflow/g3doc/get_started/basic_usage.md +++ b/tensorflow/g3doc/get_started/basic_usage.md @@ -15,7 +15,7 @@ graphs. Nodes in the graph are called *ops* (short for operations). An op takes zero or more `Tensors`, performs some computation, and produces zero or more `Tensors`. A `Tensor` is a typed multi-dimensional array. For example, you can represent a mini-batch of images as a 4-D array of floating point -numbers with dimensions `[batch, height, width, channels]`). +numbers with dimensions `[batch, height, width, channels]`. A TensorFlow graph is a *description* of computations. To compute anything, a graph must be launched in a `Session`. A `Session` places the graph ops onto diff --git a/tensorflow/g3doc/get_started/index.md b/tensorflow/g3doc/get_started/index.md index f0222e818d..9476408a54 100644 --- a/tensorflow/g3doc/get_started/index.md +++ b/tensorflow/g3doc/get_started/index.md @@ -53,11 +53,11 @@ of MNIST, definitely take the blue pill. If you're somewhere in between, we suggest skimming blue, then red. <div style="width:100%; margin:auto; margin-bottom:10px; margin-top:20px; display: flex; flex-direction: row"> - <a href="../tutorials/mnist/beginners/index.md"> - <img style="flex-grow:1; flex-shrink:1; border: 1px solid black;" src="blue_pill.png"> + <a href="../tutorials/mnist/beginners/index.md" title="MNIST for ML Beginners tutorial"> + <img style="flex-grow:1; flex-shrink:1; border: 1px solid black;" src="blue_pill.png" alt="MNIST for machine learning beginners tutorial" /> </a> - <a href="../tutorials/mnist/pros/index.md"> - <img style="flex-grow:1; flex-shrink:1; border: 1px solid black;" src="red_pill.png"> + <a href="../tutorials/mnist/pros/index.md" title="Deep MNIST for ML Experts tutorial"> + <img style="flex-grow:1; flex-shrink:1; border: 1px solid black;" src="red_pill.png" alt="Deep MNIST for machine learning experts tutorial" /> </a> </div> <p style="font-size:10px;">Images licensed CC BY-SA 4.0; original by W. Carter</p> diff --git a/tensorflow/g3doc/get_started/os_setup.md b/tensorflow/g3doc/get_started/os_setup.md index f6b6bb4015..4db07c233b 100644 --- a/tensorflow/g3doc/get_started/os_setup.md +++ b/tensorflow/g3doc/get_started/os_setup.md @@ -4,36 +4,82 @@ ### Ubuntu/Linux <a class="md-anchor" id="AUTOGENERATED-ubuntu-linux"></a> -Make sure you have [pip](https://pypi.python.org/pypi/pip) installed: +Make sure you have [pip](https://pypi.python.org/pypi/pip), the python headers, +and (optionally) [virtualenv](https://pypi.python.org/pypi/virtualenv) installed: -```sh -$ sudo apt-get install python-pip +```bash +$ sudo apt-get install python-pip python-dev python-virtualenv ``` -Install TensorFlow: +**Note**: All the virtualenv-related instructions are optional, but we recommend +using the virtualenv on any multi-user system. -```sh +Set up a new virtualenv environment. Assuming you want to set it up in the +directory `~/tensorflow`, run: + +```bash +$ virtualenv --system-site-packages ~/tensorflow +$ cd ~/tensorflow +``` + +Activate the virtualenv: + +```bash +$ source bin/activate # If using bash +$ source bin/activate.csh # If using csh +(tensorflow)$ # Your prompt should change +``` + +Inside the virtualenv, install TensorFlow: + +```bash # For CPU-only version -$ sudo pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl +(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl -# For GPU-enabled version -$ sudo pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl +# For GPU-enabled version (only install this version if you have the CUDA sdk installed) +(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.5.0-cp27-none-linux_x86_64.whl + +(tensorflow)$ deactivate # Deactivate the virtualenv +$ # Your prompt should change back ``` ### Mac OS X <a class="md-anchor" id="AUTOGENERATED-mac-os-x"></a> -Make sure you have [pip](https://pypi.python.org/pypi/pip) installed: +Make sure you have [pip](https://pypi.python.org/pypi/pip) and +(optionally) [virtualenv](https://pypi.python.org/pypi/virtualenv) installed: + +**Note**: All the virtualenv-related instructions are optional, but we recommend +using the virtualenv on any multi-user system. If using `easy_install`: -```sh -$ sudo easy_install pip +```bash +$ sudo easy_install pip # If pip is not already installed +$ sudo pip install --upgrade virtualenv +``` + +Set up a new virtualenv environment. Assuming you want to set it up in the +directory `~/tensorflow`, run: + +```bash +$ virtualenv --system-site-packages ~/tensorflow +$ cd ~/tensorflow +``` + +Activate the virtualenv: + +```bash +$ source bin/activate # If using bash +$ source bin/activate.csh # If using csh +(tensorflow)$ # Your prompt should change ``` Install TensorFlow (only CPU binary version is currently available). -```sh -$ sudo pip install https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl +```bash +(tensorflow)$ pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl +(tensorflow)$ deactivate # Deactivate the virtualenv +$ # Your prompt should change back ``` ## Docker-based installation <a class="md-anchor" id="AUTOGENERATED-docker-based-installation"></a> @@ -44,7 +90,7 @@ you avoid worrying about setting up dependencies. First, [install Docker](http://docs.docker.com/engine/installation/). Once Docker is up and running, you can start a container with one command: -```sh +```bash $ docker run -it b.gcr.io/tensorflow/tensorflow ``` @@ -64,8 +110,28 @@ which you can use in the `docker run` command above: ## Try your first TensorFlow program <a class="md-anchor" id="AUTOGENERATED-try-your-first-tensorflow-program"></a> -```sh -$ python +### (Optional) Enable GPU Support <a class="md-anchor" id="AUTOGENERATED--optional--enable-gpu-support"></a> + +If you installed the GPU-enabled TensorFlow pip binary, you must have the +correct versions of the CUDA SDK and CUDNN installed on your +system. Please see [the CUDA installation instructions](#install_cuda). + +You also need to set the `LD_LIBRARY_PATH` and `CUDA_HOME` environment +variables. Consider adding the commands below to your `~/.bash_profile`. These +assume your CUDA installation is in `/usr/local/cuda`: + +```bash +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64" +export CUDA_HOME=/usr/local/cuda +``` + +### Run TensorFlow <a class="md-anchor" id="AUTOGENERATED-run-tensorflow"></a> + +First, activate the TensorFlow virtualenv, then open a python terminal: + +```bash +$ source ~/tensorflow/bin/activate # Assuming the tensorflow virtualenv is ~/tensorflow +(tensorflow)$ python >>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow!') @@ -80,20 +146,12 @@ Hello, TensorFlow! ``` -If you are running the GPU version and you see -```sh -ImportError: libcudart.so.7.0: cannot open shared object file: No such file or directory -``` - -you most likely need to set your `LD_LIBRARY_PATH` to point to the location of -your CUDA libraries. - ## Installing from sources <a class="md-anchor" id="source"></a> ### Clone the TensorFlow repository <a class="md-anchor" id="AUTOGENERATED-clone-the-tensorflow-repository"></a> -```sh -$ git clone --recurse-submodules https://tensorflow.googlesource.com/tensorflow +```bash +$ git clone --recurse-submodules https://github.com/tensorflow/tensorflow ``` `--recurse-submodules` is required to fetch the protobuf library that TensorFlow @@ -108,7 +166,7 @@ Follow instructions [here](http://bazel.io/docs/install.html) to install the dependencies for Bazel. Then download and build the Bazel source with the following commands: -```sh +```bash $ git clone https://github.com/bazelbuild/bazel.git $ cd bazel $ git checkout tags/0.1.0 @@ -122,14 +180,14 @@ Add the executable `output/bazel` to your `$PATH` environment variable. #### Install other dependencies <a class="md-anchor" id="AUTOGENERATED-install-other-dependencies"></a> -```sh +```bash $ sudo apt-get install python-numpy swig python-dev ``` -#### Optional: Install CUDA (GPUs on Linux) <a class="md-anchor" id="AUTOGENERATED-optional--install-cuda--gpus-on-linux-"></a> +#### <a name="install_cuda"></a>Optional: Install CUDA (GPUs on Linux) <a class="md-anchor" id="AUTOGENERATED--a-name--install_cuda----a-optional--install-cuda--gpus-on-linux-"></a> -In order to build TensorFlow with GPU support, both Cuda Toolkit 7.0 and CUDNN -6.5 V2 from NVIDIA need to be installed. +In order to build or run TensorFlow with GPU support, both Cuda Toolkit 7.0 and +CUDNN 6.5 V2 from NVIDIA need to be installed. TensorFlow GPU support requires having a GPU card with NVidia Compute Capability >= 3.5. Supported cards include but are not limited to: @@ -185,7 +243,7 @@ you invoke the bazel build command. ##### Build your target with GPU support. <a class="md-anchor" id="AUTOGENERATED-build-your-target-with-gpu-support."></a> From the root of your source tree, run: -```sh +```bash $ bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer $ bazel-bin/tensorflow/cc/tutorials_example_trainer --use_gpu @@ -234,7 +292,7 @@ Follow installation instructions [here](http://docs.scipy.org/doc/numpy/user/ins ### Create the pip package and install <a class="md-anchor" id="create-pip"></a> -```sh +```bash $ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package $ bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg @@ -247,7 +305,7 @@ $ pip install /tmp/tensorflow_pkg/tensorflow-0.5.0-cp27-none-linux_x86_64.whl From the root of your source tree, run: -```sh +```python $ python tensorflow/models/image/mnist/convolutional.py Succesfully downloaded train-images-idx3-ubyte.gz 9912422 bytes. Succesfully downloaded train-labels-idx1-ubyte.gz 28881 bytes. |