Skip to content

Commit

Permalink
Deploying to gh-pages from @ 6762cb1 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudo-rnd-thoughts committed Jun 6, 2024
1 parent ce6485b commit 6996379
Show file tree
Hide file tree
Showing 68 changed files with 76 additions and 79 deletions.
2 changes: 1 addition & 1 deletion main/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 7cc3bef9c8d4702f29dac8564832178c
config: c3dc35eb3b5047d33ae6d17aca2bdf00
tags: d77d1c0d9ca2f4c8421862c7c5a0d620
21 changes: 9 additions & 12 deletions main/_modules/minigrid/wrappers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -962,19 +962,17 @@ <h1>Source code for minigrid.wrappers</h1><div class="highlight"><pre>
<span class="sd"> (2835,)</span>
<span class="sd"> &quot;&quot;&quot;</span>

<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">env</span><span class="p">,</span> <span class="n">maxStrLen</span><span class="o">=</span><span class="mi">96</span><span class="p">):</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">env</span><span class="p">,</span> <span class="n">maxStrLen</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">96</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">env</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">maxStrLen</span> <span class="o">=</span> <span class="n">maxStrLen</span>
<span class="bp">self</span><span class="o">.</span><span class="n">numCharCodes</span> <span class="o">=</span> <span class="mi">28</span>

<span class="n">imgSpace</span> <span class="o">=</span> <span class="n">env</span><span class="o">.</span><span class="n">observation_space</span><span class="o">.</span><span class="n">spaces</span><span class="p">[</span><span class="s2">&quot;image&quot;</span><span class="p">]</span>
<span class="n">imgSize</span> <span class="o">=</span> <span class="n">reduce</span><span class="p">(</span><span class="n">operator</span><span class="o">.</span><span class="n">mul</span><span class="p">,</span> <span class="n">imgSpace</span><span class="o">.</span><span class="n">shape</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>

<span class="n">img_size</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">prod</span><span class="p">(</span><span class="n">env</span><span class="o">.</span><span class="n">observation_space</span><span class="p">[</span><span class="s2">&quot;image&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">observation_space</span> <span class="o">=</span> <span class="n">spaces</span><span class="o">.</span><span class="n">Box</span><span class="p">(</span>
<span class="n">low</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span>
<span class="n">high</span><span class="o">=</span><span class="mi">255</span><span class="p">,</span>
<span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="n">imgSize</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">numCharCodes</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">maxStrLen</span><span class="p">,),</span>
<span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="n">img_size</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">numCharCodes</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">maxStrLen</span><span class="p">,),</span>
<span class="n">dtype</span><span class="o">=</span><span class="s2">&quot;uint8&quot;</span><span class="p">,</span>
<span class="p">)</span>

Expand All @@ -991,12 +989,11 @@ <h1>Source code for minigrid.wrappers</h1><div class="highlight"><pre>
<span class="p">),</span> <span class="sa">f</span><span class="s2">&quot;mission string too long (</span><span class="si">{</span><span class="nb">len</span><span class="p">(</span><span class="n">mission</span><span class="p">)</span><span class="si">}</span><span class="s2"> chars)&quot;</span>
<span class="n">mission</span> <span class="o">=</span> <span class="n">mission</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>

<span class="n">strArray</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span>
<span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">maxStrLen</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">numCharCodes</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">&quot;float32&quot;</span>
<span class="p">)</span>
<span class="n">str_array</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">maxStrLen</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">numCharCodes</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="s2">&quot;uint8&quot;</span><span class="p">)</span>
<span class="c1"># as `numCharCodes` &lt; 255 then we can use `uint8`</span>

<span class="k">for</span> <span class="n">idx</span><span class="p">,</span> <span class="n">ch</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">mission</span><span class="p">):</span>
<span class="k">if</span> <span class="n">ch</span> <span class="o">&gt;=</span> <span class="s2">&quot;a&quot;</span> <span class="ow">and</span> <span class="n">ch</span> <span class="o">&lt;=</span> <span class="s2">&quot;z&quot;</span><span class="p">:</span>
<span class="k">if</span> <span class="s2">&quot;a&quot;</span> <span class="o">&lt;=</span> <span class="n">ch</span> <span class="o">&lt;=</span> <span class="s2">&quot;z&quot;</span><span class="p">:</span>
<span class="n">chNo</span> <span class="o">=</span> <span class="nb">ord</span><span class="p">(</span><span class="n">ch</span><span class="p">)</span> <span class="o">-</span> <span class="nb">ord</span><span class="p">(</span><span class="s2">&quot;a&quot;</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">ch</span> <span class="o">==</span> <span class="s2">&quot; &quot;</span><span class="p">:</span>
<span class="n">chNo</span> <span class="o">=</span> <span class="nb">ord</span><span class="p">(</span><span class="s2">&quot;z&quot;</span><span class="p">)</span> <span class="o">-</span> <span class="nb">ord</span><span class="p">(</span><span class="s2">&quot;a&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
Expand All @@ -1006,11 +1003,11 @@ <h1>Source code for minigrid.wrappers</h1><div class="highlight"><pre>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span>
<span class="sa">f</span><span class="s2">&quot;Character </span><span class="si">{</span><span class="n">ch</span><span class="si">}</span><span class="s2"> is not available in mission string.&quot;</span>
<span class="p">)</span>
<span class="k">assert</span> <span class="n">chNo</span> <span class="o">&lt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">numCharCodes</span><span class="p">,</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2"> : </span><span class="si">%d</span><span class="s2">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">ch</span><span class="p">,</span> <span class="n">chNo</span><span class="p">)</span>
<span class="n">strArray</span><span class="p">[</span><span class="n">idx</span><span class="p">,</span> <span class="n">chNo</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>
<span class="k">assert</span> <span class="n">chNo</span> <span class="o">&lt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">numCharCodes</span><span class="p">,</span> <span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">ch</span><span class="si">}</span><span class="s2"> : </span><span class="si">{</span><span class="n">chNo</span><span class="si">:</span><span class="s2">d</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="n">str_array</span><span class="p">[</span><span class="n">idx</span><span class="p">,</span> <span class="n">chNo</span><span class="p">]</span> <span class="o">=</span> <span class="mi">1</span>

<span class="bp">self</span><span class="o">.</span><span class="n">cachedStr</span> <span class="o">=</span> <span class="n">mission</span>
<span class="bp">self</span><span class="o">.</span><span class="n">cachedArray</span> <span class="o">=</span> <span class="n">strArray</span>
<span class="bp">self</span><span class="o">.</span><span class="n">cachedArray</span> <span class="o">=</span> <span class="n">str_array</span>

<span class="n">obs</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">concatenate</span><span class="p">((</span><span class="n">image</span><span class="o">.</span><span class="n">flatten</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">cachedArray</span><span class="o">.</span><span class="n">flatten</span><span class="p">()))</span>

Expand Down
2 changes: 1 addition & 1 deletion main/api/wrappers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ <h1>Direction Obs<a class="headerlink" href="#direction-obs" title="Link to this
<h1>FlatObs<a class="headerlink" href="#flatobs" title="Link to this heading"></a></h1>
<dl class="py class">
<dt class="sig sig-object py" id="minigrid.wrappers.FlatObsWrapper">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">minigrid.wrappers.</span></span><span class="sig-name descname"><span class="pre">FlatObsWrapper</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">env</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxStrLen</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">96</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/minigrid/wrappers/#FlatObsWrapper"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#minigrid.wrappers.FlatObsWrapper" title="Link to this definition"></a></dt>
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">minigrid.wrappers.</span></span><span class="sig-name descname"><span class="pre">FlatObsWrapper</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">env</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">maxStrLen</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">96</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../_modules/minigrid/wrappers/#FlatObsWrapper"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#minigrid.wrappers.FlatObsWrapper" title="Link to this definition"></a></dt>
<dd><p>Encode mission strings using a one-hot scheme,
and combine these with observed images into one flat array.</p>
<p>This wrapper is not applicable to BabyAI environments, given that these have their own language component.</p>
Expand Down
2 changes: 1 addition & 1 deletion main/environments/babyai/ActionObjDoor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ <h1>Action Obj Door<a class="headerlink" href="#action-obj-door" title="Link to
<td><p><code class="docutils literal notranslate"><span class="pre">Discrete(7)</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Observation Space</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">Dict('direction':</span> <span class="pre">Discrete(4),</span> <span class="pre">'image':</span> <span class="pre">Box(0,</span> <span class="pre">255,</span> <span class="pre">(7,</span> <span class="pre">7,</span> <span class="pre">3),</span> <span class="pre">uint8),</span> <span class="pre">'mission':</span> <span class="pre">MissionSpace(&lt;function</span> <span class="pre">BabyAIMissionSpace._gen_mission</span> <span class="pre">at</span> <span class="pre">0x7f8018572940&gt;,</span> <span class="pre">None))</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">Dict('direction':</span> <span class="pre">Discrete(4),</span> <span class="pre">'image':</span> <span class="pre">Box(0,</span> <span class="pre">255,</span> <span class="pre">(7,</span> <span class="pre">7,</span> <span class="pre">3),</span> <span class="pre">uint8),</span> <span class="pre">'mission':</span> <span class="pre">MissionSpace(&lt;function</span> <span class="pre">BabyAIMissionSpace._gen_mission</span> <span class="pre">at</span> <span class="pre">0x7f2dfc372820&gt;,</span> <span class="pre">None))</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Reward Range</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">(0,</span> <span class="pre">1)</span></code></p></td>
Expand Down
2 changes: 1 addition & 1 deletion main/environments/babyai/BlockedUnlockPickup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ <h1>Blocked Unlock Pickup<a class="headerlink" href="#blocked-unlock-pickup" tit
<td><p><code class="docutils literal notranslate"><span class="pre">Discrete(7)</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Observation Space</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">Dict('direction':</span> <span class="pre">Discrete(4),</span> <span class="pre">'image':</span> <span class="pre">Box(0,</span> <span class="pre">255,</span> <span class="pre">(7,</span> <span class="pre">7,</span> <span class="pre">3),</span> <span class="pre">uint8),</span> <span class="pre">'mission':</span> <span class="pre">MissionSpace(&lt;function</span> <span class="pre">BabyAIMissionSpace._gen_mission</span> <span class="pre">at</span> <span class="pre">0x7f8018572940&gt;,</span> <span class="pre">None))</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">Dict('direction':</span> <span class="pre">Discrete(4),</span> <span class="pre">'image':</span> <span class="pre">Box(0,</span> <span class="pre">255,</span> <span class="pre">(7,</span> <span class="pre">7,</span> <span class="pre">3),</span> <span class="pre">uint8),</span> <span class="pre">'mission':</span> <span class="pre">MissionSpace(&lt;function</span> <span class="pre">BabyAIMissionSpace._gen_mission</span> <span class="pre">at</span> <span class="pre">0x7f2dfc372820&gt;,</span> <span class="pre">None))</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Reward Range</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">(0,</span> <span class="pre">1)</span></code></p></td>
Expand Down
2 changes: 1 addition & 1 deletion main/environments/babyai/BossLevel/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ <h1>Boss Level<a class="headerlink" href="#boss-level" title="Link to this headi
<td><p><code class="docutils literal notranslate"><span class="pre">Discrete(7)</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Observation Space</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">Dict('direction':</span> <span class="pre">Discrete(4),</span> <span class="pre">'image':</span> <span class="pre">Box(0,</span> <span class="pre">255,</span> <span class="pre">(7,</span> <span class="pre">7,</span> <span class="pre">3),</span> <span class="pre">uint8),</span> <span class="pre">'mission':</span> <span class="pre">MissionSpace(&lt;function</span> <span class="pre">BabyAIMissionSpace._gen_mission</span> <span class="pre">at</span> <span class="pre">0x7f8018572940&gt;,</span> <span class="pre">None))</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">Dict('direction':</span> <span class="pre">Discrete(4),</span> <span class="pre">'image':</span> <span class="pre">Box(0,</span> <span class="pre">255,</span> <span class="pre">(7,</span> <span class="pre">7,</span> <span class="pre">3),</span> <span class="pre">uint8),</span> <span class="pre">'mission':</span> <span class="pre">MissionSpace(&lt;function</span> <span class="pre">BabyAIMissionSpace._gen_mission</span> <span class="pre">at</span> <span class="pre">0x7f2dfc372820&gt;,</span> <span class="pre">None))</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Reward Range</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">(0,</span> <span class="pre">1)</span></code></p></td>
Expand Down
2 changes: 1 addition & 1 deletion main/environments/babyai/BossLevelNoUnlock/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ <h1>Boss Level No Unlock<a class="headerlink" href="#boss-level-no-unlock" title
<td><p><code class="docutils literal notranslate"><span class="pre">Discrete(7)</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>Observation Space</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">Dict('direction':</span> <span class="pre">Discrete(4),</span> <span class="pre">'image':</span> <span class="pre">Box(0,</span> <span class="pre">255,</span> <span class="pre">(7,</span> <span class="pre">7,</span> <span class="pre">3),</span> <span class="pre">uint8),</span> <span class="pre">'mission':</span> <span class="pre">MissionSpace(&lt;function</span> <span class="pre">BabyAIMissionSpace._gen_mission</span> <span class="pre">at</span> <span class="pre">0x7f8018572940&gt;,</span> <span class="pre">None))</span></code></p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">Dict('direction':</span> <span class="pre">Discrete(4),</span> <span class="pre">'image':</span> <span class="pre">Box(0,</span> <span class="pre">255,</span> <span class="pre">(7,</span> <span class="pre">7,</span> <span class="pre">3),</span> <span class="pre">uint8),</span> <span class="pre">'mission':</span> <span class="pre">MissionSpace(&lt;function</span> <span class="pre">BabyAIMissionSpace._gen_mission</span> <span class="pre">at</span> <span class="pre">0x7f2dfc372820&gt;,</span> <span class="pre">None))</span></code></p></td>
</tr>
<tr class="row-even"><td><p>Reward Range</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">(0,</span> <span class="pre">1)</span></code></p></td>
Expand Down
Loading

0 comments on commit 6996379

Please sign in to comment.