---

title: TCN


keywords: fastai
sidebar: home_sidebar

summary: "Temporal Convolutional Network."
description: "Temporal Convolutional Network."
nb_path: "nbs/models/layers/models.layers.tcn.ipynb"
---
<!--

#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: nbs/models/layers/models.layers.tcn.ipynb
# command to build the docs after a change: nbdev_build_docs

-->

<div class="container" id="notebook-container">
        
    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

<div class="output_wrapper">
<div class="output">

<div class="output_area">


<div class="output_markdown rendered_html output_subarea ">
<h2 id="TemporalConvNet" class="doc_header"><code>class</code> <code>TemporalConvNet</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/models/layers/tcn.py#L53" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>TemporalConvNet</code>(<strong><code>num_inputs</code></strong>, <strong><code>num_channels</code></strong>, <strong><code>kernel_size</code></strong>=<em><code>2</code></em>, <strong><code>dropout</code></strong>=<em><code>0.2</code></em>) :: <code>Module</code></p>
</blockquote>
<p>Base class for all neural network modules.</p>
<p>Your models should also subclass this class.</p>
<p>Modules can also contain other Modules, allowing to nest them in
a tree structure. You can assign the submodules as regular attributes::</p>

<pre><code>import torch.nn as nn
import torch.nn.functional as F

class Model(nn.Module):
    def __init__(self):
        super(Model, self).__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

</code></pre>
<p>Submodules assigned in this way will be registered, and will have their
parameters converted too when you call :meth:<code>to</code>, etc.</p>
<p>:ivar training: Boolean represents whether this module is in training or
                evaluation mode.
:vartype training: bool</p>

</div>

</div>

</div>
</div>

</div>
    {% endraw %}

    {% raw %}
    
<div class="cell border-box-sizing code_cell rendered">

</div>
    {% endraw %}

<div class="cell border-box-sizing text_cell rendered"><div class="inner_cell">
<div class="text_cell_render border-box-sizing rendered_html">
<blockquote><p><strong>References:-</strong>- Bai, S., Kolter, J. Z., &amp; Koltun, V. (2018). An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271.</p>
<ul>
<li>Official TCN PyTorch implementation: <a href="https://github.com/locuslab/TCN">https://github.com/locuslab/TCN</a></li>
<li><a href="https://arxiv.org/pdf/2112.11023v1.pdf">https://arxiv.org/pdf/2112.11023v1.pdf</a></li>
<li><a href="https://github.com/chenjie04/MPM/blob/master/tcn.py">https://github.com/chenjie04/MPM/blob/master/tcn.py</a></li>
</ul>
</blockquote>

</div>
</div>
</div>
</div>
 

