Skip to content

Commit

Permalink
auto-generating sphinx docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pytorchbot committed Jan 11, 2024
1 parent 38745b7 commit 50e38bc
Show file tree
Hide file tree
Showing 43 changed files with 1,928 additions and 1,920 deletions.
Binary file modified _downloads/315c4c52fb68082a731b192d944e2ede/tutorials_python.zip
Binary file not shown.
Binary file not shown.
Binary file modified _images/sphx_glr_coding_ddpg_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_coding_ddpg_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_coding_ppo_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_coding_ppo_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_dqn_with_rnn_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_dqn_with_rnn_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_rb_tutorial_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_rb_tutorial_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_rb_tutorial_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_torchrl_envs_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_torchrl_envs_002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _images/sphx_glr_torchrl_envs_thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions _modules/torchrl/data/datasets/openx.html
Original file line number Diff line number Diff line change
Expand Up @@ -943,10 +943,12 @@ <h1>Source code for torchrl.data.datasets.openx</h1><div class="highlight"><pre>
<span class="k">else</span><span class="p">:</span>
<span class="k">yield</span> <span class="n">data</span>

<span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Any</span><span class="p">:</span>
<span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">index</span><span class="p">:</span> <span class="nb">range</span> <span class="o">|</span> <span class="n">torch</span><span class="o">.</span><span class="n">Tensor</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Any</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="nb">range</span><span class="p">):</span>
<span class="c1"># we use a range to indicate how much data we want</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;iterable datasets do not support indexing.&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> <span class="o">!=</span> <span class="n">index</span><span class="p">[:</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">any</span><span class="p">():</span>
<span class="c1"># we use a range to indicate how much data we want</span>
<span class="k">raise</span> <span class="ne">RuntimeError</span><span class="p">(</span><span class="s2">&quot;iterable datasets do not support indexing.&quot;</span><span class="p">)</span>
<span class="n">index</span> <span class="o">=</span> <span class="nb">range</span><span class="p">(</span><span class="n">index</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">total</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">data_list</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">episode</span> <span class="o">=</span> <span class="mi">0</span>
Expand Down
8 changes: 7 additions & 1 deletion _modules/torchrl/data/replay_buffers/samplers.html
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,10 @@ <h1>Source code for torchrl.data.replay_buffers.samplers</h1><div class="highlig
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">buffer_ids</span><span class="o">.</span><span class="n">tolist</span><span class="p">()</span>
<span class="p">]</span>
<span class="p">)</span>
<span class="n">samples</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">sample</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sample</span><span class="p">,</span> <span class="n">torch</span><span class="o">.</span><span class="n">Tensor</span><span class="p">)</span> <span class="k">else</span> <span class="n">torch</span><span class="o">.</span><span class="n">tensor</span><span class="p">(</span><span class="n">sample</span><span class="p">)</span>
<span class="k">for</span> <span class="n">sample</span> <span class="ow">in</span> <span class="n">samples</span>
<span class="p">]</span>
<span class="k">if</span> <span class="nb">all</span><span class="p">(</span><span class="n">samples</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">shape</span> <span class="o">==</span> <span class="n">sample</span><span class="o">.</span><span class="n">shape</span> <span class="k">for</span> <span class="n">sample</span> <span class="ow">in</span> <span class="n">samples</span><span class="p">[</span><span class="mi">1</span><span class="p">:]):</span>
<span class="n">samples_stack</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">stack</span><span class="p">(</span><span class="n">samples</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
Expand All @@ -1487,7 +1491,9 @@ <h1>Source code for torchrl.data.replay_buffers.samplers</h1><div class="highlig
<span class="p">)</span>
<span class="n">infos</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">stack</span><span class="p">(</span>
<span class="p">[</span>
<span class="n">TensorDict</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">info</span><span class="p">)</span> <span class="k">if</span> <span class="n">info</span> <span class="k">else</span> <span class="n">TensorDict</span><span class="p">({},</span> <span class="p">[])</span>
<span class="n">TensorDict</span><span class="o">.</span><span class="n">from_dict</span><span class="p">(</span><span class="n">info</span><span class="p">,</span> <span class="n">batch_dims</span><span class="o">=</span><span class="n">samples</span><span class="o">.</span><span class="n">ndim</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span>
<span class="k">if</span> <span class="n">info</span>
<span class="k">else</span> <span class="n">TensorDict</span><span class="p">({},</span> <span class="p">[])</span>
<span class="k">for</span> <span class="n">info</span> <span class="ow">in</span> <span class="n">infos</span>
<span class="p">]</span>
<span class="p">)</span>
Expand Down
46 changes: 23 additions & 23 deletions _sources/sg_execution_times.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Computation times
=================
**27:22.388** total execution time for 11 files **from all galleries**:
**27:58.661** total execution time for 11 files **from all galleries**:

.. container::

Expand All @@ -33,35 +33,35 @@ Computation times
- Time
- Mem (MB)
* - :ref:`sphx_glr_tutorials_torchrl_demo.py` (``reference/generated/tutorials/torchrl_demo.py``)
- 03:58.037
- 04:03.123
- 15.9
* - :ref:`sphx_glr_tutorials_torchrl_envs.py` (``reference/generated/tutorials/torchrl_envs.py``)
- 03:35.116
- 32.5
- 03:39.853
- 31.8
* - :ref:`sphx_glr_tutorials_dqn_with_rnn.py` (``reference/generated/tutorials/dqn_with_rnn.py``)
- 03:19.282
- 1705.6
- 03:23.816
- 1604.1
* - :ref:`sphx_glr_tutorials_multiagent_ppo.py` (``reference/generated/tutorials/multiagent_ppo.py``)
- 03:06.439
- 13.5
- 03:08.624
- 14.2
* - :ref:`sphx_glr_tutorials_coding_dqn.py` (``reference/generated/tutorials/coding_dqn.py``)
- 02:45.922
- 779.0
* - :ref:`sphx_glr_tutorials_pendulum.py` (``reference/generated/tutorials/pendulum.py``)
- 02:41.068
- 8.0
- 02:58.372
- 690.8
* - :ref:`sphx_glr_tutorials_rb_tutorial.py` (``reference/generated/tutorials/rb_tutorial.py``)
- 02:39.058
- 402.6
- 02:42.792
- 395.7
* - :ref:`sphx_glr_tutorials_pendulum.py` (``reference/generated/tutorials/pendulum.py``)
- 02:38.119
- 7.8
* - :ref:`sphx_glr_tutorials_coding_ddpg.py` (``reference/generated/tutorials/coding_ddpg.py``)
- 01:58.049
- 11.8
- 02:00.576
- 11.7
* - :ref:`sphx_glr_tutorials_coding_ppo.py` (``reference/generated/tutorials/coding_ppo.py``)
- 01:36.986
- 8.6
- 01:37.867
- 8.5
* - :ref:`sphx_glr_tutorials_pretrained_models.py` (``reference/generated/tutorials/pretrained_models.py``)
- 00:52.959
- 3544.2
- 00:55.258
- 3672.9
* - :ref:`sphx_glr_tutorials_multi_task.py` (``reference/generated/tutorials/multi_task.py``)
- 00:49.471
- 25.4
- 00:50.262
- 26.2
4 changes: 2 additions & 2 deletions _sources/tutorials/coding_ddpg.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,7 @@ modules we need.

.. code-block:: none
0%| | 0/10000 [00:00<?, ?it/s] 8%|▊ | 800/10000 [00:00<00:03, 2822.91it/s] 16%|█▌ | 1600/10000 [00:01<00:08, 1036.58it/s] 32%|███▏ | 3200/10000 [00:01<00:03, 2151.21it/s] 48%|████▊ | 4800/10000 [00:01<00:01, 3093.40it/s] reward: -1.82 (r0 = -1.30), reward eval: reward: -0.01, reward normalized=-2.33/6.16, grad norm= 63.26, loss_value= 342.08, loss_actor= 12.91, target value: -14.95: 56%|█████▌ | 5600/10000 [00:04<00:01, 3093.40it/s] reward: -1.82 (r0 = -1.30), reward eval: reward: -0.01, reward normalized=-2.33/6.16, grad norm= 63.26, loss_value= 342.08, loss_actor= 12.91, target value: -14.95: 64%|██████▍ | 6400/10000 [00:04<00:02, 1387.77it/s] reward: -2.38 (r0 = -1.30), reward eval: reward: -0.01, reward normalized=-2.09/6.14, grad norm= 166.00, loss_value= 254.66, loss_actor= 13.69, target value: -12.94: 64%|██████▍ | 6400/10000 [00:06<00:02, 1387.77it/s] reward: -2.38 (r0 = -1.30), reward eval: reward: -0.01, reward normalized=-2.09/6.14, grad norm= 166.00, loss_value= 254.66, loss_actor= 13.69, target value: -12.94: 72%|███████▏ | 7200/10000 [00:06<00:03, 876.66it/s] reward: -1.55 (r0 = -1.30), reward eval: reward: -0.01, reward normalized=-2.08/6.34, grad norm= 153.49, loss_value= 347.08, loss_actor= 11.98, target value: -13.48: 72%|███████▏ | 7200/10000 [00:08<00:03, 876.66it/s] reward: -1.55 (r0 = -1.30), reward eval: reward: -0.01, reward normalized=-2.08/6.34, grad norm= 153.49, loss_value= 347.08, loss_actor= 11.98, target value: -13.48: 80%|████████ | 8000/10000 [00:08<00:03, 650.20it/s] reward: -4.51 (r0 = -1.30), reward eval: reward: -0.01, reward normalized=-2.28/6.31, grad norm= 154.12, loss_value= 348.40, loss_actor= 15.32, target value: -15.40: 80%|████████ | 8000/10000 [00:10<00:03, 650.20it/s] reward: -4.51 (r0 = -1.30), reward eval: reward: -0.01, reward normalized=-2.28/6.31, grad norm= 154.12, loss_value= 348.40, loss_actor= 15.32, target value: -15.40: 88%|████████▊ | 8800/10000 [00:10<00:02, 542.77it/s] reward: -4.45 (r0 = -1.30), reward eval: reward: -5.55, reward normalized=-2.97/5.20, grad norm= 153.74, loss_value= 191.59, loss_actor= 17.62, target value: -21.23: 88%|████████▊ | 8800/10000 [00:13<00:02, 542.77it/s] reward: -4.45 (r0 = -1.30), reward eval: reward: -5.55, reward normalized=-2.97/5.20, grad norm= 153.74, loss_value= 191.59, loss_actor= 17.62, target value: -21.23: 96%|█████████▌| 9600/10000 [00:13<00:00, 405.43it/s] reward: -4.85 (r0 = -1.30), reward eval: reward: -5.55, reward normalized=-2.10/5.48, grad norm= 113.61, loss_value= 213.39, loss_actor= 12.94, target value: -14.03: 96%|█████████▌| 9600/10000 [00:15<00:00, 405.43it/s] reward: -4.85 (r0 = -1.30), reward eval: reward: -5.55, reward normalized=-2.10/5.48, grad norm= 113.61, loss_value= 213.39, loss_actor= 12.94, target value: -14.03: : 10400it [00:15, 395.17it/s] reward: -3.08 (r0 = -1.30), reward eval: reward: -5.55, reward normalized=-2.60/5.07, grad norm= 118.02, loss_value= 143.99, loss_actor= 16.22, target value: -18.03: : 10400it [00:18, 395.17it/s]
0%| | 0/10000 [00:00<?, ?it/s] 8%|▊ | 800/10000 [00:00<00:03, 2930.51it/s] 16%|█▌ | 1600/10000 [00:01<00:07, 1076.32it/s] 32%|███▏ | 3200/10000 [00:01<00:03, 2219.73it/s] 48%|████▊ | 4800/10000 [00:01<00:01, 3161.17it/s] reward: -2.58 (r0 = -1.87), reward eval: reward: -0.00, reward normalized=-2.55/6.27, grad norm= 150.90, loss_value= 349.17, loss_actor= 13.99, target value: -17.67: 56%|█████▌ | 5600/10000 [00:04<00:01, 3161.17it/s] reward: -2.58 (r0 = -1.87), reward eval: reward: -0.00, reward normalized=-2.55/6.27, grad norm= 150.90, loss_value= 349.17, loss_actor= 13.99, target value: -17.67: 64%|██████▍ | 6400/10000 [00:04<00:02, 1330.06it/s] reward: -1.78 (r0 = -1.87), reward eval: reward: -0.00, reward normalized=-2.27/5.88, grad norm= 61.11, loss_value= 222.27, loss_actor= 12.33, target value: -13.74: 64%|██████▍ | 6400/10000 [00:06<00:02, 1330.06it/s] reward: -1.78 (r0 = -1.87), reward eval: reward: -0.00, reward normalized=-2.27/5.88, grad norm= 61.11, loss_value= 222.27, loss_actor= 12.33, target value: -13.74: 72%|███████▏ | 7200/10000 [00:06<00:03, 838.51it/s] reward: -0.57 (r0 = -1.87), reward eval: reward: -0.00, reward normalized=-1.46/5.96, grad norm= 26.68, loss_value= 211.81, loss_actor= 8.80, target value: -10.87: 72%|███████▏ | 7200/10000 [00:08<00:03, 838.51it/s] reward: -0.57 (r0 = -1.87), reward eval: reward: -0.00, reward normalized=-1.46/5.96, grad norm= 26.68, loss_value= 211.81, loss_actor= 8.80, target value: -10.87: 80%|████████ | 8000/10000 [00:08<00:03, 627.59it/s] reward: -4.20 (r0 = -1.87), reward eval: reward: -0.00, reward normalized=-1.70/5.65, grad norm= 243.77, loss_value= 282.06, loss_actor= 15.23, target value: -11.54: 80%|████████ | 8000/10000 [00:10<00:03, 627.59it/s] reward: -4.20 (r0 = -1.87), reward eval: reward: -0.00, reward normalized=-1.70/5.65, grad norm= 243.77, loss_value= 282.06, loss_actor= 15.23, target value: -11.54: 88%|████████▊ | 8800/10000 [00:10<00:02, 526.78it/s] reward: -4.00 (r0 = -1.87), reward eval: reward: -5.92, reward normalized=-2.39/6.20, grad norm= 140.39, loss_value= 374.82, loss_actor= 14.36, target value: -16.68: 88%|████████▊ | 8800/10000 [00:14<00:02, 526.78it/s] reward: -4.00 (r0 = -1.87), reward eval: reward: -5.92, reward normalized=-2.39/6.20, grad norm= 140.39, loss_value= 374.82, loss_actor= 14.36, target value: -16.68: 96%|█████████▌| 9600/10000 [00:14<00:01, 398.97it/s] reward: -4.99 (r0 = -1.87), reward eval: reward: -5.92, reward normalized=-2.39/5.56, grad norm= 87.07, loss_value= 219.87, loss_actor= 15.31, target value: -17.34: 96%|█████████▌| 9600/10000 [00:16<00:01, 398.97it/s] reward: -4.99 (r0 = -1.87), reward eval: reward: -5.92, reward normalized=-2.39/5.56, grad norm= 87.07, loss_value= 219.87, loss_actor= 15.31, target value: -17.34: : 10400it [00:16, 388.75it/s] reward: -5.21 (r0 = -1.87), reward eval: reward: -5.92, reward normalized=-2.54/5.06, grad norm= 50.72, loss_value= 195.15, loss_actor= 17.06, target value: -18.99: : 10400it [00:18, 388.75it/s]
Expand Down Expand Up @@ -1698,7 +1698,7 @@ The key takeaways are:

.. rst-class:: sphx-glr-timing

**Total running time of the script:** (1 minutes 58.049 seconds)
**Total running time of the script:** (2 minutes 0.576 seconds)

**Estimated memory usage:** 12 MB

Expand Down
74 changes: 37 additions & 37 deletions _sources/tutorials/coding_dqn.rst.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 50e38bc

Please sign in to comment.