{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 0
   },
   "source": [
    "# Parameter Management\n",
    "\n",
    "Once we have chosen an architecture\n",
    "and set our hyperparameters,\n",
    "we proceed to the training loop,\n",
    "where our goal is to find parameter values\n",
    "that minimize our loss function.\n",
    "After training, we will need these parameters\n",
    "in order to make future predictions.\n",
    "Additionally, we will sometimes wish\n",
    "to extract the parameters\n",
    "either to reuse them in some other context,\n",
    "to save our model to disk so that\n",
    "it may be executed in other software,\n",
    "or for examination in the hope of\n",
    "gaining scientific understanding.\n",
    "\n",
    "Most of the time, we will be able\n",
    "to ignore the nitty-gritty details\n",
    "of how parameters are declared\n",
    "and manipulated, relying on deep learning frameworks\n",
    "to do the heavy lifting.\n",
    "However, when we move away from\n",
    "stacked architectures with standard layers,\n",
    "we will sometimes need to get into the weeds\n",
    "of declaring and manipulating parameters.\n",
    "In this section, we cover the following:\n",
    "\n",
    "* Accessing parameters for debugging, diagnostics, and visualizations.\n",
    "* Parameter initialization.\n",
    "* Sharing parameters across different model components.\n",
    "\n",
    "(**We start by focusing on an MLP with one hidden layer.**)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "origin_pos": 1,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0.0054572 ],\n",
       "       [0.00488594]])"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from mxnet import init, np, npx\n",
    "from mxnet.gluon import nn\n",
    "\n",
    "npx.set_np()\n",
    "\n",
    "net = nn.Sequential()\n",
    "net.add(nn.Dense(8, activation='relu'))\n",
    "net.add(nn.Dense(1))\n",
    "net.initialize()  # Use the default initialization method\n",
    "\n",
    "X = np.random.uniform(size=(2, 4))\n",
    "net(X)  # Forward computation"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 4
   },
   "source": [
    "## [**Parameter Access**]\n",
    "\n",
    "Let us start with how to access parameters\n",
    "from the models that you already know.\n",
    "When a model is defined via the `Sequential` class,\n",
    "we can first access any layer by indexing\n",
    "into the model as though it were a list.\n",
    "Each layer's parameters are conveniently\n",
    "located in its attribute.\n",
    "We can inspect the parameters of the second fully-connected layer as follows.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "origin_pos": 5,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dense1_ (\n",
      "  Parameter dense1_weight (shape=(1, 8), dtype=float32)\n",
      "  Parameter dense1_bias (shape=(1,), dtype=float32)\n",
      ")\n"
     ]
    }
   ],
   "source": [
    "print(net[1].params)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 8
   },
   "source": [
    "The output tells us a few important things.\n",
    "First, this fully-connected layer\n",
    "contains two parameters,\n",
    "corresponding to that layer's\n",
    "weights and biases, respectively.\n",
    "Both are stored as single precision floats (float32).\n",
    "Note that the names of the parameters\n",
    "allow us to uniquely identify\n",
    "each layer's parameters,\n",
    "even in a network containing hundreds of layers.\n",
    "\n",
    "\n",
    "### [**Targeted Parameters**]\n",
    "\n",
    "Note that each parameter is represented\n",
    "as an instance of the parameter class.\n",
    "To do anything useful with the parameters,\n",
    "we first need to access the underlying numerical values.\n",
    "There are several ways to do this.\n",
    "Some are simpler while others are more general.\n",
    "The following code extracts the bias\n",
    "from the second neural network layer, which returns a parameter class instance, and \n",
    "further accesses that parameter's value.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "origin_pos": 9,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'mxnet.gluon.parameter.Parameter'>\n",
      "Parameter dense1_bias (shape=(1,), dtype=float32)\n",
      "[0.]\n"
     ]
    }
   ],
   "source": [
    "print(type(net[1].bias))\n",
    "print(net[1].bias)\n",
    "print(net[1].bias.data())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 12,
    "tab": [
     "mxnet"
    ]
   },
   "source": [
    "Parameters are complex objects,\n",
    "containing values, gradients,\n",
    "and additional information.\n",
    "That's why we need to request the value explicitly.\n",
    "\n",
    "In addition to the value, each parameter also allows us to access the gradient. Because we have not invoked backpropagation for this network yet, it is in its initial state.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "origin_pos": 13,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0., 0., 0., 0., 0., 0., 0., 0.]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "net[1].weight.grad()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 15
   },
   "source": [
    "### [**All Parameters at Once**]\n",
    "\n",
    "When we need to perform operations on all parameters,\n",
    "accessing them one-by-one can grow tedious.\n",
    "The situation can grow especially unwieldy\n",
    "when we work with more complex blocks (e.g., nested blocks),\n",
    "since we would need to recurse\n",
    "through the entire tree to extract\n",
    "each sub-block's parameters. Below we demonstrate accessing the parameters of the first fully-connected layer vs. accessing all layers.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "origin_pos": 16,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dense0_ (\n",
      "  Parameter dense0_weight (shape=(8, 4), dtype=float32)\n",
      "  Parameter dense0_bias (shape=(8,), dtype=float32)\n",
      ")\n",
      "sequential0_ (\n",
      "  Parameter dense0_weight (shape=(8, 4), dtype=float32)\n",
      "  Parameter dense0_bias (shape=(8,), dtype=float32)\n",
      "  Parameter dense1_weight (shape=(1, 8), dtype=float32)\n",
      "  Parameter dense1_bias (shape=(1,), dtype=float32)\n",
      ")\n"
     ]
    }
   ],
   "source": [
    "print(net[0].collect_params())\n",
    "print(net.collect_params())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 19
   },
   "source": [
    "This provides us with another way of accessing the parameters of the network as follows.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "origin_pos": 20,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.])"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "net.collect_params()['dense1_bias'].data()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 23
   },
   "source": [
    "### [**Collecting Parameters from Nested Blocks**]\n",
    "\n",
    "Let us see how the parameter naming conventions work\n",
    "if we nest multiple blocks inside each other.\n",
    "For that we first define a function that produces blocks\n",
    "(a block factory, so to speak) and then\n",
    "combine these inside yet larger blocks.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "origin_pos": 24,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[-6.3465846e-09, -1.1096752e-09,  6.4161787e-09,  6.6354140e-09,\n",
       "        -1.1265507e-09,  1.3284951e-10,  9.3619388e-09,  3.2229084e-09,\n",
       "         5.9429879e-09,  8.8181435e-09],\n",
       "       [-8.6219423e-09, -7.5150686e-10,  8.3133251e-09,  8.9321128e-09,\n",
       "        -1.6740003e-09,  3.2405989e-10,  1.2115976e-08,  4.4926449e-09,\n",
       "         8.0741742e-09,  1.2075874e-08]])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def block1():\n",
    "    net = nn.Sequential()\n",
    "    net.add(nn.Dense(32, activation='relu'))\n",
    "    net.add(nn.Dense(16, activation='relu'))\n",
    "    return net\n",
    "\n",
    "def block2():\n",
    "    net = nn.Sequential()\n",
    "    for _ in range(4):\n",
    "        # Nested here\n",
    "        net.add(block1())\n",
    "    return net\n",
    "\n",
    "rgnet = nn.Sequential()\n",
    "rgnet.add(block2())\n",
    "rgnet.add(nn.Dense(10))\n",
    "rgnet.initialize()\n",
    "rgnet(X)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 27
   },
   "source": [
    "Now that [**we have designed the network,\n",
    "let us see how it is organized.**]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "origin_pos": 28,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<bound method Block.collect_params of Sequential(\n",
      "  (0): Sequential(\n",
      "    (0): Sequential(\n",
      "      (0): Dense(4 -> 32, Activation(relu))\n",
      "      (1): Dense(32 -> 16, Activation(relu))\n",
      "    )\n",
      "    (1): Sequential(\n",
      "      (0): Dense(16 -> 32, Activation(relu))\n",
      "      (1): Dense(32 -> 16, Activation(relu))\n",
      "    )\n",
      "    (2): Sequential(\n",
      "      (0): Dense(16 -> 32, Activation(relu))\n",
      "      (1): Dense(32 -> 16, Activation(relu))\n",
      "    )\n",
      "    (3): Sequential(\n",
      "      (0): Dense(16 -> 32, Activation(relu))\n",
      "      (1): Dense(32 -> 16, Activation(relu))\n",
      "    )\n",
      "  )\n",
      "  (1): Dense(16 -> 10, linear)\n",
      ")>\n",
      "sequential1_ (\n",
      "  Parameter dense2_weight (shape=(32, 4), dtype=float32)\n",
      "  Parameter dense2_bias (shape=(32,), dtype=float32)\n",
      "  Parameter dense3_weight (shape=(16, 32), dtype=float32)\n",
      "  Parameter dense3_bias (shape=(16,), dtype=float32)\n",
      "  Parameter dense4_weight (shape=(32, 16), dtype=float32)\n",
      "  Parameter dense4_bias (shape=(32,), dtype=float32)\n",
      "  Parameter dense5_weight (shape=(16, 32), dtype=float32)\n",
      "  Parameter dense5_bias (shape=(16,), dtype=float32)\n",
      "  Parameter dense6_weight (shape=(32, 16), dtype=float32)\n",
      "  Parameter dense6_bias (shape=(32,), dtype=float32)\n",
      "  Parameter dense7_weight (shape=(16, 32), dtype=float32)\n",
      "  Parameter dense7_bias (shape=(16,), dtype=float32)\n",
      "  Parameter dense8_weight (shape=(32, 16), dtype=float32)\n",
      "  Parameter dense8_bias (shape=(32,), dtype=float32)\n",
      "  Parameter dense9_weight (shape=(16, 32), dtype=float32)\n",
      "  Parameter dense9_bias (shape=(16,), dtype=float32)\n",
      "  Parameter dense10_weight (shape=(10, 16), dtype=float32)\n",
      "  Parameter dense10_bias (shape=(10,), dtype=float32)\n",
      ")\n"
     ]
    }
   ],
   "source": [
    "print(rgnet.collect_params)\n",
    "print(rgnet.collect_params())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 31
   },
   "source": [
    "Since the layers are hierarchically nested,\n",
    "we can also access them as though\n",
    "indexing through nested lists.\n",
    "For instance, we can access the first major block,\n",
    "within it the second sub-block,\n",
    "and within that the bias of the first layer,\n",
    "with as follows.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "origin_pos": 32,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,\n",
       "       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rgnet[0][1][0].bias.data()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 35
   },
   "source": [
    "## Parameter Initialization\n",
    "\n",
    "Now that we know how to access the parameters,\n",
    "let us look at how to initialize them properly.\n",
    "We discussed the need for proper initialization in :numref:`sec_numerical_stability`.\n",
    "The deep learning framework provides default random initializations to its layers.\n",
    "However, we often want to initialize our weights\n",
    "according to various other protocols. The framework provides most commonly\n",
    "used protocols, and also allows to create a custom initializer.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 36,
    "tab": [
     "mxnet"
    ]
   },
   "source": [
    "By default, MXNet initializes weight parameters by randomly drawing from a uniform distribution $U(-0.07, 0.07)$,\n",
    "clearing bias parameters to zero.\n",
    "MXNet's `init` module provides a variety\n",
    "of preset initialization methods.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 39
   },
   "source": [
    "### [**Built-in Initialization**]\n",
    "\n",
    "Let us begin by calling on built-in initializers.\n",
    "The code below initializes all weight parameters\n",
    "as Gaussian random variables\n",
    "with standard deviation 0.01, while bias parameters cleared to zero.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "origin_pos": 40,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([-0.00324057, -0.00895028, -0.00698632,  0.01030831])"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Here `force_reinit` ensures that parameters are freshly initialized even if\n",
    "# they were already initialized previously\n",
    "net.initialize(init=init.Normal(sigma=0.01), force_reinit=True)\n",
    "net[0].weight.data()[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 43
   },
   "source": [
    "We can also initialize all the parameters\n",
    "to a given constant value (say, 1).\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "origin_pos": 44,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1., 1., 1., 1.])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "net.initialize(init=init.Constant(1), force_reinit=True)\n",
    "net[0].weight.data()[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 47
   },
   "source": [
    "[**We can also apply different initializers for certain blocks.**]\n",
    "For example, below we initialize the first layer\n",
    "with the Xavier initializer\n",
    "and initialize the second layer\n",
    "to a constant value of 42.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "origin_pos": 48,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[-0.17594433  0.02314097 -0.1992535   0.09509248]\n",
      "[[42. 42. 42. 42. 42. 42. 42. 42.]]\n"
     ]
    }
   ],
   "source": [
    "net[0].weight.initialize(init=init.Xavier(), force_reinit=True)\n",
    "net[1].initialize(init=init.Constant(42), force_reinit=True)\n",
    "print(net[0].weight.data()[0])\n",
    "print(net[1].weight.data())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 51
   },
   "source": [
    "### [**Custom Initialization**]\n",
    "\n",
    "Sometimes, the initialization methods we need\n",
    "are not provided by the deep learning framework.\n",
    "In the example below, we define an initializer\n",
    "for any weight parameter $w$ using the following strange distribution:\n",
    "\n",
    "$$\n",
    "\\begin{aligned}\n",
    "    w \\sim \\begin{cases}\n",
    "        U(5, 10) & \\text{ with probability } \\frac{1}{4} \\\\\n",
    "            0    & \\text{ with probability } \\frac{1}{2} \\\\\n",
    "        U(-10, -5) & \\text{ with probability } \\frac{1}{4}\n",
    "    \\end{cases}\n",
    "\\end{aligned}\n",
    "$$\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 52,
    "tab": [
     "mxnet"
    ]
   },
   "source": [
    "Here we define a subclass of the `Initializer` class.\n",
    "Usually, we only need to implement the `_init_weight` function\n",
    "which takes a tensor argument (`data`)\n",
    "and assigns to it the desired initialized values.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "origin_pos": 55,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Init dense0_weight (8, 4)\n",
      "Init dense1_weight (1, 8)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[ 0.       , -0.       , -0.       ,  8.522827 ],\n",
       "       [ 0.       , -8.828651 , -0.       , -5.6012006]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "class MyInit(init.Initializer):\n",
    "    def _init_weight(self, name, data):\n",
    "        print('Init', name, data.shape)\n",
    "        data[:] = np.random.uniform(-10, 10, data.shape)\n",
    "        data *= np.abs(data) >= 5\n",
    "\n",
    "net.initialize(MyInit(), force_reinit=True)\n",
    "net[0].weight.data()[:2]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 58
   },
   "source": [
    "Note that we always have the option\n",
    "of setting parameters directly.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "origin_pos": 59,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([42.      ,  1.      ,  1.      ,  9.522827])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "net[0].weight.data()[:] += 1\n",
    "net[0].weight.data()[0, 0] = 42\n",
    "net[0].weight.data()[0]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 62,
    "tab": [
     "mxnet"
    ]
   },
   "source": [
    "A note for advanced users:\n",
    "if you want to adjust parameters within an `autograd` scope,\n",
    "you need to use `set_data` to avoid confusing\n",
    "the automatic differentiation mechanics.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 63
   },
   "source": [
    "## [**Tied Parameters**]\n",
    "\n",
    "Often, we want to share parameters across multiple layers.\n",
    "Let us see how to do this elegantly.\n",
    "In the following we allocate a dense layer\n",
    "and then use its parameters specifically\n",
    "to set those of another layer.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "origin_pos": 64,
    "tab": [
     "mxnet"
    ]
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ True  True  True  True  True  True  True  True]\n",
      "[ True  True  True  True  True  True  True  True]\n"
     ]
    }
   ],
   "source": [
    "net = nn.Sequential()\n",
    "# We need to give the shared layer a name so that we can refer to its\n",
    "# parameters\n",
    "shared = nn.Dense(8, activation='relu')\n",
    "net.add(nn.Dense(8, activation='relu'),\n",
    "        shared,\n",
    "        nn.Dense(8, activation='relu', params=shared.params),\n",
    "        nn.Dense(10))\n",
    "net.initialize()\n",
    "\n",
    "X = np.random.uniform(size=(2, 20))\n",
    "net(X)\n",
    "\n",
    "# Check whether the parameters are the same\n",
    "print(net[1].weight.data()[0] == net[2].weight.data()[0])\n",
    "net[1].weight.data()[0, 0] = 100\n",
    "# Make sure that they are actually the same object rather than just having the\n",
    "# same value\n",
    "print(net[1].weight.data()[0] == net[2].weight.data()[0])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 67,
    "tab": [
     "mxnet"
    ]
   },
   "source": [
    "This example shows that the parameters\n",
    "of the second and third layer are tied.\n",
    "They are not just equal, they are\n",
    "represented by the same exact tensor.\n",
    "Thus, if we change one of the parameters,\n",
    "the other one changes, too.\n",
    "You might wonder,\n",
    "when parameters are tied\n",
    "what happens to the gradients?\n",
    "Since the model parameters contain gradients,\n",
    "the gradients of the second hidden layer\n",
    "and the third hidden layer are added together\n",
    "during backpropagation.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 68
   },
   "source": [
    "## Summary\n",
    "\n",
    "* We have several ways to access, initialize, and tie model parameters.\n",
    "* We can use custom initialization.\n",
    "\n",
    "\n",
    "## Exercises\n",
    "\n",
    "1. Use the `FancyMLP` model defined in :numref:`sec_model_construction` and access the parameters of the various layers.\n",
    "1. Look at the initialization module document to explore different initializers.\n",
    "1. Construct an MLP containing a shared parameter layer and train it. During the training process, observe the model parameters and gradients of each layer.\n",
    "1. Why is sharing parameters a good idea?\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "origin_pos": 69,
    "tab": [
     "mxnet"
    ]
   },
   "source": [
    "[Discussions](https://discuss.d2l.ai/t/56)\n"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}