{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "What is PyTorch?\n", "================\n", "\n", "It’s a Python-based scientific computing package targeted at two sets of\n", "audiences:\n", "\n", "- A replacement for NumPy to use the power of GPUs\n", "- a deep learning research platform that provides maximum flexibility\n", " and speed\n", "\n", "Getting Started\n", "---------------\n", "\n", "## Tensors\n", "\n", "Tensors are similar to NumPy’s ndarrays, with the addition being that\n", "Tensors can also be used on a GPU to accelerate computing.\n", "\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from __future__ import print_function\n", "import torch" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
An uninitialized matrix is declared,\n", " but does not contain definite known\n", " values before it is used. When an\n", " uninitialized matrix is created,\n", " whatever values were in the allocated\n", " memory at the time will appear as the initial values.
``torch.Size`` is in fact a tuple, so it supports all tuple operations.
Any operation that mutates a tensor in-place is post-fixed with an ``_``.\n", " For example: ``x.copy_(y)``, ``x.t_()``, will change ``x``.