{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Sphinx Gallery Demo\n\nThis is a simple example demonstrating the Sphinx Gallery integration\nwith the PyTorch Sphinx Theme.\n\n## NumPy Arrays\n\nLet's create some arrays and demonstrate basic operations.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, let's create some arrays:\n\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "z = np.zeros((5, 3))\nprint(z)\nprint(z.dtype)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also create arrays with random values:\n\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "x = np.random.randn(3, 3)\nprint(x)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plotting with Matplotlib\n\nThe gallery can also display plots:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n\nfig, ax = plt.subplots()\nax.plot([1, 2, 3, 4], [1, 4, 2, 3])\nax.set_xlabel('X axis')\nax.set_ylabel('Y axis')\nax.set_title('Simple Plot')\nplt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.19" } }, "nbformat": 4, "nbformat_minor": 0 }