---

title: BCQ


keywords: fastai
sidebar: home_sidebar

summary: "Batch-Constrained Deep Q-Learning."
description: "Batch-Constrained Deep Q-Learning."
nb_path: "nbs/models/bcq.ipynb"
---
<!--

#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: nbs/models/bcq.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="BCQ" class="doc_header"><code>class</code> <code>BCQ</code><a href="https://github.com/RecoHut-Projects/recohut/tree/master/recohut/models/bcq.py#L11" class="source_link" style="float:right">[source]</a></h2><blockquote><p><code>BCQ</code>(<strong><code>generator</code></strong>, <strong><code>gen_optim</code></strong>, <strong><code>perturbator</code></strong>, <strong><code>pert_optim</code></strong>, <strong><code>critic1</code></strong>, <strong><code>critic2</code></strong>, <strong><code>critic_optim</code></strong>, <strong><code>tau</code></strong>=<em><code>0.001</code></em>, <strong><code>gamma</code></strong>=<em><code>0.99</code></em>, <strong><code>lam</code></strong>=<em><code>0.75</code></em>, <strong><code>policy_delay</code></strong>=<em><code>1</code></em>, <strong><code>item_embeds</code></strong>=<em><code>None</code></em>, <strong><code>device</code></strong>=<em><code>device(type='cpu')</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>
 

