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

Issue:
Allow saving whole transform code if it was created in another module
If I get a transform from another module and do

```python
from othermodule import MyTransform
x = MyTransform()
```

saving will save just that - it will not get the code defining the transform.

Sometimes it could be desirable to save the code defining the Transform instead.

We should somehow enable that.

Different ways come into mind:
1. make it possible to set a flag in the decorator

```python
@transform(saveall=True)
class MyTransform:
    ...   
```

2. add a function that modifies the way the transform saves

```python
from othermodule import MyTransform
x = MyTransform()
x = saveall(x)
```

3. add a function that modifies the way a whole package / module saves

```python
import othermodule
saveall(othermodule)
```


Discussion / hints:
For example in `tatenen` models should be saved with reference to `tatenen` codebase.

Fix patch:
diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml
index e6e4520f..ffffa3ac 100644
--- a/.github/workflows/actions.yml
+++ b/.github/workflows/actions.yml
@@ -33,4 +33,4 @@ jobs:
         pip install -r requirements-test.txt
     - name: Test with pytest
       run: |
-        python -m pytest --cov=padl -n 2
+        python -m pytest --doctest-modules --cov=padl -n 2
diff --git a/docs/README.html b/docs/README.html
index 22e4861a..dbaf8c7d 100644
--- a/docs/README.html
+++ b/docs/README.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Introduction &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -165,7 +167,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="tex2jax_ignore mathjax_ignore section" id="introduction">
+  <section class="tex2jax_ignore mathjax_ignore" id="introduction">
 <h1>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h1>
 <p><strong>Pipeline abstractions for deep learning</strong></p>
 <hr class="docutils" />
@@ -178,16 +180,16 @@ <h1>Introduction<a class="headerlink" href="#introduction" title="Permalink to t
 <li><p>allows for converting standard functions to <strong>PADL</strong> components using a single keyword <code class="docutils literal notranslate"><span class="pre">transform</span></code>.</p></li>
 </ul>
 <p><strong>PADL</strong> was developed at <a class="reference external" href="https://lf1.io/">LF1</a>, an AI innovation lab based in Berlin, Germany.</p>
-<div class="section" id="getting-started">
+<section id="getting-started">
 <h2>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline"></a></h2>
-<div class="section" id="installation">
+<section id="installation">
 <h3>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h3>
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">padl</span>
 </pre></div>
 </div>
 <p>PADL currently supports python <strong>3.8</strong> and <strong>3.9</strong>.</p>
-</div>
-<div class="section" id="your-first-padl-program">
+</section>
+<section id="your-first-padl-program">
 <h3>Your first PADL program<a class="headerlink" href="#your-first-padl-program" title="Permalink to this headline"></a></h3>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">transform</span><span class="p">,</span> <span class="n">batch</span><span class="p">,</span> <span class="n">unbatch</span>
 <span class="kn">import</span> <span class="nn">torch</span>
@@ -205,26 +207,26 @@ <h3>Your first PADL program<a class="headerlink" href="#your-first-padl-program"
 <span class="n">my_pipeline</span> <span class="o">=</span> <span class="n">prepare</span> <span class="o">&gt;&gt;</span> <span class="n">batch</span> <span class="o">&gt;&gt;</span> <span class="n">nn</span><span class="o">.</span><span class="n">Linear</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="mi">20</span><span class="p">)</span> <span class="o">&gt;&gt;</span> <span class="n">unbatch</span> <span class="o">&gt;&gt;</span> <span class="n">post</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="resources">
+</section>
+<section id="resources">
 <h3>Resources<a class="headerlink" href="#resources" title="Permalink to this headline"></a></h3>
 <ul class="simple">
 <li><p>Go to <a class="reference internal" href="usage.html#usage"><span class="std std-ref">Usage</span></a> for a concise but comprehensive manual.</p></li>
 <li><p>Find examples at <a class="reference external" href="https://github.com/lf1-io/padl/tree/main/notebooks">https://github.com/lf1-io/padl/tree/main/notebooks</a>.</p></li>
 <li><p>Post issues at <a class="reference external" href="https://github.com/lf1-io/padl/issues">https://github.com/lf1-io/padl/issues</a>.</p></li>
 </ul>
-</div>
-</div>
-<div class="section" id="contributing">
+</section>
+</section>
+<section id="contributing">
 <h2>Contributing<a class="headerlink" href="#contributing" title="Permalink to this headline"></a></h2>
 <p>Code of conduct: <a class="reference external" href="https://github.com/lf1-io/padl/blob/main/CODE_OF_CONDUCT.md">https://github.com/lf1-io/padl/blob/main/CODE_OF_CONDUCT.md</a>.</p>
 <p>If your interested in contributing to PADL please look at the current issues: <a class="reference external" href="https://github.com/lf1-io/padl/issues">https://github.com/lf1-io/padl/issues</a>.</p>
-</div>
-<div class="section" id="licensing">
+</section>
+<section id="licensing">
 <h2>Licensing<a class="headerlink" href="#licensing" title="Permalink to this headline"></a></h2>
 <p>PADL is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.</p>
-</div>
-</div>
+</section>
+</section>
 
 
            </div>
diff --git a/docs/advanced.html b/docs/advanced.html
index ba61c9af..fa415e85 100644
--- a/docs/advanced.html
+++ b/docs/advanced.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Advanced Topics &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -165,7 +167,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="tex2jax_ignore mathjax_ignore section" id="advanced-topics">
+  <section class="tex2jax_ignore mathjax_ignore" id="advanced-topics">
 <h1>Advanced Topics<a class="headerlink" href="#advanced-topics" title="Permalink to this headline"></a></h1>
 <div class="toctree-wrapper compound">
 <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
@@ -173,7 +175,7 @@ <h1>Advanced Topics<a class="headerlink" href="#advanced-topics" title="Permalin
 <li class="toctree-l1"><a class="reference internal" href="advanced/saving.html">Saving</a></li>
 </ul>
 </div>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/advanced/saving.html b/docs/advanced/saving.html
index 2d0c5730..9cda968d 100644
--- a/docs/advanced/saving.html
+++ b/docs/advanced/saving.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Saving &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="tex2jax_ignore mathjax_ignore section" id="saving">
+  <section class="tex2jax_ignore mathjax_ignore" id="saving">
 <h1>Saving<a class="headerlink" href="#saving" title="Permalink to this headline"></a></h1>
 <p>All PADL Transforms can be saved via <a class="reference internal" href="../apidocs/padl.html#padl.save" title="padl.save"><code class="xref py py-meth docutils literal notranslate"><span class="pre">padl.save()</span></code></a>. For that, simply do:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">save</span>
@@ -182,7 +184,7 @@ <h1>Saving<a class="headerlink" href="#saving" title="Permalink to this headline
 <span class="n">my_pipeline</span> <span class="o">=</span> <span class="n">load</span><span class="p">(</span><span class="s1">&#39;some/path.padl&#39;</span><span class="p">)</span>
 </pre></div>
 </div>
-<div class="section" id="how-it-works">
+<section id="how-it-works">
 <h2>How it works<a class="headerlink" href="#how-it-works" title="Permalink to this headline"></a></h2>
 <p>When saving a Transform, PADL tracks down the statements that were used to create it
 and writes them into a python file.</p>
@@ -254,10 +256,10 @@ <h2>How it works<a class="headerlink" href="#how-it-works" title="Permalink to t
 <span class="p">)</span>
 </pre></div>
 </div>
-<p>As you can see, PADL saving supports third party imports, star imports and globally defined constants (there are some limitations to this, see <a class="reference internal" href="#what-does-not-save"><span class="std std-ref">What does not save</span></a>).</p>
+<p>As you can see, PADL saving supports third party imports, star imports and globally defined constants (there are some limitations to this, see <a class="reference internal" href="#what-does-not-save"><span class="std std-ref">Saving Transforms from other modules</span></a>).</p>
 <p><code class="file docutils literal notranslate"><span class="pre">versions.txt</span></code> contains all the packages that were used in creating the Transforms and their versions. This is very similar to a <code class="file docutils literal notranslate"><span class="pre">requirements.txt</span></code> - however, it contains the package names rather that their names in the <code class="docutils literal notranslate"><span class="pre">PyPI</span></code>.</p>
-</div>
-<div class="section" id="saving-by-value">
+</section>
+<section id="saving-by-value">
 <span id="id1"></span><h2>Saving by value<a class="headerlink" href="#saving-by-value" title="Permalink to this headline"></a></h2>
 <p>Sometimes you might want to save the <em>value</em> of a variable instead of the python statements
 that created it.</p>
@@ -328,7 +330,7 @@ <h2>How it works<a class="headerlink" href="#how-it-works" title="Permalink to t
 </div>
 <p>Currently, this only works with values that can be serialized as JSON. Future versions of PADL will add support for other things.
 You can also add your own serializer:</p>
-<div class="section" id="custom-serializers">
+<section id="custom-serializers">
 <h3>Custom serializers<a class="headerlink" href="#custom-serializers" title="Permalink to this headline"></a></h3>
 <p>You can save by value using your own serializer by defining two functions, one for saving, one for loading, and passing them to
 <a class="reference internal" href="../apidocs/padl.html#padl.value" title="padl.value"><code class="xref py py-meth docutils literal notranslate"><span class="pre">padl.value()</span></code></a>.</p>
@@ -383,14 +385,14 @@ <h3>Custom serializers<a class="headerlink" href="#custom-serializers" title="Pe
 <span class="p">[</span><span class="o">...</span><span class="p">]</span>
 </pre></div>
 </div>
-</div>
-</div>
-<div class="section" id="saving-pytorch-modules">
+</section>
+</section>
+<section id="saving-pytorch-modules">
 <h2>Saving pytorch modules<a class="headerlink" href="#saving-pytorch-modules" title="Permalink to this headline"></a></h2>
 <p>When saving, PADL automatically serializes pytorch model parameters and stores them in the <code class="docutils literal notranslate"><span class="pre">.padl</span></code>
 folder as <code class="docutils literal notranslate"><span class="pre">.pt</span></code> files. When loading, the parameters of the models are set to the previously saved values.</p>
-</div>
-<div class="section" id="defining-transform-within-nested-scopes">
+</section>
+<section id="defining-transform-within-nested-scopes">
 <h2>Defining Transform within nested scopes<a class="headerlink" href="#defining-transform-within-nested-scopes" title="Permalink to this headline"></a></h2>
 <p>It is possible to create Transforms within nested scopes (for instance in a function body):</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">transform</span><span class="p">,</span> <span class="n">save</span>
@@ -418,11 +420,52 @@ <h2>Defining Transform within nested scopes<a class="headerlink" href="#defining
     <span class="k">return</span> <span class="n">build_my_transform</span><span class="p">(</span><span class="n">arg</span> <span class="o">+</span> <span class="mi">100</span><span class="p">)</span>
 </pre></div>
 </div>
+</section>
+<section id="saving-transforms-from-other-modules">
+<span id="what-does-not-save"></span><h2>Saving Transforms from other modules<a class="headerlink" href="#saving-transforms-from-other-modules" title="Permalink to this headline"></a></h2>
+<p>When importing Transforms from a different module, saving will by default only dump the import statement.</p>
+<p>Thus, when doing</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">save</span>
+<span class="kn">from</span> <span class="nn">some.module</span> <span class="kn">import</span> <span class="n">a_transform</span>
+<span class="n">save</span><span class="p">(</span><span class="n">a_transform</span><span class="p">,</span> <span class="s1">&#39;mytransform&#39;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>the <code class="docutils literal notranslate"><span class="pre">transforms.py</span></code> will contain just:</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">some.module</span> <span class="kn">import</span> <span class="n">a_transform</span>
+
+<span class="n">_pd_main</span> <span class="o">=</span> <span class="n">a_transform</span>
+</pre></div>
+</div>
+<p>One can switch to a full dump of the transform using <a class="reference internal" href="../apidocs/padl.html#padl.fulldump" title="padl.fulldump"><code class="xref py py-func docutils literal notranslate"><span class="pre">padl.fulldump()</span></code></a>:</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">save</span><span class="p">,</span> <span class="n">fulldump</span>
+<span class="kn">from</span> <span class="nn">some.module</span> <span class="kn">import</span> <span class="n">a_transform</span>
+
+<span class="n">a_transform</span> <span class="o">=</span> <span class="n">fulldump</span><span class="p">(</span><span class="n">a_transform</span><span class="p">)</span>
+<span class="n">save</span><span class="p">(</span><span class="n">a_transform</span><span class="p">,</span> <span class="s1">&#39;mytransform&#39;</span><span class="p">)</span>
+</pre></div>
 </div>
-<div class="section" id="what-does-not-save">
-<span id="id2"></span><h2>What does not save<a class="headerlink" href="#what-does-not-save" title="Permalink to this headline"></a></h2>
+<p>This causes the <code class="docutils literal notranslate"><span class="pre">transforms.py</span></code> to contain the transform definition instead of the import:</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@transform</span>
+<span class="k">def</span> <span class="nf">a_transform</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
+    <span class="o">...</span>
+
+<span class="n">_pd_main</span> <span class="o">=</span> <span class="n">a_transform</span>
+</pre></div>
+</div>
+<p>Instead of using <a class="reference internal" href="../apidocs/padl.html#padl.fulldump" title="padl.fulldump"><code class="xref py py-func docutils literal notranslate"><span class="pre">padl.fulldump()</span></code></a> on a Transform, one can apply it to a package or module. This will enable full dump for all contained transforms.</p>
+<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">save</span><span class="p">,</span> <span class="n">fulldump</span>
+<span class="kn">import</span> <span class="nn">some.module</span>
+<span class="kn">from</span> <span class="nn">some.module</span> <span class="kn">import</span> <span class="n">a_transform</span>
+
+<span class="n">fulldump</span><span class="p">(</span><span class="n">some</span><span class="o">.</span><span class="n">module</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>To reverse the effect of <a class="reference internal" href="../apidocs/padl.html#padl.fulldump" title="padl.fulldump"><code class="xref py py-func docutils literal notranslate"><span class="pre">fulldump()</span></code></a>, use <a class="reference internal" href="../apidocs/padl.html#padl.importdump" title="padl.importdump"><code class="xref py py-func docutils literal notranslate"><span class="pre">importdump()</span></code></a>.</p>
+</section>
+<section id="id2">
+<h2>What does not save<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h2>
 <p>Saving PADL transforms has a few caveats you should be aware of:</p>
-<div class="section" id="variables-defined-as-the-targets-of-with-blocks">
+<section id="variables-defined-as-the-targets-of-with-blocks">
 <h3>Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks<a class="headerlink" href="#variables-defined-as-the-targets-of-with-blocks" title="Permalink to this headline"></a></h3>
 <p>PADL currently cannot symbolically save anything that depends on the target of a with block. If you want to
 use a with block in your code, either wrap it in a function or save by value (<a class="reference internal" href="#saving-by-value"><span class="std std-ref">Saving by value</span></a>). Instead of:</p>
@@ -458,8 +501,8 @@ <h3>Variables defined as the targets of <code class="code docutils literal notra
 <span class="p">[</span><span class="o">...</span><span class="p">]</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="variables-defined-as-targets-of-loops">
+</section>
+<section id="variables-defined-as-targets-of-loops">
 <h3>Variables defined as targets of loops<a class="headerlink" href="#variables-defined-as-targets-of-loops" title="Permalink to this headline"></a></h3>
 <p>PADL currently cannot symbolically save anything that depends on the target of a loop:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="o">...</span><span class="p">]</span>
@@ -473,8 +516,8 @@ <h3>Variables defined as targets of loops<a class="headerlink" href="#variables-
 </pre></div>
 </div>
 <p>Again, save by value instead (<a class="reference internal" href="#saving-by-value"><span class="std std-ref">Saving by value</span></a>) or wrap in a function.</p>
-</div>
-<div class="section" id="mutated-objects">
+</section>
+<section id="mutated-objects">
 <h3>Mutated objects<a class="headerlink" href="#mutated-objects" title="Permalink to this headline"></a></h3>
 <p>PADL currently does not pick up if you mutate an object after creating it:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">save</span>
@@ -487,9 +530,9 @@ <h3>Mutated objects<a class="headerlink" href="#mutated-objects" title="Permalin
 </pre></div>
 </div>
 <p>will not work (<code class="code docutils literal notranslate"><span class="pre">a.change()</span></code> will not be included in the saved <code class="file docutils literal notranslate"><span class="pre">transform.py</span></code>).</p>
-</div>
-</div>
-</div>
+</section>
+</section>
+</section>
 
 
            </div>
diff --git a/docs/advanced/saving.md b/docs/advanced/saving.md
index b2634450..ba8e5cc5 100644
--- a/docs/advanced/saving.md
+++ b/docs/advanced/saving.md
@@ -295,6 +295,59 @@ def build(arg):
 
 (what-does-not-save)=
 
+## Saving Transforms from other modules
+
+When importing Transforms from a different module, saving will by default only dump the import statement.
+
+Thus, when doing
+
+```python
+from padl import save
+from some.module import a_transform
+save(a_transform, 'mytransform')
+```
+
+the `transforms.py` will contain just:
+
+```python
+from some.module import a_transform
+
+_pd_main = a_transform
+```
+
+One can switch to a full dump of the transform using {func}`padl.fulldump`:
+
+```python
+from padl import save, fulldump
+from some.module import a_transform
+
+a_transform = fulldump(a_transform)
+save(a_transform, 'mytransform')
+```
+
+This causes the `transforms.py` to contain the transform definition instead of the import:
+
+```python
+@transform
+def a_transform(x):
+    ...
+
+_pd_main = a_transform
+```
+
+Instead of using {func}`padl.fulldump` on a Transform, one can apply it to a package or module. This will enable full dump for all contained transforms.
+
+```python
+from padl import save, fulldump
+import some.module
+from some.module import a_transform
+
+fulldump(some.module)
+```
+
+To reverse the effect of {func}`~padl.fulldump`, use {func}`~padl.importdump`.
+
+
 ## What does not save
 
 Saving PADL transforms has a few caveats you should be aware of:
diff --git a/docs/apidocs/padl.dumptools.html b/docs/apidocs/padl.dumptools.html
index fcd5302c..a8b7a398 100644
--- a/docs/apidocs/padl.dumptools.html
+++ b/docs/apidocs/padl.dumptools.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.dumptools &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,9 +168,9 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.dumptools">
+  <section id="module-padl.dumptools">
 <span id="padl-dumptools"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.dumptools</span></code><a class="headerlink" href="#module-padl.dumptools" title="Permalink to this headline"></a></h1>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.dumptools.inspector.html b/docs/apidocs/padl.dumptools.inspector.html
index a0d40c8a..373fd55e 100644
--- a/docs/apidocs/padl.dumptools.inspector.html
+++ b/docs/apidocs/padl.dumptools.inspector.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.dumptools.inspector &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,18 +168,17 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.dumptools.inspector">
+  <section id="module-padl.dumptools.inspector">
 <span id="padl-dumptools-inspector"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.dumptools.inspector</span></code><a class="headerlink" href="#module-padl.dumptools.inspector" title="Permalink to this headline"></a></h1>
 <p>Utilities for inspecting frames.</p>
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.dumptools.inspector.CallInfo">
-<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">padl.dumptools.inspector.</span></span><span class="sig-name descname"><span class="pre">CallInfo</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">origin</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Literal</span><span class="p"><span class="pre">[</span></span><span class="s"><span class="pre">'nextmodule'</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="s"><span class="pre">'here'</span></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">'nextmodule'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">drop_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>, <em class="sig-param"><span class="n"><span class="pre">ignore_scope</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</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">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.inspector.CallInfo" 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.inspector.</span></span><span class="sig-name descname"><span class="pre">CallInfo</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">origin</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Literal</span><span class="p"><span class="pre">[</span></span>
<span class="pre">'nextmodule'</span>
<span class="p"><span class="pre">,</span></span><span class="w"> </span>
<span class="pre">'here'</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">'nextmodule'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">drop_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>, <em class="sig-param"><span class="n"><span class="pre">ignore_scope</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</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">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.inspector.CallInfo" title="Permalink to this definition"></a></dt>
 <dd><p>Information about the calling context.</p>
 <dl class="simple">
 <dt>Contains the following information:</dt><dd><ul class="simple">
-<li><p>the module from which the call was made</p></li>
 <li><p>the function from which that call was made</p></li>
-<li><p>the scope (see <cite>symfinder.Scope</cite>)</p></li>
+<li><p>the scope (see <code class="xref py py-class docutils literal notranslate"><span class="pre">symfinder.Scope</span></code>)</p></li>
 </ul>
 </dd>
 </dl>
@@ -191,9 +192,6 @@
 <li><p><strong>ignore_scope</strong> – Don’t try to determine the scope (use the toplevel scope instead).</p></li>
 </ul>
 </dd>
-<dt class="field-even">Returns</dt>
-<dd class="field-even"><p>A CallInfo object.</p>
-</dd>
 </dl>
 <dl class="py property">
 <dt class="sig sig-object py" id="padl.dumptools.inspector.CallInfo.module">
@@ -273,12 +271,12 @@
 
 <dl class="py function">
 <dt class="sig sig-object py" id="padl.dumptools.inspector.trace_this">
-<span class="sig-prename descclassname"><span class="pre">padl.dumptools.inspector.</span></span><span class="sig-name descname"><span class="pre">trace_this</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tracefunc</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">frame</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">frame</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.inspector.trace_this" title="Permalink to this definition"></a></dt>
+<span class="sig-prename descclassname"><span class="pre">padl.dumptools.inspector.</span></span><span class="sig-name descname"><span class="pre">trace_this</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tracefunc</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Callable</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">frame</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">frame</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="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.inspector.trace_this" title="Permalink to this definition"></a></dt>
 <dd><p>Call in a function body to trace the rest of the function execution with function
 <em>tracefunc</em>. <em>tracefunc</em> must match the requirements for the argument of <cite>sys.settrace</cite>
 (in the documentation of which more details can be found).</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="k">def</span> <span class="nf">tracefunc</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span> <span class="n">event</span><span class="p">,</span> <span class="n">arg</span><span class="p">)</span>
+<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">tracefunc</span><span class="p">(</span><span class="n">frame</span><span class="p">,</span> <span class="n">event</span><span class="p">,</span> <span class="n">arg</span><span class="p">):</span>
 <span class="gp">... </span>    <span class="k">if</span> <span class="s1">&#39;event&#39;</span> <span class="o">==</span> <span class="s1">&#39;return&#39;</span><span class="p">:</span>
 <span class="gp">... </span>        <span class="nb">print</span><span class="p">(</span><span class="s1">&#39;returning&#39;</span><span class="p">,</span> <span class="n">arg</span><span class="p">)</span>
 </pre></div>
@@ -299,7 +297,7 @@
 </dl>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.dumptools.packagefinder.html b/docs/apidocs/padl.dumptools.packagefinder.html
index 3fde2d34..a6005179 100644
--- a/docs/apidocs/padl.dumptools.packagefinder.html
+++ b/docs/apidocs/padl.dumptools.packagefinder.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.dumptools.packagefinder &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.dumptools.packagefinder">
+  <section id="module-padl.dumptools.packagefinder">
 <span id="padl-dumptools-packagefinder"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.dumptools.packagefinder</span></code><a class="headerlink" href="#module-padl.dumptools.packagefinder" title="Permalink to this headline"></a></h1>
 <p>Utilities for finding packages used in code.</p>
 <dl class="py function">
@@ -190,6 +192,17 @@
 <dt class="sig sig-object py" id="padl.dumptools.packagefinder.get_packages">
 <span class="sig-prename descclassname"><span class="pre">padl.dumptools.packagefinder.</span></span><span class="sig-name descname"><span class="pre">get_packages</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nodes</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.packagefinder.get_packages" title="Permalink to this definition"></a></dt>
 <dd><p>Get a list of package names given a list of ast nodes <em>nodes</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">ast</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">source</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
+<span class="gp">... </span><span class="s1">import foo.bla as blu</span>
+<span class="gp">... </span><span class="s1">import bup</span>
+<span class="gp">... </span><span class="s1">from blip import blop</span>
+<span class="gp">... </span><span class="s1">...&#39;&#39;&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">get_packages</span><span class="p">(</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="o">==</span> <span class="p">{</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="s1">&#39;blip&#39;</span><span class="p">,</span> <span class="s1">&#39;bup&#39;</span><span class="p">}</span>
+<span class="go">True</span>
+</pre></div>
+</div>
 </dd></dl>
 
 <dl class="py function">
@@ -198,7 +211,7 @@
 <dd><p>Get a package’s version (defaults to ‘?’).</p>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.dumptools.serialize.html b/docs/apidocs/padl.dumptools.serialize.html
index 597668e9..e6f074e9 100644
--- a/docs/apidocs/padl.dumptools.serialize.html
+++ b/docs/apidocs/padl.dumptools.serialize.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.dumptools.serialize &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.dumptools.serialize">
+  <section id="module-padl.dumptools.serialize">
 <span id="padl-dumptools-serialize"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.dumptools.serialize</span></code><a class="headerlink" href="#module-padl.dumptools.serialize" title="Permalink to this headline"></a></h1>
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.dumptools.serialize.Serializer">
@@ -188,12 +190,12 @@
 <dt class="sig sig-object py" id="padl.dumptools.serialize.Serializer.save">
 <span class="sig-name descname"><span class="pre">save</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">pathlib.Path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.serialize.Serializer.save" title="Permalink to this definition"></a></dt>
 <dd><p>Save the serializer’s value to <em>path</em>.</p>
-<p>Returns a codegraph and a scopemap containing code needed to load the value.</p>
+<p>Returns a codegraph containing code needed to load the value.</p>
 </dd></dl>
 
 <dl class="py method">
 <dt class="sig sig-object py" id="padl.dumptools.serialize.Serializer.save_all">
-<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">save_all</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">codegraph</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scopemap</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.serialize.Serializer.save_all" 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">save_all</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">codegraph</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.serialize.Serializer.save_all" title="Permalink to this definition"></a></dt>
 <dd><p>Save all values.</p>
 </dd></dl>
 
@@ -229,7 +231,7 @@
 <dd><p>Helper function that marks things in the code that should be stored by value.</p>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.dumptools.sourceget.html b/docs/apidocs/padl.dumptools.sourceget.html
index b28ff320..4ca12466 100644
--- a/docs/apidocs/padl.dumptools.sourceget.html
+++ b/docs/apidocs/padl.dumptools.sourceget.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.dumptools.sourceget &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.dumptools.sourceget">
+  <section id="module-padl.dumptools.sourceget">
 <span id="padl-dumptools-sourceget"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.dumptools.sourceget</span></code><a class="headerlink" href="#module-padl.dumptools.sourceget" title="Permalink to this headline"></a></h1>
 <p>Module for getting source-code strings of various things (source files, modules, ipython cells).
 In addition, the module maintains a cache of source-strings in which the values can be modified.</p>
@@ -313,7 +315,7 @@
 </dl>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.dumptools.symfinder.html b/docs/apidocs/padl.dumptools.symfinder.html
index b5ffbbe6..3d1b582b 100644
--- a/docs/apidocs/padl.dumptools.symfinder.html
+++ b/docs/apidocs/padl.dumptools.symfinder.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.dumptools.symfinder &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.dumptools.symfinder">
+  <section id="module-padl.dumptools.symfinder">
 <span id="padl-dumptools-symfinder"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.dumptools.symfinder</span></code><a class="headerlink" href="#module-padl.dumptools.symfinder" title="Permalink to this headline"></a></h1>
 <p>Module for symbolically finding python entities in python source code given their name.</p>
 <p>A thing in python can get its name in various ways:</p>
@@ -270,7 +272,31 @@
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.dumptools.symfinder.ScopedName">
 <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">padl.dumptools.symfinder.</span></span><span class="sig-name descname"><span class="pre">ScopedName</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"><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"><a class="reference internal" href="#padl.dumptools.symfinder.Scope" title="padl.dumptools.symfinder.Scope"><span class="pre">padl.dumptools.symfinder.Scope</span></a></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.symfinder.ScopedName" title="Permalink to this definition"></a></dt>
-<dd></dd></dl>
+<dd><p>A name with a scope and a counter. The “name” is the name of the item, the scope is its
+<a class="reference internal" href="#padl.dumptools.symfinder.Scope" title="padl.dumptools.symfinder.Scope"><code class="xref py py-class docutils literal notranslate"><span class="pre">Scope</span></code></a> and the counter counts the items with the same name, in the same scope,
+from most recent on up.</p>
+<p>Example - the following:</p>
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">a</span> <span class="o">=</span> <span class="mi">1</span>
+
+<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
+    <span class="n">a</span> <span class="o">=</span> <span class="mi">2</span>
+
+<span class="n">a</span> <span class="o">=</span> <span class="n">a</span> <span class="o">+</span> <span class="mi">1</span>
+</pre></div>
+</div>
+<p>contains four scoped names:</p>
+<blockquote>
+<div><ul class="simple">
+<li><p>The “a” of <cite>a = a + 1</cite>, with <cite>name = a</cite>, module-level scope and <cite>n = 0</cite> (it is the most
+recent “a” in the module level scope).</p></li>
+<li><p>The “a” in the function body, with <cite>name = a</cite>, function f scope and <cite>n = 0</cite> (it is the
+most recent “a” in “f” scope).</p></li>
+<li><p>the function name “f”, module level scope, <cite>n = 0</cite></p></li>
+<li><p>the “a” of <cite>a = 1</cite>, with <cite>name = a</cite>, module-level scope and <cite>n = 1</cite> (as it’s the second
+most recent “a” in its scope).</p></li>
+</ul>
+</div></blockquote>
+</dd></dl>
 
 <dl class="py function">
 <dt class="sig sig-object py" id="padl.dumptools.symfinder.find">
@@ -292,24 +318,6 @@
 </dl>
 </dd></dl>
 
-<dl class="py function">
-<dt class="sig sig-object py" id="padl.dumptools.symfinder.find_in_function_def">
-<span class="sig-prename descclassname"><span class="pre">padl.dumptools.symfinder.</span></span><span class="sig-name descname"><span class="pre">find_in_function_def</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var_name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">source</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lineno</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">call_source</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.symfinder.find_in_function_def" title="Permalink to this definition"></a></dt>
-<dd><p>Find where <em>var_name</em> was assigned.</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>source</strong> – Source string.</p></li>
-<li><p><strong>lineno</strong> – Line number in the function to search in (this is being used to determine in
-which function scope to search).</p></li>
-<li><p><strong>call_source</strong> – Source of the function call (e.g. <cite>“f(123, b=1)”</cite>). This is being used to
-determine argument values.</p></li>
-</ul>
-</dd>
-</dl>
-</dd></dl>
-
 <dl class="py function">
 <dt class="sig sig-object py" id="padl.dumptools.symfinder.find_in_ipython">
 <span class="sig-prename descclassname"><span class="pre">padl.dumptools.symfinder.</span></span><span class="sig-name descname"><span class="pre">find_in_ipython</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">var_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">i</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> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><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">_ast.AST</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#padl.dumptools.symfinder.find_in_ipython" title="Permalink to this definition"></a></dt>
@@ -397,7 +405,7 @@
 </div>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.dumptools.var2mod.html b/docs/apidocs/padl.dumptools.var2mod.html
index 72611021..db73c44b 100644
--- a/docs/apidocs/padl.dumptools.var2mod.html
+++ b/docs/apidocs/padl.dumptools.var2mod.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.dumptools.var2mod &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,27 +168,87 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.dumptools.var2mod">
+  <section id="module-padl.dumptools.var2mod">
 <span id="padl-dumptools-var2mod"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.dumptools.var2mod</span></code><a class="headerlink" href="#module-padl.dumptools.var2mod" title="Permalink to this headline"></a></h1>
+<dl class="py class">
+<dt class="sig sig-object py" id="padl.dumptools.var2mod.CodeGraph">
+<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">CodeGraph</span></span><a class="headerlink" href="#padl.dumptools.var2mod.CodeGraph" title="Permalink to this definition"></a></dt>
+<dd><p>A graph representing python code.</p>
+<p>The nodes in the graph are <cite>CodeNode</cite> objects, representing pieces of code defining python
+variables. The edges are the dependencies between the nodes.</p>
+<p>As an example - the following code:</p>
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">foo</span>
+
+<span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
+    <span class="k">return</span> <span class="n">foo</span><span class="o">.</span><span class="n">bar</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
+
+<span class="n">o</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>defines a codegraph with the nodes:</p>
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">foo</span><span class="p">:</span> <span class="s2">&quot;import foo&quot;</span>
+<span class="n">f</span><span class="p">:</span> <span class="s2">&quot;def f(x) ...&quot;</span>
+<span class="n">o</span><span class="p">:</span> <span class="s2">&quot;o = f(100)&quot;</span>
+</pre></div>
+</div>
+<p>Edges are determined by the variable dependencies between the nodes:</p>
+<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">o</span> <span class="o">-&gt;</span> <span class="n">f</span> <span class="o">-&gt;</span> <span class="n">foo</span>
+</pre></div>
+</div>
+<p>As <cite>o</cite> depends on <cite>f</cite> and <cite>f</cite> depends on <cite>foo</cite>.</p>
+<dl class="py method">
+<dt class="sig sig-object py" id="padl.dumptools.var2mod.CodeGraph.build">
+<em class="property"><span class="pre">classmethod</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">build</span></span><span class="sig-paren">(</span><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.CodeGraph.build" title="Permalink to this definition"></a></dt>
+<dd><p>Build a codegraph corresponding to a <cite>ScopedName</cite>.</p>
+<p>The name will be searched for in its scope.</p>
+</dd></dl>
+
+<dl class="py method">
+<dt class="sig sig-object py" id="padl.dumptools.var2mod.CodeGraph.dumps">
+<span class="sig-name descname"><span class="pre">dumps</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.CodeGraph.dumps" title="Permalink to this definition"></a></dt>
+<dd><p>Create a python source string with the contents of the graph.</p>
+</dd></dl>
+
+<dl class="py method">
+<dt class="sig sig-object py" id="padl.dumptools.var2mod.CodeGraph.print">
+<span class="sig-name descname"><span class="pre">print</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.CodeGraph.print" title="Permalink to this definition"></a></dt>
+<dd><p>Print the graph (for debugging).</p>
+</dd></dl>
+
+</dd></dl>
+
 <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">ast_node</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">_ast.AST</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">NoneType</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>
-<dd></dd></dl>
+<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>
+<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">
+<li><p>a <em>source</em>: The source code represented by the <cite>CodeNode</cite>.</p></li>
+<li><p>a set of <em>globals_</em>: Names the node depends on.</p></li>
+<li><p>(optionally) a <em>scope</em>: The module and function scope the <cite>CodeNode</cite> lives in.</p></li>
+<li><p>(optionally) an <em>ast_node</em>: An <cite>ast.AST</cite> object representing the code.</p></li>
+</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>
+<dd><p>Build a <cite>CodeNode</cite> from a source string.</p>
+</dd></dl>
+
+</dd></dl>
 
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.dumptools.var2mod.Finder">
 <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">Finder</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">nodetype</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.Finder" title="Permalink to this definition"></a></dt>
-<dd><p>Class for finding ast nodes of a given type in an ast tree.</p>
+<dd><p><code class="xref py py-class docutils literal notranslate"><span class="pre">ast.NodeVisitor</span></code> for finding AST-nodes of a given type in an AST-tree.</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="n">f</span> <span class="o">=</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">find</span><span class="p">(</span><span class="n">ast</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="s1">&#39;x(y)&#39;</span><span class="p">))</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="nb">all</span><span class="p">([</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">x</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="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">f</span><span class="p">])</span>
-<span class="go">True</span>
+<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">find</span><span class="p">(</span><span class="n">ast</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="s1">&#39;x(y)&#39;</span><span class="p">))</span>  
+<span class="go">[&lt;_ast.Name object at 0x...&gt;, &lt;_ast.Name object at 0x...&gt;]</span>
 </pre></div>
 </div>
 <dl class="py method">
 <dt class="sig sig-object py" id="padl.dumptools.var2mod.Finder.find">
 <span class="sig-name descname"><span class="pre">find</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">node</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.Finder.find" title="Permalink to this definition"></a></dt>
-<dd><p>Find subnodes of node.</p>
+<dd><p>Find sub-nodes of <em>node</em>.</p>
 </dd></dl>
 
 <dl class="py method">
@@ -195,6 +257,23 @@
 <dd><p>Called if no explicit visitor function exists for a node.</p>
 </dd></dl>
 
+<dl class="py method">
+<dt class="sig sig-object py" id="padl.dumptools.var2mod.Finder.get_source_segments">
+<span class="sig-name descname"><span class="pre">get_source_segments</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">source</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.Finder.get_source_segments" title="Permalink to this definition"></a></dt>
+<dd><p>Get a list of source segments of found nodes in source and their respective positions.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Returns</dt>
+<dd class="field-odd"><p>A list of tuples (&lt;source segment&gt;, &lt;position&gt;) where position is a tuple
+(&lt;lineno&gt;, &lt;end lineno&gt;, &lt;col offset&gt;, &lt;end col offset&gt;).</p>
+</dd>
+</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>
+</pre></div>
+</div>
+</dd></dl>
+
 </dd></dl>
 
 <dl class="py class">
@@ -214,10 +293,36 @@
 
 </dd></dl>
 
+<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>
+<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>
+
 <dl class="py function">
 <dt class="sig sig-object py" id="padl.dumptools.var2mod.find_globals">
-<span class="sig-prename descclassname"><span class="pre">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">find_globals</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">node</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">_ast.AST</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filter_builtins</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.find_globals" 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_globals</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">node</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">_ast.AST</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filter_builtins</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</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">True</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Set</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></span><a class="headerlink" href="#padl.dumptools.var2mod.find_globals" title="Permalink to this definition"></a></dt>
 <dd><p>Find all globals used below a node.</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="n">source</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;</span>
+<span class="gp">... </span><span class="s1">def f(x):</span>
+<span class="gp">... </span><span class="s1">    y = a + 1</span>
+<span class="gp">... </span><span class="s1">    z = np.array(x + b)</span>
+<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="go">True</span>
+</pre></div>
+</div>
+<dl class="field-list simple">
+<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>
+</ul>
+</dd>
+</dl>
 </dd></dl>
 
 <dl class="py function">
@@ -237,13 +342,22 @@
 </dd></dl>
 
 <dl class="py function">
-<dt class="sig sig-object py" id="padl.dumptools.var2mod.unscope_graph">
-<span class="sig-prename descclassname"><span class="pre">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">unscope_graph</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">graph</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">scopemap</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.unscope_graph" title="Permalink to this definition"></a></dt>
-<dd><p>Create a version of <em>graph</em> where all non-top level variables are renamed (by prepending
-the scope) to prevent conflicts.</p>
+<dt class="sig sig-object py" id="padl.dumptools.var2mod.rename">
+<span class="sig-prename descclassname"><span class="pre">padl.dumptools.var2mod.</span></span><span class="sig-name descname"><span class="pre">rename</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">tree</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">_ast.AST</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">from_</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">to</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">rename_locals</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</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">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.dumptools.var2mod.rename" title="Permalink to this definition"></a></dt>
+<dd><p>Rename things in an AST tree.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><ul class="simple">
+<li><p><strong>tree</strong> – The tree in which to rename things.</p></li>
+<li><p><strong>from</strong> – Rename everything called this …</p></li>
+<li><p><strong>to</strong> – … to this.</p></li>
+<li><p><strong>rename_locals</strong> – If <em>True</em>, rename local things, else, only rename globals.</p></li>
+</ul>
+</dd>
+</dl>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.exceptions.html b/docs/apidocs/padl.exceptions.html
index 2869178b..e40f9e6a 100644
--- a/docs/apidocs/padl.exceptions.html
+++ b/docs/apidocs/padl.exceptions.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.exceptions &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.exceptions">
+  <section id="module-padl.exceptions">
 <span id="padl-exceptions"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.exceptions</span></code><a class="headerlink" href="#module-padl.exceptions" title="Permalink to this headline"></a></h1>
 <p>Exceptions.</p>
 <dl class="py exception">
@@ -183,7 +185,7 @@
 </dl>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.html b/docs/apidocs/padl.html
index 680f3bd4..3482d2e3 100644
--- a/docs/apidocs/padl.html
+++ b/docs/apidocs/padl.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl">
+  <section id="module-padl">
 <span id="padl"></span><h1><code class="docutils literal notranslate"><span class="pre">padl</span></code><a class="headerlink" href="#module-padl" title="Permalink to this headline"></a></h1>
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.Batchify">
@@ -204,17 +206,17 @@
 
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.IfInMode">
-<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">padl.</span></span><span class="sig-name descname"><span class="pre">IfInMode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">if_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">target_mode</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Literal</span><span class="p"><span class="pre">[</span></span><span class="s"><span class="pre">'infer'</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="s"><span class="pre">'eval'</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="s"><span class="pre">'train'</span></span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">else_</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.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</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><span class="sig-paren">)</span><a class="headerlink" href="#padl.IfInMode" 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.</span></span><span class="sig-name descname"><span class="pre">IfInMode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">if_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">target_mode</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Literal</span><span class="p"><span class="pre">[</span></span>
<span class="pre">'infer'</span>
<span class="p"><span class="pre">,</span></span><span class="w"> </span>
<span class="pre">'eval'</span>
<span class="p"><span class="pre">,</span></span><span class="w"> </span>
<span class="pre">'train'</span>
<span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">else_</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.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</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><span class="sig-paren">)</span><a class="headerlink" href="#padl.IfInMode" title="Permalink to this definition"></a></dt>
 <dd><p>Perform <em>if_</em> if called in mode <em>target_mode</em>, else perform <em>else_</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">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">transform</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">10</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span> <span class="o">*</span> <span class="mi">10</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">iis</span> <span class="o">=</span> <span class="n">IfInMode</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="s1">&#39;infer&#39;</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">iis</span><span class="o">.</span><span class="n">infer_apply</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span> <span class="o">*</span> <span class="mi">99</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">iim</span> <span class="o">=</span> <span class="n">IfInMode</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="s1">&#39;infer&#39;</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">iim</span><span class="o">.</span><span class="n">infer_apply</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
 <span class="go">11</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">iis</span><span class="o">.</span><span class="n">eval_apply</span><span class="p">([</span><span class="mi">1</span><span class="p">]))</span>
-<span class="go">[100]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">iim</span><span class="o">.</span><span class="n">eval_apply</span><span class="p">([</span><span class="mi">1</span><span class="p">]))</span>
+<span class="go">[99]</span>
 </pre></div>
 </div>
 <dl class="field-list simple">
@@ -271,10 +273,19 @@
 </dl>
 </dd></dl>
 
-<dl class="py data">
-<dt class="sig sig-object py" id="padl.batch">
-<span class="sig-prename descclassname"><span class="pre">padl.</span></span><span class="sig-name descname"><span class="pre">batch</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">Batchify(dim=0)</span></em><a class="headerlink" href="#padl.batch" title="Permalink to this definition"></a></dt>
-<dd><p>See <a class="reference internal" href="#padl.Batchify" title="padl.Batchify"><code class="xref py py-class docutils literal notranslate"><span class="pre">Batchify</span></code></a>.</p>
+<dl class="py function">
+<dt class="sig sig-object py" id="padl.fulldump">
+<span class="sig-prename descclassname"><span class="pre">padl.</span></span><span class="sig-name descname"><span class="pre">fulldump</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">transform_or_module</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.fulldump" title="Permalink to this definition"></a></dt>
+<dd><p>Switch a Transform or module or package to the “fulldump” mode.</p>
+<p>This means that the Transform or any Transform from that module or package will be fully dumped
+instead of just dumping the statement importing it.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>transform_or_module</strong> – A Transform, module or package for which to enable full dump. Can
+also be a string. In that case, will enable full dump for the module or package with
+matching name.</p>
+</dd>
+</dl>
 </dd></dl>
 
 <dl class="py function">
@@ -288,10 +299,10 @@
 2-tuple whose first item will be passed to <cite>a</cite> and whose second item will be passed to <cite>b + c</cite>.</p>
 </dd></dl>
 
-<dl class="py data">
-<dt class="sig sig-object py" id="padl.identity">
-<span class="sig-prename descclassname"><span class="pre">padl.</span></span><span class="sig-name descname"><span class="pre">identity</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">padl.Identity()</span></em><a class="headerlink" href="#padl.identity" title="Permalink to this definition"></a></dt>
-<dd><p>The <em>identity</em> Transform: <em>f(x) = x</em>.</p>
+<dl class="py function">
+<dt class="sig sig-object py" id="padl.importdump">
+<span class="sig-prename descclassname"><span class="pre">padl.</span></span><span class="sig-name descname"><span class="pre">importdump</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">transform_or_module</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.importdump" title="Permalink to this definition"></a></dt>
+<dd><p>Disable full dump (see <a class="reference internal" href="padl.transforms.html#padl.transforms.fulldump" title="padl.transforms.fulldump"><code class="xref py py-func docutils literal notranslate"><span class="pre">padl.transforms.fulldump()</span></code></a> for more).</p>
 </dd></dl>
 
 <dl class="py function">
@@ -337,7 +348,7 @@
 <dd><p>Helper function that marks things in the code that should be stored by value.</p>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.print_utils.html b/docs/apidocs/padl.print_utils.html
index 29a8d79f..e5860de9 100644
--- a/docs/apidocs/padl.print_utils.html
+++ b/docs/apidocs/padl.print_utils.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.print_utils &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.print_utils">
+  <section id="module-padl.print_utils">
 <span id="padl-print-utils"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.print_utils</span></code><a class="headerlink" href="#module-padl.print_utils" title="Permalink to this headline"></a></h1>
 <p>Utilities for printing.</p>
 <dl class="py function">
@@ -266,7 +268,7 @@
 <p>Use this to get the length of strings that contain escape sequences.</p>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.transforms.html b/docs/apidocs/padl.transforms.html
index 14a1e3c4..a5200a50 100644
--- a/docs/apidocs/padl.transforms.html
+++ b/docs/apidocs/padl.transforms.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.transforms &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.transforms">
+  <section id="module-padl.transforms">
 <span id="padl-transforms"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.transforms</span></code><a class="headerlink" href="#module-padl.transforms" title="Permalink to this headline"></a></h1>
 <p>The Transform class and its fundamental children.</p>
 <p>Transforms should be created using the <cite>padl.transform</cite> wrap-function.</p>
@@ -205,8 +207,9 @@
 
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.transforms.BuiltinTransform">
-<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">padl.transforms.</span></span><span class="sig-name descname"><span class="pre">BuiltinTransform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">call</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.transforms.BuiltinTransform" title="Permalink to this definition"></a></dt>
-<dd></dd></dl>
+<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">padl.transforms.</span></span><span class="sig-name descname"><span class="pre">BuiltinTransform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pd_name</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">str</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">ignore_scope</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</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">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">arguments</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">collections.OrderedDict</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.transforms.BuiltinTransform" title="Permalink to this definition"></a></dt>
+<dd><p>A builtin transform will simply always be imported, never fully dumped.</p>
+</dd></dl>
 
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.transforms.ClassTransform">
@@ -346,17 +349,15 @@
 <dl class="field-list simple">
 <dt class="field-odd">Parameters</dt>
 <dd class="field-odd"><ul class="simple">
-<li><p><strong>transforms</strong> – list of transforms</p></li>
-<li><p><strong>call_info</strong> – A <cite>CallInfo</cite> object containing information about the how the transform was</p></li>
+<li><p><strong>transforms</strong> – List of sub-transforms.</p></li>
+<li><p><strong>call_info</strong> – A <cite>CallInfo</cite> object containing information about the how the transform was
+created (needed for saving).</p></li>
+<li><p><strong>pd_name</strong> – Name of the Pipeline.</p></li>
+<li><p><strong>pd_group</strong> – If <em>True</em>, do not flatten this when used as child transform in a
+<a class="reference internal" href="#padl.transforms.Pipeline" title="padl.transforms.Pipeline"><code class="xref py py-meth docutils literal notranslate"><span class="pre">Pipeline()</span></code></a>.</p></li>
 </ul>
 </dd>
 </dl>
-<p>created (needed for saving).
-:param pd_name: name of Pipeline
-:param pd_group: If <em>True</em>, do not flatten this when used as child transform in a</p>
-<blockquote>
-<div><p><cite>Pipeline</cite>.</p>
-</div></blockquote>
 <dl class="py method">
 <dt class="sig sig-object py" id="padl.transforms.Pipeline.grouped">
 <span class="sig-name descname"><span class="pre">grouped</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#padl.transforms.Pipeline.grouped" title="Permalink to this definition"></a></dt>
@@ -448,11 +449,13 @@
 <dd><p>Transform base class.</p>
 <dl class="field-list simple">
 <dt class="field-odd">Parameters</dt>
-<dd class="field-odd"><p><strong>call_info</strong> – A <cite>CallInfo</cite> object containing information about the how the transform was</p>
+<dd class="field-odd"><ul class="simple">
+<li><p><strong>call_info</strong> – A <cite>CallInfo</cite> object containing information about the how the transform was
+created (needed for saving).</p></li>
+<li><p><strong>pd_name</strong> – name of the transform</p></li>
+</ul>
 </dd>
 </dl>
-<p>created (needed for saving).
-:param pd_name: name of the transform</p>
 <dl class="py method">
 <dt class="sig sig-object py" id="padl.transforms.Transform.eval_apply">
 <span class="sig-name descname"><span class="pre">eval_apply</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Iterable</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">verbose</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</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">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">flatten</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</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">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.transforms.Transform.eval_apply" title="Permalink to this definition"></a></dt>
@@ -487,7 +490,7 @@
 
 <dl class="py method">
 <dt class="sig sig-object py" id="padl.transforms.Transform.pd_call_transform">
-<span class="sig-name descname"><span class="pre">pd_call_transform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</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">Literal</span><span class="p"><span class="pre">[</span></span><span class="s"><span class="pre">'infer'</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="s"><span class="pre">'eval'</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="s"><span class="pre">'train'</span></span><span class="p"><span class="pre">]</span></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.transforms.Transform.pd_call_transform" title="Permalink to this definition"></a></dt>
+<span class="sig-name descname"><span class="pre">pd_call_transform</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">arg</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">mode</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">Literal</span><span class="p"><span class="pre">[</span></span>
<span class="pre">'infer'</span>
<span class="p"><span class="pre">,</span></span><span class="w"> </span>
<span class="pre">'eval'</span>
<span class="p"><span class="pre">,</span></span><span class="w"> </span>
<span class="pre">'train'</span>
<span class="p"><span class="pre">]</span></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.transforms.Transform.pd_call_transform" title="Permalink to this definition"></a></dt>
 <dd><p>Call the transform, with possibility to pass multiple arguments.</p>
 <dl class="field-list simple">
 <dt class="field-odd">Parameters</dt>
@@ -638,18 +641,18 @@
 
 <dl class="py method">
 <dt class="sig sig-object py" id="padl.transforms.Transform.pd_varname">
-<span class="sig-name descname"><span class="pre">pd_varname</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">module</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> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#padl.transforms.Transform.pd_varname" title="Permalink to this definition"></a></dt>
+<span class="sig-name descname"><span class="pre">pd_varname</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">scope</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> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></span><a class="headerlink" href="#padl.transforms.Transform.pd_varname" title="Permalink to this definition"></a></dt>
 <dd><p>The name of the variable name the transform was last assigned to.</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">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">transform</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="n">foo</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">foo</span><span class="o">.</span><span class="n">pd_varname</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">foo</span><span class="o">.</span><span class="n">pd_varname</span><span class="p">()</span>  
 <span class="go">&#39;foo&#39;</span>
 </pre></div>
 </div>
 <dl class="field-list simple">
 <dt class="field-odd">Parameters</dt>
-<dd class="field-odd"><p><strong>module</strong> – Module to search</p>
+<dd class="field-odd"><p><strong>scope</strong> – Scope to search</p>
 </dd>
 <dt class="field-even">Returns</dt>
 <dd class="field-even"><p>A string with the variable name or <em>None</em> if the transform has not been assigned
@@ -705,6 +708,21 @@
 </dl>
 </dd></dl>
 
+<dl class="py function">
+<dt class="sig sig-object py" id="padl.transforms.fulldump">
+<span class="sig-prename descclassname"><span class="pre">padl.transforms.</span></span><span class="sig-name descname"><span class="pre">fulldump</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">transform_or_module</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.transforms.fulldump" title="Permalink to this definition"></a></dt>
+<dd><p>Switch a Transform or module or package to the “fulldump” mode.</p>
+<p>This means that the Transform or any Transform from that module or package will be fully dumped
+instead of just dumping the statement importing it.</p>
+<dl class="field-list simple">
+<dt class="field-odd">Parameters</dt>
+<dd class="field-odd"><p><strong>transform_or_module</strong> – A Transform, module or package for which to enable full dump. Can
+also be a string. In that case, will enable full dump for the module or package with
+matching name.</p>
+</dd>
+</dl>
+</dd></dl>
+
 <dl class="py function">
 <dt class="sig sig-object py" id="padl.transforms.group">
 <span class="sig-prename descclassname"><span class="pre">padl.transforms.</span></span><span class="sig-name descname"><span class="pre">group</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">transform</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#padl.transforms.Rollout" title="padl.transforms.Rollout"><span class="pre">padl.transforms.Rollout</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="#padl.transforms.Parallel" title="padl.transforms.Parallel"><span class="pre">padl.transforms.Parallel</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.transforms.group" title="Permalink to this definition"></a></dt>
@@ -716,6 +734,12 @@
 2-tuple whose first item will be passed to <cite>a</cite> and whose second item will be passed to <cite>b + c</cite>.</p>
 </dd></dl>
 
+<dl class="py function">
+<dt class="sig sig-object py" id="padl.transforms.importdump">
+<span class="sig-prename descclassname"><span class="pre">padl.transforms.</span></span><span class="sig-name descname"><span class="pre">importdump</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">transform_or_module</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.transforms.importdump" title="Permalink to this definition"></a></dt>
+<dd><p>Disable full dump (see <a class="reference internal" href="#padl.transforms.fulldump" title="padl.transforms.fulldump"><code class="xref py py-func docutils literal notranslate"><span class="pre">padl.transforms.fulldump()</span></code></a> for more).</p>
+</dd></dl>
+
 <dl class="py function">
 <dt class="sig sig-object py" id="padl.transforms.load">
 <span class="sig-prename descclassname"><span class="pre">padl.transforms.</span></span><span class="sig-name descname"><span class="pre">load</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.transforms.load" title="Permalink to this definition"></a></dt>
@@ -733,7 +757,7 @@
 will raise a FileExistsError.</p>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.util_transforms.html b/docs/apidocs/padl.util_transforms.html
index 1cb5110d..5441b0f1 100644
--- a/docs/apidocs/padl.util_transforms.html
+++ b/docs/apidocs/padl.util_transforms.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.util_transforms &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.util_transforms">
+  <section id="module-padl.util_transforms">
 <span id="padl-util-transforms"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.util_transforms</span></code><a class="headerlink" href="#module-padl.util_transforms" title="Permalink to this headline"></a></h1>
 <p>Extra useful Transforms.</p>
 <dl class="py class">
@@ -185,17 +187,17 @@
 
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.util_transforms.IfInMode">
-<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">padl.util_transforms.</span></span><span class="sig-name descname"><span class="pre">IfInMode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">if_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">target_mode</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Literal</span><span class="p"><span class="pre">[</span></span><span class="s"><span class="pre">'infer'</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="s"><span class="pre">'eval'</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="s"><span class="pre">'train'</span></span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">else_</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.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</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><span class="sig-paren">)</span><a class="headerlink" href="#padl.util_transforms.IfInMode" 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.util_transforms.</span></span><span class="sig-name descname"><span class="pre">IfInMode</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">if_</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">target_mode</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Literal</span><span class="p"><span class="pre">[</span></span>
<span class="pre">'infer'</span>
<span class="p"><span class="pre">,</span></span><span class="w"> </span>
<span class="pre">'eval'</span>
<span class="p"><span class="pre">,</span></span><span class="w"> </span>
<span class="pre">'train'</span>
<span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">else_</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.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</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><span class="sig-paren">)</span><a class="headerlink" href="#padl.util_transforms.IfInMode" title="Permalink to this definition"></a></dt>
 <dd><p>Perform <em>if_</em> if called in mode <em>target_mode</em>, else perform <em>else_</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">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">transform</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">10</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span> <span class="o">*</span> <span class="mi">10</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">iis</span> <span class="o">=</span> <span class="n">IfInMode</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="s1">&#39;infer&#39;</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">iis</span><span class="o">.</span><span class="n">infer_apply</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">b</span> <span class="o">=</span> <span class="n">transform</span><span class="p">(</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span> <span class="o">*</span> <span class="mi">99</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">iim</span> <span class="o">=</span> <span class="n">IfInMode</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="s1">&#39;infer&#39;</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">iim</span><span class="o">.</span><span class="n">infer_apply</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
 <span class="go">11</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">iis</span><span class="o">.</span><span class="n">eval_apply</span><span class="p">([</span><span class="mi">1</span><span class="p">]))</span>
-<span class="go">[100]</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="nb">list</span><span class="p">(</span><span class="n">iim</span><span class="o">.</span><span class="n">eval_apply</span><span class="p">([</span><span class="mi">1</span><span class="p">]))</span>
+<span class="go">[99]</span>
 </pre></div>
 </div>
 <dl class="field-list simple">
@@ -239,7 +241,7 @@
 
 <dl class="py class">
 <dt class="sig sig-object py" id="padl.util_transforms.Try">
-<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">padl.util_transforms.</span></span><span class="sig-name descname"><span class="pre">Try</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">transform</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">catch_transform</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">exceptions</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Union</span><span class="p"><span class="pre">[</span></span><span class="pre">List</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Tuple</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Exception</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">else_transform</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">padl.Identity()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">finally_transform</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><span class="pre">padl.transforms.Transform</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">padl.Identity()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pd_name</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">str</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.util_transforms.Try" 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.util_transforms.</span></span><span class="sig-name descname"><span class="pre">Try</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">transform:</span> <span class="pre">padl.transforms.Transform,</span> <span class="pre">catch_transform:</span> <span class="pre">padl.transforms.Transform,</span> <span class="pre">exceptions:</span> <span class="pre">Union[List,</span> <span class="pre">Tuple,</span> <span class="pre">Exception],</span> <span class="pre">else_transform:</span> <span class="pre">padl.transforms.Transform</span> <span class="pre">=</span> <span class="pre">Identity(-?-),</span> <span class="pre">finally_transform:</span> <span class="pre">padl.transforms.Transform</span> <span class="pre">=</span> <span class="pre">Identity(-?-),</span> <span class="pre">pd_name:</span> <span class="pre">Optional[str]</span> <span class="pre">=</span> <span class="pre">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#padl.util_transforms.Try" title="Permalink to this definition"></a></dt>
 <dd><p>Perform <em>transform</em>. If this fails with any exception from <em>exceptions</em>, perform
 <em>catch_transform</em>. If <em>transform</em> is completed successfully, <em>else_transform</em> is performed
 with the output of <em>transform</em>. Regardless of any error occurring on the other Transform
@@ -259,7 +261,7 @@
 </dl>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.utils.html b/docs/apidocs/padl.utils.html
index 0df633cb..e3bf0281 100644
--- a/docs/apidocs/padl.utils.html
+++ b/docs/apidocs/padl.utils.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.utils &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.utils">
+  <section id="module-padl.utils">
 <span id="padl-utils"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.utils</span></code><a class="headerlink" href="#module-padl.utils" title="Permalink to this headline"></a></h1>
 <p>Utilities.</p>
 <dl class="py attribute">
@@ -175,7 +177,7 @@
 <dd><p>Transform factory for capturing attributes/ get-items.</p>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.version.html b/docs/apidocs/padl.version.html
index bdc2c108..5f38bcbe 100644
--- a/docs/apidocs/padl.version.html
+++ b/docs/apidocs/padl.version.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.version &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,10 +168,10 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.version">
+  <section id="module-padl.version">
 <span id="padl-version"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.version</span></code><a class="headerlink" href="#module-padl.version" title="Permalink to this headline"></a></h1>
 <p>Version.</p>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/apidocs/padl.wrap.html b/docs/apidocs/padl.wrap.html
index 89464a99..3aaf2f3d 100644
--- a/docs/apidocs/padl.wrap.html
+++ b/docs/apidocs/padl.wrap.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>padl.wrap &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -111,7 +112,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -165,7 +167,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="module-padl.wrap">
+  <section id="module-padl.wrap">
 <span id="padl-wrap"></span><h1><code class="docutils literal notranslate"><span class="pre">padl.wrap</span></code><a class="headerlink" href="#module-padl.wrap" title="Permalink to this headline"></a></h1>
 <p>Wrappers.</p>
 <dl class="py class">
@@ -197,7 +199,7 @@
 </dl>
 </dd></dl>
 
-</div>
+</section>
 
 
            </div>
diff --git a/docs/conf.py b/docs/conf.py
index 712464cb..7411f0a2 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -13,7 +13,6 @@
 import os
 import sys
 sys.path.insert(0, os.path.abspath('..'))
-import sphinx_book_theme
 
 
 
diff --git a/docs/genindex.html b/docs/genindex.html
index 1efe64d1..df72721f 100644
--- a/docs/genindex.html
+++ b/docs/genindex.html
@@ -110,7 +110,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -200,8 +201,6 @@ <h2 id="A">A</h2>
 <h2 id="B">B</h2>
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
-      <li><a href="apidocs/padl.html#padl.batch">batch (in module padl)</a>
-</li>
       <li><a href="apidocs/padl.html#padl.Batchify">Batchify (class in padl)</a>
 
       <ul>
@@ -210,6 +209,8 @@ <h2 id="B">B</h2>
       </ul></li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.CodeGraph.build">build() (padl.dumptools.var2mod.CodeGraph class method)</a>
+</li>
       <li><a href="apidocs/padl.transforms.html#padl.transforms.BuiltinTransform">BuiltinTransform (class in padl.transforms)</a>
 </li>
   </ul></td>
@@ -226,12 +227,14 @@ <h2 id="C">C</h2>
 </li>
       <li><a href="apidocs/padl.transforms.html#padl.transforms.ClassTransform">ClassTransform (class in padl.transforms)</a>
 </li>
-      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.CodeNode">CodeNode (class in padl.dumptools.var2mod)</a>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.CodeGraph">CodeGraph (class in padl.dumptools.var2mod)</a>
 </li>
-      <li><a href="apidocs/padl.print_utils.html#padl.print_utils.combine_multi_line_strings">combine_multi_line_strings() (in module padl.print_utils)</a>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.CodeNode">CodeNode (class in padl.dumptools.var2mod)</a>
 </li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="apidocs/padl.print_utils.html#padl.print_utils.combine_multi_line_strings">combine_multi_line_strings() (in module padl.print_utils)</a>
+</li>
       <li><a href="apidocs/padl.transforms.html#padl.transforms.Compose">Compose (class in padl.transforms)</a>
 </li>
       <li><a href="apidocs/padl.print_utils.html#padl.print_utils.create_arrow">create_arrow() (in module padl.print_utils)</a>
@@ -253,6 +256,10 @@ <h2 id="D">D</h2>
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
       <li><a href="apidocs/padl.dumptools.packagefinder.html#padl.dumptools.packagefinder.dump_packages_versions">dump_packages_versions() (in module padl.dumptools.packagefinder)</a>
+</li>
+  </ul></td>
+  <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.CodeGraph.dumps">dumps() (padl.dumptools.var2mod.CodeGraph method)</a>
 </li>
   </ul></td>
 </tr></table>
@@ -278,20 +285,20 @@ <h2 id="F">F</h2>
         <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.Finder.find">(padl.dumptools.var2mod.Finder method)</a>
 </li>
       </ul></li>
-      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.find_globals">find_globals() (in module padl.dumptools.var2mod)</a>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.find_codenode">find_codenode() (in module padl.dumptools.var2mod)</a>
 </li>
-      <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.find_in_function_def">find_in_function_def() (in module padl.dumptools.symfinder)</a>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.find_globals">find_globals() (in module padl.dumptools.var2mod)</a>
 </li>
       <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.find_in_ipython">find_in_ipython() (in module padl.dumptools.symfinder)</a>
 </li>
       <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.find_in_module">find_in_module() (in module padl.dumptools.symfinder)</a>
 </li>
-  </ul></td>
-  <td style="width: 33%; vertical-align: top;"><ul>
       <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.find_in_scope">find_in_scope() (in module padl.dumptools.symfinder)</a>
 </li>
       <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.find_in_source">find_in_source() (in module padl.dumptools.symfinder)</a>
 </li>
+  </ul></td>
+  <td style="width: 33%; vertical-align: top;"><ul>
       <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.Finder">Finder (class in padl.dumptools.var2mod)</a>
 </li>
       <li><a href="apidocs/padl.print_utils.html#padl.print_utils.format_argument">format_argument() (in module padl.print_utils)</a>
@@ -299,7 +306,17 @@ <h2 id="F">F</h2>
       <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.Scope.from_level">from_level() (padl.dumptools.symfinder.Scope method)</a>
 </li>
       <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.Scope.from_source">from_source() (padl.dumptools.symfinder.Scope class method)</a>
+
+      <ul>
+        <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.CodeNode.from_source">(padl.dumptools.var2mod.CodeNode class method)</a>
+</li>
+      </ul></li>
+      <li><a href="apidocs/padl.html#padl.fulldump">fulldump() (in module padl)</a>
+
+      <ul>
+        <li><a href="apidocs/padl.transforms.html#padl.transforms.fulldump">(in module padl.transforms)</a>
 </li>
+      </ul></li>
       <li><a href="apidocs/padl.transforms.html#padl.transforms.FunctionTransform">FunctionTransform (class in padl.transforms)</a>
 </li>
   </ul></td>
@@ -317,6 +334,8 @@ <h2 id="G">G</h2>
       <li><a href="apidocs/padl.dumptools.inspector.html#padl.dumptools.inspector.get_segment_from_frame">get_segment_from_frame() (in module padl.dumptools.inspector)</a>
 </li>
       <li><a href="apidocs/padl.dumptools.sourceget.html#padl.dumptools.sourceget.get_source">get_source() (in module padl.dumptools.sourceget)</a>
+</li>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.Finder.get_source_segments">get_source_segments() (padl.dumptools.var2mod.Finder method)</a>
 </li>
       <li><a href="apidocs/padl.dumptools.inspector.html#padl.dumptools.inspector.get_statement">get_statement() (in module padl.dumptools.inspector)</a>
 </li>
@@ -350,8 +369,6 @@ <h2 id="I">I</h2>
         <li><a href="apidocs/padl.transforms.html#padl.transforms.Identity">(class in padl.transforms)</a>
 </li>
       </ul></li>
-      <li><a href="apidocs/padl.html#padl.identity">identity (in module padl)</a>
-</li>
       <li><a href="apidocs/padl.html#padl.IfEval">IfEval (class in padl)</a>
 
       <ul>
@@ -364,18 +381,24 @@ <h2 id="I">I</h2>
         <li><a href="apidocs/padl.util_transforms.html#padl.util_transforms.IfInfer">(class in padl.util_transforms)</a>
 </li>
       </ul></li>
-  </ul></td>
-  <td style="width: 33%; vertical-align: top;"><ul>
       <li><a href="apidocs/padl.html#padl.IfInMode">IfInMode (class in padl)</a>
 
       <ul>
         <li><a href="apidocs/padl.util_transforms.html#padl.util_transforms.IfInMode">(class in padl.util_transforms)</a>
 </li>
       </ul></li>
+  </ul></td>
+  <td style="width: 33%; vertical-align: top;"><ul>
       <li><a href="apidocs/padl.html#padl.IfTrain">IfTrain (class in padl)</a>
 
       <ul>
         <li><a href="apidocs/padl.util_transforms.html#padl.util_transforms.IfTrain">(class in padl.util_transforms)</a>
+</li>
+      </ul></li>
+      <li><a href="apidocs/padl.html#padl.importdump">importdump() (in module padl)</a>
+
+      <ul>
+        <li><a href="apidocs/padl.transforms.html#padl.transforms.importdump">(in module padl.transforms)</a>
 </li>
       </ul></li>
       <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.increment_same_name_var">increment_same_name_var() (in module padl.dumptools.var2mod)</a>
@@ -651,6 +674,8 @@ <h2 id="P">P</h2>
       <li><a href="apidocs/padl.transforms.html#padl.transforms.TorchModuleTransform.post_load">post_load() (padl.transforms.TorchModuleTransform method)</a>
 </li>
       <li><a href="apidocs/padl.transforms.html#padl.transforms.TorchModuleTransform.pre_save">pre_save() (padl.transforms.TorchModuleTransform method)</a>
+</li>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.CodeGraph.print">print() (padl.dumptools.var2mod.CodeGraph method)</a>
 </li>
       <li><a href="apidocs/padl.dumptools.sourceget.html#padl.dumptools.sourceget.put_into_cache">put_into_cache() (in module padl.dumptools.sourceget)</a>
 </li>
@@ -660,12 +685,14 @@ <h2 id="P">P</h2>
 <h2 id="R">R</h2>
 <table style="width: 100%" class="indextable genindextable"><tr>
   <td style="width: 33%; vertical-align: top;"><ul>
-      <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.replace_star_imports">replace_star_imports() (in module padl.dumptools.symfinder)</a>
+      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.rename">rename() (in module padl.dumptools.var2mod)</a>
 </li>
-      <li><a href="apidocs/padl.dumptools.sourceget.html#padl.dumptools.sourceget.ReplaceString">ReplaceString (class in padl.dumptools.sourceget)</a>
+      <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.replace_star_imports">replace_star_imports() (in module padl.dumptools.symfinder)</a>
 </li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
+      <li><a href="apidocs/padl.dumptools.sourceget.html#padl.dumptools.sourceget.ReplaceString">ReplaceString (class in padl.dumptools.sourceget)</a>
+</li>
       <li><a href="apidocs/padl.dumptools.sourceget.html#padl.dumptools.sourceget.ReplaceStrings">ReplaceStrings (class in padl.dumptools.sourceget)</a>
 </li>
       <li><a href="apidocs/padl.transforms.html#padl.transforms.Rollout">Rollout (class in padl.transforms)</a>
@@ -748,8 +775,6 @@ <h2 id="U">U</h2>
       </ul></li>
   </ul></td>
   <td style="width: 33%; vertical-align: top;"><ul>
-      <li><a href="apidocs/padl.dumptools.var2mod.html#padl.dumptools.var2mod.unscope_graph">unscope_graph() (in module padl.dumptools.var2mod)</a>
-</li>
       <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.Scope.unscoped">unscoped() (padl.dumptools.symfinder.Scope method)</a>
 </li>
       <li><a href="apidocs/padl.dumptools.symfinder.html#padl.dumptools.symfinder.Scope.up">up() (padl.dumptools.symfinder.Scope method)</a>
diff --git a/docs/gettingstarted.html b/docs/gettingstarted.html
index 83823fe4..63493ec7 100644
--- a/docs/gettingstarted.html
+++ b/docs/gettingstarted.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Getting Started &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="static/pygments.css" type="text/css" />
@@ -110,7 +111,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -163,9 +165,9 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="tex2jax_ignore mathjax_ignore section" id="getting-started">
+  <section class="tex2jax_ignore mathjax_ignore" id="getting-started">
 <h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline"></a></h1>
-<div class="section" id="installation">
+<section id="installation">
 <h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h2>
 <p>Simply,</p>
 <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip install padl
@@ -173,8 +175,8 @@ <h2>Installation<a class="headerlink" href="#installation" title="Permalink to t
 </div>
 <p>PADL currently supports <strong>python</strong> <strong>3.8</strong> and <strong>3.9</strong>.</p>
 <p>Find the source at <a class="reference external" href="https://github.com/lf1-io/padl">https://github.com/lf1-io/padl</a>.</p>
-</div>
-<div class="section" id="project-structure">
+</section>
+<section id="project-structure">
 <h2>Project Structure<a class="headerlink" href="#project-structure" title="Permalink to this headline"></a></h2>
 <p>PADL’s chief abstractions are <code class="docutils literal notranslate"><span class="pre">padl.transforms.Transform</span></code> and <code class="docutils literal notranslate"><span class="pre">padl.transforms.Pipeline</span></code>. These are abstractions which include all elements of a typical deep learning workflow in <strong>PyTorch</strong>:</p>
 <ul class="simple">
@@ -189,18 +191,18 @@ <h2>Project Structure<a class="headerlink" href="#project-structure" title="Perm
 <p>Here’s an example of what this might like:</p>
 <p><span class="raw-html-m2r"><img src="img/schematic.png" width="300"></span></p>
 <p>The schematic represents a model which is a <code class="docutils literal notranslate"><span class="pre">Pipeline</span></code> instance with multiple steps and component parts; each of these are <code class="docutils literal notranslate"><span class="pre">Transform</span></code> instances. The model may be applied in one pass to single data points, or to batches of data.</p>
-</div>
-<div class="section" id="resources">
+</section>
+<section id="resources">
 <h2>Resources<a class="headerlink" href="#resources" title="Permalink to this headline"></a></h2>
 <ul class="simple">
 <li><p>Go to <a class="reference internal" href="usage.html#usage"><span class="std std-ref">Usage</span></a> for a concise but comprehensive manual.</p></li>
 <li><p>Find examples at <a class="reference external" href="https://github.com/lf1-io/padl/tree/main/notebooks">https://github.com/lf1-io/padl/tree/main/notebooks</a>.</p></li>
 <li><p>Post issues at <a class="reference external" href="https://github.com/lf1-io/padl/issues">https://github.com/lf1-io/padl/issues</a>.</p></li>
 </ul>
-</div>
-<div class="section" id="basic-usage">
+</section>
+<section id="basic-usage">
 <h2>Basic Usage<a class="headerlink" href="#basic-usage" title="Permalink to this headline"></a></h2>
-<div class="section" id="defining-transforms">
+<section id="defining-transforms">
 <h3>Defining transforms<a class="headerlink" href="#defining-transforms" title="Permalink to this headline"></a></h3>
 <p>Imports:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">this</span><span class="p">,</span> <span class="n">transform</span><span class="p">,</span> <span class="n">batch</span><span class="p">,</span> <span class="n">unbatch</span><span class="p">,</span> <span class="n">value</span>
@@ -271,8 +273,8 @@ <h3>Defining transforms<a class="headerlink" href="#defining-transforms" title="
 <span class="nb">print</span><span class="p">(</span><span class="nb">isinstance</span><span class="p">(</span><span class="n">cosine</span><span class="p">,</span> <span class="n">padl</span><span class="o">.</span><span class="n">transforms</span><span class="o">.</span><span class="n">Transform</span><span class="p">))</span>            <span class="c1"># prints &quot;True&quot;</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="defining-pipelines">
+</section>
+<section id="defining-pipelines">
 <h3>Defining pipelines<a class="headerlink" href="#defining-pipelines" title="Permalink to this headline"></a></h3>
 <p>Transforms may be combined using 3 functional primitives:</p>
 <p>Transform composition: <strong>compose</strong></p>
@@ -319,13 +321,13 @@ <h3>Defining pipelines<a class="headerlink" href="#defining-pipelines" title="Pe
 <span class="p">)</span> <span class="o">&gt;&gt;</span> <span class="n">loss</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="passing-inputs-between-transforms">
+</section>
+<section id="passing-inputs-between-transforms">
 <h3>Passing inputs between transforms<a class="headerlink" href="#passing-inputs-between-transforms" title="Permalink to this headline"></a></h3>
 <p>In a compose pipeline, if <code class="docutils literal notranslate"><span class="pre">transform_1</span></code> has 2 outputs and <code class="docutils literal notranslate"><span class="pre">transform_2</span></code> has 2 outputs, then in applying the composition: <code class="docutils literal notranslate"><span class="pre">transform_1</span> <span class="pre">&gt;&gt;</span> <span class="pre">transform_2</span></code> to data, the outputs of <code class="docutils literal notranslate"><span class="pre">transform_1</span></code> are passed to <code class="docutils literal notranslate"><span class="pre">transform_2</span></code> <strong>positionally</strong>. So output-1 of <code class="docutils literal notranslate"><span class="pre">transform_1</span></code> is passed to input-1 of <code class="docutils literal notranslate"><span class="pre">transform_2</span></code>. If <code class="docutils literal notranslate"><span class="pre">transform_2</span></code> has only one input, then the outputs of <code class="docutils literal notranslate"><span class="pre">transform_1</span></code> are passed as a tuple to <code class="docutils literal notranslate"><span class="pre">transform_2</span></code>.</p>
 <p>In an upcoming release, we plan to allow for passing inputs from one stage to the next using input/ output names.</p>
-</div>
-<div class="section" id="decomposing-pipelines">
+</section>
+<section id="decomposing-pipelines">
 <h3>Decomposing pipelines<a class="headerlink" href="#decomposing-pipelines" title="Permalink to this headline"></a></h3>
 <p>Often it is instructive to look at slices of a pipeline – this helps with e.g. checking intermediate computations:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">preprocess</span><span class="p">[:</span><span class="mi">3</span><span class="p">]</span>
@@ -335,8 +337,8 @@ <h3>Decomposing pipelines<a class="headerlink" href="#decomposing-pipelines" tit
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">step_1</span> <span class="o">=</span> <span class="n">pipeline</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="naming-transforms-inside-models">
+</section>
+<section id="naming-transforms-inside-models">
 <h3>Naming transforms inside models<a class="headerlink" href="#naming-transforms-inside-models" title="Permalink to this headline"></a></h3>
 <p><code class="docutils literal notranslate"><span class="pre">Transform</span></code> instances may be named inline, inside pipelines:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">s</span> <span class="o">=</span> <span class="p">(</span><span class="n">transform_1</span> <span class="o">-</span> <span class="s1">&#39;a&#39;</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">transform_2</span> <span class="o">-</span> <span class="s1">&#39;b&#39;</span><span class="p">)</span>
@@ -346,8 +348,8 @@ <h3>Naming transforms inside models<a class="headerlink" href="#naming-transform
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nb">print</span><span class="p">(</span><span class="n">s</span><span class="p">[</span><span class="s1">&#39;a&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="n">s</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>    <span class="c1"># prints &quot;True&quot;</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="applying-transforms-to-data">
+</section>
+<section id="applying-transforms-to-data">
 <h3>Applying transforms to data<a class="headerlink" href="#applying-transforms-to-data" title="Permalink to this headline"></a></h3>
 <p>To pass single data points may be passed through the pipeline:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">prediction</span> <span class="o">=</span> <span class="n">t</span><span class="o">.</span><span class="n">infer_apply</span><span class="p">(</span><span class="s1">&#39;the cat sat on the mat .&#39;</span><span class="p">)</span>
@@ -371,8 +373,8 @@ <h3>Applying transforms to data<a class="headerlink" href="#applying-transforms-
     <span class="o">...</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="training">
+</section>
+<section id="training">
 <h3>Training<a class="headerlink" href="#training" title="Permalink to this headline"></a></h3>
 <p>Important methods such as all model parameters are accessible via <code class="docutils literal notranslate"><span class="pre">.pd_*</span></code>.:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">o</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">optim</span><span class="o">.</span><span class="n">Adam</span><span class="p">(</span><span class="n">pipeline</span><span class="o">.</span><span class="n">pd_parameters</span><span class="p">(),</span> <span class="n">lr</span><span class="o">=</span><span class="n">LR</span><span class="p">)</span>
@@ -385,8 +387,8 @@ <h3>Training<a class="headerlink" href="#training" title="Permalink to this head
     <span class="n">o</span><span class="o">.</span><span class="n">step</span><span class="p">()</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="saving-loading">
+</section>
+<section id="saving-loading">
 <h3>Saving/ Loading<a class="headerlink" href="#saving-loading" title="Permalink to this headline"></a></h3>
 <p>Saving:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">pipeline</span><span class="o">.</span><span class="n">pd_save</span><span class="p">(</span><span class="s1">&#39;test.padl&#39;</span><span class="p">)</span>
@@ -399,9 +401,9 @@ <h3>Saving/ Loading<a class="headerlink" href="#saving-loading" title="Permalink
 </div>
 <p>See <a class="reference internal" href="advanced/saving.html#saving"><span class="std std-ref">Saving</span></a> for details.</p>
 <p>For a full notebook example see <code class="docutils literal notranslate"><span class="pre">notebooks/02_nlp_example.ipynb</span></code> in the GitHub project.</p>
-</div>
-</div>
-</div>
+</section>
+</section>
+</section>
 
 
            </div>
diff --git a/docs/index.html b/docs/index.html
index cce7ba97..61589c4e 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Welcome to PADL’s documentation! &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="static/pygments.css" type="text/css" />
@@ -111,7 +112,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -164,7 +166,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="tex2jax_ignore mathjax_ignore section" id="welcome-to-padl-s-documentation">
+  <section class="tex2jax_ignore mathjax_ignore" id="welcome-to-padl-s-documentation">
 <h1>Welcome to PADL’s documentation!<a class="headerlink" href="#welcome-to-padl-s-documentation" title="Permalink to this headline"></a></h1>
 <p><strong>Pipeline</strong> abstractions for deep learning.</p>
 <div class="toctree-wrapper compound">
@@ -213,7 +215,7 @@ <h1>Welcome to PADL’s documentation!<a class="headerlink" href="#welcome-to-pa
 </li>
 </ul>
 </div>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/modules.html b/docs/modules.html
index 3416211e..4b48b1cb 100644
--- a/docs/modules.html
+++ b/docs/modules.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>API Documentation &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -165,7 +167,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="tex2jax_ignore mathjax_ignore section" id="api-documentation">
+  <section class="tex2jax_ignore mathjax_ignore" id="api-documentation">
 <h1>API Documentation<a class="headerlink" href="#api-documentation" title="Permalink to this headline"></a></h1>
 <div class="toctree-wrapper compound">
 <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
@@ -187,7 +189,7 @@ <h1>API Documentation<a class="headerlink" href="#api-documentation" title="Perm
 <li class="toctree-l1"><a class="reference internal" href="apidocs/padl.wrap.html"><code class="docutils literal notranslate"><span class="pre">padl.wrap</span></code></a></li>
 </ul>
 </div>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/objects.inv b/docs/objects.inv
index d256cc9d..5e27e6ad 100644
Binary files a/docs/objects.inv and b/docs/objects.inv differ
diff --git a/docs/py-modindex.html b/docs/py-modindex.html
index 3bb1961f..db0845ed 100644
--- a/docs/py-modindex.html
+++ b/docs/py-modindex.html
@@ -113,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
diff --git a/docs/search.html b/docs/search.html
index bb46d424..35d57aa3 100644
--- a/docs/search.html
+++ b/docs/search.html
@@ -113,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
diff --git a/docs/searchindex.js b/docs/searchindex.js
index faaf14a3..d52cec95 100644
--- a/docs/searchindex.js
+++ b/docs/searchindex.js
@@ -1,1 +1,1 @@
-Search.setIndex({docnames:["README","advanced","advanced/saving","apidocs/padl","apidocs/padl.dumptools","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","gettingstarted","index","modules","usage","usage/apply","usage/combining_transforms","usage/creating_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.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","gettingstarted.md","index.md","modules.md","usage.md","usage/apply.md","usage/combining_transforms.md","usage/creating_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,"-","inspector"],[6,0,0,"-","packagefinder"],[7,0,0,"-","serialize"],[8,0,0,"-","sourceget"],[9,0,0,"-","symfinder"],[10,0,0,"-","var2mod"]],"padl.dumptools.inspector":[[5,1,1,"","CallInfo"],[5,4,1,"","caller_frame"],[5,4,1,"","caller_module"],[5,4,1,"","get_segment_from_frame"],[5,4,1,"","get_statement"],[5,4,1,"","get_surrounding_block"],[5,4,1,"","non_init_caller_frameinfo"],[5,4,1,"","outer_caller_frameinfo"],[5,4,1,"","trace_this"]],"padl.dumptools.inspector.CallInfo":[[5,3,1,"","module"]],"padl.dumptools.packagefinder":[[6,4,1,"","dump_packages_versions"],[6,4,1,"","get_packages"],[6,4,1,"","get_version"]],"padl.dumptools.serialize":[[7,1,1,"","Serializer"],[7,4,1,"","json_serializer"],[7,4,1,"","load_json"],[7,4,1,"","save_json"],[7,4,1,"","value"]],"padl.dumptools.serialize.Serializer":[[7,5,1,"","save"],[7,5,1,"","save_all"],[7,3,1,"","varname"]],"padl.dumptools.sourceget":[[8,1,1,"","ReplaceString"],[8,1,1,"","ReplaceStrings"],[8,4,1,"","cut"],[8,4,1,"","get_module_source"],[8,4,1,"","get_source"],[8,4,1,"","original"],[8,4,1,"","put_into_cache"]],"padl.dumptools.sourceget.ReplaceString":[[8,5,1,"","cut"]],"padl.dumptools.sourceget.ReplaceStrings":[[8,5,1,"","cut"]],"padl.dumptools.symfinder":[[9,6,1,"","NameNotFound"],[9,1,1,"","Scope"],[9,1,1,"","ScopedName"],[9,4,1,"","find"],[9,4,1,"","find_in_function_def"],[9,4,1,"","find_in_ipython"],[9,4,1,"","find_in_module"],[9,4,1,"","find_in_scope"],[9,4,1,"","find_in_source"],[9,4,1,"","replace_star_imports"],[9,4,1,"","split_call"]],"padl.dumptools.symfinder.Scope":[[9,5,1,"","empty"],[9,5,1,"","from_level"],[9,5,1,"","from_source"],[9,5,1,"","global_"],[9,5,1,"","is_global"],[9,3,1,"","module_name"],[9,5,1,"","toplevel"],[9,5,1,"","unscoped"],[9,5,1,"","up"]],"padl.dumptools.var2mod":[[10,1,1,"","CodeNode"],[10,1,1,"","Finder"],[10,1,1,"","Vars"],[10,4,1,"","find_globals"],[10,4,1,"","increment_same_name_var"],[10,4,1,"","unscope_graph"]],"padl.dumptools.var2mod.Finder":[[10,5,1,"","find"],[10,5,1,"","generic_visit"]],"padl.dumptools.var2mod.Vars":[[10,7,1,"","globals"],[10,7,1,"","locals"]],"padl.exceptions":[[11,6,1,"","WrongDeviceError"]],"padl.print_utils":[[12,4,1,"","combine_multi_line_strings"],[12,4,1,"","create_arrow"],[12,4,1,"","create_reverse_arrow"],[12,4,1,"","format_argument"],[12,4,1,"","make_bold"],[12,4,1,"","make_green"],[12,4,1,"","visible_len"]],"padl.transforms":[[13,1,1,"","AtomicTransform"],[13,1,1,"","Batchify"],[13,1,1,"","BuiltinTransform"],[13,1,1,"","ClassTransform"],[13,1,1,"","Compose"],[13,1,1,"","FunctionTransform"],[13,1,1,"","Identity"],[13,1,1,"","Map"],[13,1,1,"","Parallel"],[13,1,1,"","Pipeline"],[13,1,1,"","Rollout"],[13,1,1,"","TorchModuleTransform"],[13,1,1,"","Transform"],[13,1,1,"","Unbatchify"],[13,4,1,"","group"],[13,4,1,"","load"],[13,4,1,"","save"]],"padl.transforms.ClassTransform":[[13,3,1,"","source"]],"padl.transforms.FunctionTransform":[[13,3,1,"","source"]],"padl.transforms.Pipeline":[[13,5,1,"","grouped"],[13,5,1,"","pd_forward_device_check"],[13,5,1,"","pd_to"]],"padl.transforms.TorchModuleTransform":[[13,5,1,"","post_load"],[13,5,1,"","pre_save"]],"padl.transforms.Transform":[[13,5,1,"","eval_apply"],[13,5,1,"","infer_apply"],[13,5,1,"","pd_call_transform"],[13,3,1,"","pd_device"],[13,3,1,"","pd_forward"],[13,5,1,"","pd_forward_device_check"],[13,5,1,"","pd_get_loader"],[13,3,1,"","pd_layers"],[13,3,1,"","pd_name"],[13,5,1,"","pd_parameters"],[13,5,1,"","pd_post_load"],[13,3,1,"","pd_postprocess"],[13,5,1,"","pd_pre_save"],[13,3,1,"","pd_preprocess"],[13,5,1,"","pd_save"],[13,5,1,"","pd_set_mode"],[13,5,1,"","pd_to"],[13,5,1,"","pd_varname"],[13,5,1,"","pd_zip_save"],[13,5,1,"","train_apply"]],"padl.util_transforms":[[14,1,1,"","IfEval"],[14,1,1,"","IfInMode"],[14,1,1,"","IfInfer"],[14,1,1,"","IfTrain"],[14,1,1,"","Try"]],"padl.utils":[[15,7,1,"","same"]],"padl.wrap":[[17,1,1,"","PatchedModule"],[17,4,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"],[3,2,1,"","batch"],[4,0,0,"-","dumptools"],[11,0,0,"-","exceptions"],[3,4,1,"","group"],[3,2,1,"","identity"],[3,4,1,"","load"],[12,0,0,"-","print_utils"],[3,4,1,"","save"],[3,4,1,"","transform"],[13,0,0,"-","transforms"],[3,2,1,"","unbatch"],[14,0,0,"-","util_transforms"],[15,0,0,"-","utils"],[3,4,1,"","value"],[16,0,0,"-","version"],[17,0,0,"-","wrap"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","data","Python data"],"3":["py","property","Python property"],"4":["py","function","Python function"],"5":["py","method","Python method"],"6":["py","exception","Python exception"],"7":["py","attribute","Python attribute"]},objtypes:{"0":"py:module","1":"py:class","2":"py:data","3":"py:property","4":"py:function","5":"py:method","6":"py:exception","7":"py:attribute"},terms:{"0":[0,3,5,8,9,10,13,18,25,26],"02_nlp_exampl":18,"1":[0,2,3,8,9,10,13,14,18,23,25,26,27],"10":[0,3,14,18,24],"100":[2,3,14,23,24,25,26],"1000":24,"11":[3,5,14],"123":[5,9],"13":8,"2":[0,3,8,9,10,13,18,23,25,26],"20":0,"200":25,"244":23,"3":[0,3,5,9,13,18,23,25],"300":25,"4":[10,25],"5":8,"512":18,"64":18,"8":[0,18],"9":[0,8,18],"abstract":[0,13,18,19,30],"case":[2,8,9,23],"catch":[14,21],"class":[2,3,5,7,8,9,10,13,14,17,18,24,29],"const":2,"default":[3,5,6,7,9,13,14,23],"do":[2,3,11,13,21,22,24],"final":[14,18,25],"function":[0,2,3,5,7,9,10,13,17,18,23,24,30],"import":[0,2,3,9,10,13,14,17,18,19,23,24,25,28,29],"int":[5,8,9,10,12,13],"new":[8,9],"return":[0,2,5,6,7,8,9,13,18,22,23,24,25,26,29],"static":13,"super":18,"true":[3,8,9,10,12,13,17,18,23,26],"try":[3,5,8,13,14,17,21,25],"var":10,A:[5,8,9,13,18,30],As:[2,29],By:23,For:[2,18,23,24,25],If:[0,2,3,7,8,9,12,13,14,18],In:[8,9,18,23,24],It:[2,5,9,13,22,24,27],No:14,One:23,The:[2,3,5,7,8,9,12,13,14,18,21,23,29,30],These:[2,13,18],To:[2,3,8,13,18,22,23,29],With:30,_:[2,18],____________:12,__call__:[2,18,24],__file__:2,__getitem__:18,__init__:[2,5,18,24],__main__:9,_ast:[9,10],_pd_main:2,_thingfind:9,_trace_thi:5,about:[5,13,27,30],abov:[18,23],absolut:2,accept:13,access:[9,18,26,29],ad:[3,9,13,22,30],adam:[18,27],adapt:27,add:[2,3,8,13,24,25,26],add_n:2,addconst:2,addfirst:25,addit:8,advanc:19,after:[2,3,13,27],again:2,ai:0,airplan:22,alia:10,all:[0,2,5,7,10,11,13,17,18,21,22,23,27,28],allow:[0,8,9,18,23,25],along:27,also:[2,3,13,18,22,24,25],an:[0,2,5,8,9,10,12,13,18,22,25,27,30],analog:25,ani:[7,12,13,14,18],anoth:12,anyth:[2,19],apach:0,api:19,append:[2,7,18],appli:[3,12,13,14,19,21,23,29],applic:25,ar:[2,3,7,9,10,13,18,21,23,24,27,28,29],arbitrari:[0,25],arg:[2,5,13,18,22,26],argument:[2,5,9,12,13,22],aris:23,arrai:[2,25],arrow:12,ascii:12,assign:[9,13],ast:[6,9,10],ast_nod:10,atom:13,atomictransform:13,attribut:[5,8,15],augment:[23,25,27,29],automat:[2,3,13,22],avail:[5,22],awar:2,axxxxxxxxxxxxxxxxxxxx:8,b:[3,8,9,10,13,14,18],back:14,backward:[18,27],bar:[13,23],base:[0,7,13],batch:[0,3,13,18,21,22,23,27,29,30],batch_first:18,batch_siz:[18,22,27],batchifi:[3,9,13,21],baz:23,becom:[5,9,18,23,24],been:13,befor:[2,5,13,22],being:[3,9,13,25],below:10,berlin:0,between:23,big:2,blob:0,block:[5,18],bodi:[2,5,9],boilerpl:30,bold:12,bool:[3,5,8,9,13],both:[2,8,27],branch:18,build:[0,2,9,30],build_my_transform:2,builder:0,built:[18,27],builtintransform:13,c:[3,13],cach:8,call:[3,5,7,9,10,13,14,24,29],call_info:13,call_sourc:9,callabl:[3,5,7,13,17,18,24],caller:5,caller_fram:5,caller_modul:5,callinfo:[5,13],calling_scop:9,can:[0,2,5,8,9,13,14,18,22,23,24,25,26,27,28,29,30],canb:22,cannot:2,capabl:27,captur:15,carri:14,cat:[18,22],catch_transform:14,caveat:2,cell:8,central:30,chang:[2,5,14],charact:12,check:[13,18],checkpoint:28,chief:18,child:[11,13],child_transform:11,children:13,citizen:18,classifi:[23,29],classmethod:[7,9],classtransform:13,claus:14,clean:[2,18],close:25,co:18,code:[0,2,3,5,6,7,8,9,13,27,30],code_of_conduct:0,codegraph:7,codenod:10,col:[5,8],collect:[8,13,21],column:5,com:[0,18],combin:[12,13,18,19,21,24,30],combine_multi_line_str:12,come:[17,24],comment:5,common:23,complet:[5,14],complex:[2,13,26,30],compon:[0,18,23],compos:[13,18,26,29],composit:[18,23],comprehens:[0,18],compress:[3,13],comput:18,concat_low:25,concis:[0,18,21],condit:[14,21],condition:23,conduct:0,conflict:[2,10],consid:2,consist:2,constant:[2,8],construct:13,contain:[2,5,7,8,9,11,12,13,27,28],context:[5,13],continu:[23,29],contrast:13,contribut:19,conveni:27,convert:[0,9,24,27,29],coor:12,coordin:12,correct:13,correspond:[9,29],cosin:18,could:[2,9,23],counter:10,cpu:[3,13],creat:[2,5,7,9,10,12,13,19,21,22,23,27,28,30],create_arrow:12,create_reverse_arrow:12,crop:23,cuda:[13,27],current:[0,2,9,18],custom:[13,30],cut:8,data:[2,13,19,21,29,30],dataload:[13,22,30],datapoint:[13,23],dataset:2,debug:30,decor:[3,13,17,18,24],deep:[0,2,18,19,23,29,30],def:[0,2,5,13,18,24,25,26,29],def_sourc:9,defin:[7,9,21,28,29],definit:18,depend:[2,28],detail:[5,13,18,23],determin:[3,5,8,9,13,17],develop:0,devic:[3,11,13,22],di:30,dict:[8,18],dictionari:[2,13,18],differ:[8,22,29],dim:[3,13],dimens:[3,13,22,30],directli:13,directori:2,disabl:[12,22],document:[5,13],doe:[13,22],doesn:[3,14],dog:[18,22],don:[2,3,5,12,13,17],done:[13,22],down:2,drop:[5,9],drop_n:[5,9],dump:[6,7,13],dump_packages_vers:6,dumptool:[13,19,20],dure:[3,13,23,25],dynam:18,e:[3,9,13,18],each:[2,13,18,22,29],easili:30,ecosystem:0,either:[2,8],eleg:30,element:[13,18,23,29],els:[3,14],else_:[3,14],else_transform:14,emb:18,embed:18,emit:18,empti:[5,9],enabl:30,end:[3,12,13],enter:5,entir:24,entiti:9,entri:2,enumer:2,eos_valu:18,equival:25,error:14,escap:12,eval:[3,13,14,21,22,25],eval_appli:[3,13,14,18,22,25],evalu:29,even:23,event:5,everi:12,everyth:[21,23,24],exactli:23,exampl:[0,2,3,5,8,9,10,12,13,14,17,18,22,25,29],except:[9,14,19,20,21],execut:[2,5,23],exist:[3,10,13],expect:[2,3,8,13,22],explicit:[8,10],explicitli:13,extens:[3,13],extra:[14,19,21,27],extract:5,f1:13,f2:13,f:[2,3,8,9,10,13],factori:15,fail:14,fall:14,fals:[3,5,9,12,13,17],few:2,field:10,file:[2,3,8,13,25,28],file_suffix:7,fileexistserror:[3,13],filenam:[2,8,13,25],filter_builtin:10,finally_transform:14,find:[0,6,9,10,18],find_glob:10,find_in_function_def:9,find_in_ipython:9,find_in_modul:9,find_in_scop:9,find_in_sourc:9,finder:10,finish_right:12,first:[3,5,8,12,13,18,23],flat:23,flatten:[3,13,23],flexibl:30,folder:[2,3,13,28],follow:[2,5,21],foo:[13,23],force_overwrit:[3,13],form:[9,13,24,30],formal:30,format:[6,12,29,30],format_argu:12,forward:[0,13,18,19,21,22,24],forward_pass:18,found:[5,9],frame:[5,8],frameinfo:5,from:[0,2,3,5,8,9,13,14,18,19,24,25,27,28,29],from_col:8,from_level:9,from_lin:8,from_sourc:9,front:5,full:[0,18],functiontransform:13,fundament:13,futur:2,g:[9,13,18],gener:[13,22],generic_visit:10,germani:0,get:[2,5,6,8,9,12,13,15,19,21,23,25],get_module_sourc:8,get_packag:6,get_segment_from_fram:5,get_sourc:8,get_stat:5,get_surrounding_block:5,get_vers:6,getitem:[5,26],github:[0,18],give:8,given:[3,5,6,8,9,10,13],global:[2,9,10],global_:9,globals_:10,go:[0,10,18],good:13,gotten:8,gpu:[13,22,29,30],gradient:[13,18,22,30],graph:[10,18],great:0,green:12,group:[3,13,21],gru:18,ha:[2,8,13,18,23,27,29],hacki:5,handl:22,happen:[14,29],have:[0,13,27],head:23,hello:25,help:[13,18],helper:[3,7],here:[2,5,18],hidden:24,hierarchi:9,histori:9,hood:22,how:[9,13,22,23,24,26,28,29,30],howev:2,http:[0,18],i:[2,3,9,13],id:8,ident:[3,13,14,21,26],identifi:9,if_:[3,14],ifev:[3,14,21,25],iff:9,ifinf:[3,14,21,25],ifinmod:[3,14],iftrain:[3,14,18,21,23,25],ignore_scop:[3,5,13,17],ii:[3,14],imag:[12,29],implement:[13,18,24],includ:[2,8,13,18,27,28],increment:10,increment_same_name_var:10,indent:5,index:[13,18],indic:[9,13],individu:[18,23],infer:[3,13,14,21,22,25,27,29],infer_appli:[3,13,14,18,22,25],infer_pipelin:27,inform:[5,13],initi:[2,13,27],inlin:[5,13,18],innov:0,input:[3,8,12,13,22,23,25],insert:8,insid:14,inspect:[5,8,13,30],inspector:[13,19,20],instanc:[2,18,23,24,27],instanti:18,instead:[2,3,5,13,17],instruct:18,interact:[2,28,30],interest:0,intermedi:18,intern:22,introduct:19,invers:[3,13],io:[0,18],ipynb:18,ipython:[2,8,9,26],is_glob:9,isinst:[8,10,17,18],issu:[0,18],item:[0,3,13,15,22,25],iter:[13,22,27],its:[9,13],itself:5,jpg:22,json:[2,7],json_seri:7,just:[3,13],keep:23,kei:8,keyword:[0,13],kic:18,know:21,kwarg:[13,18],l1:24,l2:24,lab:0,lambda:[3,13,14,18,23,24,25],larg:[2,18],larger:[5,18],largest:5,last:[2,8,12,13],layer1:27,layer2:27,layer:[0,13,18],learn:[0,18,19,22,23,24,27,28,29,30],left_shift:18,len:[2,18],length:[12,23],level:[2,5,9,10,23],lf1:[0,18],licens:19,like:[2,18,22,29],limit:2,lin:24,line:[5,8,9,12],linear:[0,18,24],lineno:[5,9],link:18,list:[2,3,6,8,9,10,12,13,14,22,25,27,28],liter:[3,5,13,14],lm:18,load:[2,3,7,13,19,21,22,23,27,29],load_data:2,load_funct:7,load_imag:[23,29],load_json:7,loader:[7,13],loc:8,local:10,locat:[5,8],log10:24,look:[0,2,5,9,18],lookup:[27,29],loop:[9,27],loos:18,loss:[0,18,23,27],lower:25,lower_cas:18,lr:[18,27],macro:23,made:[5,13],mai:[0,18],main:[0,9,11,18],maintain:8,make:[0,12,21,27],make_bold:12,make_green:12,man:18,manual:[0,18],map:[13,18],mark:[3,7,13],mat:18,match:[3,5,11,14],math:24,md:0,mean:[2,23],messi:2,method:[5,13,18,21,25],might:[2,18,25],minim:30,minus100:24,minusx:[24,25,26],mlp:24,mml:24,mode:[3,13,14,22],model:[0,2,13,27,29],model_pass:23,modifi:8,modul:[3,5,6,7,8,9,13,17,18,19,21,23,24,26,28,29],module_nam:[5,9],more:[2,5,23,30],most:[23,29],mother:11,mother_transform:11,move:[3,13,23],much:30,multi:[5,12,30],multipl:[2,13,18,22,24,27],multiprocess:13,must:[2,5,13,23],my:2,my_classifi:[22,29],my_classifier_transform:[23,29],my_pipelin:[0,2,27,28],myfil:2,myfunct:5,mykei:8,myload:2,mypipelin:28,mypytorchlay:27,mysav:2,mytransform:2,n:[5,9,10,13],n_final_row:12,n_in:24,n_initial_row:12,n_out:24,n_to_add:2,n_word:18,name:[2,3,5,6,9,10,13,14,29],namenotfound:9,natur:22,need:[2,7,13,19],nest:[9,26,27],next:[18,22,23,24,26,27,28,29,30],nextmodul:5,nn:[0,13,18,24],node:[6,9,10],nodetyp:10,non:[8,10],non_init_caller_frameinfo:5,none:[3,5,7,9,10,13,14,17],nonetyp:10,normal:[2,8,13,18],not_found:2,note:[2,5],notebook:[0,2,18,30],noth:[3,13,21],now:2,np:[2,17,24,25],npy:2,nth:23,num_work:[18,22,27],number:[5,9,10,12],numpi:[2,17,18,24],o:18,object:[5,8,9,13,18,25],obtain:18,occur:14,offset:5,often:[18,25],one:[2,3,9,12,13,14,18,23,29],onli:[2,18,23,25],open:[2,23,25],open_fil:25,oper:[18,23],optim:[18,27],option:[3,5,7,13,14],order:13,ordereddict:13,origin:[5,8],other:[2,13,14],otherwis:[3,13,14],out:[5,8,9,10,14,17,23,24],outer:5,outer_caller_frameinfo:5,output:[3,13,14,18,22,23,29],over:[12,13,18,23,27],overlap:8,overrid:13,overwrit:[3,13],own:2,packag:[0,2,6,28],packagefind:[19,20],pad:12,padl:[2,18,20,23,24,25,26,28,29,30],padl_value_0:2,page:21,parallel:[3,13,18],param:13,paramet:[2,3,5,6,7,8,9,11,12,13,14,17,18,28],parent:[2,17],parenthes:23,pars:10,part:[8,13,18,21,22,29],parti:2,particular:24,pass:[0,2,3,13,22],patch:17,patchedmodul:17,path:[2,3,7,13,23,29],pathlib:[2,3,7,13],pd_:18,pd_call_transform:13,pd_devic:13,pd_forward:[13,22,29],pd_forward_device_check:13,pd_get_load:13,pd_group:13,pd_layer:[13,27],pd_name:[13,14],pd_np:17,pd_paramet:[13,18,27],pd_post_load:13,pd_postprocess:[13,29],pd_pre_sav:13,pd_preprocess:[13,29],pd_save:[13,18],pd_set_mod:13,pd_to:[13,27],pd_varnam:13,pd_zip_sav:13,perform:[3,13,14],pick:2,piec:9,pil:23,piltotensor:23,pip:[0,18],pipelin:[0,13,19,21,22,24,26,27,28,29],plan:18,pleas:0,pluson:2,plustwo:2,point:18,posit:8,position:18,possibl:[2,5,13,18,24,27],post:[0,18,29],post_load:13,postprocess:[3,13,18,19,21,22,23],potenti:[2,5,18],power:23,pre:[0,8,18,29],pre_sav:13,preced:12,predict:[18,23,27],prepar:0,prepend:10,preprocess:[3,13,18,19,21,22,23,27,30],preprocess_imag:23,pretti:26,prevent:[2,3,10,13],previous:2,primit:18,print:[5,12,13,18,19,21,28],print_util:[19,20],process:[0,2,18,22,29,30],progress:13,propag:13,properti:[5,7,9,13],provid:[2,23],pt:2,put:8,put_into_cach:8,py:[2,28],pypi:2,python:[0,2,5,9,18,23,24,28],pytorch:[0,13,18,19,21,22,23,24,26,28,29],rais:[3,5,13],rand:17,random:17,randomresizedcrop:23,randomrot:23,rang:[2,18],rather:[2,5,13],re:[0,23],read:[2,21,22,25,26,30],read_from_path:25,readabl:29,recreat:2,recurs:[3,13,18],refer:[18,21],referenc:18,reflex:18,regardless:14,releas:18,relu:24,rememb:27,remov:[3,5,13,22],renam:[2,10],repeat:[2,23],repl:8,replac:[8,9],replace_cach:8,replace_star_import:9,replacestr:8,repres:[9,18],reproduc:30,requir:[2,5],reshap:29,resiz:23,resnet18:[23,29],respect:[3,13,25],respons:[2,29],rest:5,result:[2,3,5,8,13,23],return_loc:5,return_parti:9,right_shift:18,rnn:18,roll:23,rollout:[3,13,18],row:5,rstring:8,s:[3,5,6,7,8,9,13,14,18,21,22,24,27,28,29],same:[3,5,8,10,13,15,21,23,27],sat:18,save:[1,3,7,13,19,21,22,30],save_al:7,save_funct:7,save_json:7,saver:7,scalar:18,schemat:18,scope:[3,5,9,10,13,17],scoped_nam:10,scopednam:[9,10],scopelist:9,scopemap:[7,10],search:[9,13],second:[2,3,13,23],section:[8,22,23,24,26,27,28,29,30],see:[0,2,3,5,13,18,22],segment:[5,9],segment_typ:5,self:[2,9,13,18,24],send:[13,22,27,30],sequenc:[12,13,23],seri:13,serial:[3,13,19,20],session:[2,28],set:[2,7,10,13,22],settrac:5,sever:18,sh:18,should:[2,3,5,7,13],similar:2,simpli:[2,18],sin:24,singl:[0,13,18,22,23],size:22,slice:[18,19,21,28,30],so:[9,18,23],some:[2,23,27],somemodul:10,someobject:2,someth:[2,25],sometim:2,soon:5,sourc:[5,8,9,10,13,18],sourceget:[19,20],space:[5,12],special:[23,25,29],specifi:[3,8,9,13,22],split:[2,9,18],split_cal:9,split_str:18,stack:5,stage:[18,19,21,22,23],stand:29,standard:[0,18],star:[2,9],start:[3,9,12,13,19,21],start_left:12,state_dict:27,statement:[2,5,9,14],step:[13,18,23,27],step_1:18,stop:30,store:[2,3,7,27,28],str:[2,3,5,7,8,9,10,12,13,14],straightforward:18,string:[6,7,8,9,12,13],sub:[8,13,23,26],subclass:9,subnod:10,substr:8,subval:2,successfulli:14,suffix:2,suggest:29,superimpos:12,support:[0,2,18],surround:[5,9],sy:5,symbol:[2,9],symfind:[5,10,19,20],t1:[13,23,26],t2:[13,23,26],t3:[13,23,26],t4:26,t5:26,t:[2,3,5,12,13,14,17,18,23,25],take:[12,23],taken:[8,24],target:[5,23],target_mod:[3,14],tensor:[0,3,13,18,22],term:18,test:18,text:[0,2],textcorpu:2,th:18,than:2,them:[2,3,13,21,23,27],thereof:[3,13],thi:[2,3,5,8,9,12,13,14,18,23,24,26,27,28],thing:[2,3,7,8,9],third:2,those:[2,10,27,29],thought:18,three:[22,23],through:[10,18,23],thu:23,time:2,to_col:8,to_integ:18,to_lin:8,to_tensor:18,toarrai:2,togeth:[18,26],tointeg:18,token:18,too:[24,26,28],top:[9,10,12],topic:19,topk:0,toplevel:[3,5,9,13,17],topolog:0,torch:[0,13,18,24,27],torchmoduletransform:[13,18],torchvis:[18,23,29],totensor:[23,29],trace:5,trace_thi:5,tracefunc:5,track:2,train:[3,13,14,21,22,25,27,29],train_appli:[13,18,22,27],train_data:[18,27],train_model:27,train_pipelin:[18,27],training_pipelin:23,transform:[0,3,9,11,14,15,17,19,20,21,26,28,29],transform_1:18,transform_2:18,transpar:[12,30],tree:[0,9,10,18],tupl:[2,3,5,9,10,13,14,18,23],turn:13,tvt:23,two:2,txt:[2,28],type:[5,10],typic:[13,18],unbatch:[0,3,18,21,23,29],unbatchifi:[3,13],under:[0,22],undo:2,unind:5,union:[3,10,13,14],uniqu:13,unk:18,unscop:9,unscope_graph:10,unsqueez:[3,13],up:[2,9],upcom:18,updat:22,us:[0,2,3,5,6,7,8,9,10,12,13,14,17,18,19,21,22,23,24,25,26,29,30],usag:[0,19],use_replace_cach:8,user:0,usual:29,util:[5,6,12,13,19,20,23,27],util_transform:[19,20],v:12,val:[2,3,7],valu:[3,7,8,9,12,18,21],valueerror:5,var2mod:[19,20],var_nam:9,variabl:[9,10,13],variou:[8,9],varnam:[7,9],verbos:13,veri:2,version:[0,2,6,8,9,10,13,19,20,28],via:[2,13,18,26,27,28,29],view:23,visibl:12,visible_len:12,visitor:10,wa:[0,5,9,13],wai:9,want:[2,25],we:[2,18,29],well:9,were:[2,9],what:[13,18,25,29],whatev:13,when:[2,3,13,14,24,27,28],where:[5,8,9,10,12],wherea:29,which:[2,5,8,9,13,18,22,23,28],whole:[13,30],whose:[3,13],wide:5,within:[5,8,9,13,27],without:30,word:[2,18],word_dropout:18,word_index:2,wordindex:2,work:[26,27,30],worker:22,workflow:[18,29,30],worri:30,would:[2,8,9,18,23],wrap:[2,3,13,19,20,24],wrappe:[3,17],wrapper:[3,17,24],write:[0,2,3,13],written:9,wrongdeviceerror:11,x1:13,x2:13,x3:13,x:[0,2,3,8,10,12,13,14,18,23,24,25,26,29],xxxx:8,xxxxxaxxxxxxxxxxxxxxxxxxxx:8,xxxxxxxxxxx:8,xxxxxxxxxxxxxb:8,xxxxxxxxxxxxxbxxxx:8,y:[10,12,23,24,26],yield:18,you:[0,2,19,23,25,30],your:[2,30],z:23,zero_grad:[18,27],zip:[3,13,18]},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.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>","Getting Started","Welcome to PADL\u2019s documentation!","API Documentation","Usage","Applying Transforms to Data","Combining Transforms into Pipelines","Creating 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,The:25,access:27,advanc:1,an:23,anyth:21,api:20,appli:[18,22,25],automat:27,basic:18,between:18,block:2,build:23,combin:23,compos:23,content:[1,19,20,21],contribut:0,convert:23,creat:24,custom:2,data:[18,22],decompos:18,defin:[2,18],depend:25,devic:27,dict:27,dictionari:23,differ:23,document:[19,20],doe:2,dumptool:[4,5,6,7,8,9,10],exampl:23,except:[11,25],extra:25,extract:23,first:0,forward:[23,29],from:[21,23],gener:23,get:[0,18],group:23,handl:25,how:2,imag:23,input:18,insid:18,inspector:5,instal:[0,18],introduct:0,item:23,layer:27,licens:0,load:[18,28],loop:2,map:23,mode:25,model:[18,23],modul:[2,27],multipl:23,mutat:2,name:18,need:21,nest:2,object:2,packagefind:6,padl:[0,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,27],parallel:23,paramet:27,pass:[18,23],pipelin:[18,23,30],post:23,postprocess:29,pre:23,preprocess:29,print:26,print_util:12,process:23,program:0,project:18,pytorch:[2,27],resourc:[0,18],rollout:23,s:19,same:25,sampl:23,save:[2,18,27,28],scope:2,serial:[2,7],share:27,slice:26,sourceget:8,stage:29,start:[0,18],state:27,structur:18,symfind:9,target:2,tensor:23,topic:1,train:[18,23],transform:[2,13,18,22,23,24,25,27,30],us:27,usag:[18,21],util:[15,25],util_transform:14,valu:2,var2mod:10,variabl:2,version:[16,23],weight:27,welcom:19,what:2,within:2,work:2,wrap:17,you:21,your:0}})
\ No newline at end of file
+Search.setIndex({docnames:["README","advanced","advanced/saving","apidocs/padl","apidocs/padl.dumptools","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","gettingstarted","index","modules","usage","usage/apply","usage/combining_transforms","usage/creating_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.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","gettingstarted.md","index.md","modules.md","usage.md","usage/apply.md","usage/combining_transforms.md","usage/creating_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,"-","inspector"],[6,0,0,"-","packagefinder"],[7,0,0,"-","serialize"],[8,0,0,"-","sourceget"],[9,0,0,"-","symfinder"],[10,0,0,"-","var2mod"]],"padl.dumptools.inspector":[[5,1,1,"","CallInfo"],[5,3,1,"","caller_frame"],[5,3,1,"","caller_module"],[5,3,1,"","get_segment_from_frame"],[5,3,1,"","get_statement"],[5,3,1,"","get_surrounding_block"],[5,3,1,"","non_init_caller_frameinfo"],[5,3,1,"","outer_caller_frameinfo"],[5,3,1,"","trace_this"]],"padl.dumptools.inspector.CallInfo":[[5,2,1,"","module"]],"padl.dumptools.packagefinder":[[6,3,1,"","dump_packages_versions"],[6,3,1,"","get_packages"],[6,3,1,"","get_version"]],"padl.dumptools.serialize":[[7,1,1,"","Serializer"],[7,3,1,"","json_serializer"],[7,3,1,"","load_json"],[7,3,1,"","save_json"],[7,3,1,"","value"]],"padl.dumptools.serialize.Serializer":[[7,4,1,"","save"],[7,4,1,"","save_all"],[7,2,1,"","varname"]],"padl.dumptools.sourceget":[[8,1,1,"","ReplaceString"],[8,1,1,"","ReplaceStrings"],[8,3,1,"","cut"],[8,3,1,"","get_module_source"],[8,3,1,"","get_source"],[8,3,1,"","original"],[8,3,1,"","put_into_cache"]],"padl.dumptools.sourceget.ReplaceString":[[8,4,1,"","cut"]],"padl.dumptools.sourceget.ReplaceStrings":[[8,4,1,"","cut"]],"padl.dumptools.symfinder":[[9,5,1,"","NameNotFound"],[9,1,1,"","Scope"],[9,1,1,"","ScopedName"],[9,3,1,"","find"],[9,3,1,"","find_in_ipython"],[9,3,1,"","find_in_module"],[9,3,1,"","find_in_scope"],[9,3,1,"","find_in_source"],[9,3,1,"","replace_star_imports"],[9,3,1,"","split_call"]],"padl.dumptools.symfinder.Scope":[[9,4,1,"","empty"],[9,4,1,"","from_level"],[9,4,1,"","from_source"],[9,4,1,"","global_"],[9,4,1,"","is_global"],[9,2,1,"","module_name"],[9,4,1,"","toplevel"],[9,4,1,"","unscoped"],[9,4,1,"","up"]],"padl.dumptools.var2mod":[[10,1,1,"","CodeGraph"],[10,1,1,"","CodeNode"],[10,1,1,"","Finder"],[10,1,1,"","Vars"],[10,3,1,"","find_codenode"],[10,3,1,"","find_globals"],[10,3,1,"","increment_same_name_var"],[10,3,1,"","rename"]],"padl.dumptools.var2mod.CodeGraph":[[10,4,1,"","build"],[10,4,1,"","dumps"],[10,4,1,"","print"]],"padl.dumptools.var2mod.CodeNode":[[10,4,1,"","from_source"]],"padl.dumptools.var2mod.Finder":[[10,4,1,"","find"],[10,4,1,"","generic_visit"],[10,4,1,"","get_source_segments"]],"padl.dumptools.var2mod.Vars":[[10,6,1,"","globals"],[10,6,1,"","locals"]],"padl.exceptions":[[11,5,1,"","WrongDeviceError"]],"padl.print_utils":[[12,3,1,"","combine_multi_line_strings"],[12,3,1,"","create_arrow"],[12,3,1,"","create_reverse_arrow"],[12,3,1,"","format_argument"],[12,3,1,"","make_bold"],[12,3,1,"","make_green"],[12,3,1,"","visible_len"]],"padl.transforms":[[13,1,1,"","AtomicTransform"],[13,1,1,"","Batchify"],[13,1,1,"","BuiltinTransform"],[13,1,1,"","ClassTransform"],[13,1,1,"","Compose"],[13,1,1,"","FunctionTransform"],[13,1,1,"","Identity"],[13,1,1,"","Map"],[13,1,1,"","Parallel"],[13,1,1,"","Pipeline"],[13,1,1,"","Rollout"],[13,1,1,"","TorchModuleTransform"],[13,1,1,"","Transform"],[13,1,1,"","Unbatchify"],[13,3,1,"","fulldump"],[13,3,1,"","group"],[13,3,1,"","importdump"],[13,3,1,"","load"],[13,3,1,"","save"]],"padl.transforms.ClassTransform":[[13,2,1,"","source"]],"padl.transforms.FunctionTransform":[[13,2,1,"","source"]],"padl.transforms.Pipeline":[[13,4,1,"","grouped"],[13,4,1,"","pd_forward_device_check"],[13,4,1,"","pd_to"]],"padl.transforms.TorchModuleTransform":[[13,4,1,"","post_load"],[13,4,1,"","pre_save"]],"padl.transforms.Transform":[[13,4,1,"","eval_apply"],[13,4,1,"","infer_apply"],[13,4,1,"","pd_call_transform"],[13,2,1,"","pd_device"],[13,2,1,"","pd_forward"],[13,4,1,"","pd_forward_device_check"],[13,4,1,"","pd_get_loader"],[13,2,1,"","pd_layers"],[13,2,1,"","pd_name"],[13,4,1,"","pd_parameters"],[13,4,1,"","pd_post_load"],[13,2,1,"","pd_postprocess"],[13,4,1,"","pd_pre_save"],[13,2,1,"","pd_preprocess"],[13,4,1,"","pd_save"],[13,4,1,"","pd_set_mode"],[13,4,1,"","pd_to"],[13,4,1,"","pd_varname"],[13,4,1,"","pd_zip_save"],[13,4,1,"","train_apply"]],"padl.util_transforms":[[14,1,1,"","IfEval"],[14,1,1,"","IfInMode"],[14,1,1,"","IfInfer"],[14,1,1,"","IfTrain"],[14,1,1,"","Try"]],"padl.utils":[[15,6,1,"","same"]],"padl.wrap":[[17,1,1,"","PatchedModule"],[17,3,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"],[11,0,0,"-","exceptions"],[3,3,1,"","fulldump"],[3,3,1,"","group"],[3,3,1,"","importdump"],[3,3,1,"","load"],[12,0,0,"-","print_utils"],[3,3,1,"","save"],[3,3,1,"","transform"],[13,0,0,"-","transforms"],[3,7,1,"","unbatch"],[14,0,0,"-","util_transforms"],[15,0,0,"-","utils"],[3,3,1,"","value"],[16,0,0,"-","version"],[17,0,0,"-","wrap"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","property","Python property"],"3":["py","function","Python function"],"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:property","3":"py:function","4":"py:method","5":"py:exception","6":"py:attribute","7":"py:data"},terms:{"0":[0,3,5,8,9,10,13,18,25,26],"02_nlp_exampl":18,"0x":10,"1":[0,2,3,8,9,10,13,14,18,23,25,26,27],"10":[0,3,14,18,24],"100":[2,10,23,24,25,26],"1000":24,"11":[3,5,14],"123":5,"13":8,"2":[0,3,8,9,10,13,18,23,25,26],"20":0,"200":25,"244":23,"3":[0,3,5,9,10,13,18,23,25],"300":25,"4":[10,25],"5":8,"512":18,"64":18,"8":[0,18],"9":[0,8,18],"99":[3,14],"abstract":[0,13,18,19,30],"case":[2,3,8,9,13,23],"catch":[14,21],"class":[2,3,5,7,8,9,10,13,14,17,18,24,29],"const":2,"default":[2,3,5,6,7,9,13,14,23],"do":[2,3,11,13,21,22,24],"final":[14,18,25],"function":[0,2,3,5,7,9,10,13,17,18,23,24,30],"import":[0,2,3,6,9,10,13,14,17,18,19,23,24,25,28,29],"int":[5,8,9,10,12,13],"new":[8,9],"return":[0,2,5,6,7,8,9,10,13,18,22,23,24,25,26,29],"static":13,"super":18,"switch":[2,3,13],"true":[3,6,8,9,10,12,13,17,18,23,26],"try":[3,5,8,13,14,17,21,25],"var":10,A:[3,5,8,9,10,13,18,30],As:[2,10,29],By:23,For:[2,18,23,24,25],If:[0,2,3,7,8,9,10,12,13,14,18],In:[3,8,9,13,18,23,24],It:[2,5,9,13,22,24,27],No:14,One:[2,23],The:[2,3,5,7,8,9,10,12,13,14,18,21,23,29,30],These:[2,13,18],To:[2,3,8,13,18,22,23,29],With:30,_:[2,18],____________:12,__call__:[2,18,24],__file__:2,__getitem__:18,__init__:[2,5,18,24],__main__:9,_ast:[9,10],_pd_main:2,_thingfind:9,_trace_thi:5,a_transform:2,about:[5,13,27,30],abov:[18,23],absolut:2,accept:13,access:[9,18,26,29],ad:[3,9,13,22,30],adam:[18,27],adapt:27,add:[2,3,8,13,24,25,26],add_n:2,addconst:2,addfirst:25,addit:8,advanc:19,after:[2,3,13,27],again:2,ai:0,airplan:22,alia:10,all:[0,2,5,7,10,11,13,17,18,21,22,23,27,28],allow:[0,8,9,18,23,25],along:27,also:[2,3,13,18,22,24,25],alwai:13,an:[0,2,5,8,9,10,12,13,18,22,25,27,30],analog:25,ani:[3,7,12,13,14,18],anoth:12,anyth:[2,19],apach:0,api:19,append:[2,7,18],appli:[2,3,12,13,14,19,21,23,29],applic:25,ar:[2,3,7,9,10,13,18,21,23,24,27,28,29],arbitrari:[0,25],arg:[2,5,13,18,22,26],argument:[2,5,9,12,13,22],aris:23,arrai:[2,10,25],arrow:12,ascii:12,assign:[9,13],ast:[6,9,10],ast_nod:10,atom:13,atomictransform:13,attribut:[5,8,15],augment:[23,25,27,29],automat:[2,3,13,22],avail:[5,22],awar:2,axxxxxxxxxxxxxxxxxxxx:8,b:[3,8,10,13,14,18],back:14,backward:[18,27],bar:[10,13,23],base:[0,7,13],batch:[0,3,13,18,21,22,23,27,29,30],batch_first:18,batch_siz:[18,22,27],batchifi:[3,9,13,21],baz:23,becom:[5,9,18,23,24],been:13,befor:[2,5,13,22],being:[3,13,25],below:10,berlin:0,between:[10,23],big:2,bla:6,blip:6,blob:0,block:[5,18],blop:6,blu:6,bodi:[2,5,6,9,10],boilerpl:30,bold:12,bool:[3,5,8,9,10,13],both:[2,8,27],branch:18,build:[0,2,9,10,30],build_my_transform:2,builder:0,built:[18,27],builtin:13,builtintransform:13,bup:6,c:[3,13],cach:8,call:[3,5,7,9,10,13,14,24,29],call_info:13,call_sourc:9,callabl:[3,5,7,13,17,18,24],caller:5,caller_fram:5,caller_modul:5,callinfo:[5,13],calling_scop:9,can:[0,2,3,5,8,9,13,14,18,22,23,24,25,26,27,28,29,30],canb:22,cannot:2,capabl:27,captur:15,carri:14,cat:[18,22],catch_transform:14,caus:2,caveat:2,cell:8,central:30,chang:[2,5,14],charact:12,check:[13,18],checkpoint:28,chief:18,child:[11,13],child_transform:11,children:13,citizen:18,classifi:[23,29],classmethod:[7,9,10],classtransform:13,claus:14,clean:[2,18],close:25,co:18,code:[0,2,3,5,6,7,8,9,10,13,27,30],code_of_conduct:0,codegraph:[7,10],codenod:10,col:[5,8,10],collect:[8,13,21],column:5,com:[0,18],combin:[12,13,18,19,21,24,30],combine_multi_line_str:12,come:[17,24],comment:5,common:23,complet:[5,14],complex:[2,13,26,30],compon:[0,18,23],compos:[13,18,26,29],composit:[18,23],comprehens:[0,18],compress:[3,13],comput:18,concat_low:25,concis:[0,18,21],condit:[14,21],condition:23,conduct:0,conflict:2,consid:2,consist:2,constant:[2,8],construct:13,contain:[2,5,7,8,9,11,12,13,27,28],content:10,context:[5,13],continu:[23,29],contrast:13,contribut:19,conveni:27,convert:[0,9,24,27,29],coor:12,coordin:12,correct:13,correspond:[9,10,29],cosin:18,could:[2,9,23],count:9,counter:[9,10],cpu:[3,13],creat:[2,5,7,9,10,12,13,19,21,22,23,27,28,30],create_arrow:12,create_reverse_arrow:12,crop:23,cuda:[13,27],current:[0,2,9,18],custom:[13,30],cut:8,data:[2,13,19,21,29,30],dataload:[13,22,30],datapoint:[13,23],dataset:2,debug:[10,30],decor:[3,13,17,18,24],deep:[0,2,18,19,23,29,30],def:[0,2,5,9,10,13,18,24,25,26,29],def_sourc:9,defin:[7,9,10,21,28,29],definit:[2,18],depend:[2,10,28],detail:[5,13,18,23],determin:[3,5,8,10,13,17],develop:0,devic:[3,11,13,22],di:30,dict:[8,18],dictionari:[2,13,18],differ:[2,8,22,29],dim:[3,13],dimens:[3,13,22,30],directli:13,directori:2,disabl:[3,12,13,22],document:[5,13],doe:[13,22],doesn:[3,14],dog:[18,22],don:[2,3,5,12,13,17],done:[13,22],down:2,drop:[5,9],drop_n:[5,9],dump:[2,3,6,7,10,13],dump_packages_vers:6,dumptool:[13,19,20],dure:[3,13,23,25],dynam:18,e:[3,9,13,18],each:[2,13,18,22,29],easili:30,ecosystem:0,edg:10,effect:2,either:[2,8],eleg:30,element:[13,18,23,29],els:[3,10,14],else_:[3,14],else_transform:14,emb:18,embed:18,emit:18,empti:[5,9],enabl:[2,3,13,30],end:[3,10,12,13],enter:5,entir:24,entiti:9,entri:2,enumer:2,eos_valu:18,equival:25,error:14,escap:12,eval:[3,13,14,21,22,25],eval_appli:[3,13,14,18,22,25],evalu:29,even:23,event:5,everi:12,everyth:[10,21,23,24],exactli:23,exampl:[0,2,3,5,6,8,9,10,12,13,14,17,18,22,25,29],except:[9,14,19,20,21],execut:[2,5,23],exist:[3,10,13],expect:[2,3,8,13,22],explicit:[8,10],explicitli:13,extens:[3,13],extra:[14,19,21,27],extract:5,f1:13,f2:13,f:[2,8,9,10,13],factori:15,fail:14,fall:14,fals:[3,5,9,10,12,13,17],few:2,field:10,file:[2,3,8,13,25,28],file_suffix:7,fileexistserror:[3,13],filenam:[2,8,13,25],filter_builtin:10,finally_transform:14,find:[0,6,9,10,18],find_codenod:10,find_glob:10,find_in_ipython:9,find_in_modul:9,find_in_scop:9,find_in_sourc:9,finder:10,finish_right:12,first:[3,5,8,12,13,18,23],flat:23,flatten:[3,13,23],flexibl:30,folder:[2,3,13,28],follow:[2,5,9,10,21],foo:[6,10,13,23],force_overwrit:[3,13],form:[9,13,24,30],formal:30,format:[6,12,29,30],format_argu:12,forward:[0,13,18,19,21,22,24],forward_pass:18,found:[5,9,10],four:9,frame:[5,8],frameinfo:5,from:[0,3,5,6,8,9,10,13,14,18,19,24,25,27,28,29],from_:10,from_col:8,from_level:9,from_lin:8,from_sourc:[9,10],front:5,full:[0,2,3,13,18],fulldump:[2,3,13],fulli:[3,13],functiontransform:13,fundament:13,futur:2,g:[13,18],gener:[13,22],generic_visit:10,germani:0,get:[2,5,6,8,9,10,12,13,15,19,21,23,25],get_module_sourc:8,get_packag:6,get_segment_from_fram:5,get_sourc:8,get_source_seg:10,get_stat:5,get_surrounding_block:5,get_vers:6,getitem:[5,26],github:[0,18],give:8,given:[3,5,6,8,9,10,13],global:[2,9,10],global_:9,globals_:10,go:[0,10,18],good:13,gotten:8,gpu:[13,22,29,30],gradient:[13,18,22,30],graph:[10,18],great:0,green:12,group:[3,13,21],gru:18,ha:[2,8,10,13,18,23,27,29],hacki:5,handl:22,happen:[14,29],have:[0,13,27],head:23,hello:25,help:[13,18],helper:[3,7],here:[2,5,18],hidden:24,hierarchi:9,histori:9,hood:22,how:[9,13,22,23,24,26,28,29,30],howev:2,http:[0,18],i:[2,3,9,13],id:8,ident:[3,13,14,21,26],identifi:9,if_:[3,14],ifev:[3,14,21,25],iff:9,ifinf:[3,14,21,25],ifinmod:[3,14],iftrain:[3,14,18,21,23,25],ignore_scop:[3,5,13,17],iim:[3,14],imag:[12,29],implement:[13,18,24],importdump:[2,3,13],includ:[2,8,13,18,27,28],increment:10,increment_same_name_var:10,indent:5,index:[13,18],indic:[9,13],individu:[18,23],infer:[3,13,14,21,22,25,27,29],infer_appli:[3,13,14,18,22,25],infer_pipelin:27,inform:[5,13],initi:[2,13,27],inlin:[5,13,18],innov:0,input:[3,8,12,13,22,23,25],insert:8,insid:14,inspect:[5,8,13,30],inspector:[13,19,20],instanc:[2,18,23,24,27],instanti:18,instead:[2,3,5,13,17],instruct:18,interact:[2,28,30],interest:0,intermedi:18,intern:22,introduct:19,invers:[3,13],io:[0,18],ipynb:18,ipython:[2,8,9,26],is_glob:9,isinst:[8,10,17,18],issu:[0,18],item:[0,3,9,13,15,22,25],iter:[13,22,27],its:[9,10,13],itself:5,jpg:22,json:[2,7],json_seri:7,just:[2,3,13],keep:23,kei:8,keyword:[0,13],kic:18,know:21,kwarg:[5,13,18],l1:24,l2:24,lab:0,lambda:[3,13,14,18,23,24,25],larg:[2,18],larger:[5,18],largest:5,last:[2,8,12,13],layer1:27,layer2:27,layer:[0,13,18],learn:[0,18,19,22,23,24,27,28,29,30],left_shift:18,len:[2,18],length:[12,23],level:[2,5,9,23],lf1:[0,18],licens:19,like:[2,18,22,29],limit:2,lin:24,line:[5,8,9,12],linear:[0,18,24],lineno:[5,9,10],link:18,list:[2,3,6,8,9,10,12,13,14,22,25,27,28],liter:[3,5,13,14],live:10,lm:18,load:[2,3,7,13,19,21,22,23,27,29],load_data:2,load_funct:7,load_imag:[23,29],load_json:7,loader:[7,13],loc:8,local:10,locat:[5,8],log10:24,look:[0,2,5,9,18],lookup:[27,29],loop:[9,27],loos:18,loss:[0,18,23,27],lower:25,lower_cas:18,lr:[18,27],macro:23,made:[5,13],mai:[0,18],main:[0,9,11,18],maintain:8,make:[0,12,21,27],make_bold:12,make_green:12,man:18,manual:[0,18],map:[13,18],mark:[3,7,13],mat:18,match:[3,5,11,13,14],math:24,md:0,mean:[2,3,13,23],messi:2,method:[5,13,18,21,25],might:[2,18,25],minim:30,minus100:24,minusx:[24,25,26],mlp:24,mml:24,mode:[3,13,14,22],model:[0,2,13,27,29],model_pass:23,modifi:8,modul:[3,5,6,7,8,9,10,13,17,18,19,21,23,24,26,28,29],module_nam:[5,9],more:[2,3,5,13,23,30],most:[9,23,29],mother:11,mother_transform:11,move:[3,13,23],much:30,multi:[5,12,30],multipl:[2,13,18,22,24,27],multiprocess:13,must:[2,5,13,23],my:2,my_classifi:[22,29],my_classifier_transform:[23,29],my_pipelin:[0,2,27,28],myfil:2,myfunct:5,mykei:8,myload:2,mypipelin:28,mypytorchlay:27,mysav:2,mytransform:2,n:[5,9,10,13],n_final_row:12,n_in:24,n_initial_row:12,n_out:24,n_to_add:2,n_word:18,name:[2,3,5,6,9,10,13,14,29],namenotfound:9,natur:22,need:[2,7,13,19],nest:[9,26,27],never:13,next:[18,22,23,24,26,27,28,29,30],nextmodul:5,nn:[0,13,18,24],node:[6,9,10],nodetyp:10,nodevisitor:10,non:8,non_init_caller_frameinfo:5,none:[3,5,7,9,10,13,14,17],normal:[2,8,13,18],not_found:2,note:[2,5],notebook:[0,2,18,30],noth:[3,13,21],now:2,np:[2,10,17,24,25],npy:2,nth:23,num_work:[18,22,27],number:[5,9,10,12],numpi:[2,17,18,24],o:[10,18],object:[5,8,9,10,13,18,25],obtain:18,occur:14,offset:[5,10],often:[18,25],one:[2,3,9,12,13,14,18,23,29],onli:[2,10,18,23,25],open:[2,23,25],open_fil:25,oper:[18,23],optim:[18,27],option:[3,5,7,10,13,14],order:13,ordereddict:13,origin:[5,8],other:[13,14],otherwis:[3,13,14],out:[5,8,9,10,14,17,23,24],outer:5,outer_caller_frameinfo:5,output:[3,13,14,18,22,23,29],over:[12,13,18,23,27],overlap:8,overrid:13,overwrit:[3,13],own:2,packag:[0,2,3,6,13,28],packagefind:[19,20],pad:12,padl:[2,18,20,23,24,25,26,28,29,30],padl_value_0:2,page:21,parallel:[3,13,18],param:13,paramet:[2,3,5,6,7,8,9,10,11,12,13,14,17,18,28],parent:[2,17],parenthes:23,pars:[6,10],part:[8,13,18,21,22,29],parti:2,particular:24,pass:[0,2,3,13,22],patch:17,patchedmodul:17,path:[2,3,7,13,23,29],pathlib:[2,3,7,13],pd_:18,pd_call_transform:13,pd_devic:13,pd_forward:[13,22,29],pd_forward_device_check:13,pd_get_load:13,pd_group:13,pd_layer:[13,27],pd_name:[13,14],pd_np:17,pd_paramet:[13,18,27],pd_post_load:13,pd_postprocess:[13,29],pd_pre_sav:13,pd_preprocess:[13,29],pd_save:[13,18],pd_set_mod:13,pd_to:[13,27],pd_varnam:13,pd_zip_sav:13,perform:[3,13,14],pick:2,piec:[9,10],pil:23,piltotensor:23,pip:[0,18],pipelin:[0,13,19,21,22,24,26,27,28,29],plan:18,pleas:0,pluson:2,plustwo:2,point:18,posit:[8,10],position:18,possibl:[2,5,13,18,24,27],post:[0,18,29],post_load:13,postprocess:[3,13,18,19,21,22,23],potenti:[2,5,18],power:23,pre:[0,8,18,29],pre_sav:13,preced:12,predict:[18,23,27],prepar:0,preprocess:[3,13,18,19,21,22,23,27,30],preprocess_imag:23,pretti:26,prevent:[2,3,13],previous:2,primit:18,print:[5,10,12,13,18,19,21,28],print_util:[19,20],process:[0,2,18,22,29,30],progress:13,propag:13,properti:[5,7,9,13],provid:[2,23],pt:2,put:8,put_into_cach:8,py:[2,28],pypi:2,python:[0,2,5,9,10,18,23,24,28],pytorch:[0,13,18,19,21,22,23,24,26,28,29],rais:[3,5,13],rand:17,random:17,randomresizedcrop:23,randomrot:23,rang:[2,18],rather:[2,5,13],re:[0,23],read:[2,21,22,25,26,30],read_from_path:25,readabl:29,recent:9,recreat:2,recurs:[3,13,18],refer:[18,21],referenc:18,reflex:18,regardless:14,releas:18,relu:24,rememb:27,remov:[3,5,13,22],renam:[2,10],rename_loc:10,repeat:[2,23],repl:8,replac:[8,9],replace_cach:8,replace_star_import:9,replacestr:8,repres:[9,10,18],reproduc:30,requir:[2,5],reshap:29,resiz:23,resnet18:[23,29],respect:[3,10,13,25],respons:[2,29],rest:5,result:[2,3,5,8,13,23],return_loc:5,return_parti:9,revers:2,right_shift:18,rnn:18,roll:23,rollout:[3,13,18],row:5,rstring:8,s:[3,5,6,7,8,9,13,14,18,21,22,24,27,28,29],same:[3,5,8,9,10,13,15,21,23,27],sat:18,save:[1,3,7,13,19,21,22,30],save_al:7,save_funct:7,save_json:7,saver:7,scalar:18,schemat:18,scope:[3,5,9,10,13,17],scoped_nam:10,scopednam:[9,10],scopelist:9,search:[9,10,13],second:[2,3,9,13,23],section:[8,22,23,24,26,27,28,29,30],see:[0,2,3,5,13,18,22],segment:[5,9,10],segment_typ:5,self:[2,9,13,18,24],send:[13,22,27,30],sequenc:[12,13,23],seri:13,serial:[3,13,19,20],session:[2,28],set:[2,7,10,13,22],settrac:5,sever:18,sh:18,should:[2,3,5,7,13],similar:2,simpli:[2,13,18],sin:24,singl:[0,13,18,22,23],size:22,slice:[18,19,21,28,30],so:[9,18,23],some:[2,23,27],somemodul:10,someobject:2,someth:[2,25],sometim:2,soon:5,sourc:[5,6,8,9,10,13,18],sourceget:[19,20],space:[5,12],special:[23,25,29],specifi:[3,8,9,13,22],split:[2,9,18],split_cal:9,split_str:18,stack:5,stage:[18,19,21,22,23],stand:29,standard:[0,18],star:[2,9],start:[3,9,12,13,19,21],start_left:12,state_dict:27,statement:[2,3,5,9,13,14],step:[13,18,23,27],step_1:18,stop:30,store:[2,3,7,27,28],str:[2,3,5,7,8,9,10,12,13,14],straightforward:18,string:[3,6,7,8,9,10,12,13],sub:[8,10,13,23,26],subclass:9,substr:8,subval:2,successfulli:14,suffix:2,suggest:29,superimpos:12,support:[0,2,18],surround:[5,9],sy:5,symbol:[2,9],symfind:[5,10,19,20],t1:[13,23,26],t2:[13,23,26],t3:[13,23,26],t4:26,t5:26,t:[2,3,5,12,13,14,17,18,23,25],take:[12,23],taken:[8,24],target:[5,23],target_mod:[3,14],tensor:[0,3,13,18,22],term:18,test:18,text:[0,2],textcorpu:2,th:18,than:2,them:[2,3,13,21,23,27],thereof:[3,13],thi:[2,3,5,8,9,10,12,13,14,18,23,24,26,27,28],thing:[2,3,7,8,9,10],third:2,those:[2,10,27,29],thought:18,three:[22,23],through:[10,18,23],thu:[2,23],time:2,to_col:8,to_integ:18,to_lin:8,to_tensor:18,toarrai:2,togeth:[18,26],tointeg:18,token:18,too:[24,26,28],top:[9,12],topic:19,topk:0,toplevel:[3,5,9,13,17],topolog:0,torch:[0,13,18,24,27],torchmoduletransform:[13,18],torchvis:[18,23,29],totensor:[23,29],trace:5,trace_thi:5,tracefunc:5,track:2,train:[3,13,14,21,22,25,27,29],train_appli:[13,18,22,27],train_data:[18,27],train_model:27,train_pipelin:[18,27],training_pipelin:23,transform:[0,3,9,11,14,15,17,19,20,21,26,28,29],transform_1:18,transform_2:18,transform_or_modul:[3,13],transpar:[12,30],tree:[0,9,10,18],tupl:[2,3,5,9,10,13,14,18,23],turn:13,tvt:23,two:2,txt:[2,28],type:[5,10],typic:[13,18],unbatch:[0,3,18,21,23,29],unbatchifi:[3,13],under:[0,22],undo:2,unind:5,union:[3,13,14],uniqu:13,unk:18,unscop:9,unsqueez:[3,13],up:[2,9],upcom:18,updat:22,us:[0,2,3,5,6,7,8,9,10,12,13,14,17,18,19,21,22,23,24,25,26,29,30],usag:[0,19],use_replace_cach:8,user:0,usual:29,util:[5,6,12,13,19,20,23,27],util_transform:[19,20],v:12,val:[2,3,7],valu:[3,7,8,9,12,18,21],valueerror:5,var2mod:[19,20],var_nam:9,variabl:[9,10,13],variou:[8,9],varnam:[7,9],verbos:13,veri:2,version:[0,2,6,8,9,13,19,20,28],via:[2,13,18,26,27,28,29],view:23,visibl:12,visible_len:12,visitor:10,wa:[0,5,13],wai:9,want:[2,25],we:[2,18,29],well:9,were:[2,9],what:[13,18,25,29],whatev:13,when:[2,3,13,14,24,27,28],where:[5,8,10,12],wherea:29,which:[2,3,5,8,9,10,13,18,22,23,28],whole:[13,30],whose:[3,13],wide:5,within:[5,8,9,13,27],without:30,word:[2,18],word_dropout:18,word_index:2,wordindex:2,work:[26,27,30],worker:22,workflow:[18,29,30],worri:30,would:[2,8,9,18,23],wrap:[2,3,13,19,20,24],wrappe:[3,17],wrapper:[3,17,24],write:[0,2,3,13],written:9,wrongdeviceerror:11,x1:13,x2:13,x3:13,x:[0,2,3,8,9,10,12,13,14,18,23,24,25,26,29],xxxx:8,xxxxxaxxxxxxxxxxxxxxxxxxxx:8,xxxxxxxxxxx:8,xxxxxxxxxxxxxb:8,xxxxxxxxxxxxxbxxxx:8,y:[10,12,23,24,26],yield:18,you:[0,2,19,23,25,30],your:[2,30],z:[10,23],zero_grad:[18,27],zip:[3,13,18]},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.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>","Getting Started","Welcome to PADL\u2019s documentation!","API Documentation","Usage","Applying Transforms to Data","Combining Transforms into Pipelines","Creating 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,The:25,access:27,advanc:1,an:23,anyth:21,api:20,appli:[18,22,25],automat:27,basic:18,between:18,block:2,build:23,combin:23,compos:23,content:[1,19,20,21],contribut:0,convert:23,creat:24,custom:2,data:[18,22],decompos:18,defin:[2,18],depend:25,devic:27,dict:27,dictionari:23,differ:23,document:[19,20],doe:2,dumptool:[4,5,6,7,8,9,10],exampl:23,except:[11,25],extra:25,extract:23,first:0,forward:[23,29],from:[2,21,23],gener:23,get:[0,18],group:23,handl:25,how:2,imag:23,input:18,insid:18,inspector:5,instal:[0,18],introduct:0,item:23,layer:27,licens:0,load:[18,28],loop:2,map:23,mode:25,model:[18,23],modul:[2,27],multipl:23,mutat:2,name:18,need:21,nest:2,object:2,other:2,packagefind:6,padl:[0,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,19,21,27],parallel:23,paramet:27,pass:[18,23],pipelin:[18,23,30],post:23,postprocess:29,pre:23,preprocess:29,print:26,print_util:12,process:23,program:0,project:18,pytorch:[2,27],resourc:[0,18],rollout:23,s:19,same:25,sampl:23,save:[2,18,27,28],scope:2,serial:[2,7],share:27,slice:26,sourceget:8,stage:29,start:[0,18],state:27,structur:18,symfind:9,target:2,tensor:23,topic:1,train:[18,23],transform:[2,13,18,22,23,24,25,27,30],us:27,usag:[18,21],util:[15,25],util_transform:14,valu:2,var2mod:10,variabl:2,version:[16,23],weight:27,welcom:19,what:2,within:2,work:2,wrap:17,you:21,your:0}})
\ No newline at end of file
diff --git a/docs/sources/advanced/saving.md.txt b/docs/sources/advanced/saving.md.txt
index b2634450..ba8e5cc5 100644
--- a/docs/sources/advanced/saving.md.txt
+++ b/docs/sources/advanced/saving.md.txt
@@ -295,6 +295,59 @@ def build(arg):
 
 (what-does-not-save)=
 
+## Saving Transforms from other modules
+
+When importing Transforms from a different module, saving will by default only dump the import statement.
+
+Thus, when doing
+
+```python
+from padl import save
+from some.module import a_transform
+save(a_transform, 'mytransform')
+```
+
+the `transforms.py` will contain just:
+
+```python
+from some.module import a_transform
+
+_pd_main = a_transform
+```
+
+One can switch to a full dump of the transform using {func}`padl.fulldump`:
+
+```python
+from padl import save, fulldump
+from some.module import a_transform
+
+a_transform = fulldump(a_transform)
+save(a_transform, 'mytransform')
+```
+
+This causes the `transforms.py` to contain the transform definition instead of the import:
+
+```python
+@transform
+def a_transform(x):
+    ...
+
+_pd_main = a_transform
+```
+
+Instead of using {func}`padl.fulldump` on a Transform, one can apply it to a package or module. This will enable full dump for all contained transforms.
+
+```python
+from padl import save, fulldump
+import some.module
+from some.module import a_transform
+
+fulldump(some.module)
+```
+
+To reverse the effect of {func}`~padl.fulldump`, use {func}`~padl.importdump`.
+
+
 ## What does not save
 
 Saving PADL transforms has a few caveats you should be aware of:
diff --git a/docs/usage.html b/docs/usage.html
index 6af67cf1..a25b3b42 100644
--- a/docs/usage.html
+++ b/docs/usage.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Usage &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -165,7 +167,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="tex2jax_ignore mathjax_ignore section" id="usage">
+  <section class="tex2jax_ignore mathjax_ignore" id="usage">
 <h1>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h1>
 <p>The following collection of pages are a concise reference of everything you need to know to use PADL.
 Read them all to know everything you need to get started!</p>
@@ -183,7 +185,7 @@ <h1>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">
 <li class="toctree-l1"><a class="reference internal" href="usage/extras.html">Extras</a></li>
 </ul>
 </div>
-<div class="section" id="import-anything-you-need-from-padl">
+<section id="import-anything-you-need-from-padl">
 <h2>Import anything you need <code class="docutils literal notranslate"><span class="pre">from</span> <span class="pre">padl</span></code><a class="headerlink" href="#import-anything-you-need-from-padl" title="Permalink to this headline"></a></h2>
 <ul class="simple">
 <li><p><a class="reference internal" href="apidocs/padl.html#padl.transform" title="padl.transform"><code class="xref py py-func docutils literal notranslate"><span class="pre">transform()</span></code></a> for making Transforms.</p></li>
@@ -191,8 +193,8 @@ <h2>Import anything you need <code class="docutils literal notranslate"><span cl
 <li><p><a class="reference internal" href="apidocs/padl.html#padl.load" title="padl.load"><code class="xref py py-func docutils literal notranslate"><span class="pre">load()</span></code></a> for loading Transforms.</p></li>
 <li><p><a class="reference internal" href="apidocs/padl.html#padl.value" title="padl.value"><code class="xref py py-func docutils literal notranslate"><span class="pre">value()</span></code></a> for saving by value.</p></li>
 <li><p><a class="reference internal" href="apidocs/padl.html#padl.group" title="padl.group"><code class="xref py py-func docutils literal notranslate"><span class="pre">group()</span></code></a> for grouping Pipeline.</p></li>
-<li><p><a class="reference internal" href="apidocs/padl.html#padl.identity" title="padl.identity"><code class="xref py py-obj docutils literal notranslate"><span class="pre">identity</span></code></a> for doing nothing.</p></li>
-<li><p><a class="reference internal" href="apidocs/padl.html#padl.batch" title="padl.batch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">batch</span></code></a> for defining the batchified part of a pipeline.</p></li>
+<li><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">identity</span></code> for doing nothing.</p></li>
+<li><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">batch</span></code> for defining the batchified part of a pipeline.</p></li>
 <li><p><a class="reference internal" href="apidocs/padl.html#padl.unbatch" title="padl.unbatch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unbatch</span></code></a> for defining the postprocessing part of a pipeline.</p></li>
 <li><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">same</span></code> for applying a value’s method.</p></li>
 <li><p><a class="reference internal" href="apidocs/padl.html#padl.IfInfer" title="padl.IfInfer"><code class="xref py py-class docutils literal notranslate"><span class="pre">IfInfer</span></code></a> for conditioning on the ‘infer’-stage.</p></li>
@@ -200,8 +202,8 @@ <h2>Import anything you need <code class="docutils literal notranslate"><span cl
 <li><p><a class="reference internal" href="apidocs/padl.html#padl.IfTrain" title="padl.IfTrain"><code class="xref py py-class docutils literal notranslate"><span class="pre">IfTrain</span></code></a> for conditioning on the ‘train’-stage.</p></li>
 <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">Try</span></code> for catching exceptions in a transform.</p></li>
 </ul>
-</div>
-</div>
+</section>
+</section>
 
 
            </div>
diff --git a/docs/usage/apply.html b/docs/usage/apply.html
index 42480ab4..29548576 100644
--- a/docs/usage/apply.html
+++ b/docs/usage/apply.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Applying Transforms to Data &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="applying-transforms-to-data">
+  <section id="applying-transforms-to-data">
 <h1>Applying Transforms to Data<a class="headerlink" href="#applying-transforms-to-data" title="Permalink to this headline"></a></h1>
 <p>Each Transform can be applied to data in three different <strong>modes</strong>: <em>infer</em>, <em>eval</em> and <em>train</em>.</p>
 <p>To process single items in inference mode, use <a class="reference internal" href="../apidocs/padl.transforms.html#padl.transforms.Transform.infer_apply" title="padl.transforms.Transform.infer_apply"><code class="xref py py-meth docutils literal notranslate"><span class="pre">infer_apply()</span></code></a>.</p>
@@ -190,7 +192,7 @@ <h1>Applying Transforms to Data<a class="headerlink" href="#applying-transforms-
 </div>
 <p><a class="reference internal" href="../apidocs/padl.transforms.html#padl.transforms.Transform.train_apply" title="padl.transforms.Transform.train_apply"><code class="xref py py-meth docutils literal notranslate"><span class="pre">train_apply()</span></code></a> also uses a <strong>PyTorch</strong> <code class="xref py py-class docutils literal notranslate"><span class="pre">DataLoader</span></code> for which arguments canbe passed, handles devices, and, naturally, does not disable gradients.</p>
 <p>Read the <a class="reference internal" href="saving.html#saving-and-loading"><span class="std std-ref">next section</span></a> to learn how to save and load transforms.</p>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/usage/combining_transforms.html b/docs/usage/combining_transforms.html
index 37537280..130cb540 100644
--- a/docs/usage/combining_transforms.html
+++ b/docs/usage/combining_transforms.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Combining Transforms into Pipelines &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,11 +168,11 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="combining-transforms-into-pipelines">
+  <section id="combining-transforms-into-pipelines">
 <h1>Combining Transforms into Pipelines<a class="headerlink" href="#combining-transforms-into-pipelines" title="Permalink to this headline"></a></h1>
 <p>PADL provides functional operators, which allow to combine Transforms to create powerful <a class="reference internal" href="../apidocs/padl.transforms.html#padl.transforms.Pipeline" title="padl.transforms.Pipeline"><code class="xref py py-class docutils literal notranslate"><span class="pre">Pipeline</span></code></a> instances.</p>
 <p>This is most useful for building deep learning pipelines on a <em>macro-level</em> - for instance combining different preprocessing steps and augmentation with a model forward pass. You can keep building the individual sub-components as you’re used to - with python and PyTorch.</p>
-<div class="section" id="compose">
+<section id="compose">
 <span id="id1"></span><h2>Compose <code class="docutils literal notranslate"><span class="pre">&gt;&gt;</span></code><a class="headerlink" href="#compose" title="Permalink to this headline"></a></h2>
 <p>Transforms can be <strong>composed</strong> using <code class="docutils literal notranslate"><span class="pre">&gt;&gt;</span></code>:</p>
 <p>Pipelines arising from a compose process their input in a sequence: The output of the first Transform in a composition becomes the input of the second and so on.</p>
@@ -180,8 +182,8 @@ <h1>Combining Transforms into Pipelines<a class="headerlink" href="#combining-tr
 <span class="go">True</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="rollout">
+</section>
+<section id="rollout">
 <h2>Rollout <code class="docutils literal notranslate"><span class="pre">+</span></code><a class="headerlink" href="#rollout" title="Permalink to this headline"></a></h2>
 <p>An input can be <strong>rolled out</strong> to multiple Transforms using <code class="docutils literal notranslate"><span class="pre">+</span></code>. This means applying different Transforms to the same input. The result is a tuple.</p>
 <img src="img/rollout.png" style='display: block; margin: auto; width: 300px'>
@@ -190,8 +192,8 @@ <h2>Rollout <code class="docutils literal notranslate"><span class="pre">+</span
 <span class="go">True</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="parallel">
+</section>
+<section id="parallel">
 <h2>Parallel <code class="docutils literal notranslate"><span class="pre">/</span></code><a class="headerlink" href="#parallel" title="Permalink to this headline"></a></h2>
 <p>Multiple Transforms can be <strong>applied in parallel</strong> to multiple inputs using <code class="docutils literal notranslate"><span class="pre">/</span></code>. The input must be a tuple and the nth Transform is applied to the nth item in the tuple.</p>
 <img src="img/parallel.png" style='display: block; margin: auto; width: 300px'>
@@ -200,8 +202,8 @@ <h2>Parallel <code class="docutils literal notranslate"><span class="pre">/</spa
 <span class="go">True</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="map">
+</section>
+<section id="map">
 <h2>Map <code class="docutils literal notranslate"><span class="pre">~</span></code><a class="headerlink" href="#map" title="Permalink to this headline"></a></h2>
 <p>Transforms can be <strong>mapped</strong> using <code class="docutils literal notranslate"><span class="pre">~</span></code>. Mapping applies the same Transform to multiple inputs. The output has the same length as the input.</p>
 <img src="img/map.png" style='display: block; margin: auto; width: 300px'>
@@ -210,8 +212,8 @@ <h2>Map <code class="docutils literal notranslate"><span class="pre">~</span></c
 <span class="go">True</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="grouping-transforms">
+</section>
+<section id="grouping-transforms">
 <h2>Grouping Transforms<a class="headerlink" href="#grouping-transforms" title="Permalink to this headline"></a></h2>
 <p>By default, Pipelines, such as rollouts and parallels, are <em>flattened</em>. This means that even if you use parentheses to group them, the output will be a flat tuple:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="p">(</span><span class="n">t1</span> <span class="o">+</span> <span class="p">(</span><span class="n">t2</span> <span class="o">+</span> <span class="n">t3</span><span class="p">))(</span><span class="n">x</span><span class="p">)</span> <span class="o">==</span> <span class="p">((</span><span class="n">t1</span> <span class="o">+</span> <span class="n">t2</span><span class="p">)</span> <span class="o">+</span> <span class="n">t3</span><span class="p">)(</span><span class="n">x</span><span class="p">)</span> <span class="o">==</span> <span class="p">(</span><span class="n">t1</span> <span class="o">+</span> <span class="n">t2</span> <span class="o">+</span> <span class="n">t3</span><span class="p">)(</span><span class="n">x</span><span class="p">)</span>  <span class="o">==</span> <span class="p">(</span><span class="n">t1</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">t2</span><span class="p">(</span><span class="n">x</span><span class="p">),</span> <span class="n">t2</span><span class="p">(</span><span class="n">x</span><span class="p">))</span>
@@ -225,13 +227,13 @@ <h2>Grouping Transforms<a class="headerlink" href="#grouping-transforms" title="
 </pre></div>
 </div>
 <p>Continue in the <a class="reference internal" href="stages.html#stages"><span class="std std-ref">next section</span></a> to learn how to combine pre-processing, forward pass and post-processing in a single Transform.</p>
-</div>
+</section>
 <hr class="docutils" />
-<div class="section" id="examples">
+<section id="examples">
 <h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
-<div class="section" id="id2">
+<section id="id2">
 <h3>Compose<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
-<div class="section" id="building-pre-processing-pipelines">
+<section id="building-pre-processing-pipelines">
 <h4>Building pre-processing pipelines<a class="headerlink" href="#building-pre-processing-pipelines" title="Permalink to this headline"></a></h4>
 <p>Use <em>composition</em> to build pre-processing pipelines - exactly as you would using <code class="docutils literal notranslate"><span class="pre">torchvision.transforms.Compose</span></code>:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">transform</span><span class="p">,</span> <span class="n">IfTrain</span>
@@ -253,10 +255,10 @@ <h4>Building pre-processing pipelines<a class="headerlink" href="#building-pre-p
 <li><p><a class="reference internal" href="../apidocs/padl.html#padl.transform" title="padl.transform"><code class="xref py py-func docutils literal notranslate"><span class="pre">transform()</span></code></a> to <a class="reference internal" href="creating_transforms.html#convert-functions"><span class="std std-ref">convert a lambda function</span></a> and <a class="reference internal" href="creating_transforms.html#convert-module"><span class="std std-ref">everything from the torchvision.transforms module</span></a> into a Transform</p></li>
 <li><p><a class="reference internal" href="../apidocs/padl.html#padl.IfTrain" title="padl.IfTrain"><code class="xref py py-class docutils literal notranslate"><span class="pre">IfTrain</span></code></a> to <a class="reference internal" href="extras.html#if-in-mode"><span class="std std-ref">conditionally execute a step</span></a> only during training</p></li>
 </ul>
-</div>
-<div class="section" id="combining-pre-processing-model-forward-pass-and-post-processing">
+</section>
+<section id="combining-pre-processing-model-forward-pass-and-post-processing">
 <h4>Combining pre-processing, model forward pass and post-processing<a class="headerlink" href="#combining-pre-processing-model-forward-pass-and-post-processing" title="Permalink to this headline"></a></h4>
-<p>You can use composition to combine pre-processing, model forward pass and post-processing in one transform using the special Transforms <a class="reference internal" href="../apidocs/padl.html#padl.batch" title="padl.batch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">batch</span></code></a> and <a class="reference internal" href="../apidocs/padl.html#padl.unbatch" title="padl.unbatch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unbatch</span></code></a>:</p>
+<p>You can use composition to combine pre-processing, model forward pass and post-processing in one transform using the special Transforms <code class="xref py py-obj docutils literal notranslate"><span class="pre">batch</span></code> and <a class="reference internal" href="../apidocs/padl.html#padl.unbatch" title="padl.unbatch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unbatch</span></code></a>:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">my_classifier_transform</span> <span class="o">=</span> <span class="p">(</span>
     <span class="n">load_image</span>                 <span class="c1"># preprocessing ...</span>
     <span class="o">&gt;&gt;</span> <span class="n">transforms</span><span class="o">.</span><span class="n">ToTensor</span><span class="p">()</span>   <span class="c1"># </span>
@@ -268,11 +270,11 @@ <h4>Combining pre-processing, model forward pass and post-processing<a class="he
 </pre></div>
 </div>
 <p>For more details, head over to <a class="reference internal" href="stages.html#stages"><span class="std std-ref">the next section</span></a>.</p>
-</div>
-</div>
-<div class="section" id="id3">
+</section>
+</section>
+<section id="id3">
 <h3>Rollout<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
-<div class="section" id="extracting-items-from-a-dictionary">
+<section id="extracting-items-from-a-dictionary">
 <h4>Extracting items from a dictionary<a class="headerlink" href="#extracting-items-from-a-dictionary" title="Permalink to this headline"></a></h4>
 <p>One common use case for the <em>rollout</em> is to extract different elements from a dictionary.</p>
 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">same</span>
@@ -285,8 +287,8 @@ <h4>Extracting items from a dictionary<a class="headerlink" href="#extracting-it
 <ul class="simple">
 <li><p><a class="reference internal" href="extras.html#same"><span class="std std-ref">the “same” utility</span></a> for getting items</p></li>
 </ul>
-</div>
-<div class="section" id="generating-different-versions-of-an-image">
+</section>
+<section id="generating-different-versions-of-an-image">
 <span id="generate-image-versions"></span><h4>Generating different versions of an image<a class="headerlink" href="#generating-different-versions-of-an-image" title="Permalink to this headline"></a></h4>
 <p>In a preprocessing pipeline one could repeat a transform instance to generate multiple views of the same image:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">transform</span><span class="p">,</span> <span class="n">IfTrain</span>
@@ -303,11 +305,11 @@ <h4>Extracting items from a dictionary<a class="headerlink" href="#extracting-it
 </pre></div>
 </div>
 <p>This generates three different crops of the same image.</p>
-</div>
-</div>
-<div class="section" id="id4">
+</section>
+</section>
+<section id="id4">
 <h3>Parallel<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h3>
-<div class="section" id="pass-training-samples">
+<section id="pass-training-samples">
 <h4>Pass training samples<a class="headerlink" href="#pass-training-samples" title="Permalink to this headline"></a></h4>
 <p>Use <em>parallel</em> to pass training datapoints <code class="docutils literal notranslate"><span class="pre">(input,</span> <span class="pre">target)</span></code> through the same pipeline:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span>
@@ -325,13 +327,13 @@ <h4>Pass training samples<a class="headerlink" href="#pass-training-samples" tit
 </div>
 <p>This uses</p>
 <ul class="simple">
-<li><p><a class="reference internal" href="../apidocs/padl.html#padl.batch" title="padl.batch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">batch</span></code></a> to move between <a class="reference internal" href="stages.html#stages"><span class="std std-ref">stages</span></a>.</p></li>
+<li><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">batch</span></code> to move between <a class="reference internal" href="stages.html#stages"><span class="std std-ref">stages</span></a>.</p></li>
 </ul>
-</div>
-</div>
-<div class="section" id="id5">
+</section>
+</section>
+<section id="id5">
 <h3>Map<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h3>
-<div class="section" id="example-convert-multiple-images-to-tensors">
+<section id="example-convert-multiple-images-to-tensors">
 <h4>Example: convert multiple images to tensors<a class="headerlink" href="#example-convert-multiple-images-to-tensors" title="Permalink to this headline"></a></h4>
 <p>To continue the <a class="reference internal" href="#generate-image-versions"><span class="std std-ref">above example</span></a>, one could use <em>map</em> to convert
 all resulting <code class="docutils literal notranslate"><span class="pre">PIL</span> <span class="pre">Images</span></code> to tensors.</p>
@@ -350,10 +352,10 @@ <h4>Example: convert multiple images to tensors<a class="headerlink" href="#exam
 </pre></div>
 </div>
 <p>This Transform takes an image path and returns a tuple of tensors.</p>
-</div>
-</div>
-</div>
-</div>
+</section>
+</section>
+</section>
+</section>
 
 
            </div>
diff --git a/docs/usage/creating_transforms.html b/docs/usage/creating_transforms.html
index e92b9c75..56b58ed6 100644
--- a/docs/usage/creating_transforms.html
+++ b/docs/usage/creating_transforms.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Creating Transforms &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="id1">
+  <section id="id1">
 <h1>Creating Transforms<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h1>
 <p>Everything that can be <em>called</em> in python can be converted into a <a class="reference internal" href="../apidocs/padl.transforms.html#padl.transforms.Transform" title="padl.transforms.Transform"><code class="xref py py-class docutils literal notranslate"><span class="pre">Transform</span></code></a>.
 For that, use the <a class="reference internal" href="../apidocs/padl.html#padl.transform" title="padl.transform"><code class="xref py py-func docutils literal notranslate"><span class="pre">transform()</span></code></a> wrapper.</p>
@@ -248,7 +250,7 @@ <h1>Creating Transforms<a class="headerlink" href="#id1" title="Permalink to thi
 </li>
 </ul>
 <p>Learn in the <a class="reference internal" href="combining_transforms.html#pipelines"><span class="std std-ref">next Section</span></a> how to combine multiple Transforms to form a Pipeline.</p>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/usage/extras.html b/docs/usage/extras.html
index 74e03f77..bf2bb20c 100644
--- a/docs/usage/extras.html
+++ b/docs/usage/extras.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Extras &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,9 +168,9 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="id1">
+  <section id="id1">
 <h1>Extras<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h1>
-<div class="section" id="the-same-utility">
+<section id="the-same-utility">
 <span id="same"></span><h2>The <code class="xref py py-obj docutils literal notranslate"><span class="pre">same</span></code> Utility<a class="headerlink" href="#the-same-utility" title="Permalink to this headline"></a></h2>
 <p>The special object <code class="xref py py-obj docutils literal notranslate"><span class="pre">same</span></code> allows the application of arbitrary methods to the input -
 <code class="docutils literal notranslate"><span class="pre">same.something()</span></code> is the same as <code class="docutils literal notranslate"><span class="pre">transform(lambda</span> <span class="pre">x:</span> <span class="pre">x.something())</span></code>:</p>
@@ -186,8 +188,8 @@ <h1>Extras<a class="headerlink" href="#id1" title="Permalink to this headline">
 <span class="go">3</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="applying-transforms-depending-on-the-mode">
+</section>
+<section id="applying-transforms-depending-on-the-mode">
 <span id="if-in-mode"></span><h2>Applying Transforms Depending on the Mode<a class="headerlink" href="#applying-transforms-depending-on-the-mode" title="Permalink to this headline"></a></h2>
 <p>Often it can be useful to apply Transforms depending on what mode (infer, eval or train) is being applied. For example, you might want to apply augmentation Transforms only during training.</p>
 <p>Use an <a class="reference internal" href="../apidocs/padl.html#padl.IfInfer" title="padl.IfInfer"><code class="xref py py-class docutils literal notranslate"><span class="pre">IfInfer</span></code></a> Transform to apply a Transform only in the “infer” mode:</p>
@@ -200,8 +202,8 @@ <h1>Extras<a class="headerlink" href="#id1" title="Permalink to this headline">
 </pre></div>
 </div>
 <p>Analogously, use <a class="reference internal" href="../apidocs/padl.html#padl.IfEval" title="padl.IfEval"><code class="xref py py-class docutils literal notranslate"><span class="pre">IfEval</span></code></a> or <a class="reference internal" href="../apidocs/padl.html#padl.IfTrain" title="padl.IfTrain"><code class="xref py py-class docutils literal notranslate"><span class="pre">IfTrain</span></code></a> to apply a Transform only in the “eval”- or “train” mode, respectively.</p>
-</div>
-<div class="section" id="exception-handling">
+</section>
+<section id="exception-handling">
 <h2>Exception Handling<a class="headerlink" href="#exception-handling" title="Permalink to this headline"></a></h2>
 <p>Use <code class="xref py py-class docutils literal notranslate"><span class="pre">Try</span></code> to handle exceptions:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="nd">@transform</span>
@@ -222,8 +224,8 @@ <h2>Exception Handling<a class="headerlink" href="#exception-handling" title="Pe
 <span class="p">)</span>
 </pre></div>
 </div>
-</div>
-</div>
+</section>
+</section>
 
 
            </div>
diff --git a/docs/usage/print_slice.html b/docs/usage/print_slice.html
index 6d537275..26696ae4 100644
--- a/docs/usage/print_slice.html
+++ b/docs/usage/print_slice.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Printing and Slicing &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="printing-and-slicing">
+  <section id="printing-and-slicing">
 <h1>Printing and Slicing<a class="headerlink" href="#printing-and-slicing" title="Permalink to this headline"></a></h1>
 <p>Transforms pretty-print in IPython:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">add</span>
@@ -207,7 +209,7 @@ <h1>Printing and Slicing<a class="headerlink" href="#printing-and-slicing" title
 </pre></div>
 </div>
 <p>Read in the <a class="reference internal" href="pytorch.html#pytorch"><span class="std std-ref">next section</span></a> how <strong>PyTorch</strong> Modules and Transforms work together.</p>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/usage/pytorch.html b/docs/usage/pytorch.html
index 3af07ccb..5db4fdff 100644
--- a/docs/usage/pytorch.html
+++ b/docs/usage/pytorch.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Using PyTorch Modules with Transforms &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,14 +168,14 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="tex2jax_ignore mathjax_ignore section" id="using-pytorch-modules-with-transforms">
+  <section class="tex2jax_ignore mathjax_ignore" id="using-pytorch-modules-with-transforms">
 <span id="pytorch"></span><h1>Using PyTorch Modules with Transforms<a class="headerlink" href="#using-pytorch-modules-with-transforms" title="Permalink to this headline"></a></h1>
 <p>Remember from <a class="reference internal" href="creating_transforms.html#creating-transforms"><span class="std std-ref">the section on creating Transforms</span></a> that <strong>PyTorch</strong> Modules can be converted into Transforms. PADL has built-in capabilities that make it convenient to work with them.</p>
-<div class="section" id="padl-automatically-saves-pytorch-state-dicts">
+<section id="padl-automatically-saves-pytorch-state-dicts">
 <h2>PADL Automatically Saves PyTorch State-Dicts<a class="headerlink" href="#padl-automatically-saves-pytorch-state-dicts" title="Permalink to this headline"></a></h2>
 <p>When using <a class="reference internal" href="../apidocs/padl.html#padl.save" title="padl.save"><code class="xref py py-meth docutils literal notranslate"><span class="pre">padl.save()</span></code></a> to <a class="reference internal" href="saving.html#saving"><span class="std std-ref">save a Transform</span></a>, PADL automatically stores <code class="docutils literal notranslate"><span class="pre">state_dict</span></code>s of the contained <strong>PyTorch</strong> layers along with the code. When loading with <a class="reference internal" href="../apidocs/padl.html#padl.load" title="padl.load"><code class="xref py py-meth docutils literal notranslate"><span class="pre">padl.load()</span></code></a>, these are used to initialize the layers’ parameters.</p>
-</div>
-<div class="section" id="devices">
+</section>
+<section id="devices">
 <span id="id1"></span><h2>Devices<a class="headerlink" href="#devices" title="Permalink to this headline"></a></h2>
 <p>Use <a class="reference internal" href="../apidocs/padl.transforms.html#padl.transforms.Transform.pd_to" title="padl.transforms.Transform.pd_to"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pd_to()</span></code></a> to send all <strong>PyTorch</strong> layers in a Transform to a device:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">my_pipeline</span> <span class="o">=</span> <span class="p">(</span>
@@ -186,8 +188,8 @@ <h2>PADL Automatically Saves PyTorch State-Dicts<a class="headerlink" href="#pad
 <span class="n">my_pipeline</span><span class="o">.</span><span class="n">pd_to</span><span class="p">(</span><span class="s1">&#39;cuda:1&#39;</span><span class="p">)</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="accessing-layers-and-parameters">
+</section>
+<section id="accessing-layers-and-parameters">
 <h2>Accessing Layers and Parameters<a class="headerlink" href="#accessing-layers-and-parameters" title="Permalink to this headline"></a></h2>
 <p>All <strong>PyTorch</strong> layers in a Transform (this includes those nested within Pipelines) are accessible via <a class="reference internal" href="../apidocs/padl.transforms.html#padl.transforms.Transform.pd_layers" title="padl.transforms.Transform.pd_layers"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pd_layers()</span></code></a>:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">layers</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">my_pipeline</span><span class="o">.</span><span class="n">pd_layers</span><span class="p">())</span>
@@ -211,8 +213,8 @@ <h2>Accessing Layers and Parameters<a class="headerlink" href="#accessing-layers
     <span class="n">optimizer</span><span class="o">.</span><span class="n">step</span><span class="p">()</span>
 </pre></div>
 </div>
-</div>
-<div class="section" id="weight-sharing">
+</section>
+<section id="weight-sharing">
 <h2>Weight Sharing<a class="headerlink" href="#weight-sharing" title="Permalink to this headline"></a></h2>
 <p>It is possible to use the same <strong>PyTorch</strong> layer Transforms in multiple Pipelines. Those Transforms then share weights. This can be used, for instance, to create a train Pipeline and an inference Pipeline:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">layer</span> <span class="o">=</span> <span class="n">MyPyTorchLayer</span><span class="p">()</span>
@@ -237,8 +239,8 @@ <h2>Weight Sharing<a class="headerlink" href="#weight-sharing" title="Permalink
 </div>
 <p>After some training, both <code class="docutils literal notranslate"><span class="pre">train_pipeline</span></code> and <code class="docutils literal notranslate"><span class="pre">infer_pipeline</span></code> will have adapted parameters.</p>
 <p>Learn about extras and utilities in the <a class="reference internal" href="extras.html#id1"><span class="std std-ref">next section</span></a>.</p>
-</div>
-</div>
+</section>
+</section>
 
 
            </div>
diff --git a/docs/usage/saving.html b/docs/usage/saving.html
index 825d88ae..8938e879 100644
--- a/docs/usage/saving.html
+++ b/docs/usage/saving.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Saving and Loading &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="saving-and-loading">
+  <section id="saving-and-loading">
 <h1>Saving and Loading<a class="headerlink" href="#saving-and-loading" title="Permalink to this headline"></a></h1>
 <p>All PADL Transforms can be saved via <a class="reference internal" href="../apidocs/padl.html#padl.save" title="padl.save"><code class="xref py py-meth docutils literal notranslate"><span class="pre">save()</span></code></a>:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">save</span>
@@ -189,7 +191,7 @@ <h1>Saving and Loading<a class="headerlink" href="#saving-and-loading" title="Pe
 </pre></div>
 </div>
 <p>Learn in the <a class="reference internal" href="print_slice.html#print-slice"><span class="std std-ref">next section</span></a> how to print and slice Transforms in interactive sessions.</p>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/usage/stages.html b/docs/usage/stages.html
index 17c8039b..b118419f 100644
--- a/docs/usage/stages.html
+++ b/docs/usage/stages.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Stages: Preprocess, Forward and Postprocess &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="stages-preprocess-forward-and-postprocess">
+  <section id="stages-preprocess-forward-and-postprocess">
 <h1>Stages: Preprocess, Forward and Postprocess<a class="headerlink" href="#stages-preprocess-forward-and-postprocess" title="Permalink to this headline"></a></h1>
 <p>Each Pipeline has a <em>preprocess</em>, <em>forward</em> and <em>postprocess</em> part. We call those parts <strong>stages</strong>.</p>
 <p>As the names suggest, the different stages are responsible for processing data in the different parts of the deep learning workflow:</p>
@@ -175,7 +177,7 @@ <h1>Stages: Preprocess, Forward and Postprocess<a class="headerlink" href="#stag
 <li><p><em>forward</em> corresponds to the model’s “forward” part - what happens in a PyTorch module, usually on the gpu</p></li>
 <li><p><em>postprocess</em> stands for post-processing - for example converting the output of a model to a readable format</p></li>
 </ul>
-<p>To define stages, use the special Transforms <a class="reference internal" href="../apidocs/padl.html#padl.batch" title="padl.batch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">padl.batch</span></code></a> and
+<p>To define stages, use the special Transforms <code class="xref py py-obj docutils literal notranslate"><span class="pre">padl.batch</span></code> and
 <a class="reference internal" href="../apidocs/padl.html#padl.unbatch" title="padl.unbatch"><code class="xref py py-obj docutils literal notranslate"><span class="pre">padl.unbatch</span></code></a> in a <a class="reference internal" href="combining_transforms.html#id2"><span class="std std-ref">composed</span></a> Pipeline:</p>
 <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">padl</span> <span class="kn">import</span> <span class="n">transform</span><span class="p">,</span> <span class="n">batch</span><span class="p">,</span> <span class="n">unbatch</span>
 <span class="kn">from</span> <span class="nn">torchvision</span> <span class="kn">import</span> <span class="n">transforms</span><span class="p">,</span> <span class="n">models</span>
@@ -213,7 +215,7 @@ <h1>Stages: Preprocess, Forward and Postprocess<a class="headerlink" href="#stag
 </div>
 <p>The Transforms in the preprocess and postprocess stages process the elements <em>one-by-one</em> whereas the Transforms in the forward stage process <em>batches</em>.</p>
 <p>Continue in the <a class="reference internal" href="apply.html#apply"><span class="std std-ref">next section</span></a> to learn how to apply transforms to data for inference, evaluation and training.</p>
-</div>
+</section>
 
 
            </div>
diff --git a/docs/usage/transform.html b/docs/usage/transform.html
index e893e37f..7bfd54f7 100644
--- a/docs/usage/transform.html
+++ b/docs/usage/transform.html
@@ -1,7 +1,8 @@
 <!DOCTYPE html>
 <html class="writer-html5" lang="en" >
 <head>
-  <meta charset="utf-8" />
+  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
+
   <meta name="viewport" content="width=device-width, initial-scale=1.0" />
   <title>Transforms and Pipelines &mdash; PADL 0.1.0 documentation</title>
       <link rel="stylesheet" href="../static/pygments.css" type="text/css" />
@@ -112,7 +113,8 @@
 </li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-pytorch-modules">Saving pytorch modules</a></li>
 <li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#defining-transform-within-nested-scopes">Defining Transform within nested scopes</a></li>
-<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#what-does-not-save">What does not save</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#saving-transforms-from-other-modules">Saving Transforms from other modules</a></li>
+<li class="toctree-l3"><a class="reference internal" href="../advanced/saving.html#id2">What does not save</a><ul>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-the-targets-of-with-blocks">Variables defined as the targets of <code class="code docutils literal notranslate"><span class="pre">with</span></code> blocks</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#variables-defined-as-targets-of-loops">Variables defined as targets of loops</a></li>
 <li class="toctree-l4"><a class="reference internal" href="../advanced/saving.html#mutated-objects">Mutated objects</a></li>
@@ -166,7 +168,7 @@
           <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
            <div itemprop="articleBody">
              
-  <div class="section" id="transforms-and-pipelines">
+  <section id="transforms-and-pipelines">
 <h1><em>Transforms</em> and <em>Pipelines</em><a class="headerlink" href="#transforms-and-pipelines" title="Permalink to this headline"></a></h1>
 <p>The central abstractions in PADL is the <em>Transform</em>. A Transform
 is a function with added functionality for the deep learning workflow.</p>
@@ -181,7 +183,7 @@ <h1><em>Transforms</em> and <em>Pipelines</em><a class="headerlink" href="#trans
 </ul>
 <p>and much more.</p>
 <p>Read the <a class="reference internal" href="creating_transforms.html#id1"><span class="std std-ref">next section</span></a> to learn how to create Transforms.</p>
-</div>
+</section>
 
 
            </div>
diff --git a/padl/__init__.py b/padl/__init__.py
index f363e13d..ae7ee0c0 100644
--- a/padl/__init__.py
+++ b/padl/__init__.py
@@ -1,16 +1,14 @@
 from padl.wrap import transform
-from padl.transforms import Batchify, Unbatchify, Identity, group, load, save
+from padl.transforms import (
+    Batchify, Unbatchify, identity, Identity, group, load, save, fulldump,
+    importdump
+)
 from padl.dumptools.serialize import value
 from padl.util_transforms import IfTrain, IfEval, IfInfer, IfInMode
 from padl.version import __version__
 
 #: this is same
 from padl.utils import same
-
-#: The *identity* Transform: *f(x) = x*.
-identity = Identity()
-
-#: See :class:`Batchify`.
 batch = Batchify()
 
 #: See :class:`Unbatchify`.
@@ -18,4 +16,4 @@
 
 __all__ = ['value', 'transform', 'Batchify', 'Unbatchify', 'Identity', 'group', 'load', 'save',
            'IfTrain', 'IfEval', 'IfInfer', 'IfInMode', 'identity', 'batch', 'unbatch', 'same',
-           '__version__']
+           '__version__', 'fulldump', 'importdump']
diff --git a/padl/dumptools/inspector.py b/padl/dumptools/inspector.py
index bc55d7c9..28983b5c 100644
--- a/padl/dumptools/inspector.py
+++ b/padl/dumptools/inspector.py
@@ -16,17 +16,14 @@ class CallInfo:
     """Information about the calling context.
 
     Contains the following information:
-        - the module from which the call was made
         - the function from which that call was made
-        - the scope (see `symfinder.Scope`)
+        - the scope (see :class:`symfinder.Scope`)
 
     :param origin: Where to look for the call, can be
         - "nextmodule": use the first frame not in the module the object was created in
         - "here": use the frame the object was created in
     :param drop_n: Drop *n* levels from the calling scope.
     :param ignore_scope: Don't try to determine the scope (use the toplevel scope instead).
-
-    :returns: A CallInfo object.
     """
 
     def __init__(self, origin: Literal['nextmodule', 'here'] = 'nextmodule',
@@ -80,14 +77,14 @@ def non_init_caller_frameinfo() -> inspect.FrameInfo:
     return frameinfo
 
 
-def trace_this(tracefunc: Callable, frame: Optional[types.FrameType] = None):
+def trace_this(tracefunc: Callable, frame: Optional[types.FrameType] = None, *args, **kwargs):
     """Call in a function body to trace the rest of the function execution with function
     *tracefunc*. *tracefunc* must match the requirements for the argument of `sys.settrace`
     (in the documentation of which more details can be found).
 
     Example:
 
-    >>> def tracefunc(frame, event, arg)
+    >>> def tracefunc(frame, event, arg):
     ...     if 'event' == 'return':
     ...         print('returning', arg)
 
@@ -106,7 +103,7 @@ def trace_this(tracefunc: Callable, frame: Optional[types.FrameType] = None):
         frame = inspect.currentframe().f_back
 
     def trace(frame, event, arg):
-        tracefunc(frame, event, arg)
+        tracefunc(frame, event, arg, *args, **kwargs)
         if event == 'return':
             sys.settrace(previous_tracefunc)
         if previous_tracefunc is not None:
diff --git a/padl/dumptools/packagefinder.py b/padl/dumptools/packagefinder.py
index ea62c94d..ebb8304d 100644
--- a/padl/dumptools/packagefinder.py
+++ b/padl/dumptools/packagefinder.py
@@ -24,7 +24,19 @@ def standard_lib_names_gen(include_underscored=False):
 
 
 def get_packages(nodes):
-    """Get a list of package names given a list of ast nodes *nodes*. """
+    """Get a list of package names given a list of ast nodes *nodes*.
+
+    Example:
+
+    >>> import ast
+    >>> source = '''
+    ... import foo.bla as blu
+    ... import bup
+    ... from blip import blop
+    ... ...'''
+    >>> get_packages(ast.parse(source).body) == {'foo', 'blip', 'bup'}
+    True
+    """
     result = set()
     for node in nodes:
         if isinstance(node, ast.Import):
diff --git a/padl/dumptools/serialize.py b/padl/dumptools/serialize.py
index 22727b69..88d5bc3c 100644
--- a/padl/dumptools/serialize.py
+++ b/padl/dumptools/serialize.py
@@ -9,7 +9,7 @@
 
 from padl.dumptools import inspector, sourceget, var2mod, symfinder
 from padl.dumptools.symfinder import ScopedName
-from padl.dumptools.var2mod import CodeNode
+from padl.dumptools.var2mod import CodeNode, CodeGraph
 
 
 SCOPE = symfinder.Scope.toplevel(sys.modules[__name__])
@@ -40,8 +40,8 @@ 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, self.load_scopemap = (
-            var2mod.build_codegraph(ScopedName(load_function.__name__, self.scope))
+        self.load_codegraph = (
+            var2mod.CodeGraph.build(ScopedName(load_function.__name__, self.scope))
         )
         self.load_name = load_function.__name__
         super().__init__()
@@ -49,7 +49,7 @@ def __init__(self, val: Any, save_function: Callable, load_function: callable,
     def save(self, path: Path):
         """Save the serializer's value to *path*.
 
-        Returns a codegraph and a scopemap containing code needed to load the value.
+        Returns a codegraph containing code needed to load the value.
         """
         if path is None:
             path = Path('?')
@@ -70,16 +70,17 @@ def save(self, path: Path):
         else:
             raise ValueError('The save function must return a filename, a list of filenames or '
                              'nothing.')
-        return (
+        return CodeGraph(
             {**self.load_codegraph,
              ScopedName(self.varname, self.scope):
                  CodeNode(source=f'{self.varname} = {self.load_name}({complete_path})',
-                          globals_={ScopedName(self.load_name, self.scope)}),
+                          globals_={ScopedName(self.load_name, self.scope)},
+                          scope=self.scope),
              ScopedName('pathlib', SCOPE):
                  CodeNode(source='import pathlib',
                           globals_=set(),
-                          ast_node=ast.parse('import pathlib').body[0])},
-            self.load_scopemap
+                          ast_node=ast.parse('import pathlib').body[0],
+                          scope=self.scope)}
         )
 
     @property
@@ -88,17 +89,13 @@ def varname(self):
         return f'PADL_VALUE_{self.index}'
 
     @classmethod
-    def save_all(cls, codegraph, scopemap, path):
+    def save_all(cls, codegraph, path):
         """Save all values. """
         for codenode in list(codegraph.values()):
             for serializer in cls.store:
                 if serializer.varname in codenode.source:
-                    loader_graph, loader_scopemap = serializer.save(path)
+                    loader_graph = serializer.save(path)
                     codegraph.update(loader_graph)
-                    scopemap.update(loader_scopemap)
-                    for scoped_name in codenode.globals_:
-                        if scoped_name.name == serializer.varname:
-                            scopemap[scoped_name] = SCOPE
 
 
 def save_json(val, path):
diff --git a/padl/dumptools/sourceget.py b/padl/dumptools/sourceget.py
index 6473b76e..d018bb91 100644
--- a/padl/dumptools/sourceget.py
+++ b/padl/dumptools/sourceget.py
@@ -28,11 +28,20 @@ def get_source(filename: str, use_replace_cache: bool = True) -> str:
     If *use_replace_cache*, try getting the source from the "replace_cache", which can contain
     explicit replacements of the original source strings.
     """
+    # needed to support doctest
+    if filename.startswith('<doctest'):
+        stack = inspect.stack()
+        for frameinfo in stack:
+            if frameinfo.filename == filename:
+                return ''.join(frameinfo.code_context)
+
     if use_replace_cache and filename in replace_cache:
         return replace_cache[filename]
+        
     if filename in linecache.cache:
         # the ipython case
         return ''.join(linecache.cache[filename][2])
+
     # normal module
     with open(filename) as f:
         return f.read()
@@ -227,6 +236,7 @@ def _cut_string(string: str, from_line: int, to_line: int, from_col: int, to_col
     """Cut a string and return the resulting substring.
 
     Example:
+
         Given a *string*,
 
         "xxxxxxxxxxx
diff --git a/padl/dumptools/symfinder.py b/padl/dumptools/symfinder.py
index 7fc20c49..c36d99c9 100644
--- a/padl/dumptools/symfinder.py
+++ b/padl/dumptools/symfinder.py
@@ -1,3 +1,4 @@
+# pylint: disable=invalid-name
 """Module for symbolically finding python entities in python source code given their name.
 
 A thing in python can get its name in various ways:
@@ -51,6 +52,7 @@ def found_something(self) -> bool:
         return self._result is not None
 
     def visit_Module(self, node):
+        """Visit each statement in a module's body, from top to bottom and stop at "max_n". """
         for i, statement in enumerate(node.body[::-1]):
             if i > self.max_n:
                 return
@@ -60,6 +62,8 @@ def visit_Module(self, node):
                 return
 
     def visit_With(self, node):
+        """With is currently not supported - raises an error if the "thing" is defined in the
+        head of a "with"-statement. """
         for item in node.items:
             if item.optional_vars is not None and item.optional_vars.id == self.var_name:
                 raise NotImplementedError(f'"{self.var_name}" is defined in the head of a with'
@@ -68,11 +72,11 @@ def visit_With(self, node):
             self.visit(subnode)
 
     def visit_ClassDef(self, node):
-        # don't search definitions
+        """Don't search class definitions (as that's another scope). """
         pass
 
     def visit_FunctionDef(self, node):
-        # don't search definitions
+        """Don't search function definitions (as that's another scope). """
         pass
 
     def deparse(self) -> str:
@@ -90,7 +94,30 @@ class _NameFinder(_ThingFinder):
 
 
 class _FunctionDefFinder(_NameFinder):
-    """Class for finding a *function definition* of a specified name in an AST tree. """
+    """Class for finding a *function definition* of a specified name in an AST tree.
+
+    Example:
+
+    >>> source = '''
+    ... import baz
+    ...
+    ... def foo(x):
+    ...     ...
+    ...
+    ... def bar(y):
+    ...     ...
+    ...
+    ... X = 100'''
+    >>> finder = _FunctionDefFinder(source, 'foo')
+    >>> node = ast.parse(source)
+    >>> finder.visit(node)
+    >>> finder.found_something()
+    True
+    >>> finder.deparse()
+    'def foo(x):\\n    ...'
+    >>> finder.node()  # doctest: +ELLIPSIS
+    <_ast.FunctionDef object at 0x...>
+    """
 
     def visit_FunctionDef(self, node):
         if node.name == self.var_name:
@@ -119,7 +146,30 @@ def _fix_indent(source):
 
 
 class _ClassDefFinder(_NameFinder):
-    """Class for finding a *class definition* of a specified name in an AST tree. """
+    """Class for finding a *class definition* of a specified name in an AST tree.
+
+    Example:
+
+    >>> source = '''
+    ... import baz
+    ...
+    ... class Foo:
+    ...     ...
+    ...
+    ... def bar(y):
+    ...     ...
+    ...
+    ... X = 100'''
+    >>> finder = _ClassDefFinder(source, 'Foo')
+    >>> node = ast.parse(source)
+    >>> finder.visit(node)
+    >>> finder.found_something()
+    True
+    >>> finder.deparse()
+    'class Foo:\\n    ...'
+    >>> finder.node()  # doctest: +ELLIPSIS
+    <_ast.ClassDef object at 0x...>
+    """
 
     def visit_ClassDef(self, node):
         if node.name == self.var_name:
@@ -134,7 +184,30 @@ def deparse(self):
 
 
 class _ImportFinder(_NameFinder):
-    """Class for finding a *module import* of a specified name in an AST tree. """
+    """Class for finding a *module import* of a specified name in an AST tree.
+
+    Works with normal imports ("import x") and aliased imports ("import x as y").
+
+    Example:
+
+    >>> source = '''
+    ... import baz as boo
+    ...
+    ... class Foo:
+    ...     ...
+    ...
+    ... def bar(y):
+    ...     ...
+    ...
+    ... X = 100'''
+    >>> finder = _ImportFinder(source, 'boo')
+    >>> node = ast.parse(source)
+    >>> finder.visit(node)
+    >>> finder.found_something()
+    True
+    >>> finder.deparse()
+    'import baz as boo'
+    """
 
     def visit_Import(self, node):
         for name in node.names:
@@ -155,12 +228,34 @@ def deparse(self):
     def node(self):
         # TODO: cache deparse?
         node = ast.parse(self.deparse()).body[0]
-        node._globalscope = True
+        if node.names[0].asname is None:
+            node._globalscope = True
         return node
 
 
 class _ImportFromFinder(_NameFinder):
-    """Class for finding a *from import* of a specified name in an AST tree. """
+    """Class for finding a *from import* of a specified name in an AST tree.
+
+    Example:
+
+    >>> source = '''
+    ... from boo import baz as hoo, bup
+    ...
+    ... class Foo:
+    ...     ...
+    ...
+    ... def bar(y):
+    ...     ...
+    ...
+    ... X = 100'''
+    >>> finder = _ImportFromFinder(source, 'hoo')
+    >>> node = ast.parse(source)
+    >>> finder.visit(node)
+    >>> finder.found_something()
+    True
+    >>> finder.deparse()
+    'from boo import baz as hoo'
+    """
 
     def visit_ImportFrom(self, node):
         for name in node.names:
@@ -180,11 +275,38 @@ def deparse(self):
 
     def node(self):
         # TODO: cache deparse?
-        return ast.parse(self.deparse()).body[0]
+        node = ast.parse(self.deparse()).body[0]
+        # the scope does not matter here
+        if node.names[0].asname is None:
+            node._globalscope = True
+        return node
 
 
 class _AssignFinder(_NameFinder):
-    """Class for finding a *variable assignment* of a specified name in an AST tree. """
+    """Class for finding a *variable assignment* of a specified name in an AST tree.
+
+    Example:
+
+    >>> source = '''
+    ... import baz
+    ...
+    ... class Foo:
+    ...     ...
+    ...
+    ... def bar(y):
+    ...     ...
+    ...
+    ... X = 100'''
+    >>> finder = _AssignFinder(source, 'X')
+    >>> node = ast.parse(source)
+    >>> finder.visit(node)
+    >>> finder.found_something()
+    True
+    >>> finder.deparse()
+    'X = 100'
+    >>> finder.node()  # doctest: +ELLIPSIS
+    <_ast.Assign object at 0x...>
+    """
 
     def visit_Assign(self, node):
         for target in node.targets:
@@ -210,7 +332,30 @@ def deparse(self):
 
 
 class _CallFinder(_ThingFinder):
-    """Class for finding a *call* in an AST tree. """
+    """Class for finding a *call* in an AST tree.
+
+    Example:
+
+    >>> source = '''
+    ... import baz
+    ...
+    ... class Foo:
+    ...     ...
+    ...
+    ... def bar(y):
+    ...     ...
+    ...
+    ... X = baz(100)'''
+    >>> finder = _CallFinder(source, 'baz')
+    >>> node = ast.parse(source)
+    >>> finder.visit(node)
+    >>> finder.found_something()
+    True
+    >>> finder.deparse()
+    'baz(100)'
+    >>> finder.node()  # doctest: +ELLIPSIS
+    <_ast.Call object at 0x...>
+    """
 
     def visit_Call(self, node):
         if node.func.id == self.var_name:
@@ -276,8 +421,13 @@ def _get_call_assignments(args, source, values, keywords):
 def _get_call_signature(source: str):
     """Get the call signature of a string containing a call.
 
-    :param source: String containing a call (e.g. "a(2, b, c=100)")
+    :param source: String containing a call (e.g. "a(2, b, 'f', c=100)")
     :returns: A tuple with a list of positional arguments and a list of keyword arguments.
+
+    Example:
+
+    >>> _get_call_signature("a(2, b, 'f', c=100)")
+    (['2', 'b', "'f'"], {'c': '100'})
     """
     call = ast.parse(source).body[0].value
     if not isinstance(call, ast.Call):
@@ -390,12 +540,12 @@ def module_name(self) -> str:
     def unscoped(self, varname: str) -> str:
         """Convert a variable name in an "unscoped" version by adding strings representing
         the containing scope. """
-        if not self.scopelist:
+        if not self.scopelist and self.module_name in ('', '__main__'):
             return varname
-        return f'{"_".join(x[0] for x in [self.module_name] + self.scopelist)}_{varname}'
+        return f'{"_".join(x[0] for x in [(self.module_name.replace(".", "_"), 0)] + self.scopelist)}_{varname}'
 
     def __repr__(self):
-        return f'Scope[{self.module_name}.{".".join(x[0] for x in self.scopelist)}]'
+        return f'Scope[{".".join(x[0] for x in [(self.module_name, 0)] + self.scopelist)}]'
 
     def __len__(self):
         return len(self.scopelist)
@@ -409,26 +559,35 @@ def __hash__(self):
 
 @dataclass
 class ScopedName:
-    name: str
-    scope: Scope
-    n: int = 0
+    """A name with a scope and a counter. The "name" is the name of the item, the scope is its
+    :class:`Scope` and the counter counts the items with the same name, in the same scope,
+    from most recent on up.
 
-    def __hash__(self):
-        return hash((self.name, self.scope))
+    Example - the following::
 
+        a = 1
 
-def find_in_function_def(var_name, source, lineno, call_source):
-    """Find where *var_name* was assigned.
+        def f(x):
+            a = 2
 
-    :param var_name: Name of the variable to look for.
-    :param source: Source string.
-    :param lineno: Line number in the function to search in (this is being used to determine in
-        which function scope to search).
-    :param call_source: Source of the function call (e.g. `"f(123, b=1)"`). This is being used to
-        determine argument values.
+        a = a + 1
+
+    contains four scoped names:
+
+        - The "a" of `a = a + 1`, with `name = a`, module-level scope and `n = 0` (it is the most
+          recent "a" in the module level scope).
+        - The "a" in the function body, with `name = a`, function f scope and `n = 0` (it is the
+          most recent "a" in "f" scope).
+        - the function name "f", module level scope, `n = 0`
+        - the "a" of `a = 1`, with `name = a`, module-level scope and `n = 1` (as it's the second
+          most recent "a" in its scope).
     """
-    scope = Scope.from_source(source, lineno, call_source)
-    return find_in_scope(ScopedName(var_name, scope))
+    name: str
+    scope: Scope
+    n: int = 0
+
+    def __hash__(self):
+        return hash((self.name, self.scope, self.n))
 
 
 def find_in_scope(name: ScopedName):
@@ -449,7 +608,7 @@ def find_in_scope(name: ScopedName):
                 continue
             source, node = res
             if getattr(node, '_globalscope', False):
-                scope = scope.global_()
+                scope = Scope.empty()
 
             return (source, node), scope
         except NameNotFound:
@@ -458,7 +617,10 @@ def find_in_scope(name: ScopedName):
     if scope.module is None:
         raise NameNotFound(f'{name.name} not found in function hierarchy.')
     source, node = find(name.name, scope.module, i)
-    scope = getattr(node, '_scope', scope.global_())
+    if getattr(node, '_globalscope', False):
+        scope = Scope.empty()
+    else:
+        scope = getattr(node, '_scope', scope.global_())
     return (source, node), scope
 
 
@@ -608,12 +770,12 @@ def split_call(call_source):
     """
     node = ast.parse(call_source).body[0].value
     call = ast.get_source_segment(call_source, node.func)
-    if not node.args:
-        args = ''
-    else:
-        args = sourceget.cut(call_source,
-                             node.args[0].lineno - 1,
-                             node.args[-1].end_lineno - 1,
-                             node.args[0].col_offset,
-                             node.args[-1].end_col_offset)
+    if not node.args and not node.keywords:
+        return call, ''
+    all_args = node.args + [x.value for x in node.keywords]
+    args = sourceget.cut(call_source,
+                         node.func.lineno - 1,
+                         all_args[-1].end_lineno - 1,
+                         node.func.end_col_offset + 1,
+                         all_args[-1].end_col_offset)
     return call, args
diff --git a/padl/dumptools/var2mod.py b/padl/dumptools/var2mod.py
index 6122e043..3f876346 100644
--- a/padl/dumptools/var2mod.py
+++ b/padl/dumptools/var2mod.py
@@ -3,9 +3,9 @@
 from collections import Counter, namedtuple
 from collections.abc import Iterable
 from dataclasses import dataclass
-from typing import Optional, List, Tuple
+from typing import Dict, Optional, List, Tuple, Set
 
-from padl.dumptools.symfinder import find_in_scope, ScopedName
+from padl.dumptools.symfinder import find_in_scope, ScopedName, Scope
 
 try:
     unparse = ast.unparse
@@ -14,13 +14,12 @@
 
 
 class Finder(ast.NodeVisitor):
-    """Class for finding ast nodes of a given type in an ast tree.
+    """:class:`ast.NodeVisitor` for finding AST-nodes of a given type in an AST-tree.
 
     Example:
 
-    >>> f = Finder(ast.Name).find(ast.parse('x(y)'))
-    >>> all([isinstance(x, ast.Name) for x in f])
-    True
+    >>> Finder(ast.Name).find(ast.parse('x(y)'))  # doctest: +ELLIPSIS
+    [<_ast.Name object at 0x...>, <_ast.Name object at 0x...>]
     """
 
     def __init__(self, nodetype):
@@ -35,15 +34,26 @@ def generic_visit(self, node):
         super().generic_visit(node)
 
     def find(self, node):
-        """Find subnodes of node. """
+        """Find sub-nodes of *node*. """
         self.visit(node)
         return self.result
 
     def get_source_segments(self, source):
+        """Get a list of source segments of found nodes in source and their respective positions.
+
+        :return: A list of tuples (<source segment>, <position>) where position is a tuple
+            (<lineno>, <end lineno>, <col offset>, <end col offset>).
+
+        Example:
+
+        >>> Finder(ast.Name).get_source_segments('x(y)')
+        [('x', (1, 1, 0, 1)), ('y', (1, 1, 2, 3))]
+        """
         nodes = self.find(ast.parse(source))
         return [
-            (ast.get_source_segment(source, node),
-             (node.lineno, node.end_lineno, node.col_offset, node.end_col_offset)
+            (
+                ast.get_source_segment(source, node),
+                (node.lineno, node.end_lineno, node.col_offset, node.end_col_offset)
             )
             for node in nodes
         ]
@@ -53,7 +63,24 @@ def get_source_segments(self, source):
 
 
 class _VarFinder(ast.NodeVisitor):
-    """NodeVisitor that traverses all nodes subnodes and finds all named things. """
+    # pylint: disable=invalid-name
+    """An :class:`ast.NodeVisitor` that traverses all subnodes of an AST-node and finds all named
+    things (variables, functions, classes, modules etc) used in it.
+
+    The results are grouped as "globals" and "locals". "locals" are those things whose definition
+    is found under the node itself whereas "globals" are all others.
+
+    >>> source = '''
+    ... def f(x):
+    ...     y = a + 1
+    ...     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)})
+    True
+    """
 
     def __init__(self):
         super().__init__()
@@ -61,7 +88,7 @@ def __init__(self):
         self.locals = set()
 
     def find(self, node):
-        """Find all globals and locals.
+        """Find all globals and locals in an AST-node.
 
         :param node: An ast node to search.
         :returns: Tuple of sets with names of globals and locals.
@@ -75,8 +102,26 @@ def find(self, node):
         self.visit(node)
         return Vars(self.globals, self.locals)
 
+    def find_in_source(self, source):
+        """Find all globals and locals in a piece of source code."""
+        return self.find(ast.parse(source).body[0])
+
     def _find_in_function_def(self, node):
-        """Special case: exclude args from globals. """
+        """This is a special case: Functions args are "locals" rather than "globals".
+
+        Example:
+
+        >>> source = '''
+        ... def f(x):
+        ...     y = a + 1
+        ...     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)})
+        True
+        """
         for arg in node.args.args + node.args.posonlyargs + node.args.kwonlyargs:
             self.locals.add((arg.arg, 0))
         if node.args.vararg is not None:
@@ -88,15 +133,40 @@ def _find_in_function_def(self, node):
         return Vars(self.globals, self.locals)
 
     def visit_Name(self, node):
+        """Names - Every `Name`'s id is a global unless it's a local.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('x')
+        Vars(globals={('x', 0)}, locals=set())
+        """
         if (node.id, 0) not in self.locals:
             self.globals.add((node.id, 0))
 
     def visit_withitem(self, node):
+        """With statements - The "as ..." of a with statement is a local.
+
+        Example:
+
+        >>> source = '''
+        ... with open('file') as f:
+        ...     ...
+        ... '''
+        >>> _VarFinder().find_in_source(source)
+        Vars(globals={('open', 0)}, locals={('f', 0)})
+        """
         self.visit(node.context_expr)
         if node.optional_vars is not None:
             self.locals.add((node.optional_vars.id, 0))
 
     def visit_Assign(self, node):
+        """Assignments - Their targets are locals, their values are globals.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('x = y')
+        Vars(globals={('y', 0)}, locals={('x', 0)})
+        """
         # collect targets (the 'x' in 'x = a', can be multiple due to 'x = y = a')
         targets = set()
         for target in node.targets:
@@ -122,15 +192,39 @@ def visit_Assign(self, node):
         self.globals.update(sub_dependencies - self.locals)
 
     def visit_For(self, node):
+        """For loops - Looped over items are locals.
+
+        Example:
+
+        >>> source = '''
+        ... for x in range(10):
+        ...     ...
+        ... '''
+        >>> _VarFinder().find_in_source(source)
+        Vars(globals={('range', 0)}, locals={('x', 0)})
+        """
         self.locals.update([(x.id, 0) for x in Finder(ast.Name).find(node.target)])
         for child in node.body:
             self.visit(child)
+        self.visit(node.iter)
 
     def visit_NamedExpr(self, node):
+        """The walrus operator - it's targets become locals.
+
+        Example:
+
+        >>> source = '''
+        ... while a := l.pop():
+        ...     ...
+        ... '''
+        >>> _VarFinder().find_in_source(source)
+        Vars(globals={('l', 0)}, locals={('a', 0)})
+        """
         self.locals.update([(x.id, 0) for x in Finder(ast.Name).find(node.target)])
+        self.visit(node.value)
 
     def visit_comprehension(self, node):
-        """Special case for comprehension - comprehension targets should be ignored. """
+        """Comprehensions are a special case: Their targets should be ignored. """
         targets = set()
         for gen in node.generators:
             for name in Finder(ast.Name).find(gen.target):
@@ -139,33 +233,80 @@ def visit_comprehension(self, node):
         self.globals.update(all_ - targets - self.locals)
 
     def visit_DictComp(self, node):
+        """Dict comprehensions.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('{k: v for k, v in foo}')
+        Vars(globals={('foo', 0)}, locals=set())
+        """
         self.visit_comprehension(node)
 
     def visit_ListComp(self, node):
+        """List comprehensions.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('[x for x in foo]')
+        Vars(globals={('foo', 0)}, locals=set())
+        """
         self.visit_comprehension(node)
 
     def visit_SetComp(self, node):
+        """Set comprehensions.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('{x for x in foo}')
+        Vars(globals={('foo', 0)}, locals=set())
+        """
         self.visit_comprehension(node)
 
     def visit_GeneratorExp(self, node):
-        pass
+        """Generator expressions.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('(x for x in foo)')
+        Vars(globals={('foo', 0)}, locals=set())
+        """
+        self.visit_comprehension(node)
 
     def visit_Lambda(self, node):
+        """Lambda expressions - Their arguments are locals.
+
+        Example:
+
+        >>> vars = _VarFinder().find_in_source('lambda x, y: x + y + foo')
+        >>> vars == Vars(globals={('foo', 0)}, locals={('x', 0), ('y', 0)})
+        True
+        """
         for arg in node.args.args + node.args.posonlyargs + node.args.kwonlyargs:
             self.locals.add((arg.arg, 0))
         self.visit(node.body)
 
     def visit_FunctionDef(self, node):
+        """Function definitions. """
         self.locals.add((node.name, 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))
         inner_globals = find_globals(node)
         self.globals.update(inner_globals - self.locals)
 
     def visit_Import(self, node):
+        """Import statements.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('import foo')
+        Vars(globals=set(), locals={('foo', 0)})
+        >>> _VarFinder().find_in_source('import foo as bar')
+        Vars(globals=set(), locals={('bar', 0)})
+        """
         for name in node.names:
             if name.asname is None:
                 self.locals.add((name.name, 0))
@@ -173,6 +314,15 @@ def visit_Import(self, node):
                 self.locals.add((name.asname, 0))
 
     def visit_ImportFrom(self, node):
+        """Import-from statements.
+
+        Example:
+
+        >>> _VarFinder().find_in_source('from foo import bar')
+        Vars(globals=set(), locals={('bar', 0)})
+        >>> _VarFinder().find_in_source('from foo import bar as baz')
+        Vars(globals=set(), locals={('baz', 0)})
+        """
         for name in node.names:
             if name.asname is None:
                 self.locals.add((name.name, 0))
@@ -181,63 +331,139 @@ def visit_ImportFrom(self, node):
 
 
 class _Renamer(ast.NodeTransformer):
+    # pylint: disable=invalid-name
+    """An :class:`ast.NodeTransformer` for renaming things. Used in :func:`rename`.
+
+    :param from_: Rename everything called this ...
+    :param to: ... to this.
+    :param rename_locals: If *True*, rename local things, else, only rename globals.
+    """
+
     def __init__(self, from_, to, rename_locals):
         self.from_ = from_
         self.to = to
         self.rename_locals = rename_locals
 
     def visit_arg(self, node):
+        """Arguments.
+
+        Example:
+
+        >>> node = ast.parse('''
+        ... def f(a, b):
+        ...    ...
+        ... ''').body[0]
+        >>> unparse(rename(node, 'a', 'c', rename_locals=True))
+        '\\n\\ndef f(c, b):\\n    ...\\n'
+        """
         if node.arg == self.from_:
             return ast.arg(**{**node.__dict__, 'arg': self.to})
         return node
 
     def visit_Name(self, node):
+        """Names.
+
+        Example:
+
+        >>> node = ast.parse('x')
+        >>> unparse(rename(node, 'x', 'y', True)).strip()
+        'y'
+        """
         if node.id == self.from_:
             return ast.Name(**{**node.__dict__, 'id': self.to})
         return node
 
     def visit_FunctionDef(self, node):
+        """Function definitions.
+
+        Example:
+
+        >>> node = ast.parse('''
+        ... def f(a, b):
+        ...    y = p(z)
+        ... ''').body[0]
+        >>> unparse(rename(node, 'z', 'u', rename_locals=True))
+        '\\n\\ndef f(a, b):\\n    y = p(u)\\n'
+        """
         if self.rename_locals and node.name == self.from_:
             name = self.to
         else:
             name = node.name
         if not self.rename_locals:
             globals_ = find_globals(node)
-            if self.from_ not in globals_:
+            if self.from_ not in {x[0] for x in globals_}:
                 return node
         return ast.FunctionDef(**{**node.__dict__,
-                                  'body': rename(node.body, self.from_, self.to),
+                                  'args': rename(node.args, self.from_, self.to,
+                                                 self.rename_locals),
+                                  'body': rename(node.body, self.from_, self.to,
+                                                 self.rename_locals),
                                   'name': name})
 
     def visit_ClassDef(self, node):
+        """Class definitions.
+
+        Example:
+
+        >>> node = ast.parse('''
+        ... class Foo:
+        ...     def __init__(self, a, b):
+        ...         y = p(z)
+        ... ''').body[0]
+        >>> unparse(rename(node, 'z', 'u', rename_locals=True))
+        '\\n\\nclass Foo():\\n\\n    def __init__(self, a, b):\\n        y = p(u)\\n'
+        """
         if self.rename_locals and node.name == self.from_:
             name = self.to
         else:
             name = node.name
         if not self.rename_locals:
             globals_ = find_globals(node)
-            if self.from_ not in globals_:
+            if self.from_ not in {x[0] for x in globals_}:
                 return node
         return ast.ClassDef(**{**node.__dict__,
-                               'body': rename(node.body, self.from_, self.to),
+                               'body': rename(node.body, self.from_, self.to,
+                                              self.rename_locals),
                                'name': name})
 
 
-def rename(tree, from_, to, rename_locals=False):
+def rename(tree: ast.AST, from_: str, to: str, rename_locals: bool = False):
+    """Rename things in an AST tree.
+
+    :param tree: The tree in which to rename things.
+    :param from_: Rename everything called this ...
+    :param to: ... to this.
+    :param rename_locals: If *True*, rename local things, else, only rename globals.
+    """
     if not rename_locals:
         globals_ = find_globals(tree)
-        if from_ not in globals_:
+        if from_ not in {x[0] for x in globals_}:
             return tree
     if isinstance(tree, Iterable) and not isinstance(tree, str):
-        return [rename(x, from_, to) for x in tree]
-    elif not isinstance(tree, ast.AST):
+        return [rename(x, from_, to, rename_locals) for x in tree]
+    if not isinstance(tree, ast.AST):
         return tree
     renamer = _Renamer(from_, to, rename_locals)
     return renamer.visit(tree)
 
 
 class _MethodFinder(ast.NodeVisitor):
-    """Find all methods in a class node. """
+    """Find all methods in a class node.
+
+    Example:
+
+    >>> source = '''
+    ... class X:
+    ...     def one(self):
+    ...         ...
+    ...
+    ...     def two(self):
+    ...         ...
+    ... '''
+    >>> node = ast.parse(source).body[0]
+    >>> _MethodFinder().find(node)  # doctest: +ELLIPSIS
+    {'one': <_ast.FunctionDef object at 0x...>, 'two': <_ast.FunctionDef object at 0x...>}
+    """
 
     def __init__(self):
         self.methods = {}
@@ -245,7 +471,8 @@ def __init__(self):
     def visit_FunctionDef(self, node):
         self.methods[node.name] = node
 
-    def find(self, node: ast.ClassDef):
+    def find(self, node: ast.ClassDef) -> Dict['str', ast.FunctionDef]:
+        """Do find the methods. """
         self.visit(node)
         return self.methods
 
@@ -265,8 +492,24 @@ def _find_globals_in_classdef(node: ast.ClassDef, filter_builtins=True):
     return globals_
 
 
-def find_globals(node: ast.AST, filter_builtins=True):
-    """Find all globals used below a node. """
+def find_globals(node: ast.AST, filter_builtins: bool = True) -> Set[Tuple[str, int]]:
+    """Find all globals used below a node.
+
+    Example:
+
+    >>> source = '''
+    ... def f(x):
+    ...     y = a + 1
+    ...     z = np.array(x + b)
+    ...     return str(z)
+    ... '''
+    >>> node = ast.parse(source).body[0]
+    >>> find_globals(node) == {('a', 0), ('b', 0), ('np', 0)}
+    True
+
+    :param node: AST node to search in.
+    :param filter_builtins:
+    """
     if isinstance(node, ast.ClassDef):
         return _find_globals_in_classdef(node)
     globals_ = _VarFinder().find(node).globals
@@ -297,37 +540,31 @@ def increment_same_name_var(variables: List[Tuple[str, int]], scoped_name: Scope
     return result
 
 
-def build_codegraph(scoped_name: ScopedName):
-    graph = {}
-    scopemap = {}
-
-    todo = {scoped_name}
-
-    while todo and (next_ := todo.pop()):
-        # we know this already - go on
-        if next_ in scopemap:
-            continue
-
-        # find how next_var came into being
-        (source, node), scope_of_next_var = find_in_scope(next_)
-        scopemap[next_] = scope_of_next_var
+def find_codenode(name: ScopedName):
+    """Find the :class:`CodeNode` corresponding to a :class:`ScopedName` *name*. """
+    (source, node), scope_of_next_var = find_in_scope(name)
 
-        # find dependencies
-        globals_ = find_globals(node)
-        next_name = ScopedName(next_.name, scope_of_next_var, next_.n)
-        globals_ = increment_same_name_var(globals_, next_name)
-        graph[next_name] = CodeNode(source=source,
-                                    globals_=globals_,
-                                    ast_node=node)
-        todo.update(globals_)
+    # 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 graph, scopemap
+    return CodeNode(source=source, globals_=globals_, ast_node=node, scope=scope_of_next_var)
 
 
 def _get_nodes_without_in_edges(graph):
     """Get all nodes in directed graph *graph* that don't have incoming edges.
 
     The graph is represented by a dict mapping nodes to incoming edges.
+
+    Example:
+
+    >>> graph = {'a': [], 'b': ['a'], 'c': ['a'], 'd': ['b']}
+    >>> _get_nodes_without_in_edges(graph)
+    ({'a'}, {'b': set(), 'c': set(), 'd': {'b'}})
+
+    :param graph: A dict mapping nodes to incoming edges.
+    :return: The set of nodes without incoming edges and the graph with these nodes removed.
     """
     nextlevel = set()
     for node, deps in graph.items():
@@ -342,35 +579,50 @@ def _get_nodes_without_in_edges(graph):
     return nextlevel, filtered_graph
 
 
-def _topsort(graph):
+# sort precedence
+_PRECEDENCE = {
+    # imports and modules on top, ordered by module name
+    ast.Import: lambda k, v: '1' + v.ast_node.names[0].name.lower() + k.lower(),
+    ast.ImportFrom: lambda k, v: '1' + v.ast_node.module.lower() + k.lower(),
+    # assignments (-> constants) after that
+    ast.Assign: lambda k, _v: '2' + k.lower()
+    # the rest goes below
+}
+
+
+def _topsort(graph: dict) -> List[set]:
     """Topologically sort a graph represented by a dict mapping nodes to incoming edges.
+
+    Raises a :exc:`RuntimeError` if the graph contains a cycle.
+
+    Example:
+
+    >>> graph = {'a': [], 'b': ['a'], 'c': ['a'], 'd': ['b']}
+    >>> _topsort(graph) == [{'a'}, {'b', 'c'}, {'d'}]
+    True
+
+    :param graph: Graph represented by a dict mapping nodes to incoming edges.
+    :return: List of set where each contained set represents one level, the first level
+        has no dependencies, each subsequent level depends on nodes in the previous level.
     """
     levels = []
     graphlen = len(graph)
     while graph:
         nextlevel, graph = _get_nodes_without_in_edges(graph)
         if graphlen == len(graph):  # graph didn't shrink
-            raise RuntimeError('Graph has a circle.')
+            raise RuntimeError('Graph has a cycle.')
         graphlen = len(graph)
         levels.append(nextlevel)
     return levels
 
 
-# sort precedence
-_PRECEDENCE = {
-    ast.Import: lambda k, v: '1' + v[2].names[0].name.lower() + k.lower(),
-    ast.ImportFrom: lambda k, v: '1' + v[2].module.lower() + k.lower(),
-    ast.Assign: lambda k, _v: '2' + k.lower()
-}
-
-
-def _sort(graph):
-    top = _topsort({k: v[1] for k, v in graph.items()})
+def _sort(unscoped_graph):
+    top = _topsort({k: v.globals_ for k, v in unscoped_graph.items()})
 
     def sortkey(x):
-        val = graph[x]
+        val = unscoped_graph[x]
         try:
-            return _PRECEDENCE[val[2].__class__](x[0], val)
+            return _PRECEDENCE[val.ast_node.__class__](x[0], val)
         except KeyError:
             return 'zz' + x[0].lower()
 
@@ -380,48 +632,25 @@ def sortkey(x):
     return res
 
 
-def unscope_graph(graph, scopemap):
-    """Create a version of *graph* where all non-top level variables are renamed (by prepending
-    the scope) to prevent conflicts."""
-    name_scope = {(x.name, x.scope) for x in graph}
-    counts = Counter(x[0] for x in name_scope)
-    to_rename = set(k for k, c in counts.items() if c > 1)
-    scopemap = {**scopemap}
-    scopemap.update({scoped_name: scoped_name.scope for scoped_name in scopemap})
-
-    def unscope(name, scope):
-        if name in to_rename:
-            return scope.unscoped(name)
-        return name
-
-    res = {}
-    for k, v in graph.items():
-        changed = False
-        k_unscoped = unscope(k.name, k.scope)
-        changed = changed or k_unscoped != k.name
-        code = v.source
-        tree = ast.parse(code)
-        rename(tree, k.name, k_unscoped, rename_locals=True)
-        vars_ = set()
-        for var in list(v.globals_):
-            var_unscoped = unscope(var.name, scopemap[var])
-            changed = changed or var_unscoped != var.name
-            rename(tree, var.name, var_unscoped)
-            vars_.add((var_unscoped, var.n))
-        if changed:
-            code = unparse(tree).strip('\n')
-        res[k_unscoped, k.n] = (code, vars_, v.ast_node)
-    return res
-
-
 @dataclass
 class CodeNode:
+    """A node in a :class:`CodeGraph`.
+
+    A `CodeNode` has
+
+    - a *source*: The source code represented by the `CodeNode`.
+    - a set of *globals_*: Names the node depends on.
+    - (optionally) a *scope*: The module and function scope the `CodeNode` lives in.
+    - (optionally) an *ast_node*: An `ast.AST` object representing the code.
+    """
     source: str
     globals_: set
+    scope: Optional[Scope] = None
     ast_node: Optional[ast.AST] = None
 
     @classmethod
     def from_source(cls, source, scope):
+        """Build a `CodeNode` from a source string. """
         node = ast.parse(source).body[0]
         globals_ = {
             ScopedName(var, scope, n)
@@ -431,24 +660,129 @@ def from_source(cls, source, scope):
         return cls(
             source=source,
             ast_node=node,
-            globals_=globals_
+            globals_=globals_,
+            scope=scope
         )
 
 
-def dumps_graph(graph):
-    sorted_ = _sort(graph)
+def _dumps_unscoped(unscoped_graph):
+    """Dump an unscoped (see :meth:`CodeGraph.unscope`) :class:`CodeGraph` to a python source
+    string. """
+    sorted_ = _sort(unscoped_graph)
     res = ''
     for i, name in enumerate(sorted_):
-        here = graph[name]
-        res += here[0]
+        here = unscoped_graph[name]
+        res += here.source
         if i < len(sorted_) - 1:
-            next_ = graph[sorted_[i + 1]]
-            if isinstance(here[2], (ast.Import, ast.ImportFrom)) \
-                    and isinstance(next_[2], (ast.Import, ast.ImportFrom)):
+            next_ = unscoped_graph[sorted_[i + 1]]
+            if isinstance(here.ast_node, (ast.Import, ast.ImportFrom)) \
+                    and isinstance(next_.ast_node, (ast.Import, ast.ImportFrom)):
                 res += '\n'
-            elif isinstance(here[2], ast.Assign) \
-                    and isinstance(next_[2], ast.Assign):
+            elif isinstance(here.ast_node, ast.Assign) \
+                    and isinstance(next_.ast_node, ast.Assign):
                 res += '\n'
             else:
                 res += '\n\n\n'
     return res + '\n'
+
+
+class CodeGraph(dict):
+    """A graph representing python code.
+
+    The nodes in the graph are `CodeNode` objects, representing pieces of code defining python
+    variables. The edges are the dependencies between the nodes.
+
+    As an example - the following code::
+
+        import foo
+
+        def f(x):
+            return foo.bar(x) + 1
+
+        o = f(100)
+
+    defines a codegraph with the nodes::
+
+        foo: "import foo"
+        f: "def f(x) ..."
+        o: "o = f(100)"
+
+    Edges are determined by the variable dependencies between the nodes::
+
+        o -> f -> foo
+
+    As `o` depends on `f` and `f` depends on `foo`.
+    """
+
+    def _unscoped(self):
+        """Create a version of *self* where all non-top level variables are renamed (by prepending
+        the scope) to prevent conflicts."""
+        name_scope = {(k.name, v.scope) for k, v in self.items()}
+        counts = Counter(x[0] for x in name_scope)
+        to_rename = set(k for k, c in counts.items() if c > 1)
+
+        def unscope(name, scope):
+            if name in to_rename:
+                return scope.unscoped(name)
+            return name
+
+        res = {}
+        for k, v in self.items():
+            changed = False
+            k_unscoped = unscope(k.name, k.scope)
+            changed = changed or k_unscoped != k.name
+            code = v.source
+            tree = ast.parse(code)
+            rename(tree, k.name, k_unscoped, rename_locals=True)
+            vars_ = set()
+            for var in list(v.globals_):
+                var_unscoped = unscope(var.name, var.scope)
+                changed = changed or var_unscoped != var.name
+                rename(tree, var.name, var_unscoped)
+                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)
+        return res
+
+    def dumps(self):
+        """Create a python source string with the contents of the graph. """
+        return _dumps_unscoped(self._unscoped())
+
+    @classmethod
+    def build(cls, scoped_name: ScopedName):
+        """Build a codegraph corresponding to a `ScopedName`.
+
+        The name will be searched for in its scope.
+        """
+        graph = cls()
+        done = set()
+
+        todo = {scoped_name}
+
+        while todo and (next_name := todo.pop()):
+            # we know this already - go on
+            if next_name in done:
+                continue
+
+            # find how next_var came into being
+            next_codenode = find_codenode(next_name)
+            graph[next_name] = next_codenode
+
+            todo.update(next_codenode.globals_)
+            done.add(next_name)
+
+        return graph
+
+    def print(self):
+        """Print the graph (for debugging). """
+        for k, v in self.items():
+            print(f'{k.name} {k.scope} {k.n}:')
+            print()
+            print(v.source)
+            print()
+            for dep in v.globals_:
+                print(f'{dep.name} {dep.scope} {dep.n}:')
+            print()
+            print('--------')
+            print()
diff --git a/padl/transforms.py b/padl/transforms.py
index d48079b8..4154dd4a 100644
--- a/padl/transforms.py
+++ b/padl/transforms.py
@@ -23,7 +23,8 @@
 from torch.utils.data import DataLoader
 from tqdm import tqdm
 
-from padl.dumptools import var2mod, symfinder, inspector
+from padl.dumptools import symfinder, inspector
+from padl.dumptools.var2mod import CodeGraph, CodeNode, find_codenode
 from padl.dumptools.symfinder import ScopedName
 from padl.dumptools.serialize import Serializer
 
@@ -33,15 +34,6 @@
     make_green, create_arrow, format_argument, visible_len
 
 
-class _Notset:
-    # pylint: disable=too-few-public-methods
-    def __bool__(self):
-        return False
-
-
-_notset = _Notset()
-
-
 def _unpack_batch(args):
     """Convert an input in batch-form into a tuple of datapoints.
 
@@ -123,21 +115,42 @@ class Transform:
     """Transform base class.
 
     :param call_info: A `CallInfo` object containing information about the how the transform was
-    created (needed for saving).
+        created (needed for saving).
     :param pd_name: name of the transform
     """
     pd_mode = None
+    _pd_external_full_dump_modules = set()
 
     def __init__(self, call_info: Optional[inspector.CallInfo] = None,
                  pd_name: Optional[str] = None):
         if call_info is None:
             call_info = inspector.CallInfo()
         self._pd_call_info = call_info
-        self._pd_varname = _notset
+        self._pd_varname = {}
         self._pd_name = pd_name
         self._pd_device = 'cpu'
         self._pd_layers = None
         self._pd_stages = None
+        self._pd_external_full_dump = False
+
+    @property
+    def _pd_full_dump_relevant_module(self):
+        return self._pd_call_info.scope.module
+
+    @property
+    def _pd_full_dump(self) -> bool:
+        """If *True*, dump the Transform in full (with definition etc) even if it was defined in
+        a different module. Else, only dump an import statement. """
+        module = self._pd_full_dump_relevant_module
+        # always fully dump Transforms from the module the dump was triggered in
+        if inspector.caller_module() == module:
+            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):
+            return True
+        return self._pd_external_full_dump
 
     @staticmethod
     def _pd_merge_components(components):
@@ -166,7 +179,7 @@ def _pd_get_stages(self):
             if has_batchify:
                 preprocess, forward, postprocess = splits
             else:
-                preprocess, forward, postprocess = builtin_identity, splits[0], splits[2]
+                preprocess, forward, postprocess = identity, splits[0], splits[2]
             self._pd_stages = preprocess, forward, postprocess
 
         return self._pd_stages
@@ -176,7 +189,7 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
                                                             'Transform',
                                                             'Transform'],
                                                       bool]:
-        """ Split the transform into "pre-batchified", "batchified" and "postprocessing" splits.
+        """Split the transform into "pre-batchified", "batchified" and "postprocessing" splits.
 
         *input_components* contains information about the "split" the input is in and potentially
         how many "pipes" of input there are. It is either an int or a (potentially nested)
@@ -202,13 +215,13 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
             - the "postprocess" part of the transform
         """
         component = Transform._pd_merge_components(input_components)
-        assert isinstance(component, int), ('A normal Tranform cannot process input from multiple '
+        assert isinstance(component, int), ('A normal Transform cannot process input from multiple '
                                             'stages.')
         return (
             # a normal transform doesn't change the components
             component,
             # for the component the transform is in, return the transform, else Identity
-            tuple(self if i == component else builtin_identity for i in range(3)),
+            tuple(self if i == component else identity for i in range(3)),
             False
         )
 
@@ -235,7 +248,7 @@ def __rshift__(self, other: "Transform") -> "Compose":
         return Compose([self, other])
 
     def __add__(self, other: "Transform") -> "Rollout":
-        """ Rollout with *other*.
+        """Rollout with *other*.
 
         Example:
             t = a + b + c
@@ -243,7 +256,7 @@ def __add__(self, other: "Transform") -> "Rollout":
         return Rollout([self, other])
 
     def __truediv__(self, other: "Transform") -> "Parallel":
-        """ Parallel with *other*.
+        """Parallel with *other*.
 
         Example:
             t = a / b / c
@@ -258,7 +271,7 @@ def __sub__(self, name: str) -> "Transform":
         """
         named_copy = copy(self)
         named_copy._pd_name = name
-        named_copy._pd_varname = _notset
+        named_copy._pd_varname = {}
         return named_copy
 
     def __invert__(self) -> "Map":
@@ -352,11 +365,28 @@ def pd_save(self, path: Union[Path, str], force_overwrite: bool = False):
         with open(path / 'versions.txt', 'w') as f:
             f.write(versions)
 
-    def _pd_codegraph_startnode(self, name: str) -> var2mod.CodeNode:
-        """Build the start-code-node - the node with the source needed to create *self* as "name".
-        (in the scope where *self* was originally created). """
+    def _pd_codegraph_add_startnodes(self, graph, name: Union[str, None]) -> Set:
+        """Build the start-:class:`CodeNode` objects - the node with the source needed to create
+        *self* as *name* (in the scope where *self* was originally created).
+
+        Returns a set of dependencies (scoped names the start-node depends on).
+        """
+        scope = self._pd_call_info.scope
+
+        nodes = []
+
         start_source = f'{name or "_pd_dummy"} = {self._pd_evaluable_repr()}'
-        return var2mod.CodeNode.from_source(start_source, self._pd_call_info.scope)
+        start = CodeNode.from_source(start_source, scope)
+        nodes.append(start)
+
+        # if name is given, add the node to the CodeGraph, otherwise only use the dependencies
+        if name is not None:
+            graph[ScopedName(name, scope, 0)] = start
+
+        dependencies = set()
+        for node in nodes:
+            dependencies.update(node.globals_)
+        return dependencies
 
     @property
     def _pd_closurevars(self) -> Tuple[dict, dict]:
@@ -364,9 +394,7 @@ def _pd_closurevars(self) -> Tuple[dict, dict]:
         return {}, {}
 
     def _pd_build_codegraph(self, graph: Optional[dict] = None,
-                            scopemap: Optional[dict] = None,
-                            name: Optional[str] = None,
-                            scope: Optional[symfinder.Scope] = None) -> Tuple[dict, dict]:
+                            name: Optional[str] = None) -> Tuple[dict, dict]:
         """Build a codegraph defining the transform.
 
         A codegraph's nodes are :class:`CodeNode` instances which contain a scoped name, a piece of
@@ -411,19 +439,11 @@ def f(x):
         The codegraph can be used to compile a python module defining ``f``.
 
         :param graph: A codegraph to extend. If *None* a new codegraph will be created.
-        :param scopemap: A dict mapping scoped names to the scopes they were created in.
         :param name: The name to give the transform.
-        :param scope: The scope for the start-node. Default is to use the scope of the transform.
-        :return: Updated graph and scopemap.
+        :return: Updated graph.
         """
         if graph is None:
-            graph = {}
-        if scopemap is None:
-            scopemap = {}
-
-        # the default is to use the scope of the transform
-        if scope is None:
-            scope = self._pd_call_info.scope
+            graph = CodeGraph()
 
         # build the start node ->
         # if the *name* is the same as the call, we don't need to assign to the name
@@ -433,19 +453,17 @@ def f(x):
         else:
             new_name = name
 
-        start = self._pd_codegraph_startnode(new_name)
-        # <-
+        todo = self._pd_codegraph_add_startnodes(graph, new_name)
 
-        # if this has closurevars, get them (if there are transforms in the closure, we want to
-        # allow them to build their codegraph themselves, see below)
+        # if this transform has closurevars, get them (if there are transforms in the closure, we
+        # want to allow them to build their codegraph themselves, see below)
         globals_dict, nonlocals_dict = self._pd_closurevars
         all_vars_dict = {**globals_dict, **nonlocals_dict}
 
         # find dependencies
-        todo = {*start.globals_}
         while todo and (next_name := todo.pop()):
             # we know this already - go on
-            if next_name in scopemap:
+            if next_name in graph:
                 continue
 
             # ignoring this (it comes from the serializer)
@@ -459,40 +477,19 @@ def f(x):
                 else:
                     next_obj = all_vars_dict[next_name.name]
                 # pylint: disable=protected-access
-                next_obj._pd_build_codegraph(graph, scopemap, next_name.name)
+                next_obj._pd_build_codegraph(graph, next_name.name)
             except (KeyError, AttributeError):
                 pass
             else:
                 continue
 
-            # find how next_ came into being
-            (source, node), scope_of_next_var = symfinder.find_in_scope(next_name)
-
-            # store a mapping from *next_name* to it's defining scope
-            scopemap[next_name] = scope_of_next_var
+            # find how *next_name* came into being
+            next_codenode = find_codenode(next_name)
+            graph[next_name] = next_codenode
 
-            # find dependencies
-            dependencies = var2mod.find_globals(node)
-            # fix the scope of *next_name* (from where it was a dependency to where it was defined)
-            next_name = ScopedName(next_name.name, scope_of_next_var, next_name.n)
-            dependencies = var2mod.increment_same_name_var(dependencies, next_name)
+            todo.update(next_codenode.globals_)
 
-            graph[next_name] = var2mod.CodeNode(source=source,
-                                                globals_=dependencies,
-                                                ast_node=node)
-            todo.update(dependencies)
-        # finding dependencies done
-
-        # if *new_name* is not ``None``, add the start node (i.e. the node assigning the transform
-        # to *new_name*) to the codegraph
-        if new_name is not None:
-            assert scope is not None
-            graph[ScopedName(new_name, scope, 0)] = start
-
-        if name is not None:
-            scopemap[ScopedName(name, scope, 0)] = self._pd_call_info.scope
-
-        return graph, scopemap
+        return graph
 
     def _pd_evaluable_repr(self, indent: int = 0) -> str:
         """Return a string that if evaluated *in the same scope where the transform was created*
@@ -511,7 +508,7 @@ def _pd_evaluable_repr_inner(self, indent: int = 0) -> str:
     def _pd_all_transforms(self, result: Optional[list] = None) -> list:
         """Return a list of all transforms needed for executing the transform.
 
-        This includes the transform itself, the subtransforms of a compount transform or
+        This includes the transform itself, the subtransforms of a pipeline transform or
         transforms a function-transform depends on as a global. """
         if result is None:
             result = []
@@ -537,11 +534,9 @@ def _pd_dumps(self, return_versions: bool = False,
             dependencies and their versions.
         :param path: Optional path to save at, might be required for serializer code snippets.
         """
-        scope = symfinder.Scope.toplevel(inspector.caller_module())
-        graph, scopemap = self._pd_build_codegraph(name='_pd_main', scope=scope)
-        Serializer.save_all(graph, scopemap, path)
-        unscoped = var2mod.unscope_graph(graph, scopemap)
-        code = var2mod.dumps_graph(unscoped)
+        graph = self._pd_build_codegraph(name='_pd_main')
+        Serializer.save_all(graph, path)
+        code = graph.dumps()
         if return_versions:
             versions = dump_packages_versions(node.ast_node for node in graph.values())
             return code, versions
@@ -599,25 +594,25 @@ def _pd_find_varname(self, scopedict: dict) -> Optional[str]:
         except IndexError:
             return None
 
-    def pd_varname(self, module=None) -> Optional[str]:
+    def pd_varname(self, scope=None) -> Optional[str]:
         """The name of the variable name the transform was last assigned to.
 
         Example:
 
         >>> from padl import transform
         >>> foo = transform(lambda x: x + 1)
-        >>> foo.pd_varname()
+        >>> foo.pd_varname()  # doctest: +SKIP
         'foo'
 
-        :param module: Module to search
+        :param scope: Scope to search
         :return: A string with the variable name or *None* if the transform has not been assigned
             to any variable.
         """
-        if self._pd_varname is _notset or module is not None:
-            if module is None:
-                module = inspector.caller_module()
-            self._pd_varname = self._pd_find_varname(module.__dict__)
-        return self._pd_varname
+        if scope is None:
+            scope = self._pd_call_info.scope
+        if scope not in self._pd_varname:
+            self._pd_varname[scope] = self._pd_find_varname(scope.module.__dict__)
+        return self._pd_varname[scope]
 
     def pd_forward_device_check(self) -> bool:
         """Check if all transform in forward are in correct device
@@ -865,8 +860,7 @@ def infer_apply(self, inputs):
         output_format = self._pd_get_output_format()
         if output_format is not None:
             return output_format(*inputs)
-        else:
-            return inputs
+        return inputs
 
     def eval_apply(self, inputs: Iterable,
                    verbose: bool = False, flatten: bool = False, **kwargs):
@@ -975,6 +969,20 @@ def __init__(self, function: Callable, call_info: inspector.CallInfo,
         self._pd_number_of_inputs = None
         self._source = source
 
+    def _pd_codegraph_add_startnodes(self, graph, name):
+        if self._pd_full_dump:
+            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 name is not None:
+            source += f' as {name}'
+        else:
+            name = self.__name__
+        node = CodeNode.from_source(source, scope)
+        graph[ScopedName(name, scope, 0)] = node
+        return {}
+
     @property
     def source(self) -> str:
         """The source of the wrapped function. """
@@ -1064,6 +1072,81 @@ def __init__(self, pd_name: str = None, ignore_scope: bool = False,
             pd_name=pd_name
         )
 
+    @property
+    def _pd_full_dump_relevant_module(self):
+        return inspect.getmodule(self.__class__)
+
+    def _pd_codegraph_add_startnodes_import_var(self, graph, name):
+        instance_scope = self._pd_call_info.scope
+        varname = self.pd_varname(instance_scope)
+
+        import_source = f'from {self.__module__} import {varname}'
+        import_node = CodeNode.from_source(import_source, instance_scope)
+
+        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)
+            if name is not None:
+                graph[ScopedName(name, instance_scope, 0)] = start_node
+
+        return set()
+
+    def _pd_codegraph_add_startnodes_import(self, graph, name):
+        instance_scope = self._pd_call_info.scope
+
+        # instance creation and class definition are in separate modules
+        if instance_scope.module.__name__ != self.__class__.__module__:
+            return super()._pd_codegraph_add_startnodes(graph, name)
+
+        # the instance has a varname - just import the instance
+        if self.pd_varname(instance_scope) is not None:
+            return self._pd_codegraph_add_startnodes_import_var(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)
+        graph[ScopedName(self.__class__.__name__, instance_scope, 0)] = import_node
+        nodes = [import_node]
+
+        # make the call
+        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)
+        if name is not None:
+            graph[ScopedName(name, call_scope, 0)] = start_node
+        nodes.append(start_node)
+
+        dependencies = set()
+        for node in nodes:
+            dependencies.update(node.globals_)
+        return dependencies
+
+    def _pd_codegraph_add_startnodes_full(self, graph, name):
+        call_scope = self._pd_call_info.scope
+        class_scope = self._pd_class_call_info.scope
+        if class_scope == call_scope:
+            return super()._pd_codegraph_add_startnodes(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)
+        if name is not None:
+            graph[ScopedName(name, call_scope, 0)] = start_node
+
+        for scoped_name in start_node.globals_:
+            if scoped_name.name == self.__class__.__name__:
+                scoped_name.scope = class_scope
+
+        return set(start_node.globals_)
+
+    def _pd_codegraph_add_startnodes(self, graph, name):
+        if self._pd_full_dump:
+            return self._pd_codegraph_add_startnodes_full(graph, name)
+        return self._pd_codegraph_add_startnodes_import(graph, name)
+
     @property
     def source(self) -> str:
         """The class source code. """
@@ -1178,7 +1261,7 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
                 # output_components is whatever the sub-transform does to it
                 output_components,
                 # the splits are the splits of the sub-transform, but mapped
-                tuple(Map(split) if not isinstance(split, Identity) else builtin_identity
+                tuple(Map(split) if not isinstance(split, Identity) else identity
                       for split in splits),
                 has_batchify
             )
@@ -1201,7 +1284,7 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
         # .. and combine them as a Parallel
         return (
             output_components,
-            tuple(Parallel(s) if s else builtin_identity for s in splits),
+            tuple(Parallel(s) if s else identity for s in splits),
             has_batchify
         )
 
@@ -1224,33 +1307,16 @@ def _pd_evaluable_repr_inner(self, indent: int = 0) -> str:
             return f'~{varname}'
         return f'~{self.transform._pd_evaluable_repr(indent)}'
 
-    def _pd_build_codegraph(self, graph=None, scopemap=None, name=None, scope=None):
-        if graph is None:
-            graph = {}
-        if scopemap is None:
-            scopemap = {}
-
-        start = self._pd_codegraph_startnode(name)
-
-        if name is not None:
-            assert scope is not None
-            graph[ScopedName(name, scope, 0)] = start
-            scopemap[ScopedName(name, scope, 0)] = scope
-
-        varname = self.transform.pd_varname(self._pd_call_info.module)
-        self.transform._pd_build_codegraph(graph, scopemap, varname,  self._pd_call_info.scope)
-        return graph, scopemap
-
 
 class Pipeline(Transform):
     """Abstract base class for Pipeline
 
-    :param transforms: list of transforms
+    :param transforms: List of sub-transforms.
     :param call_info: A `CallInfo` object containing information about the how the transform was
-    created (needed for saving).
-    :param pd_name: name of Pipeline
+        created (needed for saving).
+    :param pd_name: Name of the Pipeline.
     :param pd_group: If *True*, do not flatten this when used as child transform in a
-        `Pipeline`.
+        :meth:`Pipeline`.
     """
     op = NotImplemented
     display_op = NotImplemented
@@ -1284,7 +1350,7 @@ def __sub__(self, name: str) -> "Transform":
         named_copy = copy(self)
         named_copy._pd_name = name
         named_copy._pd_group = True
-        named_copy._pd_varname = _notset
+        named_copy._pd_varname = {}
         return named_copy
 
     def __getitem__(self, item: Union[int, slice, str]) -> Transform:
@@ -1314,7 +1380,7 @@ def __len__(self):
 
     def _pd_evaluable_repr_inner(self, indent=0):
         sub_reprs = [
-            x.pd_varname() or x._pd_evaluable_repr(indent + 4)
+            x.pd_varname(self._pd_call_info.scope) or x._pd_evaluable_repr(indent + 4)
             for x in self.transforms
         ]
         result = (
@@ -1326,7 +1392,26 @@ def _pd_evaluable_repr_inner(self, indent=0):
             result = 'padl.group' + result
         return result
 
-    def _pd_build_codegraph(self, graph=None, scopemap=None, name=None, scope=None):
+    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 defined_as is not None
+        )
+
+    def _codegraph_add_import_startnode(self, graph, name):
+        module = inspector.caller_module()
+        scope = symfinder.Scope.toplevel(module)
+        defined_as = self.pd_varname(self._pd_call_info.scope)
+        source = f'from {self._pd_call_info.scope.module_name} import {defined_as}'
+        if name is not None and name != defined_as:
+            source += f' as {name}'
+        else:
+            name = defined_as
+        node = CodeNode.from_source(source, scope)
+        graph[ScopedName(name, scope, 0)] = node
+
+    def _pd_build_codegraph(self, graph=None, name=None):
         """Build a codegraph defining the transform.
 
         See :meth:`Transform._pd_build_codegraph` for an explanation of what a code-graph is.
@@ -1335,31 +1420,25 @@ def _pd_build_codegraph(self, graph=None, scopemap=None, name=None, scope=None):
         contained transforms plus the node defining the transform itself.
         """
         if graph is None:
-            graph = {}
-        if scopemap is None:
-            scopemap = {}
+            graph = CodeGraph()
+
+        if not self._pd_full_dump and self._defined_somewhere_else():
+            self._codegraph_add_import_startnode(graph, name)
+            return graph
 
-        start = self._pd_codegraph_startnode(name)
+        self._pd_codegraph_add_startnodes(graph, name)
 
         if self._pd_group and 'padl' not in graph:
             emptyscope = symfinder.Scope.empty()
-            graph[ScopedName('padl', emptyscope, 0)] = var2mod.CodeNode.from_source('import padl',
-                                                                                    emptyscope)
-            scopemap[ScopedName('padl', self._pd_call_info.scope, 0)] = emptyscope
-
-        # if a name is given, add the start-node to the codegraph
-        if name is not None:
-            assert scope is not None
-            graph[ScopedName(name, scope, 0)] = start
-            scopemap[ScopedName(name, scope, 0)] = scope
+            graph[ScopedName('padl', emptyscope, 0)] = CodeNode.from_source('import padl',
+                                                                            emptyscope)
 
         # iterate over sub-transforms and update the codegraph with their codegraphs
         for transform in self.transforms:
-            varname = transform.pd_varname(self._pd_call_info.module)
+            varname = transform.pd_varname(self._pd_call_info.scope)
             # pylint: disable=protected-access
-            transform._pd_build_codegraph(graph, scopemap, varname,
-                                          self._pd_call_info.scope)
-        return graph, scopemap
+            transform._pd_build_codegraph(graph, varname)
+        return graph
 
     def _pd_longrepr(self, formatting=True):
         between = f'\n{make_green(self.display_op, not formatting)}  \n'
@@ -1548,7 +1627,7 @@ def _pd_splits(self, input_components=0, has_batchify=False) -> Tuple[Union[int,
             elif len(split) == 1:  # if it's just one, no need to combine
                 final_splits.append(split[0])
             else:  # if it's empty: identity
-                final_splits.append(builtin_identity)
+                final_splits.append(identity)
 
         return output_components, final_splits, has_batchify
 
@@ -1722,13 +1801,15 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
         output_components = []
         has_batchify = False
         for transform_ in self.transforms:
-            sub_output_components, sub_splits, sub_has_batchify = transform_._pd_splits(input_components)
+            # pylint: disable=protected-access
+            sub_output_components, sub_splits, sub_has_batchify = \
+                transform_._pd_splits(input_components)
             has_batchify = has_batchify or sub_has_batchify
             output_components.append(sub_output_components)
             for split, sub_split in zip(splits, sub_splits):
                 split.append(sub_split)
 
-        # only replace with builtin_identity if all Identity to preserve number of pipes
+        # only replace with identity if all Identity to preserve number of pipes
 
         merged_components = self._pd_merge_components(input_components)
         if not isinstance(merged_components, int):
@@ -1738,7 +1819,7 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
         for i, split in enumerate(splits):
             if all(isinstance(s, Identity) for s in split):
                 if i != merged_components:
-                    cleaned_splits.append(builtin_identity)
+                    cleaned_splits.append(identity)
                 else:
                     cleaned_splits.append(split)
             else:
@@ -1849,9 +1930,9 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
             for split, sub_split in zip(splits, sub_splits):
                 split.append(sub_split)
 
-        # only replace with builtin_identity if all Identity to preserve number of pipes
+        # only replace with identity if all Identity to preserve number of pipes
         cleaned_splits = tuple(
-            builtin_identity if all(isinstance(s, Identity) for s in split) else split
+            identity if all(isinstance(s, Identity) for s in split) else split
             for split in splits
         )
 
@@ -1908,58 +1989,28 @@ def horizontal(n):
         return out
 
 
-class BuiltinTransform(AtomicTransform):
-    def __init__(self, call):
-        caller_frameinfo = inspector.non_init_caller_frameinfo()
-        call_info = inspector.CallInfo(caller_frameinfo)
-        super().__init__(call, call_info=call_info)
-
-    def _pd_build_codegraph(self, graph: Optional[dict] = None,
-                            scopemap: Optional[dict] = None,
-                            name: Optional[str] = None,
-                            scope: Optional[symfinder.Scope] = None) -> Tuple[dict, dict]:
-        if graph is None:
-            graph = {}
-        if scopemap is None:
-            scopemap = {}
-
-        if scope is None:
-            scope = self._pd_call_info.scope
-
-        # if padl is not in the scope, add it
-        if ScopedName('padl', scope, 0) not in graph:
-            emptyscope = symfinder.Scope.empty()
-            graph[ScopedName('padl', emptyscope, 0)] = var2mod.CodeNode.from_source('import padl',
-                                                                                    scope)
-            scopemap[ScopedName('padl', scope, 0)] = emptyscope
+class BuiltinTransform(ClassTransform):
+    """A builtin transform will simply always be imported, never fully dumped. """
 
-        if name is not None:
-            start_source = f'{name or "_pd_dummy"} = {self._pd_evaluable_repr()}'
-            graph[ScopedName(name, scope, 0)] = \
-                var2mod.CodeNode.from_source(start_source, scope)
-
-            scopemap[ScopedName(name, scope, 0)] = scope
-
-        return graph, scopemap
-
-    def _pd_longrepr(self, formatting=True):
-        return self._pd_call.split('padl.')[-1]
+    @property
+    def _pd_full_dump(self):
+        return False
 
 
 class Identity(BuiltinTransform):
     """Do nothing. Just pass on."""
 
     def __init__(self):
-        super().__init__('padl.Identity()')
+        super().__init__()
 
     def __call__(self, args):
         return args
 
 
-builtin_identity = Identity()
+identity = Identity()
 
 
-class Unbatchify(ClassTransform):
+class Unbatchify(BuiltinTransform):
     """Mark start of postprocessing.
 
     Unbatchify removes batch dimension (inverse of Batchify) and moves the input tensors to 'cpu'.
@@ -1982,7 +2033,7 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
         to 2 ("un-batchified").
         """
         # put the output component to 2 ("un-batchified")
-        return 2, (builtin_identity, builtin_identity, self), False
+        return 2, (identity, identity, self), False
 
     def _move_to_device(self, args):
         if isinstance(args, tuple):
@@ -2011,7 +2062,7 @@ def __call__(self, args):
         raise TypeError('only tensors and tuples of tensors recursively supported...')
 
 
-class Batchify(ClassTransform):
+class Batchify(BuiltinTransform):
     """Mark end of preprocessing.
 
     Batchify adds batch dimension at *dim*. During inference, this unsqueezes tensors and,
@@ -2036,7 +2087,7 @@ def _pd_splits(self, input_components=0) -> Tuple[Union[int, List],
         # ensure that all inputs are "fresh"
         assert self._pd_merge_components(input_components) == 0, 'double batchify'
         # put the output component to 1 ("batchified")
-        return 1, (self, builtin_identity, builtin_identity), True
+        return 1, (self, identity, identity), True
 
     def __call__(self, args):
         assert Transform.pd_mode is not None, ('Mode is not set, use infer_apply, eval_apply '
@@ -2155,3 +2206,40 @@ def __getitem__(self, item):
 
     def __len__(self):
         return len(self.samples)
+
+
+def fulldump(transform_or_module):
+    """Switch a Transform or module or package to the "fulldump" mode.
+
+    This means that the Transform or any Transform from that module or package will be fully dumped
+    instead of just dumping the statement importing it.
+
+    :param transform_or_module: A Transform, module or package for which to enable full dump. Can
+        also be a string. In that case, will enable full dump for the module or package with
+        matching name.
+    """
+    if isinstance(transform_or_module, types.ModuleType):
+        transform_or_module = transform_or_module.__spec__.name
+    if isinstance(transform_or_module, str):
+        Transform._pd_external_full_dump_modules.add(transform_or_module)
+        return None
+    assert isinstance(transform_or_module, Transform)
+    t_copy = copy(transform_or_module)
+    t_copy._pd_external_full_dump = True
+    return t_copy
+
+
+def importdump(transform_or_module):
+    """Disable full dump (see :func:`padl.transforms.fulldump` for more). """
+    if isinstance(transform_or_module, types.ModuleType):
+        transform_or_module = transform_or_module.__spec__.name
+    if isinstance(transform_or_module, str):
+        try:
+            Transform._pd_external_full_dump_modules.remove(transform_or_module)
+        except KeyError:
+            pass
+        return None
+    assert isinstance(transform_or_module, Transform)
+    t_copy = copy(transform_or_module)
+    t_copy._pd_external_full_dump = False
+    return t_copy
diff --git a/padl/util_transforms.py b/padl/util_transforms.py
index 02bcb6a1..32083fc8 100644
--- a/padl/util_transforms.py
+++ b/padl/util_transforms.py
@@ -3,7 +3,7 @@
 from collections import OrderedDict
 from typing import Optional, Union, List, Tuple
 
-from padl.transforms import ClassTransform, Identity, Transform, Mode, builtin_identity
+from padl.transforms import ClassTransform, Identity, Transform, Mode, identity
 
 
 class IfInMode(ClassTransform):
@@ -13,20 +13,18 @@ class IfInMode(ClassTransform):
 
         >>> from padl import transform
         >>> a = transform(lambda x: x + 10)
-        >>> b = transform(lambda x: x * 10)
-        >>> iis = IfInMode(a, 'infer', b)
-        >>> iis.infer_apply(1)
+        >>> b = transform(lambda x: x * 99)
+        >>> iim = IfInMode(a, 'infer', b)
+        >>> iim.infer_apply(1)
         11
-        >>> list(iis.eval_apply([1]))
-        [100]
+        >>> list(iim.eval_apply([1]))
+        [99]
 
     :param if_: Transform to apply when the mode matches.
     :param target_mode: Mode (one of 'train', 'eval', 'infer').
     :param else_: Transform to apply when the mode doesn't match (defaults to identity transform).
     """
 
-    pd_dont_dump_code = True
-
     def __init__(self, if_: Transform, target_mode: Mode, else_: Optional[Transform] = None):
         assert target_mode in ('train', 'eval', 'infer'), "Target mode can only be train, " \
                                                           "eval or infer"
@@ -51,6 +49,7 @@ def __call__(self, args):
         return self.else_.pd_call_transform(args)
 
     def _pd_splits(self, input_components=0):
+        # pylint: disable=protected-access
         if_output_components, if_splits, if_has_batchify = \
             self.if_._pd_splits(input_components)
         else_output_components, else_splits, else_has_batchify = \
@@ -126,8 +125,8 @@ def __init__(self,
                  transform: Transform,
                  catch_transform: Transform,
                  exceptions: Union[List, Tuple, Exception],
-                 else_transform: Transform = builtin_identity,
-                 finally_transform: Transform = builtin_identity,
+                 else_transform: Transform = identity,
+                 finally_transform: Transform = identity,
                  pd_name: str = None):
 
         if not isinstance(exceptions, (tuple, list)):
@@ -164,7 +163,7 @@ def _pd_splits(self, input_components=0):
 
         final_splits = tuple(
             self if i == components[0]
-            else builtin_identity
+            else identity
             for i in range(3)
         )
 
diff --git a/padl/wrap.py b/padl/wrap.py
index 172e83d0..2e5df064 100644
--- a/padl/wrap.py
+++ b/padl/wrap.py
@@ -14,18 +14,17 @@
 from padl.dumptools import var2mod, inspector
 from padl.dumptools.sourceget import cut, get_source, original
 from padl.transforms import (
-    AtomicTransform, ClassTransform, FunctionTransform, TorchModuleTransform, _notset
+    AtomicTransform, ClassTransform, FunctionTransform, TorchModuleTransform
 )
 
 import re
 
 
-def _set_local_varname(frame, event, _args):
+def _set_local_varname(frame, event, _args, scope):
     if event == 'return':
         for k, v in frame.f_locals.items():
             try:
-                if v._pd_varname is _notset or v._pd_varname is None:
-                    v._pd_varname = k
+                v._pd_varname[scope] = k
             except AttributeError:
                 continue
 
@@ -56,7 +55,7 @@ def _wrap_function(fun, ignore_scope=False, call_info: inspector.CallInfo = None
     if call_info is None:
         call_info = inspector.CallInfo(drop_n=drop_n, ignore_scope=ignore_scope)
     if call_info.function != '<module>' and not ignore_scope:
-        inspector.trace_this(_set_local_varname, caller.frame)
+        inspector.trace_this(_set_local_varname, caller.frame, scope=call_info.scope)
 
     wrapper = FunctionTransform(fun, call_info, call=call)
 
@@ -111,6 +110,7 @@ def __init__(self, *args, **kwargs):
 
     cls.__init__ = __init__
     cls.__module__ = module
+    cls._pd_class_call_info = inspector.CallInfo()
     return cls
 
 
@@ -231,11 +231,11 @@ class PatchedModule:
 
     Example:
 
-        >>> import padl
-        >>> import numpy as np
-        >>> pd_np = padl.transform(np)
-        >>> isinstance(pd_np.random.rand, padl.transforms.Transform)
-        True
+    >>> import padl
+    >>> import numpy as np
+    >>> pd_np = padl.transform(np)
+    >>> isinstance(pd_np.random.rand, padl.transforms.Transform)
+    True
     """
 
     def __init__(self, module, parents=None):
diff --git a/requirements-docs.txt b/requirements-docs.txt
index 8ffef95a..cb0e6df2 100644
--- a/requirements-docs.txt
+++ b/requirements-docs.txt
@@ -1,6 +1,5 @@
 sphinx==4.3.0
 sphinx-rtd-theme==1.0.0
 m2r==0.2.1
-sphinx_book_theme==0.1.7
 myst-parser==0.15.2
 mistune==0.8.4


Test patch:
diff --git a/tests/material/dumps/nested_d.txt b/tests/material/dumps/nested_d.txt
new file mode 100644
index 00000000..af08c2af
--- /dev/null
+++ b/tests/material/dumps/nested_d.txt
@@ -0,0 +1,35 @@
+from padl import transform
+
+
+CONST = 1
+
+
+def k(o):
+    return o * 7
+
+
+@transform
+def x(y):
+    return CONST + 1
+
+
+@transform
+def y(y):
+    return 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(1, 2, x)
diff --git a/tests/material/dumps/othermodule_full_class.txt b/tests/material/dumps/othermodule_full_class.txt
new file mode 100644
index 00000000..687769bc
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_class.txt
@@ -0,0 +1,13 @@
+from padl import transform
+
+
+@transform
+class Class:
+    def __init__(self, x):
+        self.x = x
+
+    def __call__(self, y):
+        return self.x + y
+
+
+_pd_main = Class(1)
diff --git a/tests/material/dumps/othermodule_full_function.txt b/tests/material/dumps/othermodule_full_function.txt
new file mode 100644
index 00000000..dae3af33
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_function.txt
@@ -0,0 +1,9 @@
+from padl import transform
+
+
+@transform
+def function(x):
+    return x
+
+
+_pd_main = function
diff --git a/tests/material/dumps/othermodule_full_makeclass.txt b/tests/material/dumps/othermodule_full_makeclass.txt
new file mode 100644
index 00000000..4728d584
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_makeclass.txt
@@ -0,0 +1,30 @@
+from padl import transform
+
+
+CONST = 123
+
+
+def k(y):
+    return y
+
+
+@transform
+def y(y):
+    return 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(1, 2, 3)
diff --git a/tests/material/dumps/othermodule_full_makeclasstransform.txt b/tests/material/dumps/othermodule_full_makeclasstransform.txt
new file mode 100644
index 00000000..7fc14b01
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_makeclasstransform.txt
@@ -0,0 +1,33 @@
+from padl import transform
+
+
+a = 1
+b = 2
+c = 3
+CONST = 123
+
+
+def k(y):
+    return y
+
+
+@transform
+def y(y):
+    return 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_makefunction.txt b/tests/material/dumps/othermodule_full_makefunction.txt
new file mode 100644
index 00000000..90ef97e5
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_makefunction.txt
@@ -0,0 +1,9 @@
+from padl import transform
+
+
+@transform
+def z(x):
+    return x
+
+
+_pd_main = z
diff --git a/tests/material/dumps/othermodule_full_object.txt b/tests/material/dumps/othermodule_full_object.txt
new file mode 100644
index 00000000..aa3021ba
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_object.txt
@@ -0,0 +1,16 @@
+from padl import transform
+
+
+var = 100
+
+
+@transform
+class Class:
+    def __init__(self, x):
+        self.x = x
+
+    def __call__(self, y):
+        return self.x + y
+
+
+_pd_main = Class(var)
diff --git a/tests/material/dumps/othermodule_full_pipeline.txt b/tests/material/dumps/othermodule_full_pipeline.txt
new file mode 100644
index 00000000..f8c372ca
--- /dev/null
+++ b/tests/material/dumps/othermodule_full_pipeline.txt
@@ -0,0 +1,32 @@
+from padl import transform
+
+
+var = 100
+
+
+@transform
+class Class:
+    def __init__(self, x):
+        self.x = x
+
+    def __call__(self, y):
+        return self.x + y
+
+
+@transform
+def function(x):
+    return x
+
+
+obj = Class(var)
+_pd_main = (
+    obj
+    >> (
+        obj
+        + function
+    )
+    >> (
+        function
+        / function
+    )
+)
diff --git a/tests/material/dumps/othermodule_import_class.txt b/tests/material/dumps/othermodule_import_class.txt
new file mode 100644
index 00000000..dbf414a0
--- /dev/null
+++ b/tests/material/dumps/othermodule_import_class.txt
@@ -0,0 +1,4 @@
+from tests.material import transforms_in_module as tim
+
+
+_pd_main = tim.Class(1)
diff --git a/tests/material/dumps/othermodule_import_function.txt b/tests/material/dumps/othermodule_import_function.txt
new file mode 100644
index 00000000..9cc41ef4
--- /dev/null
+++ b/tests/material/dumps/othermodule_import_function.txt
@@ -0,0 +1,1 @@
+from tests.material.transforms_in_module import function as _pd_main
diff --git a/tests/material/dumps/othermodule_import_object.txt b/tests/material/dumps/othermodule_import_object.txt
new file mode 100644
index 00000000..a00b1847
--- /dev/null
+++ b/tests/material/dumps/othermodule_import_object.txt
@@ -0,0 +1,4 @@
+from tests.material.transforms_in_module import obj
+
+
+_pd_main = obj
diff --git a/tests/material/dumps/othermodule_import_pipeline.txt b/tests/material/dumps/othermodule_import_pipeline.txt
new file mode 100644
index 00000000..9435aa89
--- /dev/null
+++ b/tests/material/dumps/othermodule_import_pipeline.txt
@@ -0,0 +1,1 @@
+from tests.material.transforms_in_module import pipeline as _pd_main
diff --git a/tests/material/dumps/compound_a.txt b/tests/material/dumps/pipeline_a.txt
similarity index 100%
rename from tests/material/dumps/compound_a.txt
rename to tests/material/dumps/pipeline_a.txt
diff --git a/tests/material/dumps/compound_b.txt b/tests/material/dumps/pipeline_b.txt
similarity index 100%
rename from tests/material/dumps/compound_b.txt
rename to tests/material/dumps/pipeline_b.txt
diff --git a/tests/material/dumps/compound_c.txt b/tests/material/dumps/pipeline_c.txt
similarity index 100%
rename from tests/material/dumps/compound_c.txt
rename to tests/material/dumps/pipeline_c.txt
diff --git a/tests/material/transforms_in_module.py b/tests/material/transforms_in_module.py
index 0ac6b643..13914fa1 100644
--- a/tests/material/transforms_in_module.py
+++ b/tests/material/transforms_in_module.py
@@ -18,4 +18,56 @@ def __call__(self, y):
 var = 100
 obj = Class(var)
 
-compound = obj >> obj + function >> function / function
+pipeline = obj >> obj + function >> function / function
+
+
+def makefunction():
+    @transform
+    def z(x):
+        return x
+    return z
+
+CONST = 123
+
+
+def k(y):
+    return y
+
+
+@transform
+def y(y):
+    return CONST + k(y)
+
+
+def makeclass():
+    @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_)
+
+    return MyClassTransform
+
+
+def makeclasstransform(a, b, c):
+    @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_)
+
+    return MyClassTransform(a, b, c)
diff --git a/tests/unittests/dumptools/test_serialize.py b/tests/unittests/dumptools/test_serialize.py
index c94bb219..a927b4fb 100644
--- a/tests/unittests/dumptools/test_serialize.py
+++ b/tests/unittests/dumptools/test_serialize.py
@@ -1,3 +1,7 @@
+from padl import *
+
+
 def test_save_by_value():
     from tests.material.save_by_value import test
+    test = fulldump(test)
     assert 'LABELS = [1, 2, 3]' in test._pd_dumps()
diff --git a/tests/unittests/test_dump.py b/tests/unittests/test_dump.py
index 89fb6fa1..cb092b24 100644
--- a/tests/unittests/test_dump.py
+++ b/tests/unittests/test_dump.py
@@ -1,6 +1,6 @@
 import pytest
 
-from padl import transform, group, IfTrain, Batchify, Unbatchify
+from padl import transform, group, IfTrain, Batchify, Unbatchify, importdump, fulldump
 from tests.material import transforms_in_module as tim
 
 
@@ -163,6 +163,11 @@ def test_nested_dump_c():
     assert t._pd_dumps() == read_dump('nested_c')
 
 
+def test_nested_dump_d():
+    t = maketransformclass()(1, 2, x)
+    assert t._pd_dumps() == read_dump('nested_d')
+
+
 c_a = x >> y >> x
 c_b = x >> y >> x / x + c_a
 c_c = (x
@@ -172,16 +177,16 @@ def test_nested_dump_c():
 )
 
 
-def test_compound_dump_a():
-    assert c_a._pd_dumps() == read_dump('compound_a')
+def test_pipeline_dump_a():
+    assert c_a._pd_dumps() == read_dump('pipeline_a')
 
 
-def test_compound_dump_b():
-    assert c_b._pd_dumps() == read_dump('compound_b')
+def test_pipeline_dump_b():
+    assert c_b._pd_dumps() == read_dump('pipeline_b')
 
 
-def test_compound_dump_c():
-    assert c_c._pd_dumps() == read_dump('compound_c')
+def test_pipeline_dump_c():
+    assert c_c._pd_dumps() == read_dump('pipeline_c')
 
 
 g_a = x + group(y + x + x)
@@ -235,7 +240,58 @@ def test_dumping_selfassign():
     assert SelfAssign(1)._pd_dumps() == read_dump('selfassign')
 
 
-def test_othermodule_function():
-    x = tim.function._pd_dumps()
-    # TODO: wip
-    #  assert 'todo' == 'done'
+class TestOtherModule:
+    def test_import_function(self):
+        importdump(tim)
+        dump = tim.function._pd_dumps()
+        assert dump == read_dump('othermodule_import_function')
+
+    def test_full_function(self):
+        fulldump(tim)
+        dump = tim.function._pd_dumps()
+        assert dump == read_dump('othermodule_full_function')
+
+    def test_import_class(self):
+        importdump(tim)
+        dump = tim.Class(1)._pd_dumps()
+        assert dump == read_dump('othermodule_import_class')
+
+    def test_full_class(self):
+        fulldump(tim)
+        dump = tim.Class(1)._pd_dumps()
+        assert dump == read_dump('othermodule_full_class')
+
+    def test_import_object(self):
+        importdump(tim)
+        dump = tim.obj._pd_dumps()
+        assert dump == read_dump('othermodule_import_object')
+
+    def test_full_object(self):
+        fulldump(tim)
+        dump = tim.obj._pd_dumps()
+        assert dump == read_dump('othermodule_full_object')
+
+    def test_import_pipeline(self):
+        importdump(tim)
+        dump = tim.pipeline._pd_dumps()
+        assert dump == read_dump('othermodule_import_pipeline')
+
+    def test_full_pipeline(self):
+        fulldump(tim)
+        dump = tim.pipeline._pd_dumps()
+        assert dump == read_dump('othermodule_full_pipeline')
+
+    def test_full_makefunction(self):
+        fulldump(tim)
+        dump = tim.makefunction()._pd_dumps()
+        assert dump == read_dump('othermodule_full_makefunction')
+
+    def test_full_makeclass(self):
+        fulldump(tim)
+        dump = tim.makeclass()(1, 2, 3)._pd_dumps()
+        assert dump == read_dump('othermodule_full_makeclass')
+
+    def test_full_makeclasstransform(self):
+        fulldump(tim)
+        dump = tim.makeclasstransform(1, 2, 3)._pd_dumps()
+        assert dump == read_dump('othermodule_full_makeclasstransform')