diff --git a/Misc/06-Gradients.ipynb b/Misc/06-Gradients.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..26c042b6e47415b3f24430336f1d559a40b045f5 --- /dev/null +++ b/Misc/06-Gradients.ipynb @@ -0,0 +1,162 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import torch" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Pure Python" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "f(1) is : 0\n", + "f(2) is : 7\n", + "df(3) is : 10\n" + ] + } + ], + "source": [ + "# ---- My basic function f\n", + "def f(x):\n", + " y = x*x + 4*x - 5\n", + " return y\n", + "\n", + "def df(x):\n", + " y=2*x + 4\n", + " return y\n", + "\n", + "# ---- Examples :\n", + "print('f(1) is : ', f(1))\n", + "print('f(2) is : ', f(2))\n", + "\n", + "print('df(3) is : ',df(3))\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Using Torch" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Get a nice tensor, with `requires_grad=True` :-)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x: tensor(3., requires_grad=True)\n" + ] + } + ], + "source": [ + "x = torch.tensor(3.0, requires_grad = True)\n", + "print(\"x:\", x)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Define our function.." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "y = x*x + 4*x + - 5 " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Compute gradient with the backward function" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "y.backward()" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "dx= tensor(10.)\n" + ] + } + ], + "source": [ + "dx=x.grad\n", + "print('dx=',dx)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "fidle-env", + "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.9.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/README.ipynb b/README.ipynb index 8b92b213641469e156d022b07e772c8f86a18353..a21d9355b52bf35cfb1b04a3cb924a9ac033dc4c 100644 --- a/README.ipynb +++ b/README.ipynb @@ -3,13 +3,13 @@ { "cell_type": "code", "execution_count": 1, - "id": "60a4d6df", + "id": "3f8d27e1", "metadata": { "execution": { - "iopub.execute_input": "2024-03-03T19:38:38.844681Z", - "iopub.status.busy": "2024-03-03T19:38:38.844023Z", - "iopub.status.idle": "2024-03-03T19:38:38.854300Z", - "shell.execute_reply": "2024-03-03T19:38:38.853434Z" + "iopub.execute_input": "2024-03-20T20:58:24.985713Z", + "iopub.status.busy": "2024-03-20T20:58:24.985441Z", + "iopub.status.idle": "2024-03-20T20:58:24.998771Z", + "shell.execute_reply": "2024-03-20T20:58:24.997910Z" }, "jupyter": { "source_hidden": true @@ -53,14 +53,14 @@ "For more information, you can contact us at : \n", "[<img width=\"200px\" style=\"vertical-align:middle\" src=\"fidle/img/00-Mail_contact.svg\"></img>](#top)\n", "\n", - "Current Version : <!-- VERSION_BEGIN -->3.0.9<!-- VERSION_END -->\n", + "Current Version : <!-- VERSION_BEGIN -->3.0.10<!-- VERSION_END -->\n", "\n", "\n", "## Course materials\n", "\n", - "| | | | |\n", + "| Courses | Notebooks | Datasets | Videos |\n", "|:--:|:--:|:--:|:--:|\n", - "| **[<img width=\"50px\" src=\"fidle/img/00-Fidle-pdf.svg\"></img><br>Course slides](https://fidle.cnrs.fr/supports)**<br>The course in pdf format<br>| **[<img width=\"50px\" src=\"fidle/img/00-Notebooks.svg\"></img><br>Notebooks](https://fidle.cnrs.fr/notebooks)**<br> Get a Zip or clone this repository <br>| **[<img width=\"50px\" src=\"fidle/img/00-Datasets-tar.svg\"></img><br>Datasets](https://fidle.cnrs.fr/datasets-fidle.tar)**<br>All the needed datasets<br>|**[<img width=\"50px\" src=\"fidle/img/00-Videos.svg\"></img><br>Videos](https://fidle.cnrs.fr/youtube)**<br> Our Youtube channel |\n", + "| [<img width=\"50px\" src=\"fidle/img/00-Fidle-pdf.svg\"></img><br>**Course slides**](https://fidle.cnrs.fr/supports)<br>The course in pdf format<br>| [<img width=\"50px\" src=\"fidle/img/00-Notebooks.svg\"></img><br>**Notebooks**](https://fidle.cnrs.fr/notebooks)<br> Get a Zip or clone this repository <br>| [<img width=\"50px\" src=\"fidle/img/00-Datasets-tar.svg\"></img><br>**Datasets**](https://fidle.cnrs.fr/datasets-fidle.tar)<br>All the needed datasets<br>|[<img width=\"50px\" src=\"fidle/img/00-Videos.svg\"></img><br>**Videos**](https://fidle.cnrs.fr/youtube)<br> Our Youtube channel |\n", "\n", "Have a look about **[How to get and install](https://fidle.cnrs.fr/installation)** these notebooks and datasets.\n", "\n", @@ -68,7 +68,7 @@ "## Jupyter notebooks\n", "\n", "<!-- TOC_BEGIN -->\n", - "<!-- Automatically generated on : 03/03/24 20:38:37 -->\n", + "<!-- Automatically generated on : 20/03/24 21:58:23 -->\n", "\n", "### Linear and logistic regression\n", "- **[LINR1](LinearReg/01-Linear-Regression.ipynb)** - [Linear regression with direct resolution](LinearReg/01-Linear-Regression.ipynb) \n", @@ -207,6 +207,8 @@ "4 ways to use Tensorboard from the Jupyter environment\n", "- **[??](Misc/05-RNN.ipynb)** - [??](Misc/05-RNN.ipynb) \n", "??\n", + "- **[??](Misc/06-Gradients.ipynb)** - [??](Misc/06-Gradients.ipynb) \n", + "??\n", "<!-- TOC_END -->\n", "\n", "## Installation\n", @@ -237,7 +239,7 @@ "from IPython.display import display,Markdown\n", "display(Markdown(open('README.md', 'r').read()))\n", "#\n", - "# This README is visible under Jupiter Lab ;-)# Automatically generated on : 03/03/24 20:38:37" + "# This README is visible under Jupiter Lab ;-)# Automatically generated on : 20/03/24 21:58:24" ] } ], diff --git a/README.md b/README.md index 320b9d2bbc76cc4e9d7701661c725a661e5b5fc3..b44e752f71901981bf0797e08a1c1590b54a043e 100644 --- a/README.md +++ b/README.md @@ -32,14 +32,14 @@ For more information, see **https://fidle.cnrs.fr** : For more information, you can contact us at : [<img width="200px" style="vertical-align:middle" src="fidle/img/00-Mail_contact.svg"></img>](#top) -Current Version : <!-- VERSION_BEGIN -->3.0.9<!-- VERSION_END --> +Current Version : <!-- VERSION_BEGIN -->3.0.10<!-- VERSION_END --> ## Course materials -| | | | | +| Courses | Notebooks | Datasets | Videos | |:--:|:--:|:--:|:--:| -| **[<img width="50px" src="fidle/img/00-Fidle-pdf.svg"></img><br>Course slides](https://fidle.cnrs.fr/supports)**<br>The course in pdf format<br>| **[<img width="50px" src="fidle/img/00-Notebooks.svg"></img><br>Notebooks](https://fidle.cnrs.fr/notebooks)**<br> Get a Zip or clone this repository <br>| **[<img width="50px" src="fidle/img/00-Datasets-tar.svg"></img><br>Datasets](https://fidle.cnrs.fr/datasets-fidle.tar)**<br>All the needed datasets<br>|**[<img width="50px" src="fidle/img/00-Videos.svg"></img><br>Videos](https://fidle.cnrs.fr/youtube)**<br> Our Youtube channel | +| [<img width="50px" src="fidle/img/00-Fidle-pdf.svg"></img><br>**Course slides**](https://fidle.cnrs.fr/supports)<br>The course in pdf format<br>| [<img width="50px" src="fidle/img/00-Notebooks.svg"></img><br>**Notebooks**](https://fidle.cnrs.fr/notebooks)<br> Get a Zip or clone this repository <br>| [<img width="50px" src="fidle/img/00-Datasets-tar.svg"></img><br>**Datasets**](https://fidle.cnrs.fr/datasets-fidle.tar)<br>All the needed datasets<br>|[<img width="50px" src="fidle/img/00-Videos.svg"></img><br>**Videos**](https://fidle.cnrs.fr/youtube)<br> Our Youtube channel | Have a look about **[How to get and install](https://fidle.cnrs.fr/installation)** these notebooks and datasets. @@ -47,7 +47,7 @@ Have a look about **[How to get and install](https://fidle.cnrs.fr/installation) ## Jupyter notebooks <!-- TOC_BEGIN --> -<!-- Automatically generated on : 03/03/24 20:38:37 --> +<!-- Automatically generated on : 20/03/24 21:58:23 --> ### Linear and logistic regression - **[LINR1](LinearReg/01-Linear-Regression.ipynb)** - [Linear regression with direct resolution](LinearReg/01-Linear-Regression.ipynb) @@ -186,6 +186,8 @@ PyTorch est l'un des principaux framework utilisé dans le Deep Learning 4 ways to use Tensorboard from the Jupyter environment - **[??](Misc/05-RNN.ipynb)** - [??](Misc/05-RNN.ipynb) ?? +- **[??](Misc/06-Gradients.ipynb)** - [??](Misc/06-Gradients.ipynb) +?? <!-- TOC_END --> ## Installation diff --git a/fidle/about.yml b/fidle/about.yml index 74bff6ab75f7e1526d43c59dbbfe54e019487c33..c145d7895c19bccd7ba4e3aab9b73d9027c05384 100644 --- a/fidle/about.yml +++ b/fidle/about.yml @@ -13,7 +13,7 @@ # # This file describes the notebooks used by the Fidle training. -version: 3.0.9 +version: 3.0.10 content: notebooks name: Notebooks Fidle description: All notebooks used by the Fidle training diff --git a/fidle/ci/default.yml b/fidle/ci/default.yml index 31d363e42e30f6512b145cd7af36f1840626b079..ae0bd6b0f2de7a69c736b80505a1909c6026876f 100644 --- a/fidle/ci/default.yml +++ b/fidle/ci/default.yml @@ -1,6 +1,6 @@ campain: version: '1.0' - description: Automatically generated ci profile (03/03/24 20:38:37) + description: Automatically generated ci profile (20/03/24 21:58:23) directory: ./campains/default existing_notebook: 'remove # remove|skip' report_template: 'fidle # fidle|default' @@ -321,4 +321,4 @@ TSB1: notebook: Misc/04-Using-Tensorboard.ipynb overrides: ?? ??: - notebook: Misc/05-RNN.ipynb + notebook: Misc/06-Gradients.ipynb