Repository: lf1-io/padl (language: python)

Issue:
Support full import statements
Things like this aren't supported:

```
import sheen.models.Discriminator
import scipy.io.wavfile.read
```

Currently we are forced to write:

```
from sheen.models import Discriminator
from scipy.io.wavfile import read
```


Discussion / hints:
Hi @blythed so can you tell me if I have to change these imports to the form `import package_name.module` ??
@DipayanP007 no currently `from package.module import my_function` _is_ supported. However `import package.module.my_function` _is not_ supported. I believe @wuhu has a fix in review.
@blythed not yet, working on it.

Fix patch:
diff --git a/docs/unstable/apidocs/padl.dumptools.symfinder.html b/docs/unstable/apidocs/padl.dumptools.symfinder.html
index 39a62136..0ab8b34c 100644
--- a/docs/unstable/apidocs/padl.dumptools.symfinder.html
+++ b/docs/unstable/apidocs/padl.dumptools.symfinder.html
@@ -364,10 +364,7 @@
 scope <em>scope</em>.</p>
 <dl class="field-list simple">
 <dt class="field-odd">Parameters</dt>
-<dd class="field-odd"><ul class="simple">
-<li><p><strong>var_name</strong> – Name of the variable to look for.</p></li>
-<li><p><strong>scope</strong> – Scope to search.</p></li>
-</ul>
+<dd class="field-odd"><p><strong>scope</strong> – Name (with scope) of the variable to look for.</p>
 </dd>
 </dl>
 </dd></dl>
diff --git a/docs/unstable/apidocs/padl.dumptools.var2mod.html b/docs/unstable/apidocs/padl.dumptools.var2mod.html
index 56683d75..f3316420 100644
--- a/docs/unstable/apidocs/padl.dumptools.var2mod.html
+++ b/docs/unstable/apidocs/padl.dumptools.var2mod.html
@@ -225,7 +225,7 @@
 
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.dumptools.var2mod.CodeNode">
-<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">CodeNode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">source</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">globals_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scope</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="padl.dumptools.symfinder.html#padl.dumptools.symfinder.Scope" title="padl.dumptools.symfinder.Scope"><span class="pre">padl.dumptools.symfinder.Scope</span></a><span class="p"><span class="pre">]</span></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">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ast_node</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">_ast.AST</span><span class="p"><span class="pre">]</span></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">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.CodeNode" title="Permalink 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">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">CodeNode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">source</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">globals_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">set</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scope</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="padl.dumptools.symfinder.html#padl.dumptools.symfinder.Scope" title="padl.dumptools.symfinder.Scope"><span class="pre">padl.dumptools.symfinder.Scope</span></a><span class="p"><span class="pre">]</span></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">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ast_node</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">_ast.AST</span><span class="p"><span class="pre">]</span></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">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n</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">0</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.CodeNode" title="Permalink to this definition"></a></dt>
 <dd><p>A node in a <a class="reference internal" href="#padl.dumptools.var2mod.CodeGraph" title="padl.dumptools.var2mod.CodeGraph"><code class="xref py py-class docutils literal notranslate"><span class="pre">CodeGraph</span></code></a>.</p>
 <p>A <cite>CodeNode</cite> has</p>
 <ul class="simple">
@@ -236,7 +236,7 @@
 </ul>
 <dl class="py method">
 <dt class="sig sig-object py" id="padl.dumptools.var2mod.CodeNode.from_source">
-<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_source</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">source</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scope</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.CodeNode.from_source" title="Permalink to this definition"></a></dt>
+<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_source</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">source</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scope</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.CodeNode.from_source" title="Permalink to this definition"></a></dt>
 <dd><p>Build a <cite>CodeNode</cite> from a source string.</p>
 </dd></dl>
 
@@ -275,7 +275,7 @@
 </dl>
 <p>Example:</p>
 <div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">Finder</span><span class="p">(</span><span class="n">ast</span><span class="o">.</span><span class="n">Name</span><span class="p">)</span><span class="o">.</span><span class="n">get_source_segments</span><span class="p">(</span><span class="s1">&#39;x(y)&#39;</span><span class="p">)</span>
-<span class="go">[(&#39;x&#39;, (1, 1, 0, 1)), (&#39;y&#39;, (1, 1, 2, 3))]</span>
+<span class="go">[(&#39;x&#39;, Position(lineno=1, end_lineno=1, col_offset=0, end_col_offset=1)), (&#39;y&#39;, Position(lineno=1, end_lineno=1, col_offset=2, end_col_offset=3))]</span>
 </pre></div>
 </div>
 </dd></dl>
@@ -301,7 +301,7 @@
 
 <dl class="py function">
 <dt class="sig sig-object py" id="padl.dumptools.var2mod.find_codenode">
-<span class="sig-prename descclassname"><span class="pre">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">find_codenode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.dumptools.symfinder.html#padl.dumptools.symfinder.ScopedName" title="padl.dumptools.symfinder.ScopedName"><span class="pre">padl.dumptools.symfinder.ScopedName</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.find_codenode" title="Permalink to this definition"></a></dt>
+<span class="sig-prename descclassname"><span class="pre">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">find_codenode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.dumptools.symfinder.html#padl.dumptools.symfinder.ScopedName" title="padl.dumptools.symfinder.ScopedName"><span class="pre">padl.dumptools.symfinder.ScopedName</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">full_dump_module_names</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.find_codenode" title="Permalink to this definition"></a></dt>
 <dd><p>Find the <a class="reference internal" href="#padl.dumptools.var2mod.CodeNode" title="padl.dumptools.var2mod.CodeNode"><code class="xref py py-class docutils literal notranslate"><span class="pre">CodeNode</span></code></a> corresponding to a <code class="xref py py-class docutils literal notranslate"><span class="pre">ScopedName</span></code> <em>name</em>.</p>
 </dd></dl>
 
@@ -317,7 +317,8 @@
 <span class="gp">... </span><span class="s1">    return str(z)</span>
 <span class="gp">... </span><span class="s1">&#39;&#39;&#39;</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="n">node</span> <span class="o">=</span> <span class="n">ast</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">source</span><span class="p">)</span><span class="o">.</span><span class="n">body</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">find_globals</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> <span class="o">==</span> <span class="p">{(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;np&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)}</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">find_globals</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> <span class="o">==</span> <span class="p">{</span><span class="n">ScopedName</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">ScopedName</span><span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
+<span class="gp">... </span>                       <span class="n">ScopedName</span><span class="p">(</span><span class="s1">&#39;np.array&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="mi">0</span><span class="p">)}</span>
 <span class="go">True</span>
 </pre></div>
 </div>
@@ -325,7 +326,7 @@
 <dt class="field-odd">Parameters</dt>
 <dd class="field-odd"><ul class="simple">
 <li><p><strong>node</strong> – AST node to search in.</p></li>
-<li><p><strong>filter_builtins</strong> – </p></li>
+<li><p><strong>filter_builtins</strong> – If <em>True</em>, filter out builtins.</p></li>
 </ul>
 </dd>
 </dl>
@@ -333,12 +334,13 @@
 
 <dl class="py function">
 <dt class="sig sig-object py" id="padl.dumptools.var2mod.increment_same_name_var">
-<span class="sig-prename descclassname"><span class="pre">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">increment_same_name_var</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">variables</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><span class="pre">Tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scoped_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.dumptools.symfinder.html#padl.dumptools.symfinder.ScopedName" title="padl.dumptools.symfinder.ScopedName"><span class="pre">padl.dumptools.symfinder.ScopedName</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.increment_same_name_var" title="Permalink to this definition"></a></dt>
+<span class="sig-prename descclassname"><span class="pre">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">increment_same_name_var</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">variables</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="padl.dumptools.symfinder.html#padl.dumptools.symfinder.ScopedName" title="padl.dumptools.symfinder.ScopedName"><span class="pre">padl.dumptools.symfinder.ScopedName</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scoped_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.dumptools.symfinder.html#padl.dumptools.symfinder.ScopedName" title="padl.dumptools.symfinder.ScopedName"><span class="pre">padl.dumptools.symfinder.ScopedName</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.increment_same_name_var" title="Permalink to this definition"></a></dt>
 <dd><p>Go through <em>variables</em> and increment the the counter for those with the same name as
 <em>scoped_name</em> by <em>scoped_name.n</em>.</p>
 <p>Example:</p>
 <div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">padl</span> <span class="k">as</span> <span class="nn">somemodule</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">out</span> <span class="o">=</span> <span class="n">increment_same_name_var</span><span class="p">({(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)},</span> <span class="n">ScopedName</span><span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="n">somemodule</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">out</span> <span class="o">=</span> <span class="n">increment_same_name_var</span><span class="p">({</span><span class="n">ScopedName</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="n">ScopedName</span><span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">,</span> <span class="mi">2</span><span class="p">)},</span>
+<span class="gp">... </span>                              <span class="n">ScopedName</span><span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="n">somemodule</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="nb">isinstance</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="nb">set</span><span class="p">)</span>
 <span class="go">True</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="p">{(</span><span class="n">x</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">x</span><span class="o">.</span><span class="n">n</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">out</span><span class="p">}</span> <span class="o">==</span> <span class="p">{(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)}</span>
diff --git a/docs/unstable/searchindex.js b/docs/unstable/searchindex.js
index 243b59a9..24dec626 100644
--- a/docs/unstable/searchindex.js
+++ b/docs/unstable/searchindex.js
@@ -1,1 +1,1 @@
-Search.setIndex({docnames:["README","advanced","advanced/saving","apidocs/padl","apidocs/padl.dumptools","apidocs/padl.dumptools.ast_utils","apidocs/padl.dumptools.inspector","apidocs/padl.dumptools.packagefinder","apidocs/padl.dumptools.serialize","apidocs/padl.dumptools.sourceget","apidocs/padl.dumptools.symfinder","apidocs/padl.dumptools.var2mod","apidocs/padl.exceptions","apidocs/padl.print_utils","apidocs/padl.transforms","apidocs/padl.util_transforms","apidocs/padl.utils","apidocs/padl.version","apidocs/padl.wrap","index","modules","usage","usage/apply","usage/combining_transforms","usage/creating_transforms","usage/debugging_your_transforms","usage/extras","usage/print_slice","usage/pytorch","usage/saving","usage/stages","usage/transform"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1,sphinx:56},filenames:["README.md","advanced.md","advanced/saving.md","apidocs/padl.md","apidocs/padl.dumptools.md","apidocs/padl.dumptools.ast_utils.md","apidocs/padl.dumptools.inspector.md","apidocs/padl.dumptools.packagefinder.md","apidocs/padl.dumptools.serialize.md","apidocs/padl.dumptools.sourceget.md","apidocs/padl.dumptools.symfinder.md","apidocs/padl.dumptools.var2mod.md","apidocs/padl.exceptions.md","apidocs/padl.print_utils.md","apidocs/padl.transforms.md","apidocs/padl.util_transforms.md","apidocs/padl.utils.md","apidocs/padl.version.md","apidocs/padl.wrap.md","index.md","modules.md","usage.md","usage/apply.md","usage/combining_transforms.md","usage/creating_transforms.md","usage/debugging_your_transforms.md","usage/extras.md","usage/print_slice.md","usage/pytorch.md","usage/saving.md","usage/stages.md","usage/transform.md"],objects:{"":[[3,0,0,"-","padl"]],"padl.dumptools":[[5,0,0,"-","ast_utils"],[6,0,0,"-","inspector"],[7,0,0,"-","packagefinder"],[8,0,0,"-","serialize"],[9,0,0,"-","sourceget"],[10,0,0,"-","symfinder"],[11,0,0,"-","var2mod"]],"padl.dumptools.ast_utils":[[5,1,1,"","Position"],[5,2,1,"","get_position"],[5,2,1,"","get_source_segment"]],"padl.dumptools.inspector":[[6,1,1,"","CallInfo"],[6,2,1,"","caller_frame"],[6,2,1,"","caller_module"],[6,2,1,"","get_segment_from_frame"],[6,2,1,"","get_statement"],[6,2,1,"","get_surrounding_block"],[6,2,1,"","non_init_caller_frameinfo"],[6,2,1,"","outer_caller_frameinfo"],[6,2,1,"","trace_this"]],"padl.dumptools.inspector.CallInfo":[[6,3,1,"","module"]],"padl.dumptools.packagefinder":[[7,2,1,"","dump_packages_versions"],[7,2,1,"","get_packages"],[7,2,1,"","get_version"]],"padl.dumptools.serialize":[[8,1,1,"","Serializer"],[8,2,1,"","json_serializer"],[8,2,1,"","load_json"],[8,2,1,"","save_json"],[8,2,1,"","value"]],"padl.dumptools.serialize.Serializer":[[8,4,1,"","save"],[8,4,1,"","save_all"],[8,3,1,"","varname"]],"padl.dumptools.sourceget":[[9,1,1,"","ReplaceString"],[9,1,1,"","ReplaceStrings"],[9,2,1,"","cut"],[9,2,1,"","get_module_source"],[9,2,1,"","get_source"],[9,2,1,"","original"],[9,2,1,"","put_into_cache"]],"padl.dumptools.sourceget.ReplaceString":[[9,4,1,"","cut"]],"padl.dumptools.sourceget.ReplaceStrings":[[9,4,1,"","cut"]],"padl.dumptools.symfinder":[[10,5,1,"","NameNotFound"],[10,1,1,"","Scope"],[10,1,1,"","ScopedName"],[10,2,1,"","find"],[10,2,1,"","find_in_ipython"],[10,2,1,"","find_in_module"],[10,2,1,"","find_in_scope"],[10,2,1,"","find_in_source"],[10,2,1,"","replace_star_imports"],[10,2,1,"","split_call"]],"padl.dumptools.symfinder.Scope":[[10,4,1,"","empty"],[10,4,1,"","from_level"],[10,4,1,"","from_source"],[10,4,1,"","global_"],[10,4,1,"","is_global"],[10,3,1,"","module_name"],[10,4,1,"","toplevel"],[10,4,1,"","unscoped"],[10,4,1,"","up"]],"padl.dumptools.var2mod":[[11,1,1,"","CodeGraph"],[11,1,1,"","CodeNode"],[11,1,1,"","Finder"],[11,1,1,"","Vars"],[11,2,1,"","find_codenode"],[11,2,1,"","find_globals"],[11,2,1,"","increment_same_name_var"],[11,2,1,"","rename"]],"padl.dumptools.var2mod.CodeGraph":[[11,4,1,"","build"],[11,4,1,"","dumps"],[11,4,1,"","print"]],"padl.dumptools.var2mod.CodeNode":[[11,4,1,"","from_source"]],"padl.dumptools.var2mod.Finder":[[11,4,1,"","find"],[11,4,1,"","generic_visit"],[11,4,1,"","get_source_segments"]],"padl.dumptools.var2mod.Vars":[[11,6,1,"","globals"],[11,6,1,"","locals"]],"padl.exceptions":[[12,5,1,"","WrongDeviceError"]],"padl.print_utils":[[13,2,1,"","combine_multi_line_strings"],[13,2,1,"","create_arrow"],[13,2,1,"","create_reverse_arrow"],[13,2,1,"","format_argument"],[13,2,1,"","make_bold"],[13,2,1,"","make_green"],[13,2,1,"","visible_len"]],"padl.transforms":[[14,1,1,"","AtomicTransform"],[14,1,1,"","Batchify"],[14,1,1,"","BuiltinTransform"],[14,1,1,"","ClassTransform"],[14,1,1,"","Compose"],[14,1,1,"","FunctionTransform"],[14,1,1,"","Identity"],[14,1,1,"","Map"],[14,1,1,"","Parallel"],[14,1,1,"","Pipeline"],[14,1,1,"","Rollout"],[14,1,1,"","TorchModuleTransform"],[14,1,1,"","Transform"],[14,1,1,"","Unbatchify"],[14,2,1,"","fulldump"],[14,2,1,"","group"],[14,2,1,"","importdump"],[14,2,1,"","load"],[14,2,1,"","save"]],"padl.transforms.ClassTransform":[[14,3,1,"","source"]],"padl.transforms.FunctionTransform":[[14,3,1,"","source"]],"padl.transforms.Pipeline":[[14,4,1,"","grouped"],[14,4,1,"","pd_forward_device_check"],[14,4,1,"","pd_to"]],"padl.transforms.TorchModuleTransform":[[14,4,1,"","post_load"],[14,4,1,"","pre_save"]],"padl.transforms.Transform":[[14,4,1,"","eval_apply"],[14,4,1,"","infer_apply"],[14,4,1,"","pd_call_in_mode"],[14,3,1,"","pd_device"],[14,3,1,"","pd_forward"],[14,4,1,"","pd_forward_device_check"],[14,4,1,"","pd_get_loader"],[14,3,1,"","pd_layers"],[14,3,1,"","pd_name"],[14,4,1,"","pd_parameters"],[14,4,1,"","pd_post_load"],[14,3,1,"","pd_postprocess"],[14,4,1,"","pd_pre_save"],[14,3,1,"","pd_preprocess"],[14,4,1,"","pd_save"],[14,3,1,"","pd_stages"],[14,4,1,"","pd_to"],[14,4,1,"","pd_varname"],[14,4,1,"","pd_zip_save"],[14,4,1,"","train_apply"]],"padl.util_transforms":[[15,1,1,"","IfEval"],[15,1,1,"","IfInMode"],[15,1,1,"","IfInfer"],[15,1,1,"","IfTrain"],[15,1,1,"","Try"]],"padl.utils":[[16,6,1,"","same"]],"padl.wrap":[[18,1,1,"","PatchedModule"],[18,2,1,"","transform"]],padl:[[3,1,1,"","Batchify"],[3,1,1,"","Identity"],[3,1,1,"","IfEval"],[3,1,1,"","IfInMode"],[3,1,1,"","IfInfer"],[3,1,1,"","IfTrain"],[3,1,1,"","Unbatchify"],[4,0,0,"-","dumptools"],[12,0,0,"-","exceptions"],[3,2,1,"","fulldump"],[3,2,1,"","group"],[3,2,1,"","importdump"],[3,2,1,"","load"],[13,0,0,"-","print_utils"],[3,2,1,"","save"],[3,2,1,"","transform"],[14,0,0,"-","transforms"],[3,7,1,"","unbatch"],[15,0,0,"-","util_transforms"],[16,0,0,"-","utils"],[3,2,1,"","value"],[17,0,0,"-","version"],[18,0,0,"-","wrap"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","function","Python function"],"3":["py","property","Python property"],"4":["py","method","Python method"],"5":["py","exception","Python exception"],"6":["py","attribute","Python attribute"],"7":["py","data","Python data"]},objtypes:{"0":"py:module","1":"py:class","2":"py:function","3":"py:property","4":"py:method","5":"py:exception","6":"py:attribute","7":"py:data"},terms:{"0":[0,3,6,9,10,11,14,25,26,27],"0x":11,"1":[0,2,3,9,10,11,14,15,23,25,26,27,28],"10":[0,3,15,24,25],"100":[2,11,23,24,26,27],"1000":24,"11":[3,6,15],"123":6,"13":9,"2":[0,3,9,10,11,14,23,25,26,27],"20":0,"200":26,"244":23,"3":[0,3,5,6,10,11,14,23,25,26],"300":26,"4":[11,25,26],"5":[9,25],"6":25,"7":[0,25],"8":[0,5,25],"9":[0,9,25],"99":[3,15],"abstract":[0,14,19,25,31],"case":[2,3,9,10,14,23],"catch":[15,21],"class":[2,3,5,6,8,9,10,11,14,15,18,24,25,30],"const":2,"default":[2,3,6,7,8,10,14,15,23],"do":[2,3,12,14,21,22,24],"final":[15,26],"function":[0,2,3,6,8,10,11,14,18,19,23,24,25,31],"import":[0,2,3,7,10,11,14,15,18,19,22,23,24,25,26,29,30],"int":[5,6,9,10,11,13,14],"new":[9,10],"return":[0,2,6,7,8,9,10,11,14,22,23,24,26,27,30],"switch":[2,3,14,25],"true":[3,7,9,10,11,13,14,18,23,25,27],"try":[3,6,9,14,15,18,21,26],"var":11,A:[3,6,9,10,11,14,31],As:[2,11,30],At:25,By:23,For:[2,23,24,25,26],If:[0,2,3,8,9,10,11,13,14,15],In:[3,9,10,14,23,24],It:[2,6,10,14,22,24,28],No:15,On:25,One:[2,23],The:[2,3,6,8,9,10,11,13,14,15,21,22,23,25,30,31],Then:25,These:[2,14],To:[2,3,9,14,22,23,30],With:31,_:2,____________:13,__call__:[2,24],__file__:2,__init__:[2,6,24],__main__:10,_ast:[10,11],_generatorwithlength:22,_pd_main:2,_thingfind:10,_trace_thi:6,a_transform:2,about:[6,14,25,28,31],abov:23,absolut:[2,25],accept:14,access:[10,27,30],ad:[3,10,14,22,31],adam:28,adapt:28,add:[2,3,9,14,24,26,27],add_n:2,addconst:2,addfirst:26,addit:9,advanc:19,after:[2,3,14,25,28],again:2,ai:[0,19],airplan:22,alia:11,all:[0,2,6,8,11,12,14,18,19,21,22,23,28,29],allow:[0,9,10,19,22,23,26],along:28,also:[2,3,14,22,24,26],alwai:14,am:25,an:[0,2,6,9,10,11,13,14,19,22,25,26,28,31],analog:26,analysi:0,ani:[3,8,13,14,15],anoth:13,anyth:[2,19],apach:0,api:19,append:[2,8],appli:[2,3,13,14,15,19,21,23,25,30],applic:26,ar:[2,3,8,10,11,14,21,22,23,24,25,28,29,30],arbitrari:[0,19,26],arg:[2,6,14,22,25,27],argument:[2,6,10,13,14,22],aris:23,arrai:[2,11,26],arrow:13,ascii:13,assign:[10,14],ast:[5,7,10,11],ast_nod:11,ast_util:[19,20],atom:14,atomictransform:[14,25],attribut:[6,9,16,25],augment:[23,26,28,30],automat:[2,3,14,22],avail:[6,22],awar:2,axxxxxxxxxxxxxxxxxxxx:9,b:[3,9,11,14,15],back:15,backward:28,bar:[11,22,23],base:[0,8,14,19],batch:[0,3,14,21,22,23,25,28,30,31],batch_siz:[22,25,28],batchifi:[3,10,14,21,25],baz:23,becaus:0,becom:[6,10,23,24],been:14,befor:[2,6,14,22],being:[3,14,26],below:[11,25],berlin:[0,19],between:[11,23],bia:25,big:2,bla:7,blip:7,blob:0,block:6,blop:7,blu:7,bodi:[2,6,7,10,11],boilerpl:31,bold:13,bool:[3,6,9,10,11,14],both:[2,9,28],build:[0,2,10,11,19,31],build_my_transform:2,builder:[0,19],built:28,builtin:14,builtintransform:14,bup:7,c:[3,14],cach:9,call:[3,6,8,10,11,14,15,24,25,30],call_info:14,call_sourc:10,callabl:[3,6,8,14,18,24],caller:6,caller_fram:6,caller_modul:6,callinfo:[6,14],calling_scop:10,can:[0,2,3,6,9,10,14,15,19,22,23,24,25,26,27,28,29,30,31],canb:22,cannot:2,capabl:28,captur:16,carri:15,cat:22,catch_transform:15,caus:2,caveat:2,cell:9,central:31,chang:[2,6,15],charact:13,check:[14,25],checkpoint:29,child:[12,14],child_transform:12,children:14,classifi:[23,30],classmethod:[8,10,11],classtransform:14,claus:15,clean:2,close:26,co:25,code:[0,2,3,6,7,8,9,10,11,14,25,28,31],code_of_conduct:0,codegraph:[8,11],codenod:11,col:[6,9,11],col_offset:5,collect:[9,14,21],column:6,com:0,combin:[13,14,19,21,24,31],combine_multi_line_str:13,come:[18,24],command:25,comment:6,common:23,complet:[6,15],complex:[2,14,27,31],compon:[0,19,23],compos:[14,25,27,30],composit:23,comprehens:0,compress:[3,14],concat_low:26,concis:[0,21],condit:[15,21],condition:23,conduct:0,conflict:2,consid:2,consist:2,consol:25,constant:[2,9],construct:14,contain:[2,6,8,9,10,12,13,14,28,29],content:11,context:[6,14],continu:[23,30],contrast:14,contribut:19,conveni:28,convert:[0,10,19,24,28,30],coor:13,coordin:13,correct:14,correspond:[5,10,11,30],could:[2,10,23],count:10,counter:[10,11],cpu:[3,14],creat:[0,2,6,8,10,11,13,14,19,21,22,23,28,29,31],create_arrow:13,create_reverse_arrow:13,crop:23,cuda:[14,28],current:[0,2,10,25],custom:[14,25,31],cut:9,d:25,data:[2,14,19,21,30,31],dataload:[14,22,31],datapoint:[14,23],dataset:2,debug:[11,19,21,31],debugg:25,decor:[3,14,18,24],deep:[0,2,19,23,30,31],deeper:25,def:[0,2,6,10,11,14,24,26,27,30],def_sourc:10,defin:[8,10,11,21,25,29,30],definit:2,depend:[2,11,29],detail:[6,14,23],determin:[3,6,9,11,14,18],develop:[0,19],devic:[3,12,14,22],di:31,diagnos:25,dict:9,dictionari:[2,14],differ:[2,9,22,25,30],dim:[3,14,25],dimens:[3,14,22,31],directli:14,directori:2,disabl:[3,13,14,22],displai:25,document:[6,14],doe:[14,22,25],doesn:[3,15],dog:22,don:[2,3,6,13,14,18],done:[14,22],down:[2,25],drop:[6,10],drop_n:[6,10],dump:[2,3,7,8,11,14],dump_packages_vers:7,dumptool:[14,19,20],dure:[3,14,23,26],e:[3,10,14],each:[2,14,22,25,30],easili:31,ecosystem:[0,19],edg:11,effect:2,either:[2,9],eleg:31,element:[14,23,25,30],elp:25,els:[3,11,15],else_:[3,15],else_transform:15,emb:25,embed:25,embedding_dim:25,empti:[6,10],enabl:[2,3,14,31],end:[3,11,13,14],end_col_offset:5,end_lineno:5,enter:[6,25],entir:[24,25],entiti:10,entri:2,enumer:2,epeat:25,equival:26,error:[15,25],escap:13,eval:[3,14,15,21,22,26],eval_appli:[3,14,15,22,25,26],evalu:30,even:23,event:6,everi:13,everyth:[11,21,23,24],exactli:23,exampl:[0,2,3,6,7,9,10,11,13,14,15,18,22,26,30],except:[10,15,19,20,21,25],execut:[0,2,6,23,25],exist:[3,11,14],expect:[2,3,9,14,22,25],explicit:[9,11],explicitli:14,extens:[3,14],extra:[15,19,21,28],extract:6,f1:14,f2:14,f:[2,9,10,11,14],factori:16,fail:[15,25],fall:15,fals:[3,6,10,11,13,14,18],few:2,field:11,file:[2,3,9,14,26,29],file_suffix:8,fileexistserror:[3,14],filenam:[2,9,14,26],filter_builtin:11,finally_transform:15,find:[0,7,10,11],find_codenod:11,find_glob:11,find_in_ipython:10,find_in_modul:10,find_in_scop:10,find_in_sourc:10,finder:11,finish_right:13,first:[3,6,9,13,14,23],flat:23,flatten:[3,14,23],flexibl:31,folder:[2,3,14,29],follow:[2,6,10,11,21,25],foo:[7,11,14,23],force_overwrit:[3,14],form:[10,14,24,31],formal:31,format:[7,13,30,31],format_argu:13,forward:[0,14,19,21,22,24,25],found:[6,10,11],four:10,frame:[6,9],frameinfo:6,from:[0,3,6,7,9,10,11,14,15,19,22,24,25,26,28,29,30],from_:11,from_col:9,from_level:10,from_lin:9,from_sourc:[10,11],front:6,full:[0,2,3,14],fulldump:[2,3,14],fulli:[3,14],functiontransform:14,fundament:14,futur:2,g:14,gener:[14,22],generic_visit:11,germani:[0,19],get:[2,5,6,7,9,10,11,13,14,16,19,21,23,25,26],get_module_sourc:9,get_packag:7,get_posit:5,get_segment_from_fram:6,get_sourc:9,get_source_seg:[5,11],get_stat:6,get_surrounding_block:6,get_vers:7,getitem:[6,27],github:0,give:9,given:[3,6,7,9,10,11,14],global:[2,10,11],global_:10,globals_:11,go:[0,11,25],good:14,got:25,gotten:9,gpu:[14,22,30,31],gradient:[14,22,31],graph:11,great:[0,19],green:13,group:[3,14,21],h:25,ha:[2,9,11,14,23,25,28,30],hacki:6,handl:22,happen:[15,30],have:[0,14,19,28],head:23,hello:26,help:[14,25],helper:[3,8],here:[2,6,25],hidden:24,hierarchi:10,histori:10,hood:22,how:[10,14,22,23,24,27,29,30,31],howev:2,http:0,i:[2,3,10,14,25],id:9,ident:[3,14,15,21,27],identifi:10,if_:[3,15],ifev:[3,15,21,26],iff:10,ifinf:[3,15,21,26],ifinmod:[3,15],iftrain:[3,15,21,23,26],ignor:14,ignore_grad:14,ignore_scop:[3,6,14,18],iim:[3,15],imag:[13,30],implement:[14,24],importdump:[2,3,14],in_featur:25,includ:[2,9,14,28,29],incorpor:25,increment:11,increment_same_name_var:11,indent:6,index:14,indic:[10,14],individu:23,infer:[3,14,15,21,22,26,28,30],infer_appli:[3,14,15,22,25,26],infer_pipelin:28,inform:[6,14,25],initi:[2,14,28],inlin:[6,14],inline_wrap:14,innov:[0,19],input:[3,9,13,14,22,23,25,26],insert:9,insid:[15,25],inspect:[6,9,14,25,31],inspector:[14,19,20],instanc:[2,22,23,24,28],instead:[2,3,6,14,18],interact:[2,25,29,31],interest:0,intern:22,introduct:19,invers:[3,14],io:0,ipython:[2,9,10,27],is_glob:10,isinst:[9,11,18],issu:0,item:[0,3,10,14,16,22,26],iter:[14,22,28],its:[10,11,14,25],itself:6,jpg:22,json:[2,8],json_seri:8,just:[2,3,14],keep:23,kei:9,keyword:[0,14,19],know:21,kwarg:[6,14],l1:24,l2:24,lab:[0,19],lambda:[3,14,15,23,24,25,26],larg:2,larger:6,largest:6,last:[2,9,13,14],layer1:28,layer2:28,layer:[0,14,19,25],learn:[0,19,22,23,24,28,29,30,31],len:[2,22],length:[13,23],let:25,level:[2,6,10,23,25],lf1:[0,19],licens:19,like:[2,22,30],limit:2,lin:24,line:[6,9,10,13,14,25],linear:[0,24,25],lineno:[5,6,10,11],list:[2,3,7,9,10,11,13,14,15,22,25,26,28,29],liter:[3,6,14,15],live:11,load:[0,2,3,8,14,19,21,22,23,28,30],load_data:2,load_funct:8,load_imag:[23,30],load_json:8,loader:[8,14],loc:9,local:11,locat:[6,9],log10:24,longtensor:25,look:[0,2,6,10],lookup:[28,30],loop:[10,22,28],loss:[0,19,23,28],lower:26,lr:28,macro:23,made:[6,14],mai:[0,19],main:[0,10,12],maintain:9,make:[0,13,19,21,25,28],make_bold:13,make_green:13,manual:0,map:14,mark:[3,8,14],match:[3,6,12,14,15,25],math:24,md:0,mean:[2,3,14,23],messi:2,method:[6,14,21,26],might:[2,26],minim:31,minus100:24,minusx:[24,26,27],mlp:24,mml:24,mnist:0,mode:[3,14,15,22],model:[0,2,14,19,28,30],model_pass:23,modifi:9,modul:[3,6,7,8,9,10,11,14,18,19,21,23,24,27,29,30],module_nam:[6,10],more:[2,3,6,14,23,31],most:[10,23,30],mother:12,mother_transform:12,move:[3,14,23,25],mpiler:25,much:31,multi:[6,13,31],multipl:[2,14,22,24,28],multiprocess:14,must:[2,6,14,23],my:2,my_classifi:[22,30],my_classifier_transform:[23,30],my_pipelin:[0,2,28,29],myfil:2,myfunct:6,mykei:9,myload:2,mypipelin:29,mypytorchlay:28,mysav:2,mytransform:2,n:[6,10,11,14],n_final_row:13,n_in:24,n_initial_row:13,n_out:24,n_to_add:2,name:[2,3,6,7,10,11,14,15,30],namenotfound:10,natur:22,need:[2,8,14,19],nest:[10,27,28],never:14,next:[22,23,24,27,28,29,30,31],nextmodul:6,nlp:0,nn:[0,14,24,25],node:[5,7,10,11],nodetyp:11,nodevisitor:11,non:9,non_init_caller_frameinfo:6,none:[3,6,8,10,11,14,15,18],normal:[2,9,14],not_found:2,note:[2,6],notebook:[2,31],noth:[3,14,21],now:2,np:[2,11,18,24,26],nput:25,npy:2,nth:23,num_embed:25,num_work:[22,25,28],number:[6,10,11,13],numpi:[2,18,24],o:11,object:[6,9,10,11,14,22,26],occur:15,offset:[6,11],often:26,one:[2,3,10,13,14,15,23,25,30],onli:[2,11,23,26],open:[2,23,26],open_fil:26,oper:23,optim:28,option:[3,6,8,11,14,15],order:14,ordereddict:14,origin:[6,9],other:[14,15],otherwis:[3,14,15],out:[6,9,10,11,15,18,23,24],out_featur:25,outer:6,outer_caller_frameinfo:6,output:[3,14,15,22,23,30],over:[13,14,23,28],overlap:9,overrid:14,overwrit:[3,14],own:[2,25],p:25,packag:[0,2,3,7,14,19,25,29],packagefind:[19,20],pad:13,padl:[2,20,23,24,25,26,27,29,30,31],padl_value_0:2,page:21,parallel:[3,14],param:14,paramet:[2,3,6,7,8,9,10,11,12,13,14,15,18,29],parent:[2,18],parenthes:23,pars:[7,11],part:[9,14,21,22,25,30],parti:2,particular:24,pass:[0,2,3,14,19,22],patch:18,patchedmodul:18,path:[2,3,8,14,23,30],pathlib:[2,3,8,14],pd_call_in_mod:14,pd_debug:[21,25],pd_devic:14,pd_forward:[14,22,30],pd_forward_device_check:14,pd_get_load:14,pd_group:14,pd_layer:[14,28],pd_name:[14,15],pd_np:18,pd_paramet:[14,28],pd_post_load:14,pd_postprocess:[14,30],pd_pre_sav:14,pd_preprocess:[14,30],pd_save:14,pd_stage:14,pd_to:[14,28],pd_varnam:14,pd_zip_sav:14,perform:[3,14,15],pick:2,piec:[10,11],pil:23,piltotensor:23,pip:0,pipelin:[0,14,19,21,22,24,25,27,28,29,30],pleas:0,pluson:2,plustwo:2,posit:[5,9,11,25],possibl:[2,6,14,24,28],post:[0,14,19,30],post_load:14,postprocess:[3,14,19,21,22,23,25],potenti:[2,6],power:23,pre:[0,9,14,19,30],pre_sav:14,preced:13,predict:[23,28],prefer:0,prepar:0,preprocess:[3,14,19,21,22,23,25,28,31],preprocess_imag:23,pretti:27,prevent:[2,3,14],previous:2,print:[6,11,13,14,19,21,25,29],print_util:[19,20],process:[0,2,14,19,22,30,31],produc:25,progress:22,propag:14,properti:[6,8,10,14],provid:[2,23,25],pt:2,put:9,put_into_cach:9,py:[2,29],pypi:2,python:[0,2,5,6,10,11,19,23,24,29],pytorch:[0,14,19,21,22,23,24,27,29,30],q:25,quit:25,r:25,rais:[3,6,14,25],rand:18,random:18,randomresizedcrop:23,randomrot:23,rang:2,ransform:25,rather:[2,6,14],re:[0,19,23],reach:25,read:[2,21,22,26,27,31],read_from_path:26,readabl:30,recent:10,recreat:2,recurs:[3,14,25],ref:25,refer:21,regardless:15,relev:25,relu:24,rememb:28,remov:[3,6,14,22],renam:[2,11],rename_loc:11,repeat:[2,23,25],repl:9,replac:[9,10],replace_cach:9,replace_star_import:10,replacestr:9,repres:[10,11],reproduc:31,requir:[2,6],reshap:30,resiz:23,resnet18:[23,30],respect:[3,11,14,26],respons:[2,30],rest:6,result:[2,3,6,9,14,23],retriev:25,return_loc:6,return_parti:10,revers:2,roll:23,rollout:[3,14],row:6,rstring:9,run:25,runtimeerror:25,s:[3,6,7,8,9,10,14,15,21,22,24,28,29,30],same:[3,5,6,9,10,11,14,16,21,23,25,28],save:[1,3,8,14,19,21,22,31],save_al:8,save_funct:8,save_json:8,saver:8,scope:[3,6,10,11,14,18],scoped_nam:11,scopednam:[10,11],scopelist:10,search:[10,11,14],second:[2,3,10,14,23],section:[9,22,23,24,27,28,29,30,31],see:[0,2,3,6,14,22],segment:[5,6,10,11],segment_typ:6,self:[2,10,14,24],send:[14,22,28,31],sentiment:0,sequenc:[13,14,23],seri:14,serial:[3,14,19,20],session:[2,29],set:[2,8,11,14,22],settrac:6,shape:25,should:[2,3,6,8,14],show:[22,25],shown:25,similar:2,simpl:0,simpli:[2,14],sin:24,sinc:25,singl:[0,14,19,22,23],size:[22,25],slice:[19,21,29,31],slower:0,so:[10,23,25],some:[2,23,25,28],somemodul:11,someobject:2,someth:[2,26],sometim:2,soon:6,sourc:[5,6,7,9,10,11,14],sourceget:[19,20],space:[6,13],special:[23,26,30],specifi:[3,9,10,14,22],split:[2,10],split_cal:10,stack:6,stage:[14,19,21,22,23,25],stand:30,standard:[0,19],star:[2,10],start:[3,10,13,14,19,21,25],start_left:13,state_dict:28,statement:[2,3,6,10,14,15,25],step:[14,23,28],stop:31,store:[2,3,8,28,29],str:[2,3,6,8,9,10,11,13,14,15],string:[3,7,8,9,10,11,13,14],sub:[9,11,14,23,27],subclass:10,substr:9,subval:2,successfulli:15,suffix:2,suggest:30,superimpos:13,support:[0,2,22],surround:[6,10],sy:6,symbol:[2,10],symfind:[6,11,19,20],t1:[14,23,27],t2:[14,23,27],t3:[14,23,27],t4:27,t5:27,t:[2,3,6,13,14,15,18,23,25,26],take:[13,23],taken:[9,24],target:[6,23],target_mod:[3,15],tensor:[0,3,14,22],text:[0,2],textcorpu:2,than:2,them:[2,3,14,21,23,28],thereof:[3,14],thi:[2,3,6,9,10,11,13,14,15,22,23,24,25,27,28,29],thing:[2,3,8,9,10,11],third:2,those:[2,11,28,30],three:[22,23],through:[11,22,23],thu:[2,23],time:2,to_col:9,to_lin:9,to_tensor:25,toarrai:2,togeth:27,too:[24,27,29],top:[10,13,25],topic:19,topk:0,toplevel:[3,6,10,14,18],topolog:[0,19],torch:[0,14,24,25,28],torchmoduletransform:14,torchvis:[23,30],totensor:[23,30],tqdm:22,trace:6,trace_thi:6,tracefunc:6,track:2,train:[3,14,15,21,22,26,28,30],train_appli:[14,22,25,28],train_data:28,train_model:28,train_pipelin:28,training_pipelin:23,transform:[0,3,10,12,15,16,18,19,20,21,27,29,30],transform_or_modul:[3,14],transpar:[13,31],tree:[0,10,11],tupl:[2,3,6,10,11,14,15,23],turn:14,tvt:23,two:2,txt:[2,29],type:[6,11],typic:14,u:25,uit:25,unbatch:[0,3,21,23,30],unbatchifi:[3,14],under:[0,22],undo:2,unind:6,union:[3,14,15],uniqu:14,unscop:10,unsqueez:[3,14],until:25,up:[2,10,25],updat:22,us:[0,2,3,6,7,8,9,10,11,13,14,15,18,19,21,22,23,24,25,26,27,30,31],usag:[0,19],use_replace_cach:9,user:[0,19,25],usual:30,util:[6,7,13,14,19,20,23,28],util_transform:[19,20],v:13,val:[2,3,8],valu:[3,8,9,10,13,21],valueerror:6,var2mod:[19,20],var_nam:10,variabl:[10,11,14,25],variou:[9,10],varnam:[8,10],veri:2,version:[0,2,7,9,10,14,19,20,29],via:[2,14,27,28,29,30],view:23,visibl:13,visible_len:13,visitor:11,w:25,wa:[0,6,14,19,25],wai:[10,25],want:[2,26],we:[2,25,30],well:10,were:[2,10],what:[14,26,30],whatev:14,when:[2,3,14,15,24,25,28,29],where:[6,9,11,13,25],wherea:30,which:[2,3,6,9,10,11,14,22,23,29],whole:[14,31],whose:[3,14],wide:6,within:[6,9,10,14,28],without:31,word:2,word_index:2,wordindex:2,work:[27,28,31],worker:22,workflow:[30,31],worri:31,would:[2,9,10,23],wrap:[2,3,14,19,20,24],wrap_typ:14,wrappe:[3,18],wrapper:[3,18,24],write:[0,2,3,14,19],written:10,wrongdeviceerror:12,x1:14,x2:14,x3:14,x:[0,2,3,9,10,11,13,14,15,23,24,25,26,27,30],xxxx:9,xxxxxaxxxxxxxxxxxxxxxxxxxx:9,xxxxxxxxxxx:9,xxxxxxxxxxxxxb:9,xxxxxxxxxxxxxbxxxx:9,y:[11,13,23,24,27],you:[0,2,19,23,26,31],your:[2,19,21,31],z:[11,23],zero_grad:28,zip:[3,14]},titles:["Introduction","Advanced Topics","Saving","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.ast_utils</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.inspector</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.packagefinder</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.serialize</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.sourceget</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.symfinder</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.var2mod</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.exceptions</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.print_utils</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.transforms</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.util_transforms</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.utils</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.version</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.wrap</span></code>","Welcome to PADL\u2019s documentation!","API Documentation","Usage","Applying Transforms to Data","Combining Transforms into Pipelines","Creating Transforms","Debugging your Transforms","Extras","Printing and Slicing","Using PyTorch Modules with Transforms","Saving and Loading","Stages: Preprocess, Forward and Postprocess","<em>Transforms</em> and <em>Pipelines</em>"],titleterms:{"import":21,"try":0,The:26,access:28,advanc:1,an:23,anyth:21,api:20,appli:[22,26],ast_util:5,automat:28,block:2,build:23,colab:0,combin:23,compos:23,content:[1,19,20,21],contribut:0,convert:23,creat:24,custom:2,data:22,debug:25,defin:2,depend:26,devic:28,dict:28,dictionari:23,differ:23,document:[19,20],doe:2,dumptool:[4,5,6,7,8,9,10,11],exampl:[23,25],except:[12,26],extra:26,extract:23,first:0,forward:[23,30],from:[2,21,23],gener:23,get:0,group:23,handl:26,how:2,imag:23,inspector:6,instal:0,introduct:0,item:23,layer:28,licens:0,load:29,loop:2,map:23,mode:26,model:23,modul:[2,28],multipl:23,mutat:2,need:21,nest:2,notebook:0,object:2,other:2,out:0,packagefind:7,padl:[0,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,28],parallel:23,paramet:28,pass:23,pipelin:[23,31],post:23,postprocess:30,pre:23,preprocess:30,print:27,print_util:13,process:23,program:0,pytorch:[2,28],resourc:0,rollout:23,s:19,same:26,sampl:23,save:[2,28,29],scope:2,serial:[2,8],share:28,slice:27,sourceget:9,stage:30,start:0,state:28,symfind:10,target:2,tensor:23,topic:1,train:23,transform:[2,14,22,23,24,25,26,28,31],us:28,usag:21,util:[16,26],util_transform:15,valu:2,var2mod:11,variabl:2,version:[17,23],weight:28,welcom:19,what:2,within:2,work:2,wrap:18,you:21,your:[0,25]}})
\ No newline at end of file
+Search.setIndex({docnames:["README","advanced","advanced/saving","apidocs/padl","apidocs/padl.dumptools","apidocs/padl.dumptools.ast_utils","apidocs/padl.dumptools.inspector","apidocs/padl.dumptools.packagefinder","apidocs/padl.dumptools.serialize","apidocs/padl.dumptools.sourceget","apidocs/padl.dumptools.symfinder","apidocs/padl.dumptools.var2mod","apidocs/padl.exceptions","apidocs/padl.print_utils","apidocs/padl.transforms","apidocs/padl.util_transforms","apidocs/padl.utils","apidocs/padl.version","apidocs/padl.wrap","index","modules","usage","usage/apply","usage/combining_transforms","usage/creating_transforms","usage/debugging_your_transforms","usage/extras","usage/print_slice","usage/pytorch","usage/saving","usage/stages","usage/transform"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.intersphinx":1,sphinx:56},filenames:["README.md","advanced.md","advanced/saving.md","apidocs/padl.md","apidocs/padl.dumptools.md","apidocs/padl.dumptools.ast_utils.md","apidocs/padl.dumptools.inspector.md","apidocs/padl.dumptools.packagefinder.md","apidocs/padl.dumptools.serialize.md","apidocs/padl.dumptools.sourceget.md","apidocs/padl.dumptools.symfinder.md","apidocs/padl.dumptools.var2mod.md","apidocs/padl.exceptions.md","apidocs/padl.print_utils.md","apidocs/padl.transforms.md","apidocs/padl.util_transforms.md","apidocs/padl.utils.md","apidocs/padl.version.md","apidocs/padl.wrap.md","index.md","modules.md","usage.md","usage/apply.md","usage/combining_transforms.md","usage/creating_transforms.md","usage/debugging_your_transforms.md","usage/extras.md","usage/print_slice.md","usage/pytorch.md","usage/saving.md","usage/stages.md","usage/transform.md"],objects:{"":[[3,0,0,"-","padl"]],"padl.dumptools":[[5,0,0,"-","ast_utils"],[6,0,0,"-","inspector"],[7,0,0,"-","packagefinder"],[8,0,0,"-","serialize"],[9,0,0,"-","sourceget"],[10,0,0,"-","symfinder"],[11,0,0,"-","var2mod"]],"padl.dumptools.ast_utils":[[5,1,1,"","Position"],[5,2,1,"","get_position"],[5,2,1,"","get_source_segment"]],"padl.dumptools.inspector":[[6,1,1,"","CallInfo"],[6,2,1,"","caller_frame"],[6,2,1,"","caller_module"],[6,2,1,"","get_segment_from_frame"],[6,2,1,"","get_statement"],[6,2,1,"","get_surrounding_block"],[6,2,1,"","non_init_caller_frameinfo"],[6,2,1,"","outer_caller_frameinfo"],[6,2,1,"","trace_this"]],"padl.dumptools.inspector.CallInfo":[[6,3,1,"","module"]],"padl.dumptools.packagefinder":[[7,2,1,"","dump_packages_versions"],[7,2,1,"","get_packages"],[7,2,1,"","get_version"]],"padl.dumptools.serialize":[[8,1,1,"","Serializer"],[8,2,1,"","json_serializer"],[8,2,1,"","load_json"],[8,2,1,"","save_json"],[8,2,1,"","value"]],"padl.dumptools.serialize.Serializer":[[8,4,1,"","save"],[8,4,1,"","save_all"],[8,3,1,"","varname"]],"padl.dumptools.sourceget":[[9,1,1,"","ReplaceString"],[9,1,1,"","ReplaceStrings"],[9,2,1,"","cut"],[9,2,1,"","get_module_source"],[9,2,1,"","get_source"],[9,2,1,"","original"],[9,2,1,"","put_into_cache"]],"padl.dumptools.sourceget.ReplaceString":[[9,4,1,"","cut"]],"padl.dumptools.sourceget.ReplaceStrings":[[9,4,1,"","cut"]],"padl.dumptools.symfinder":[[10,5,1,"","NameNotFound"],[10,1,1,"","Scope"],[10,1,1,"","ScopedName"],[10,2,1,"","find"],[10,2,1,"","find_in_ipython"],[10,2,1,"","find_in_module"],[10,2,1,"","find_in_scope"],[10,2,1,"","find_in_source"],[10,2,1,"","replace_star_imports"],[10,2,1,"","split_call"]],"padl.dumptools.symfinder.Scope":[[10,4,1,"","empty"],[10,4,1,"","from_level"],[10,4,1,"","from_source"],[10,4,1,"","global_"],[10,4,1,"","is_global"],[10,3,1,"","module_name"],[10,4,1,"","toplevel"],[10,4,1,"","unscoped"],[10,4,1,"","up"]],"padl.dumptools.var2mod":[[11,1,1,"","CodeGraph"],[11,1,1,"","CodeNode"],[11,1,1,"","Finder"],[11,1,1,"","Vars"],[11,2,1,"","find_codenode"],[11,2,1,"","find_globals"],[11,2,1,"","increment_same_name_var"],[11,2,1,"","rename"]],"padl.dumptools.var2mod.CodeGraph":[[11,4,1,"","build"],[11,4,1,"","dumps"],[11,4,1,"","print"]],"padl.dumptools.var2mod.CodeNode":[[11,4,1,"","from_source"]],"padl.dumptools.var2mod.Finder":[[11,4,1,"","find"],[11,4,1,"","generic_visit"],[11,4,1,"","get_source_segments"]],"padl.dumptools.var2mod.Vars":[[11,6,1,"","globals"],[11,6,1,"","locals"]],"padl.exceptions":[[12,5,1,"","WrongDeviceError"]],"padl.print_utils":[[13,2,1,"","combine_multi_line_strings"],[13,2,1,"","create_arrow"],[13,2,1,"","create_reverse_arrow"],[13,2,1,"","format_argument"],[13,2,1,"","make_bold"],[13,2,1,"","make_green"],[13,2,1,"","visible_len"]],"padl.transforms":[[14,1,1,"","AtomicTransform"],[14,1,1,"","Batchify"],[14,1,1,"","BuiltinTransform"],[14,1,1,"","ClassTransform"],[14,1,1,"","Compose"],[14,1,1,"","FunctionTransform"],[14,1,1,"","Identity"],[14,1,1,"","Map"],[14,1,1,"","Parallel"],[14,1,1,"","Pipeline"],[14,1,1,"","Rollout"],[14,1,1,"","TorchModuleTransform"],[14,1,1,"","Transform"],[14,1,1,"","Unbatchify"],[14,2,1,"","fulldump"],[14,2,1,"","group"],[14,2,1,"","importdump"],[14,2,1,"","load"],[14,2,1,"","save"]],"padl.transforms.ClassTransform":[[14,3,1,"","source"]],"padl.transforms.FunctionTransform":[[14,3,1,"","source"]],"padl.transforms.Pipeline":[[14,4,1,"","grouped"],[14,4,1,"","pd_forward_device_check"],[14,4,1,"","pd_to"]],"padl.transforms.TorchModuleTransform":[[14,4,1,"","post_load"],[14,4,1,"","pre_save"]],"padl.transforms.Transform":[[14,4,1,"","eval_apply"],[14,4,1,"","infer_apply"],[14,4,1,"","pd_call_in_mode"],[14,3,1,"","pd_device"],[14,3,1,"","pd_forward"],[14,4,1,"","pd_forward_device_check"],[14,4,1,"","pd_get_loader"],[14,3,1,"","pd_layers"],[14,3,1,"","pd_name"],[14,4,1,"","pd_parameters"],[14,4,1,"","pd_post_load"],[14,3,1,"","pd_postprocess"],[14,4,1,"","pd_pre_save"],[14,3,1,"","pd_preprocess"],[14,4,1,"","pd_save"],[14,3,1,"","pd_stages"],[14,4,1,"","pd_to"],[14,4,1,"","pd_varname"],[14,4,1,"","pd_zip_save"],[14,4,1,"","train_apply"]],"padl.util_transforms":[[15,1,1,"","IfEval"],[15,1,1,"","IfInMode"],[15,1,1,"","IfInfer"],[15,1,1,"","IfTrain"],[15,1,1,"","Try"]],"padl.utils":[[16,6,1,"","same"]],"padl.wrap":[[18,1,1,"","PatchedModule"],[18,2,1,"","transform"]],padl:[[3,1,1,"","Batchify"],[3,1,1,"","Identity"],[3,1,1,"","IfEval"],[3,1,1,"","IfInMode"],[3,1,1,"","IfInfer"],[3,1,1,"","IfTrain"],[3,1,1,"","Unbatchify"],[4,0,0,"-","dumptools"],[12,0,0,"-","exceptions"],[3,2,1,"","fulldump"],[3,2,1,"","group"],[3,2,1,"","importdump"],[3,2,1,"","load"],[13,0,0,"-","print_utils"],[3,2,1,"","save"],[3,2,1,"","transform"],[14,0,0,"-","transforms"],[3,7,1,"","unbatch"],[15,0,0,"-","util_transforms"],[16,0,0,"-","utils"],[3,2,1,"","value"],[17,0,0,"-","version"],[18,0,0,"-","wrap"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","function","Python function"],"3":["py","property","Python property"],"4":["py","method","Python method"],"5":["py","exception","Python exception"],"6":["py","attribute","Python attribute"],"7":["py","data","Python data"]},objtypes:{"0":"py:module","1":"py:class","2":"py:function","3":"py:property","4":"py:method","5":"py:exception","6":"py:attribute","7":"py:data"},terms:{"0":[0,3,6,9,10,11,14,25,26,27],"0x":11,"1":[0,2,3,9,10,11,14,15,23,25,26,27,28],"10":[0,3,15,24,25],"100":[2,11,23,24,26,27],"1000":24,"11":[3,6,15],"123":6,"13":9,"2":[0,3,9,10,11,14,23,25,26,27],"20":0,"200":26,"244":23,"3":[0,3,5,6,10,11,14,23,25,26],"300":26,"4":[11,25,26],"5":[9,25],"6":25,"7":[0,25],"8":[0,5,25],"9":[0,9,25],"99":[3,15],"abstract":[0,14,19,25,31],"case":[2,3,9,10,14,23],"catch":[15,21],"class":[2,3,5,6,8,9,10,11,14,15,18,24,25,30],"const":2,"default":[2,3,6,7,8,10,14,15,23],"do":[2,3,12,14,21,22,24],"final":[15,26],"function":[0,2,3,6,8,10,11,14,18,19,23,24,25,31],"import":[0,2,3,7,10,11,14,15,18,19,22,23,24,25,26,29,30],"int":[5,6,9,10,11,13,14],"new":[9,10],"return":[0,2,6,7,8,9,10,11,14,22,23,24,26,27,30],"switch":[2,3,14,25],"true":[3,7,9,10,11,13,14,18,23,25,27],"try":[3,6,9,14,15,18,21,26],"var":11,A:[3,6,9,10,11,14,31],As:[2,11,30],At:25,By:23,For:[2,23,24,25,26],If:[0,2,3,8,9,10,11,13,14,15],In:[3,9,10,14,23,24],It:[2,6,10,14,22,24,28],No:15,On:25,One:[2,23],The:[2,3,6,8,9,10,11,13,14,15,21,22,23,25,30,31],Then:25,These:[2,14],To:[2,3,9,14,22,23,30],With:31,_:2,____________:13,__call__:[2,24],__file__:2,__init__:[2,6,24],__main__:10,_ast:[10,11],_generatorwithlength:22,_pd_main:2,_thingfind:10,_trace_thi:6,a_transform:2,about:[6,14,25,28,31],abov:23,absolut:[2,25],accept:14,access:[10,27,30],ad:[3,10,14,22,31],adam:28,adapt:28,add:[2,3,9,14,24,26,27],add_n:2,addconst:2,addfirst:26,addit:9,advanc:19,after:[2,3,14,25,28],again:2,ai:[0,19],airplan:22,alia:11,all:[0,2,6,8,11,12,14,18,19,21,22,23,28,29],allow:[0,9,10,19,22,23,26],along:28,also:[2,3,14,22,24,26],alwai:14,am:25,an:[0,2,6,9,10,11,13,14,19,22,25,26,28,31],analog:26,analysi:0,ani:[3,8,13,14,15],anoth:13,anyth:[2,19],apach:0,api:19,append:[2,8],appli:[2,3,13,14,15,19,21,23,25,30],applic:26,ar:[2,3,8,10,11,14,21,22,23,24,25,28,29,30],arbitrari:[0,19,26],arg:[2,6,14,22,25,27],argument:[2,6,10,13,14,22],aris:23,arrai:[2,11,26],arrow:13,ascii:13,assign:[10,14],ast:[5,7,10,11],ast_nod:11,ast_util:[19,20],atom:14,atomictransform:[14,25],attribut:[6,9,16,25],augment:[23,26,28,30],automat:[2,3,14,22],avail:[6,22],awar:2,axxxxxxxxxxxxxxxxxxxx:9,b:[3,9,11,14,15],back:15,backward:28,bar:[11,22,23],base:[0,8,14,19],batch:[0,3,14,21,22,23,25,28,30,31],batch_siz:[22,25,28],batchifi:[3,10,14,21,25],baz:23,becaus:0,becom:[6,10,23,24],been:14,befor:[2,6,14,22],being:[3,14,26],below:[11,25],berlin:[0,19],between:[11,23],bia:25,big:2,bla:7,blip:7,blob:0,block:6,blop:7,blu:7,bodi:[2,6,7,10,11],boilerpl:31,bold:13,bool:[3,6,9,10,11,14],both:[2,9,28],build:[0,2,10,11,19,31],build_my_transform:2,builder:[0,19],built:28,builtin:[11,14],builtintransform:14,bup:7,c:[3,14],cach:9,call:[3,6,8,10,11,14,15,24,25,30],call_info:14,call_sourc:10,callabl:[3,6,8,14,18,24],caller:6,caller_fram:6,caller_modul:6,callinfo:[6,14],calling_scop:10,can:[0,2,3,6,9,10,14,15,19,22,23,24,25,26,27,28,29,30,31],canb:22,cannot:2,capabl:28,captur:16,carri:15,cat:22,catch_transform:15,caus:2,caveat:2,cell:9,central:31,chang:[2,6,15],charact:13,check:[14,25],checkpoint:29,child:[12,14],child_transform:12,children:14,classifi:[23,30],classmethod:[8,10,11],classtransform:14,claus:15,clean:2,close:26,co:25,code:[0,2,3,6,7,8,9,10,11,14,25,28,31],code_of_conduct:0,codegraph:[8,11],codenod:11,col:[6,9,11],col_offset:[5,11],collect:[9,14,21],column:6,com:0,combin:[13,14,19,21,24,31],combine_multi_line_str:13,come:[18,24],command:25,comment:6,common:23,complet:[6,15],complex:[2,14,27,31],compon:[0,19,23],compos:[14,25,27,30],composit:23,comprehens:0,compress:[3,14],concat_low:26,concis:[0,21],condit:[15,21],condition:23,conduct:0,conflict:2,consid:2,consist:2,consol:25,constant:[2,9],construct:14,contain:[2,6,8,9,10,12,13,14,28,29],content:11,context:[6,14],continu:[23,30],contrast:14,contribut:19,conveni:28,convert:[0,10,19,24,28,30],coor:13,coordin:13,correct:14,correspond:[5,10,11,30],could:[2,10,23],count:10,counter:[10,11],cpu:[3,14],creat:[0,2,6,8,10,11,13,14,19,21,22,23,28,29,31],create_arrow:13,create_reverse_arrow:13,crop:23,cuda:[14,28],current:[0,2,10,25],custom:[14,25,31],cut:9,d:25,data:[2,14,19,21,30,31],dataload:[14,22,31],datapoint:[14,23],dataset:2,debug:[11,19,21,31],debugg:25,decor:[3,14,18,24],deep:[0,2,19,23,30,31],deeper:25,def:[0,2,6,10,11,14,24,26,27,30],def_sourc:10,defin:[8,10,11,21,25,29,30],definit:2,depend:[2,11,29],detail:[6,14,23],determin:[3,6,9,11,14,18],develop:[0,19],devic:[3,12,14,22],di:31,diagnos:25,dict:9,dictionari:[2,14],differ:[2,9,22,25,30],dim:[3,14,25],dimens:[3,14,22,31],directli:14,directori:2,disabl:[3,13,14,22],displai:25,document:[6,14],doe:[14,22,25],doesn:[3,15],dog:22,don:[2,3,6,13,14,18],done:[14,22],down:[2,25],drop:[6,10],drop_n:[6,10],dump:[2,3,7,8,11,14],dump_packages_vers:7,dumptool:[14,19,20],dure:[3,14,23,26],e:[3,10,14],each:[2,14,22,25,30],easili:31,ecosystem:[0,19],edg:11,effect:2,either:[2,9],eleg:31,element:[14,23,25,30],elp:25,els:[3,11,15],else_:[3,15],else_transform:15,emb:25,embed:25,embedding_dim:25,empti:[6,10],enabl:[2,3,14,31],end:[3,11,13,14],end_col_offset:[5,11],end_lineno:[5,11],enter:[6,25],entir:[24,25],entiti:10,entri:2,enumer:2,epeat:25,equival:26,error:[15,25],escap:13,eval:[3,14,15,21,22,26],eval_appli:[3,14,15,22,25,26],evalu:30,even:23,event:6,everi:13,everyth:[11,21,23,24],exactli:23,exampl:[0,2,3,6,7,9,10,11,13,14,15,18,22,26,30],except:[10,15,19,20,21,25],execut:[0,2,6,23,25],exist:[3,11,14],expect:[2,3,9,14,22,25],explicit:[9,11],explicitli:14,extens:[3,14],extra:[15,19,21,28],extract:6,f1:14,f2:14,f:[2,9,10,11,14],factori:16,fail:[15,25],fall:15,fals:[3,6,10,11,13,14,18],few:2,field:11,file:[2,3,9,14,26,29],file_suffix:8,fileexistserror:[3,14],filenam:[2,9,14,26],filter:11,filter_builtin:11,finally_transform:15,find:[0,7,10,11],find_codenod:11,find_glob:11,find_in_ipython:10,find_in_modul:10,find_in_scop:10,find_in_sourc:10,finder:11,finish_right:13,first:[3,6,9,13,14,23],flat:23,flatten:[3,14,23],flexibl:31,folder:[2,3,14,29],follow:[2,6,10,11,21,25],foo:[7,11,14,23],force_overwrit:[3,14],form:[10,14,24,31],formal:31,format:[7,13,30,31],format_argu:13,forward:[0,14,19,21,22,24,25],found:[6,10,11],four:10,frame:[6,9],frameinfo:6,from:[0,3,6,7,9,10,11,14,15,19,22,24,25,26,28,29,30],from_:11,from_col:9,from_level:10,from_lin:9,from_sourc:[10,11],front:6,full:[0,2,3,14],full_dump_module_nam:11,fulldump:[2,3,14],fulli:[3,14],functiontransform:14,fundament:14,futur:2,g:14,gener:[14,22],generic_visit:11,germani:[0,19],get:[2,5,6,7,9,10,11,13,14,16,19,21,23,25,26],get_module_sourc:9,get_packag:7,get_posit:5,get_segment_from_fram:6,get_sourc:9,get_source_seg:[5,11],get_stat:6,get_surrounding_block:6,get_vers:7,getitem:[6,27],github:0,give:9,given:[3,6,7,9,10,11,14],global:[2,10,11],global_:10,globals_:11,go:[0,11,25],good:14,got:25,gotten:9,gpu:[14,22,30,31],gradient:[14,22,31],graph:11,great:[0,19],green:13,group:[3,14,21],h:25,ha:[2,9,11,14,23,25,28,30],hacki:6,handl:22,happen:[15,30],have:[0,14,19,28],head:23,hello:26,help:[14,25],helper:[3,8],here:[2,6,25],hidden:24,hierarchi:10,histori:10,hood:22,how:[10,14,22,23,24,27,29,30,31],howev:2,http:0,i:[2,3,10,14,25],id:9,ident:[3,14,15,21,27],identifi:10,if_:[3,15],ifev:[3,15,21,26],iff:10,ifinf:[3,15,21,26],ifinmod:[3,15],iftrain:[3,15,21,23,26],ignor:14,ignore_grad:14,ignore_scop:[3,6,14,18],iim:[3,15],imag:[13,30],implement:[14,24],importdump:[2,3,14],in_featur:25,includ:[2,9,14,28,29],incorpor:25,increment:11,increment_same_name_var:11,indent:6,index:14,indic:[10,14],individu:23,infer:[3,14,15,21,22,26,28,30],infer_appli:[3,14,15,22,25,26],infer_pipelin:28,inform:[6,14,25],initi:[2,14,28],inlin:[6,14],inline_wrap:14,innov:[0,19],input:[3,9,13,14,22,23,25,26],insert:9,insid:[15,25],inspect:[6,9,14,25,31],inspector:[14,19,20],instanc:[2,22,23,24,28],instead:[2,3,6,14,18],interact:[2,25,29,31],interest:0,intern:22,introduct:19,invers:[3,14],io:0,ipython:[2,9,10,27],is_glob:10,isinst:[9,11,18],issu:0,item:[0,3,10,14,16,22,26],iter:[14,22,28],its:[10,11,14,25],itself:6,jpg:22,json:[2,8],json_seri:8,just:[2,3,14],keep:23,kei:9,keyword:[0,14,19],know:21,kwarg:[6,14],l1:24,l2:24,lab:[0,19],lambda:[3,14,15,23,24,25,26],larg:2,larger:6,largest:6,last:[2,9,13,14],layer1:28,layer2:28,layer:[0,14,19,25],learn:[0,19,22,23,24,28,29,30,31],len:[2,22],length:[13,23],let:25,level:[2,6,10,23,25],lf1:[0,19],licens:19,like:[2,22,30],limit:2,lin:24,line:[6,9,10,13,14,25],linear:[0,24,25],lineno:[5,6,10,11],list:[2,3,7,9,10,11,13,14,15,22,25,26,28,29],liter:[3,6,14,15],live:11,load:[0,2,3,8,14,19,21,22,23,28,30],load_data:2,load_funct:8,load_imag:[23,30],load_json:8,loader:[8,14],loc:9,local:11,locat:[6,9],log10:24,longtensor:25,look:[0,2,6,10],lookup:[28,30],loop:[10,22,28],loss:[0,19,23,28],lower:26,lr:28,macro:23,made:[6,14],mai:[0,19],main:[0,10,12],maintain:9,make:[0,13,19,21,25,28],make_bold:13,make_green:13,manual:0,map:14,mark:[3,8,14],match:[3,6,12,14,15,25],math:24,md:0,mean:[2,3,14,23],messi:2,method:[6,14,21,26],might:[2,26],minim:31,minus100:24,minusx:[24,26,27],mlp:24,mml:24,mnist:0,mode:[3,14,15,22],model:[0,2,14,19,28,30],model_pass:23,modifi:9,modul:[3,6,7,8,9,10,11,14,18,19,21,23,24,27,29,30],module_nam:[6,10],more:[2,3,6,14,23,31],most:[10,23,30],mother:12,mother_transform:12,move:[3,14,23,25],mpiler:25,much:31,multi:[6,13,31],multipl:[2,14,22,24,28],multiprocess:14,must:[2,6,14,23],my:2,my_classifi:[22,30],my_classifier_transform:[23,30],my_pipelin:[0,2,28,29],myfil:2,myfunct:6,mykei:9,myload:2,mypipelin:29,mypytorchlay:28,mysav:2,mytransform:2,n:[6,10,11,14],n_final_row:13,n_in:24,n_initial_row:13,n_out:24,n_to_add:2,name:[2,3,6,7,10,11,14,15,30],namenotfound:10,natur:22,need:[2,8,14,19],nest:[10,27,28],never:14,next:[22,23,24,27,28,29,30,31],nextmodul:6,nlp:0,nn:[0,14,24,25],node:[5,7,10,11],nodetyp:11,nodevisitor:11,non:9,non_init_caller_frameinfo:6,none:[3,6,8,10,11,14,15,18],normal:[2,9,14],not_found:2,note:[2,6],notebook:[2,31],noth:[3,14,21],now:2,np:[2,11,18,24,26],nput:25,npy:2,nth:23,num_embed:25,num_work:[22,25,28],number:[6,10,11,13],numpi:[2,18,24],o:11,object:[6,9,10,11,14,22,26],occur:15,offset:[6,11],often:26,one:[2,3,10,13,14,15,23,25,30],onli:[2,11,23,26],open:[2,23,26],open_fil:26,oper:23,optim:28,option:[3,6,8,11,14,15],order:14,ordereddict:14,origin:[6,9],other:[14,15],otherwis:[3,14,15],out:[6,9,10,11,15,18,23,24],out_featur:25,outer:6,outer_caller_frameinfo:6,output:[3,14,15,22,23,30],over:[13,14,23,28],overlap:9,overrid:14,overwrit:[3,14],own:[2,25],p:25,packag:[0,2,3,7,14,19,25,29],packagefind:[19,20],pad:13,padl:[2,20,23,24,25,26,27,29,30,31],padl_value_0:2,page:21,parallel:[3,14],param:14,paramet:[2,3,6,7,8,9,10,11,12,13,14,15,18,29],parent:[2,18],parenthes:23,pars:[7,11],part:[9,14,21,22,25,30],parti:2,particular:24,pass:[0,2,3,14,19,22],patch:18,patchedmodul:18,path:[2,3,8,14,23,30],pathlib:[2,3,8,14],pd_call_in_mod:14,pd_debug:[21,25],pd_devic:14,pd_forward:[14,22,30],pd_forward_device_check:14,pd_get_load:14,pd_group:14,pd_layer:[14,28],pd_name:[14,15],pd_np:18,pd_paramet:[14,28],pd_post_load:14,pd_postprocess:[14,30],pd_pre_sav:14,pd_preprocess:[14,30],pd_save:14,pd_stage:14,pd_to:[14,28],pd_varnam:14,pd_zip_sav:14,perform:[3,14,15],pick:2,piec:[10,11],pil:23,piltotensor:23,pip:0,pipelin:[0,14,19,21,22,24,25,27,28,29,30],pleas:0,pluson:2,plustwo:2,posit:[5,9,11,25],possibl:[2,6,14,24,28],post:[0,14,19,30],post_load:14,postprocess:[3,14,19,21,22,23,25],potenti:[2,6],power:23,pre:[0,9,14,19,30],pre_sav:14,preced:13,predict:[23,28],prefer:0,prepar:0,preprocess:[3,14,19,21,22,23,25,28,31],preprocess_imag:23,pretti:27,prevent:[2,3,14],previous:2,print:[6,11,13,14,19,21,25,29],print_util:[19,20],process:[0,2,14,19,22,30,31],produc:25,progress:22,propag:14,properti:[6,8,10,14],provid:[2,23,25],pt:2,put:9,put_into_cach:9,py:[2,29],pypi:2,python:[0,2,5,6,10,11,19,23,24,29],pytorch:[0,14,19,21,22,23,24,27,29,30],q:25,quit:25,r:25,rais:[3,6,14,25],rand:18,random:18,randomresizedcrop:23,randomrot:23,rang:2,ransform:25,rather:[2,6,14],re:[0,19,23],reach:25,read:[2,21,22,26,27,31],read_from_path:26,readabl:30,recent:10,recreat:2,recurs:[3,14,25],ref:25,refer:21,regardless:15,relev:25,relu:24,rememb:28,remov:[3,6,14,22],renam:[2,11],rename_loc:11,repeat:[2,23,25],repl:9,replac:[9,10],replace_cach:9,replace_star_import:10,replacestr:9,repres:[10,11],reproduc:31,requir:[2,6],reshap:30,resiz:23,resnet18:[23,30],respect:[3,11,14,26],respons:[2,30],rest:6,result:[2,3,6,9,14,23],retriev:25,return_loc:6,return_parti:10,revers:2,roll:23,rollout:[3,14],row:6,rstring:9,run:25,runtimeerror:25,s:[3,6,7,8,9,10,14,15,21,22,24,28,29,30],same:[3,5,6,9,10,11,14,16,21,23,25,28],save:[1,3,8,14,19,21,22,31],save_al:8,save_funct:8,save_json:8,saver:8,scope:[3,6,10,11,14,18],scoped_nam:11,scopednam:[10,11],scopelist:10,search:[10,11,14],second:[2,3,10,14,23],section:[9,22,23,24,27,28,29,30,31],see:[0,2,3,6,14,22],segment:[5,6,10,11],segment_typ:6,self:[2,10,14,24],send:[14,22,28,31],sentiment:0,sequenc:[13,14,23],seri:14,serial:[3,14,19,20],session:[2,29],set:[2,8,11,14,22],settrac:6,shape:25,should:[2,3,6,8,14],show:[22,25],shown:25,similar:2,simpl:0,simpli:[2,14],sin:24,sinc:25,singl:[0,14,19,22,23],size:[22,25],slice:[19,21,29,31],slower:0,so:[10,23,25],some:[2,23,25,28],somemodul:11,someobject:2,someth:[2,26],sometim:2,soon:6,sourc:[5,6,7,9,10,11,14],sourceget:[19,20],space:[6,13],special:[23,26,30],specifi:[3,9,10,14,22],split:[2,10],split_cal:10,stack:6,stage:[14,19,21,22,23,25],stand:30,standard:[0,19],star:[2,10],start:[3,10,13,14,19,21,25],start_left:13,state_dict:28,statement:[2,3,6,10,14,15,25],step:[14,23,28],stop:31,store:[2,3,8,28,29],str:[2,3,6,8,9,10,11,13,14,15],string:[3,7,8,9,10,11,13,14],sub:[9,11,14,23,27],subclass:10,substr:9,subval:2,successfulli:15,suffix:2,suggest:30,superimpos:13,support:[0,2,22],surround:[6,10],sy:6,symbol:[2,10],symfind:[6,11,19,20],t1:[14,23,27],t2:[14,23,27],t3:[14,23,27],t4:27,t5:27,t:[2,3,6,13,14,15,18,23,25,26],take:[13,23],taken:[9,24],target:[6,23],target_mod:[3,15],tensor:[0,3,14,22],text:[0,2],textcorpu:2,than:2,them:[2,3,14,21,23,28],thereof:[3,14],thi:[2,3,6,9,10,11,13,14,15,22,23,24,25,27,28,29],thing:[2,3,8,9,10,11],third:2,those:[2,11,28,30],three:[22,23],through:[11,22,23],thu:[2,23],time:2,to_col:9,to_lin:9,to_tensor:25,toarrai:2,togeth:27,too:[24,27,29],top:[10,13,25],topic:19,topk:0,toplevel:[3,6,10,14,18],topolog:[0,19],torch:[0,14,24,25,28],torchmoduletransform:14,torchvis:[23,30],totensor:[23,30],tqdm:22,trace:6,trace_thi:6,tracefunc:6,track:2,train:[3,14,15,21,22,26,28,30],train_appli:[14,22,25,28],train_data:28,train_model:28,train_pipelin:28,training_pipelin:23,transform:[0,3,10,12,15,16,18,19,20,21,27,29,30],transform_or_modul:[3,14],transpar:[13,31],tree:[0,10,11],tupl:[2,3,6,10,11,14,15,23],turn:14,tvt:23,two:2,txt:[2,29],type:[6,11],typic:14,u:25,uit:25,unbatch:[0,3,21,23,30],unbatchifi:[3,14],under:[0,22],undo:2,unind:6,union:[3,14,15],uniqu:14,unscop:10,unsqueez:[3,14],until:25,up:[2,10,25],updat:22,us:[0,2,3,6,7,8,9,10,11,13,14,15,18,19,21,22,23,24,25,26,27,30,31],usag:[0,19],use_replace_cach:9,user:[0,19,25],usual:30,util:[6,7,13,14,19,20,23,28],util_transform:[19,20],v:13,val:[2,3,8],valu:[3,8,9,10,13,21],valueerror:6,var2mod:[19,20],var_nam:10,variabl:[10,11,14,25],variou:[9,10],varnam:[8,10],veri:2,version:[0,2,7,9,10,14,19,20,29],via:[2,14,27,28,29,30],view:23,visibl:13,visible_len:13,visitor:11,w:25,wa:[0,6,14,19,25],wai:[10,25],want:[2,26],we:[2,25,30],well:10,were:[2,10],what:[14,26,30],whatev:14,when:[2,3,14,15,24,25,28,29],where:[6,9,11,13,25],wherea:30,which:[2,3,6,9,10,11,14,22,23,29],whole:[14,31],whose:[3,14],wide:6,within:[6,9,10,14,28],without:31,word:2,word_index:2,wordindex:2,work:[27,28,31],worker:22,workflow:[30,31],worri:31,would:[2,9,10,23],wrap:[2,3,14,19,20,24],wrap_typ:14,wrappe:[3,18],wrapper:[3,18,24],write:[0,2,3,14,19],written:10,wrongdeviceerror:12,x1:14,x2:14,x3:14,x:[0,2,3,9,10,11,13,14,15,23,24,25,26,27,30],xxxx:9,xxxxxaxxxxxxxxxxxxxxxxxxxx:9,xxxxxxxxxxx:9,xxxxxxxxxxxxxb:9,xxxxxxxxxxxxxbxxxx:9,y:[11,13,23,24,27],you:[0,2,19,23,26,31],your:[2,19,21,31],z:[11,23],zero_grad:28,zip:[3,14]},titles:["Introduction","Advanced Topics","Saving","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.ast_utils</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.inspector</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.packagefinder</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.serialize</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.sourceget</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.symfinder</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.dumptools.var2mod</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.exceptions</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.print_utils</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.transforms</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.util_transforms</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.utils</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.version</span></code>","<code class=\"docutils literal notranslate\"><span class=\"pre\">padl.wrap</span></code>","Welcome to PADL\u2019s documentation!","API Documentation","Usage","Applying Transforms to Data","Combining Transforms into Pipelines","Creating Transforms","Debugging your Transforms","Extras","Printing and Slicing","Using PyTorch Modules with Transforms","Saving and Loading","Stages: Preprocess, Forward and Postprocess","<em>Transforms</em> and <em>Pipelines</em>"],titleterms:{"import":21,"try":0,The:26,access:28,advanc:1,an:23,anyth:21,api:20,appli:[22,26],ast_util:5,automat:28,block:2,build:23,colab:0,combin:23,compos:23,content:[1,19,20,21],contribut:0,convert:23,creat:24,custom:2,data:22,debug:25,defin:2,depend:26,devic:28,dict:28,dictionari:23,differ:23,document:[19,20],doe:2,dumptool:[4,5,6,7,8,9,10,11],exampl:[23,25],except:[12,26],extra:26,extract:23,first:0,forward:[23,30],from:[2,21,23],gener:23,get:0,group:23,handl:26,how:2,imag:23,inspector:6,instal:0,introduct:0,item:23,layer:28,licens:0,load:29,loop:2,map:23,mode:26,model:23,modul:[2,28],multipl:23,mutat:2,need:21,nest:2,notebook:0,object:2,other:2,out:0,packagefind:7,padl:[0,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21,28],parallel:23,paramet:28,pass:23,pipelin:[23,31],post:23,postprocess:30,pre:23,preprocess:30,print:27,print_util:13,process:23,program:0,pytorch:[2,28],resourc:0,rollout:23,s:19,same:26,sampl:23,save:[2,28,29],scope:2,serial:[2,8],share:28,slice:27,sourceget:9,stage:30,start:0,state:28,symfind:10,target:2,tensor:23,topic:1,train:23,transform:[2,14,22,23,24,25,26,28,31],us:28,usag:21,util:[16,26],util_transform:15,valu:2,var2mod:11,variabl:2,version:[17,23],weight:28,welcom:19,what:2,within:2,work:2,wrap:18,you:21,your:[0,25]}})
\ No newline at end of file
diff --git a/padl/dumptools/inspector.py b/padl/dumptools/inspector.py
index 2b5086fc..69f66487 100644
--- a/padl/dumptools/inspector.py
+++ b/padl/dumptools/inspector.py
@@ -50,23 +50,8 @@ def _determine_scope(self, caller_frameinfo: inspect.FrameInfo,
 
         if self.function == '<module>' or ignore_scope:
             return symfinder.Scope.toplevel(module)
-        try:
-            call_source = get_segment_from_frame(caller_frameinfo.frame.f_back, 'call')
-        except RuntimeError:
-            warn('Error determining call source.')
-            call_source = '__na()'
-        try:
-            definition_source = get_source(caller_frameinfo.filename)
-            fdef_lineno = caller_frameinfo.frame.f_lineno
-            calling_scope = symfinder.Scope.toplevel(_module(caller_frameinfo.frame.f_back))
-            scope = symfinder.Scope.from_source(definition_source, fdef_lineno,
-                                                call_source, module, drop_n,
-                                                calling_scope)
-            assert len(scope) <= 1, 'scope longer than 1 currently not supported'
-            return scope
-        except (SyntaxError, RuntimeError) as exc:
-            warn(f'Error determining scope, using top level: {exc}')  # TODO: fix this
-            return symfinder.Scope.toplevel(module)
+
+        return _get_scope_from_frame(caller_frameinfo.frame, drop_n)
 
     @property
     def module(self):
@@ -74,6 +59,31 @@ def module(self):
         return self.scope.module
 
 
+# exclude these modules from detailed scope analysis (as that slows testing down in python 3.7.)
+_EXCLUDED_MODULES = ['pytest', 'pluggy']
+
+
+def _get_scope_from_frame(frame, drop_n):
+    """Get the :class:`~symfinder.Scope` from the frame object *frame*. """
+    module = _module(frame)
+    if any(module.__name__.startswith(excluded_module) for excluded_module in _EXCLUDED_MODULES):
+        return symfinder.Scope.toplevel(module)
+    try:
+        call_source = get_segment_from_frame(frame.f_back, 'call')
+    except (RuntimeError, FileNotFoundError, AttributeError):
+        return symfinder.Scope.toplevel(module)
+    try:
+        definition_source = get_source(frame.f_code.co_filename)
+    except FileNotFoundError:
+        return symfinder.Scope.toplevel(module)
+    calling_scope = _get_scope_from_frame(frame.f_back, 0)
+    scope = symfinder.Scope.from_source(definition_source, frame.f_lineno,
+                                        call_source, module, drop_n,
+                                        calling_scope)
+    assert len(scope) <= 1, 'scope longer than 1 currently not supported'
+    return scope
+
+
 def non_init_caller_frameinfo() -> inspect.FrameInfo:
     """Get the FrameInfo for the first outer frame that is not of an "__init__" method. """
     stack = inspect.stack()
@@ -187,18 +197,6 @@ def get_statement(source: str, lineno: int):
 def _get_statement_from_block(block: str, lineno_in_block: int):
     """Get statements at like *lineno_in_block* from a code block.
 
-    Example:
-
-    >>> block = \
-    ...: '''bla = 1
-    ...: hehe = 2
-    ...: x = X(1,
-    ...:       2,
-    ...:       3)
-    ...: '''
-    >>> _get_statement_from_block(block, 4)
-    'x = X(1,\n      2,\n      3)', 1)
-
     :param block: The code block to get the statements from.
     :param lineno_in_block: Line number which the statement must include. Counted from 1.
     :returns: A tuple of string with the found statements and and offset between the beginning of
diff --git a/padl/dumptools/serialize.py b/padl/dumptools/serialize.py
index 88d5bc3c..d4fdbd22 100644
--- a/padl/dumptools/serialize.py
+++ b/padl/dumptools/serialize.py
@@ -40,9 +40,9 @@ def __init__(self, val: Any, save_function: Callable, load_function: callable,
         if module is None:
             module = inspector.caller_module()
         self.scope = symfinder.Scope.toplevel(module)
-        self.load_codegraph = (
-            var2mod.CodeGraph.build(ScopedName(load_function.__name__, self.scope))
-        )
+        self.load_codegraph = \
+            var2mod.CodeGraph.build(ScopedName(load_function.__name__,
+                                               symfinder.Scope.toplevel(load_function.__module__)))
         self.load_name = load_function.__name__
         super().__init__()
 
@@ -75,12 +75,14 @@ def save(self, path: Path):
              ScopedName(self.varname, self.scope):
                  CodeNode(source=f'{self.varname} = {self.load_name}({complete_path})',
                           globals_={ScopedName(self.load_name, self.scope)},
-                          scope=self.scope),
+                          scope=self.scope,
+                          name=self.varname),
              ScopedName('pathlib', SCOPE):
                  CodeNode(source='import pathlib',
                           globals_=set(),
                           ast_node=ast.parse('import pathlib').body[0],
-                          scope=self.scope)}
+                          scope=self.scope,
+                          name='pathlib')}
         )
 
     @property
diff --git a/padl/dumptools/sourceget.py b/padl/dumptools/sourceget.py
index 9796a4d9..6cc8d90c 100644
--- a/padl/dumptools/sourceget.py
+++ b/padl/dumptools/sourceget.py
@@ -295,9 +295,8 @@ def _replace(string, repl, from_line, to_line, from_col, to_col):
         middle = lines[from_line][:from_col] + repl + lines[from_line][to_col:]
         start = end = ''
     else:
-        start = lines[from_line][from_col:] + repl
-        middle = ''.join(lines[from_line+1:to_line])
-        end = lines[to_line][:to_col]
+        start = lines[from_line][:from_col]
+        middle = repl
+        end = lines[to_line][to_col:]
     after = ''.join(lines[to_line+1:])
-
     return before + start + middle + end + after
diff --git a/padl/dumptools/symfinder.py b/padl/dumptools/symfinder.py
index 36eb5900..5e08b47d 100644
--- a/padl/dumptools/symfinder.py
+++ b/padl/dumptools/symfinder.py
@@ -26,7 +26,6 @@
 import sys
 from types import ModuleType
 from typing import List, Tuple
-from warnings import warn
 
 from padl.dumptools import ast_utils, sourceget
 
@@ -73,11 +72,9 @@ def visit_With(self, node):
 
     def visit_ClassDef(self, node):
         """Don't search class definitions (as that's another scope). """
-        pass
 
     def visit_FunctionDef(self, node):
         """Don't search function definitions (as that's another scope). """
-        pass
 
     def deparse(self) -> str:
         """Get the source snipped corresponding to the found node. """
@@ -342,7 +339,31 @@ def deparse(self):
             source = self._result._source
         except AttributeError:
             source = self.source
-        return f'{self.var_name} = {ast_utils.get_source_segment(source, self._result.value)}'
+        return ast_utils.get_source_segment(source, self._result)
+
+
+class _SetAttribute(ast.NodeVisitor):
+    """Class for setting an attribute on all nodes in an ast tree.
+
+    This is being used in :meth:`Scope.from_source` to tag nodes with the scope they were found in.
+
+    Example:
+
+    >>> tree = ast.parse('a = f(0)')
+    >>> _SetAttribute('myattribute', True).visit(tree)
+    >>> tree.body[0].targets[0].myattribute
+    True
+    >>> tree.body[0].value.myattribute
+    True
+    """
+
+    def __init__(self, attr, value):
+        self.attr = attr
+        self.value = value
+
+    def generic_visit(self, node):
+        setattr(node, self.attr, self.value)
+        super().generic_visit(node)
 
 
 class _CallFinder(_ThingFinder):
@@ -474,6 +495,8 @@ def __init__(self, module: ModuleType, def_source: str,
     @classmethod
     def toplevel(cls, module):
         """Create a top-level scope (i.e. module level, no nesting). """
+        if isinstance(module, str):
+            module = sys.modules[module]
         return cls(module, '', [])
 
     @classmethod
@@ -498,6 +521,9 @@ def from_source(cls, def_source, lineno, call_source, module=None, drop_n=0,
         if drop_n > 0:
             function_defs = function_defs[:-drop_n]
 
+        if not function_defs:
+            return cls.toplevel(module)
+
         # get call assignments for inner function
         # def f(a, b, c=3):
         #    ...
@@ -516,7 +542,7 @@ def from_source(cls, def_source, lineno, call_source, module=None, drop_n=0,
             src = f'{k} = {v}'
             assignment = ast.parse(src).body[0]
             assignment._source = src
-            # assignment._scope = calling_scope
+            _SetAttribute('_scope', calling_scope).visit(assignment.value)
             call_assignments.append(assignment)
 
         scopelist = []
@@ -606,13 +632,15 @@ def f(x):
     def __hash__(self):
         return hash((self.name, self.scope, self.n))
 
+    def __eq__(self, other):
+        return (self.name, self.scope, self.n) == (other.name, other.scope, other.n)
+
 
 def find_in_scope(name: ScopedName):
     """Find the piece of code that assigned a value to the variable with name *var_name* in the
     scope *scope*.
 
-    :param var_name: Name of the variable to look for.
-    :param scope: Scope to search.
+    :param scope: Name (with scope) of the variable to look for.
     """
     scope = name.scope
     i = name.n
@@ -623,22 +651,22 @@ def find_in_scope(name: ScopedName):
             if isinstance(res, int):
                 i = res
                 continue
-            source, node = res
+            source, node, name = res
             if getattr(node, '_globalscope', False):
                 scope = Scope.empty()
 
-            return (source, node), scope
+            return (source, node), scope, name
         except NameNotFound:
             scope = scope.up()
             continue
     if scope.module is None:
         raise NameNotFound(f'{name.name} not found in function hierarchy.')
-    source, node = find(name.name, scope.module, i)
+    source, node, name = find(name.name, scope.module, i)
     if getattr(node, '_globalscope', False):
         scope = Scope.empty()
     else:
         scope = getattr(node, '_scope', scope.global_())
-    return (source, node), scope
+    return (source, node), scope, name
 
 
 def replace_star_imports(tree: ast.Module):
@@ -681,8 +709,10 @@ def find_in_source(var_name: str, source: str, tree=None, i: int = 0,
             finder.visit(statement)
             if finder.found_something():
                 if i == 0:
-                    return finder.deparse(), finder.node()
+                    return finder.deparse(), finder.node(), var_name
                 i -= 1
+    if '.' in var_name:
+        return find_in_source(var_name.rsplit('.', 1)[0], source, tree, i, return_partial)
     if return_partial:
         return i
     raise NameNotFound(f'{var_name} not found.')
@@ -742,13 +772,13 @@ def find_in_ipython(var_name: str, i: int = 0) -> Tuple[str, ast.AST]:
             if isinstance(res, int):
                 i = res
                 continue
-            source, node = res
+            source, node, name = res
         except (NameNotFound, SyntaxError):
             continue
         break
     if source is None:
         raise NameNotFound(f'"{var_name}" not found.')
-    return source, node
+    return source, node, name
 
 
 def find(var_name: str, module=None, i: int = 0) -> Tuple[str, ast.AST]:
@@ -796,4 +826,4 @@ def split_call(call_source):
                          last_arg_position.end_lineno - 1,
                          func_position.end_col_offset + 1,
                          last_arg_position.end_col_offset)
-    return call, args
+    return call, ', '.join(x.strip() for x in args.split(','))
diff --git a/padl/dumptools/var2mod.py b/padl/dumptools/var2mod.py
index 8ff9d445..3325c3aa 100644
--- a/padl/dumptools/var2mod.py
+++ b/padl/dumptools/var2mod.py
@@ -48,7 +48,7 @@ def get_source_segments(self, source):
         Example:
 
         >>> Finder(ast.Name).get_source_segments('x(y)')
-        [('x', (1, 1, 0, 1)), ('y', (1, 1, 2, 3))]
+        [('x', Position(lineno=1, end_lineno=1, col_offset=0, end_col_offset=1)), ('y', Position(lineno=1, end_lineno=1, col_offset=2, end_col_offset=3))]
         """
         nodes = self.find(ast.parse(source))
         return [
@@ -60,6 +60,15 @@ def get_source_segments(self, source):
         ]
 
 
+def _join_attr(node):
+    if not isinstance(node, (ast.Attribute, ast.Name)):
+        raise TypeError()
+    try:
+        return [node.id]
+    except AttributeError:
+        return _join_attr(node.value) + [node.attr]
+
+
 Vars = namedtuple('Vars', 'globals locals')
 
 
@@ -77,9 +86,13 @@ class _VarFinder(ast.NodeVisitor):
     ...     z = np.array(x + b)
     ...     return str(z)
     ... '''
-    >>> _VarFinder().find_in_source(source) == Vars(globals={('str', 0), ('np', 0), ('a', 0),
-    ...                                                      ('b', 0)},
-    ...                                             locals={('x', 0), ('z', 0), ('y', 0)})
+    >>> _VarFinder().find_in_source(source) == Vars(globals={ScopedName('str', None, 0),
+    ...                                                      ScopedName('np.array', None, 0),
+    ...                                                      ScopedName('a', None, 0),
+    ...                                                      ScopedName('b', None, 0)},
+    ...                                             locals={ScopedName('x', None, 0),
+    ...                                                     ScopedName('z', None, 0),
+    ...                                                     ScopedName('y', None, 0)})
     True
     """
 
@@ -118,18 +131,22 @@ def _find_in_function_def(self, node):
         ...     z = np.array(x + b)
         ...     return str(z)
         ... '''
-        >>> _VarFinder().find_in_source(source) == Vars(globals={('str', 0), ('np', 0), ('a', 0),
-        ...                                                      ('b', 0)},
-        ...                                             locals={('x', 0), ('z', 0), ('y', 0)})
+        >>> _VarFinder().find_in_source(source) == Vars(globals={ScopedName('str', None, 0),
+        ...                                                      ScopedName('np.array', None, 0),
+        ...                                                      ScopedName('a', None, 0),
+        ...                                                      ScopedName('b', None, 0)},
+        ...                                             locals={ScopedName('x', None, 0),
+        ...                                                     ScopedName('z', None, 0),
+        ...                                                     ScopedName('y', None, 0)})
         True
         """
         posonlyargs = getattr(node.args, 'posonlyargs', [])
         for arg in node.args.args + posonlyargs + node.args.kwonlyargs:
-            self.locals.add((arg.arg, 0))
+            self.locals.add(ScopedName(arg.arg, None, 0))
         if node.args.vararg is not None:
-            self.locals.add((node.args.vararg.arg, 0))
+            self.locals.add(ScopedName(node.args.vararg.arg, None, 0))
         if node.args.kwarg is not None:
-            self.locals.add((node.args.kwarg.arg, 0))
+            self.locals.add(ScopedName(node.args.kwarg.arg, None, 0))
         for n in ast.iter_child_nodes(node):
             self.visit(n)
         return Vars(self.globals, self.locals)
@@ -140,10 +157,45 @@ def visit_Name(self, node):
         Example:
 
         >>> _VarFinder().find_in_source('x')
-        Vars(globals={('x', 0)}, locals=set())
+        Vars(globals={ScopedName(name='x', scope=None, n=0)}, locals=set())
         """
-        if (node.id, 0) not in self.locals:
-            self.globals.add((node.id, 0))
+        scope = getattr(node, '_scope', None)
+        name = ScopedName(node.id, scope, 0)
+        if not self.in_locals(name):
+            self.globals.add(name)
+
+    def visit_Attribute(self, node):
+        """Names - Every `Name`'s id is a global unless it's a local.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('x')
+        Vars(globals={ScopedName(name='x', scope=None, n=0)}, locals=set())
+        """
+        try:
+            path = _join_attr(node)
+        except TypeError:
+            self.generic_visit(node)
+            return
+
+        scope = getattr(node, '_scope', None)
+        name = ScopedName('.'.join(path), scope, 0)
+        if self.in_locals(name):
+            return
+        self.globals.add(name)
+
+    def in_locals(self, name):
+        if name in self.locals:
+            return True
+        if '.' not in name.name:
+            return False
+
+        path = name.name.split('.')
+        for i in range(len(path), 0, -1):
+            subname = '.'.join(path[:i])
+            if ScopedName(subname, name.scope, 0) in self.locals:
+                return True
+        return False
 
     def visit_withitem(self, node):
         """With statements - The "as ..." of a with statement is a local.
@@ -155,11 +207,11 @@ def visit_withitem(self, node):
         ...     ...
         ... '''
         >>> _VarFinder().find_in_source(source)
-        Vars(globals={('open', 0)}, locals={('f', 0)})
+        Vars(globals={ScopedName(name='open', scope=None, n=0)}, locals={ScopedName(name='f', scope=None, n=0)})
         """
         self.visit(node.context_expr)
         if node.optional_vars is not None:
-            self.locals.add((node.optional_vars.id, 0))
+            self.locals.add(ScopedName(node.optional_vars.id, None, 0))
 
     def visit_Assign(self, node):
         """Assignments - Their targets are locals, their values are globals.
@@ -167,7 +219,7 @@ def visit_Assign(self, node):
         Example:
 
         >>> _VarFinder().find_in_source('x = y')
-        Vars(globals={('y', 0)}, locals={('x', 0)})
+        Vars(globals={ScopedName(name='y', scope=None, n=0)}, locals={ScopedName(name='x', scope=None, n=0)})
         """
         # collect targets (the 'x' in 'x = a', can be multiple due to 'x = y = a')
         targets = set()
@@ -178,20 +230,23 @@ def visit_Assign(self, node):
             # exclude assignment to attribute ('x.y = a')
             if isinstance(target, ast.Attribute):
                 continue
+            scope = getattr(target, '_scope', None)
             targets.update(
-                {(x.id, 0) for x in Finder(ast.Name).find(target)}
+                {ScopedName(x.id, scope, 0) for x in Finder(ast.Name).find(target)}
             )
         # find globals in RHS
-        sub_globals = find_globals(node.value) - self.locals
+        sub_globals = {name for name in find_globals(node.value) if not self.in_locals(name)}
         sub_dependencies = set()
         # if a variable on the RHS is one of the targets, increase its counter
-        for name, i in sub_globals:
-            if (name, i) in targets:
-                sub_dependencies.add((name, i + 1))
+        for name in sub_globals:
+            if self.in_locals(name):
+                continue
+            if name in targets:
+                sub_dependencies.add(ScopedName(name.name, name.scope, name.n + 1))
             else:
-                sub_dependencies.add((name, i))
+                sub_dependencies.add(name)
         self.locals.update(targets)
-        self.globals.update(sub_dependencies - self.locals)
+        self.globals.update(sub_dependencies)
 
     def visit_For(self, node):
         """For loops - Looped over items are locals.
@@ -203,9 +258,10 @@ def visit_For(self, node):
         ...     ...
         ... '''
         >>> _VarFinder().find_in_source(source)
-        Vars(globals={('range', 0)}, locals={('x', 0)})
+        Vars(globals={ScopedName(name='range', scope=None, n=0)}, locals={ScopedName(name='x', scope=None, n=0)})
         """
-        self.locals.update([(x.id, 0) for x in Finder(ast.Name).find(node.target)])
+        self.locals.update([ScopedName(x.id, getattr(x, '_scope', None), 0)
+                            for x in Finder(ast.Name).find(node.target)])
         for child in node.body:
             self.visit(child)
         self.visit(node.iter)
@@ -220,9 +276,10 @@ def visit_NamedExpr(self, node):
         ...     ...
         ... '''
         >>> _VarFinder().find_in_source(source)
-        Vars(globals={('l', 0)}, locals={('a', 0)})
+        Vars(globals={ScopedName(name='l.pop', scope=None, n=0)}, locals={ScopedName(name='a', scope=None, n=0)})
         """
-        self.locals.update([(x.id, 0) for x in Finder(ast.Name).find(node.target)])
+        self.locals.update([ScopedName(x.id, getattr(x, '_scope', None), 0)
+                            for x in Finder(ast.Name).find(node.target)])
         self.visit(node.value)
 
     def visit_comprehension(self, node):
@@ -230,8 +287,9 @@ def visit_comprehension(self, node):
         targets = set()
         for gen in node.generators:
             for name in Finder(ast.Name).find(gen.target):
-                targets.add((name.id, 0))
-        all_ = set((x.id, 0) for x in Finder(ast.Name).find(node))
+                targets.add(ScopedName(name.id, getattr(name, '_scope', None), 0))
+        all_ = set(ScopedName(x.id, getattr(x, '_scope', None), 0)
+                   for x in Finder(ast.Name).find(node))
         self.globals.update(all_ - targets - self.locals)
 
     def visit_DictComp(self, node):
@@ -240,7 +298,7 @@ def visit_DictComp(self, node):
         Example:
 
         >>> _VarFinder().find_in_source('{k: v for k, v in foo}')
-        Vars(globals={('foo', 0)}, locals=set())
+        Vars(globals={ScopedName(name='foo', scope=None, n=0)}, locals=set())
         """
         self.visit_comprehension(node)
 
@@ -250,7 +308,7 @@ def visit_ListComp(self, node):
         Example:
 
         >>> _VarFinder().find_in_source('[x for x in foo]')
-        Vars(globals={('foo', 0)}, locals=set())
+        Vars(globals={ScopedName(name='foo', scope=None, n=0)}, locals=set())
         """
         self.visit_comprehension(node)
 
@@ -260,7 +318,7 @@ def visit_SetComp(self, node):
         Example:
 
         >>> _VarFinder().find_in_source('{x for x in foo}')
-        Vars(globals={('foo', 0)}, locals=set())
+        Vars(globals={ScopedName(name='foo', scope=None, n=0)}, locals=set())
         """
         self.visit_comprehension(node)
 
@@ -270,7 +328,7 @@ def visit_GeneratorExp(self, node):
         Example:
 
         >>> _VarFinder().find_in_source('(x for x in foo)')
-        Vars(globals={('foo', 0)}, locals=set())
+        Vars(globals={ScopedName(name='foo', scope=None, n=0)}, locals=set())
         """
         self.visit_comprehension(node)
 
@@ -280,23 +338,27 @@ def visit_Lambda(self, node):
         Example:
 
         >>> vars = _VarFinder().find_in_source('lambda x, y: x + y + foo')
-        >>> vars == Vars(globals={('foo', 0)}, locals={('x', 0), ('y', 0)})
+        >>> vars == Vars(globals={ScopedName('foo', None, 0)}, locals={ScopedName('x', None, 0),
+        ...                                                            ScopedName('y', None, 0)})
         True
         """
+        scope = getattr(node, '_scope', None)
         posonlyargs = getattr(node.args, 'posonlyargs', [])
         for arg in node.args.args + posonlyargs + node.args.kwonlyargs:
-            self.locals.add((arg.arg, 0))
+            self.locals.add(ScopedName(arg.arg, scope, 0))
         self.visit(node.body)
 
     def visit_FunctionDef(self, node):
         """Function definitions. """
-        self.locals.add((node.name, 0))
+        scope = getattr(node, '_scope', None)
+        self.locals.add(ScopedName(node.name, scope, 0))
         inner_globals = find_globals(node)
         self.globals.update(inner_globals - self.locals)
 
     def visit_ClassDef(self, node):
         """Class definitions. """
-        self.locals.add((node.name, 0))
+        scope = getattr(node, '_scope', None)
+        self.locals.add(ScopedName(node.name, scope, 0))
         inner_globals = find_globals(node)
         self.globals.update(inner_globals - self.locals)
 
@@ -306,15 +368,16 @@ def visit_Import(self, node):
         Example:
 
         >>> _VarFinder().find_in_source('import foo')
-        Vars(globals=set(), locals={('foo', 0)})
+        Vars(globals=set(), locals={ScopedName(name='foo', scope=None, n=0)})
         >>> _VarFinder().find_in_source('import foo as bar')
-        Vars(globals=set(), locals={('bar', 0)})
+        Vars(globals=set(), locals={ScopedName(name='bar', scope=None, n=0)})
         """
+        scope = getattr(node, '_scope', None)
         for name in node.names:
             if name.asname is None:
-                self.locals.add((name.name, 0))
+                self.locals.add(ScopedName(name.name, scope, 0))
             else:
-                self.locals.add((name.asname, 0))
+                self.locals.add(ScopedName(name.asname, scope, 0))
 
     def visit_ImportFrom(self, node):
         """Import-from statements.
@@ -322,15 +385,16 @@ def visit_ImportFrom(self, node):
         Example:
 
         >>> _VarFinder().find_in_source('from foo import bar')
-        Vars(globals=set(), locals={('bar', 0)})
+        Vars(globals=set(), locals={ScopedName(name='bar', scope=None, n=0)})
         >>> _VarFinder().find_in_source('from foo import bar as baz')
-        Vars(globals=set(), locals={('baz', 0)})
+        Vars(globals=set(), locals={ScopedName(name='baz', scope=None, n=0)})
         """
+        scope = getattr(node, '_scope', None)
         for name in node.names:
             if name.asname is None:
-                self.locals.add((name.name, 0))
+                self.locals.add(ScopedName(name.name, scope, 0))
             else:
-                self.locals.add((name.asname, 0))
+                self.locals.add(ScopedName(name.asname, scope, 0))
 
 
 class _Renamer(ast.NodeTransformer):
@@ -394,7 +458,7 @@ def visit_FunctionDef(self, node):
             name = node.name
         if not self.rename_locals:
             globals_ = find_globals(node)
-            if self.from_ not in {x[0] for x in globals_}:
+            if self.from_ not in {x.name for x in globals_}:
                 return node
         return ast.FunctionDef(**{**node.__dict__,
                                   'args': rename(node.args, self.from_, self.to,
@@ -422,7 +486,7 @@ def visit_ClassDef(self, node):
             name = node.name
         if not self.rename_locals:
             globals_ = find_globals(node)
-            if self.from_ not in {x[0] for x in globals_}:
+            if self.from_ not in {x.name for x in globals_}:
                 return node
         return ast.ClassDef(**{**node.__dict__,
                                'body': rename(node.body, self.from_, self.to,
@@ -440,7 +504,7 @@ def rename(tree: ast.AST, from_: str, to: str, rename_locals: bool = False):
     """
     if not rename_locals:
         globals_ = find_globals(tree)
-        if from_ not in {x[0] for x in globals_}:
+        if from_ not in {x.name for x in globals_}:
             return tree
     if isinstance(tree, Iterable) and not isinstance(tree, str):
         return [rename(x, from_, to, rename_locals) for x in tree]
@@ -480,7 +544,10 @@ def find(self, node: ast.ClassDef) -> Dict['str', ast.FunctionDef]:
         return self.methods
 
 
-def _find_globals_in_classdef(node: ast.ClassDef, filter_builtins=True):
+def _filter_builtins(names):
+    return {name for name in names if name.name not in builtins.__dict__}
+
+def _find_globals_in_classdef(node: ast.ClassDef, filter_builtins: bool = True):
     """Find globals used below a ClassDef node. """
     methods = _MethodFinder().find(node)
     # globals used in class body
@@ -491,7 +558,7 @@ def _find_globals_in_classdef(node: ast.ClassDef, filter_builtins=True):
     for method in methods.values():
         globals_.update(_VarFinder().find(method).globals)
     if filter_builtins:
-        globals_ = {(x, i) for x, i in globals_ if x not in builtins.__dict__}
+        globals_ = _filter_builtins(globals_)
     return globals_
 
 
@@ -507,52 +574,71 @@ def find_globals(node: ast.AST, filter_builtins: bool = True) -> Set[Tuple[str,
     ...     return str(z)
     ... '''
     >>> node = ast.parse(source).body[0]
-    >>> find_globals(node) == {('a', 0), ('b', 0), ('np', 0)}
+    >>> find_globals(node) == {ScopedName('a', None, 0), ScopedName('b', None, 0),
+    ...                        ScopedName('np.array', None, 0)}
     True
 
     :param node: AST node to search in.
-    :param filter_builtins:
+    :param filter_builtins: If *True*, filter out builtins.
     """
     if isinstance(node, ast.ClassDef):
         return _find_globals_in_classdef(node)
     globals_ = _VarFinder().find(node).globals
     if filter_builtins:
-        globals_ = {(x, i) for x, i in globals_ if x not in builtins.__dict__}
+        globals_ = _filter_builtins(globals_)
     return globals_
 
 
-def increment_same_name_var(variables: List[Tuple[str, int]], scoped_name: ScopedName):
+def increment_same_name_var(variables: List[ScopedName], scoped_name: ScopedName):
     """Go through *variables* and increment the the counter for those with the same name as
     *scoped_name* by *scoped_name.n*.
 
     Example:
 
     >>> import padl as somemodule
-    >>> out = increment_same_name_var({('a', 1), ('b', 2)}, ScopedName('b', somemodule, 2))
+    >>> out = increment_same_name_var({ScopedName('a', None, 1), ScopedName('b', None, 2)},
+    ...                               ScopedName('b', somemodule, 2))
     >>> isinstance(out, set)
     True
     >>> {(x.name, x.n) for x in out} == {('a', 1), ('b', 4)}
     True
     """
     result = set()
-    for var, n in variables:
-        if var == scoped_name.name:
-            result.add(ScopedName(var, scoped_name.scope, n + scoped_name.n))
+    for var in variables:
+        if var.scope is None:
+            scope = scoped_name.scope
         else:
-            result.add(ScopedName(var, scoped_name.scope, n))
+            scope = var.scope
+
+        if var.name == scoped_name.name:
+            result.add(ScopedName(var.name, scope, var.n + scoped_name.n))
+        else:
+            result.add(ScopedName(var.name, scope, var.n))
     return result
 
 
-def find_codenode(name: ScopedName):
+def find_codenode(name: ScopedName, full_dump_module_names=None):
     """Find the :class:`CodeNode` corresponding to a :class:`ScopedName` *name*. """
-    (source, node), scope_of_next_var = find_in_scope(name)
+    (source, node), scope_of_next_var, found_name = find_in_scope(name)
+
+    module_name = None
+    if full_dump_module_names:
+        if isinstance(node, ast.Import):
+            module_name = node.names[0].name
+        if isinstance(node, ast.ImportFrom):
+            module_name = node.module
+    if module_name is not None:
+        if any(module_name.startswith(mod) for mod in full_dump_module_names):
+            return find_codenode(ScopedName(name.name, Scope.toplevel(module_name), name.n),
+                                 full_dump_module_names)
 
     # find dependencies
     globals_ = find_globals(node)
     next_name = ScopedName(name.name, scope_of_next_var, name.n)
     globals_ = increment_same_name_var(globals_, next_name)
 
-    return CodeNode(source=source, globals_=globals_, ast_node=node, scope=scope_of_next_var)
+    return CodeNode(source=source, globals_=globals_, ast_node=node, scope=scope_of_next_var,
+                    name=found_name, n=name.n)
 
 
 def _get_nodes_without_in_edges(graph):
@@ -619,22 +705,6 @@ def _topsort(graph: dict) -> List[set]:
     return levels
 
 
-def _sort(unscoped_graph):
-    top = _topsort({k: v.globals_ for k, v in unscoped_graph.items()})
-
-    def sortkey(x):
-        val = unscoped_graph[x]
-        try:
-            return _PRECEDENCE[val.ast_node.__class__](x[0], val)
-        except KeyError:
-            return 'zz' + x[0].lower()
-
-    res = []
-    for level in top:
-        res += sorted(level, key=sortkey)
-    return res
-
-
 @dataclass
 class CodeNode:
     """A node in a :class:`CodeGraph`.
@@ -648,33 +718,65 @@ class CodeNode:
     """
     source: str
     globals_: set
+    name: str
     scope: Optional[Scope] = None
     ast_node: Optional[ast.AST] = None
+    n: int = 0
 
     @classmethod
-    def from_source(cls, source, scope):
+    def from_source(cls, source, scope, name):
         """Build a `CodeNode` from a source string. """
         node = ast.parse(source).body[0]
         globals_ = {
-            ScopedName(var, scope, n)
-            for var, n in find_globals(node)
+            ScopedName(name.name, scope, name.n)
+            for name in find_globals(node)
         }
 
         return cls(
             source=source,
             ast_node=node,
             globals_=globals_,
-            scope=scope
+            scope=scope,
+            name=name
         )
 
+    def __hash__(self):
+        return hash((self.name, self.scope, self.n))
+
+    def __eq__(self, other):
+        return (
+            (self.name, self.scope, self.n)
+            == (other.name, other.scope, other.n)
+        )
+
+
+def _sort(unscoped_graph):
+    top = _topsort({k: v.globals_ for k, v in unscoped_graph.items()})
+
+    def sortkey(x):
+        val = unscoped_graph[x]
+        try:
+            return _PRECEDENCE[val.ast_node.__class__](x[0], val)
+        except KeyError:
+            return 'zz' + x[0].lower()
+
+    res = []
+    for level in top:
+        res += sorted(level, key=sortkey)
+    return res
+
 
 def _dumps_unscoped(unscoped_graph):
     """Dump an unscoped (see :meth:`CodeGraph.unscope`) :class:`CodeGraph` to a python source
     string. """
     sorted_ = _sort(unscoped_graph)
     res = ''
+    done = set()
     for i, name in enumerate(sorted_):
         here = unscoped_graph[name]
+        if here in done:
+            continue
+        done.add(here)
         res += here.source
         if i < len(sorted_) - 1:
             next_ = unscoped_graph[sorted_[i + 1]]
@@ -733,6 +835,7 @@ def unscope(name, scope):
         for k, v in self.items():
             changed = False
             k_unscoped = unscope(k.name, k.scope)
+            v_unscoped = unscope(v.name, k.scope)
             changed = changed or k_unscoped != k.name
             code = v.source
             tree = ast.parse(code)
@@ -745,7 +848,8 @@ def unscope(name, scope):
                 vars_.add((var_unscoped, var.n))
             if changed:
                 code = unparse(tree).strip('\n')
-            res[k_unscoped, k.n] = CodeNode(code, vars_, ast_node=v.ast_node)
+            res[k_unscoped, k.n] = CodeNode(code, vars_, ast_node=v.ast_node, name=v_unscoped,
+                                            n=v.n)
         return res
 
     def dumps(self):
diff --git a/padl/transforms.py b/padl/transforms.py
index 5a867c1d..1eda3202 100644
--- a/padl/transforms.py
+++ b/padl/transforms.py
@@ -2,6 +2,7 @@
 
 Transforms should be created using the `padl.transform` wrap-function.
 """
+import ast
 import re
 from copy import copy
 from collections import Counter, namedtuple, OrderedDict
@@ -169,11 +170,13 @@ def _pd_full_dump(self) -> bool:
             return True
         # fully dump all Transforms from packages or modules specified in
         # _pd_external_full_dump_modules
-        if any(module.__spec__.name.startswith(mod)
-               for mod in self._pd_external_full_dump_modules):
+        if self._pd_is_full_dump_module(module.__spec__.name):
             return True
         return self._pd_external_full_dump
 
+    def _pd_is_full_dump_module(self, module_name):
+        return any(module_name.startswith(mod) for mod in self._pd_external_full_dump_modules)
+
     @staticmethod
     def _pd_merge_components(components):
         """Merge components recusively such that lists consisting of all the same integers are
@@ -398,7 +401,7 @@ def _pd_codegraph_add_startnodes(self, graph, name: Union[str, None]) -> Set:
         nodes = []
 
         start_source = f'{name or "_pd_dummy"} = {self._pd_evaluable_repr()}'
-        start = CodeNode.from_source(start_source, scope)
+        start = CodeNode.from_source(start_source, scope, name=name or "_pd_dummy")
         nodes.append(start)
 
         # if name is given, add the node to the CodeGraph, otherwise only use the dependencies
@@ -508,7 +511,8 @@ def f(x):
                 continue
 
             # find how *next_name* came into being
-            next_codenode = find_codenode(next_name)
+            next_codenode = find_codenode(next_name, self._pd_external_full_dump_modules)
+
             graph[next_name] = next_codenode
 
             todo.update(next_codenode.globals_)
@@ -1100,21 +1104,21 @@ def _pd_evaluable_repr_inner(self, indent: int = 0) -> str:
         return self._pd_call
 
     def _pd_codegraph_add_startnodes(self, graph, name):
-        if self._pd_full_dump or self._wrap_type in ('module', 'lambda'):
+        if self._pd_full_dump or self._wrap_type in ('module', 'lambda') or (not self._wrap_type == 'inline' and self._pd_call_info.scope.scopelist):
             return super()._pd_codegraph_add_startnodes(graph, name)
         module = inspector.caller_module()
         scope = symfinder.Scope.toplevel(module)
         source = f'from {self.__module__} import {self.__name__}'
 
         if self._wrap_type == 'inline':
-            node = CodeNode.from_source(source, scope)
+            node = CodeNode.from_source(source, scope, name=self.__name__)
             graph[ScopedName(self.__name__, scope, 0)] = node
             emptyscope = symfinder.Scope.empty()
             graph[ScopedName('transform', emptyscope, 0)] = \
-                CodeNode.from_source('from padl import transform', emptyscope)
+                CodeNode.from_source('from padl import transform', emptyscope, name='transform')
 
             start_source = f'{name or "_pd_dummy"} = transform({self.__name__})'
-            start = CodeNode.from_source(start_source, scope)
+            start = CodeNode.from_source(start_source, scope, name=name or "_pd_dummy")
             if name is not None:
                 graph[ScopedName(name, scope, 0)] = start
             return {}
@@ -1123,7 +1127,7 @@ def _pd_codegraph_add_startnodes(self, graph, name):
             source += f' as {name}'
         else:
             name = self.__name__
-        node = CodeNode.from_source(source, scope)
+        node = CodeNode.from_source(source, scope, name=name)
         graph[ScopedName(name, scope, 0)] = node
         return {}
 
@@ -1230,13 +1234,13 @@ def _pd_codegraph_add_startnodes_import_var(self, graph, name):
         varname = self.pd_varname(instance_scope)
 
         import_source = f'from {self.__module__} import {varname}'
-        import_node = CodeNode.from_source(import_source, instance_scope)
+        import_node = CodeNode.from_source(import_source, instance_scope, name=varname)
 
         graph[ScopedName(varname, instance_scope, 0)] = import_node
 
         if name != varname:
             start_source = f'{name or "_pd_dummy"} = {varname}'
-            start_node = CodeNode.from_source(start_source, instance_scope)
+            start_node = CodeNode.from_source(start_source, instance_scope, name=name or "_pd_dummy")
             if name is not None:
                 graph[ScopedName(name, instance_scope, 0)] = start_node
 
@@ -1255,7 +1259,8 @@ def _pd_codegraph_add_startnodes_import(self, graph, name):
 
         # import the class
         import_source = f'from {self.__class__.__module__} import {self.__class__.__name__}'
-        import_node = CodeNode.from_source(import_source, instance_scope)
+        import_node = CodeNode.from_source(import_source, instance_scope,
+                                           name=self.__class__.__name__)
         graph[ScopedName(self.__class__.__name__, instance_scope, 0)] = import_node
         nodes = [import_node]
 
@@ -1263,7 +1268,7 @@ def _pd_codegraph_add_startnodes_import(self, graph, name):
         call = self.__class__.__name__ + f'({self._split_call()[1]})'
         call_scope = symfinder.Scope.toplevel(inspector.caller_module())
         start_source = f'{name or "_pd_dummy"} = {call}'
-        start_node = CodeNode.from_source(start_source, call_scope)
+        start_node = CodeNode.from_source(start_source, instance_scope, name=name or "_pd_dummy")
         if name is not None:
             graph[ScopedName(name, call_scope, 0)] = start_node
         nodes.append(start_node)
@@ -1281,7 +1286,7 @@ def _pd_codegraph_add_startnodes_full(self, graph, name):
 
         call = self.__class__.__name__ + f'({self._split_call()[1]})'
         start_source = f'{name or "_pd_dummy"} = {call}'
-        start_node = CodeNode.from_source(start_source, call_scope)
+        start_node = CodeNode.from_source(start_source, call_scope, name=name or '_pd_dummy')
         if name is not None:
             graph[ScopedName(name, call_scope, 0)] = start_node
 
@@ -1299,7 +1304,7 @@ def _pd_codegraph_add_startnodes(self, graph, name):
     @property
     def source(self) -> str:
         """The class source code. """
-        (body_msg, _), _ = symfinder.find_in_scope(ScopedName(self.__class__.__name__,
+        (body_msg, _), _, _ = symfinder.find_in_scope(ScopedName(self.__class__.__name__,
                                                               self._pd_call_info.scope))
         try:
             return 'class ' + body_msg.split('class ', 1)[1]
@@ -1380,7 +1385,7 @@ def post_load(self, path, i):
         path = Path(path)
         checkpoint_path = path / f'{i}.pt'
         print('loading torch module from', checkpoint_path)
-        self.load_state_dict(torch.load(checkpoint_path))
+        self.load_state_dict(torch.load(checkpoint_path, map_location='cpu'))
 
     def _pd_longrepr(self, marker=None) -> str:
         out = torch.nn.Module.__repr__(self)
@@ -1567,6 +1572,7 @@ def _defined_somewhere_else(self):
         defined_as = self.pd_varname(self._pd_call_info.scope)
         return (
             self._pd_call_info.scope.module_name != inspector.caller_module().__name__
+            and not self._pd_call_info.scope.scopelist
             and defined_as is not None
         )
 
@@ -1579,7 +1585,7 @@ def _codegraph_add_import_startnode(self, graph, name):
             source += f' as {name}'
         else:
             name = defined_as
-        node = CodeNode.from_source(source, scope)
+        node = CodeNode.from_source(source, scope, name=name)
         graph[ScopedName(name, scope, 0)] = node
 
     def _pd_build_codegraph(self, graph=None, name=None):
@@ -1601,8 +1607,9 @@ def _pd_build_codegraph(self, graph=None, name=None):
 
         if self._pd_group and 'padl' not in graph:
             emptyscope = symfinder.Scope.empty()
-            graph[ScopedName('padl', emptyscope, 0)] = CodeNode.from_source('import padl',
-                                                                            emptyscope)
+            graph[ScopedName('padl.group', emptyscope, 0)] = CodeNode.from_source('import padl',
+                                                                                  emptyscope,
+                                                                                  name='padl')
 
         # iterate over sub-transforms and update the codegraph with their codegraphs
         for transform in self.transforms:
@@ -2495,9 +2502,9 @@ class _ItemGetter:
     >>> len(ig)
     3
     >>> ig[0]
-    2
+    (0, 2)
     >>> ig[1]
-    3
+    (1, 3)
 
     :param samples: An object implementing __getitem__ and __len__.
     :param transform: Preprocessing transform.
@@ -2505,10 +2512,13 @@ class _ItemGetter:
         :class:`Transform` whose preprocessing part is *transform*.
     """
 
-    def __init__(self, samples, transform, entire_transform):
+    def __init__(self, samples, transform, entire_transform=None):
         self.samples = samples
         self.transform = transform
-        self.entire_transform = entire_transform
+        if entire_transform is None:
+            self.entire_transform = self.transform
+        else:
+            self.entire_transform = entire_transform
 
     def __getitem__(self, item):
         try:
diff --git a/padl/wrap.py b/padl/wrap.py
index dfdc27d5..be80acfd 100644
--- a/padl/wrap.py
+++ b/padl/wrap.py
@@ -19,7 +19,6 @@
 
 import re
 
-
 def _set_local_varname(frame, event, _args, scope):
     if event == 'return':
         for k, v in frame.f_locals.items():
@@ -38,7 +37,7 @@ def _wrap_function(fun, ignore_scope=False, call_info: inspector.CallInfo = None
     """
     caller = inspect.stack()[2]
 
-    if '@' in caller.code_context[0]:
+    if '@' in caller.code_context[0] or caller.code_context[0].startswith('def'):
         call = None
         wrap_type = 'decorator'
     else:
@@ -46,7 +45,7 @@ def _wrap_function(fun, ignore_scope=False, call_info: inspector.CallInfo = None
             # case transform(f)
             call = inspector.get_segment_from_frame(caller.frame, 'call')
             wrap_type = 'inline'
-        except RuntimeError:
+        except (RuntimeError, IndexError):
             # case transform(some_module).f
             try:
                 call = inspector.get_segment_from_frame(caller.frame, 'attribute')
diff --git a/ttt.py b/ttt.py
new file mode 100644
index 00000000..cbc8980c
--- /dev/null
+++ b/ttt.py
@@ -0,0 +1,11 @@
+import numpy
+from padl import transform
+
+
+@transform
+def rescale_image_tensor(x):
+    return (255 * (x * 0.5 + 0.5)).numpy().astype(numpy.uint8)
+
+
+_pd_main = rescale_image_tensor
+


Test patch:
diff --git a/tests/material/dumps/dotimport.txt b/tests/material/dumps/dotimport.txt
new file mode 100644
index 00000000..cac56e48
--- /dev/null
+++ b/tests/material/dumps/dotimport.txt
@@ -0,0 +1,10 @@
+import padl.dumptools.var2mod
+from padl import transform
+
+
+@transform
+def f_using_dotimport(x):
+    return padl.dumptools.var2mod.ast.parse(x)
+
+
+_pd_main = f_using_dotimport
diff --git a/tests/material/dumps/othermodule_full_makeclasstransform_with_transforms.txt b/tests/material/dumps/othermodule_full_makeclasstransform_with_transforms.txt
new file mode 100644
index 00000000..467f0fce
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_makeclasstransform_with_transforms.txt
@@ -0,0 +1,38 @@
+from padl import transform
+
+
+B = 2
+C = 3
+tests_material_transforms_in_module_CONST = 123
+tests_unittests_test_dump_test_full_makeclasstransform_with_constants_CONST = 1
+
+
+def k(y):
+    return y
+
+
+a = tests_unittests_test_dump_test_full_makeclasstransform_with_constants_CONST
+b = B
+c = C
+
+
+@transform
+def y(y):
+    return (tests_material_transforms_in_module_CONST + k(y))
+
+
+@transform
+class MyClassTransform:
+    def __init__(self, a, b, c):
+        self.a = a
+        self.b = b
+        self.c = c
+
+    def calculate(self, input_):
+        return self.a * self.b + input_
+
+    def __call__(self, input_):
+        return self.calculate(input_) + y(input_) + self.c(input_)
+
+
+_pd_main = MyClassTransform(a, b, c)
diff --git a/tests/material/dumps/othermodule_full_makeclasstransform_with_transforms38.txt b/tests/material/dumps/othermodule_full_makeclasstransform_with_transforms38.txt
new file mode 100644
index 00000000..0d96f782
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_makeclasstransform_with_transforms38.txt
@@ -0,0 +1,38 @@
+from padl import transform
+
+
+B = 2
+C = 3
+tests_material_transforms_in_module_CONST = 123
+tests_unittests_test_dump_test_full_makeclasstransform_with_constants_CONST = 1
+
+
+def k(y):
+    return y
+
+
+a = tests_unittests_test_dump_test_full_makeclasstransform_with_constants_CONST
+b = B
+c = C
+
+
+@transform
+def y(y):
+    return tests_material_transforms_in_module_CONST + k(y)
+
+
+@transform
+class MyClassTransform:
+    def __init__(self, a, b, c):
+        self.a = a
+        self.b = b
+        self.c = c
+
+    def calculate(self, input_):
+        return self.a * self.b + input_
+
+    def __call__(self, input_):
+        return self.calculate(input_) + y(input_) + self.c(input_)
+
+
+_pd_main = MyClassTransform(a, b, c)
diff --git a/tests/material/dumps/othermodule_import_makeclass_squared.txt b/tests/material/dumps/othermodule_import_makeclass_squared.txt
new file mode 100644
index 00000000..bb554c70
--- /dev/null
+++ b/tests/material/dumps/othermodule_import_makeclass_squared.txt
@@ -0,0 +1,7 @@
+from tests.material.transforms_in_module import MyClassTransform
+
+
+a = 1
+b = 2
+c = 3
+_pd_main = MyClassTransform(a, b, c)
diff --git a/tests/material/dumps/othermodule_import_makefunction_squared.txt b/tests/material/dumps/othermodule_import_makefunction_squared.txt
new file mode 100644
index 00000000..90ef97e5
--- /dev/null
+++ b/tests/material/dumps/othermodule_import_makefunction_squared.txt
@@ -0,0 +1,9 @@
+from padl import transform
+
+
+@transform
+def z(x):
+    return x
+
+
+_pd_main = z
diff --git a/tests/material/transforms_in_module.py b/tests/material/transforms_in_module.py
index 02531c18..9b2b9e5e 100644
--- a/tests/material/transforms_in_module.py
+++ b/tests/material/transforms_in_module.py
@@ -73,6 +73,14 @@ def __call__(self, input_):
     return MyClassTransform(a, b, c)
 
 
+def makefunction_squared():
+    return makefunction()
+
+
+def makeclass_squared():
+    return makeclasstransform(1, 2, 3)
+
+
 def wrap_transform():
     return transform(k)
 
diff --git a/tests/unittests/dumptools/test_var2mod.py b/tests/unittests/dumptools/test_var2mod.py
index db7a666f..f4a0780f 100644
--- a/tests/unittests/dumptools/test_var2mod.py
+++ b/tests/unittests/dumptools/test_var2mod.py
@@ -1,6 +1,7 @@
 import ast
 
 from padl.dumptools import var2mod
+from padl.dumptools.var2mod import ScopedName
 
 
 class TestFindGlobals:
@@ -8,10 +9,41 @@ def test_find_same_name(self):
         statement = 'a = run(a)'
         tree = ast.parse(statement)
         res = var2mod.find_globals(tree)
-        assert res == {('a', 1), ('run', 0)}
+        assert res == {ScopedName('a', None, 1), ScopedName('run', None, 0)}
 
     def test_find_in_assignment(self):
         statement = 'a = run'
         tree = ast.parse(statement)
         res = var2mod.find_globals(tree)
-        assert res == {('run', 0)}
+        assert res == {ScopedName('run', None, 0)}
+
+    def test_dots(self):
+        statement = (
+            'def f(x):\n'
+            '    o = x.y\n'
+            '    u = y.x\n'
+            '    return a.b.c(x)\n'
+        )
+        res = var2mod.find_globals(ast.parse(statement))
+        assert res == {ScopedName('a.b.c', None, 0), ScopedName('y.x', None, 0)}
+
+    def test_attribute(self):
+        statement = (
+            'def f(x):\n'
+            '    o = x.y\n'
+            '    u = y.x\n'
+            '    ff = (aa + bb).c\n'
+            '    return a.b.c(x)\n'
+        )
+        res = var2mod.find_globals(ast.parse(statement))
+        assert res == {ScopedName('a.b.c', None, 0), ScopedName('y.x', None, 0),
+                       ScopedName('aa', None, 0), ScopedName('bb', None, 0)}
+
+    def test_complex_statement_1(self):
+        statement = (
+            '@transform\n'
+            'def f(x):\n'
+            '    (255 * (x * 0.5 + 0.5)).numpy().astype(numpy.uint8)\n'
+        )
+        res = var2mod.find_globals(ast.parse(statement))
+        assert res == {ScopedName('numpy.uint8', None, 0), ScopedName('transform', None, 0)}
diff --git a/tests/unittests/test_dump.py b/tests/unittests/test_dump.py
index 94eac356..e6117a57 100644
--- a/tests/unittests/test_dump.py
+++ b/tests/unittests/test_dump.py
@@ -1,6 +1,8 @@
 import pytest
+import sys
 
 from padl import transform, group, IfTrain, Batchify, Unbatchify, importdump, fulldump
+import padl.dumptools.var2mod
 from tests.material import transforms_in_module as tim
 
 
@@ -248,6 +250,16 @@ def test_multiline_init():
     )  # no further testing, this should just not fail
 
 
+@transform
+def f_using_dotimport(x):
+    return padl.dumptools.var2mod.ast.parse(x)
+
+
+def test_dotimport():
+    dump = f_using_dotimport._pd_dumps()
+    assert dump == read_dump('dotimport')
+
+
 class TestOtherModule:
     def test_import_function(self):
         importdump(tim)
@@ -304,6 +316,17 @@ def test_full_makeclasstransform(self):
         dump = tim.makeclasstransform(1, 2, 3)._pd_dumps()
         assert dump == read_dump('othermodule_full_makeclasstransform')
 
+    def test_full_makeclasstransform_with_constants(self):
+        fulldump(tim)
+        B = 2
+        C = 3
+        dump = tim.makeclasstransform(CONST, B, C)._pd_dumps()
+        if sys.version_info[1] <= 8:
+            assert dump == read_dump('othermodule_full_makeclasstransform_with_transforms')
+        else:
+            # python >= 3.9 creates a slightly different dump (semantically the same)
+            assert dump == read_dump('othermodule_full_makeclasstransform_with_transforms38')
+
     def test_import_wrapped(self):
         importdump(tim)
         dump = tim.wrap_transform()._pd_dumps()
@@ -313,3 +336,13 @@ def test_import_makelambda(self):
         importdump(tim)
         dump = tim.makelambda()._pd_dumps()
         assert dump == read_dump('othermodule_import_makelambda')
+
+    def test_import_makefunction_squared(self):
+        importdump(tim)
+        dump = tim.makefunction_squared()._pd_dumps()
+        assert dump == read_dump('othermodule_import_makefunction_squared')
+
+    def test_import_makeclass_squared(self):
+        importdump(tim)
+        dump = tim.makeclass_squared()._pd_dumps()
+        assert dump == read_dump('othermodule_import_makeclass_squared')