How to use max pool in a Sequential container using C++ API

username: satrajit-chatterjee
cooked: <p>I’ve been trying to use max_pool2d using the C++ API in a sequential container. However I can’t figure out the proper way to use it. This is how far I’ve managed to come after referring to the available C++ examples on the PyTorch repository as well as the library source code:</p>
<pre><code class="lang-auto">//
// Created by satrajit-c on 6/12/19.
//

#ifndef BASEMODEL_H
#define BASEMODEL_H

#include &lt;torch/torch.h&gt;
#include &lt;torch/nn/options/pooling.h&gt;
#include &lt;vector&gt;

using namespace std;
using namespace torch;

const int num_classes=6;

struct Intensity : nn::Module {
    Intensity():
    features(
            nn::Conv2d(nn::Conv2dOptions(/*in channels*/ 3, /*out channels*/ 64, /*kernel*/ 3).padding(2)),
            nn::Functional(relu),
            nn::Conv2d(nn::Conv2dOptions(/*in channels*/ 64, /*out channels*/ 64, /*kernel*/ 3).padding(2)),
            nn::Functional(relu),
            nn::Functional(max_pool2d, nn::MaxPool2dOptions(ExpandingArray&lt;2&gt;({2,2}))),
            ){}

    torch::Tensor forward(const torch::Tensor&amp; input){
        auto x = features-&gt;forward(input);
        return x;
    }

    nn::Sequential features;

};

#endif //BASEMODEL_H
</code></pre>
<p>The above code is a bit trimmed down to just refer to the essential parts. However this is the error that’s occurring:</p>
<pre><code class="lang-auto">Scanning dependencies of target OpenFace
[ 50%] Building CXX object CMakeFiles/OpenFace.dir/Template.cpp.o
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/c10/core/DeviceType.h:11:0,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/c10/core/Device.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/c10/core/Allocator.h:6,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/ATen/ATen.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:7:
/usr/include/c++/7/functional: In instantiation of ‘struct std::_Bind_check_arity&lt;at::Tensor (*)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool), const std::_Placeholder&lt;1&gt;&amp;, torch::nn::MaxPoolOptions&lt;2&gt; &gt;’:
/usr/include/c++/7/functional:854:12:   required from ‘struct std::_Bind_helper&lt;false, at::Tensor (*&amp;)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool), const std::_Placeholder&lt;1&gt;&amp;, torch::nn::MaxPoolOptions&lt;2&gt; &gt;’
/usr/include/c++/7/functional:875:5:   required by substitution of ‘template&lt;class _Func, class ... _BoundArgs&gt; typename std::_Bind_helper&lt;std::__is_socketlike&lt;_Func&gt;::value, _Func, _BoundArgs ...&gt;::type std::bind(_Func&amp;&amp;, _BoundArgs&amp;&amp; ...) [with _Func = at::Tensor (*&amp;)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool); _BoundArgs = {const std::_Placeholder&lt;1&gt;&amp;, torch::nn::MaxPoolOptions&lt;2&gt;}]’
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:70:28:   required from ‘torch::nn::FunctionalImpl::FunctionalImpl(SomeFunction, Args&amp;&amp; ...) [with SomeFunction = at::Tensor (*)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool); Args = {torch::nn::MaxPoolOptions&lt;2&gt;}; &lt;template-parameter-1-3&gt; = void]’
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:64:15:   required from ‘torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(Head&amp;&amp;, Tail&amp;&amp; ...) [with Head = at::Tensor (&amp;)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool); Tail = {torch::nn::MaxPoolOptions&lt;2&gt;}; &lt;template-parameter-2-3&gt; = void; Contained = torch::nn::FunctionalImpl]’
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1:   required from here
/usr/include/c++/7/functional:825:7: error: static assertion failed: Wrong number of arguments for function
       static_assert(sizeof...(_BoundArgs) == sizeof...(_Args),
       ^~~~~~~~~~~~~
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules.h:5:0,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn.h:7,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:7:
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h: In instantiation of ‘torch::nn::FunctionalImpl::FunctionalImpl(SomeFunction, Args&amp;&amp; ...) [with SomeFunction = at::Tensor (*)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool); Args = {torch::nn::MaxPoolOptions&lt;2&gt;}; &lt;template-parameter-1-3&gt; = void]’:
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:64:15:   required from ‘torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(Head&amp;&amp;, Tail&amp;&amp; ...) [with Head = at::Tensor (&amp;)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool); Tail = {torch::nn::MaxPoolOptions&lt;2&gt;}; &lt;template-parameter-2-3&gt; = void; Contained = torch::nn::FunctionalImpl]’
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1:   required from here
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:73:41: error: no matching function for call to ‘std::function&lt;at::Tensor(at::Tensor)&gt;::function(std::_Bind_helper&lt;false, at::Tensor (*&amp;)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool), const std::_Placeholder&lt;1&gt;&amp;, torch::nn::MaxPoolOptions&lt;2&gt; &gt;::type)’
             std::forward&lt;Args&gt;(args)...)) {
                                         ^
In file included from /usr/include/c++/7/functional:58:0,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/c10/core/DeviceType.h:11,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/c10/core/Device.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/c10/core/Allocator.h:6,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/ATen/ATen.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:7:
/usr/include/c++/7/bits/std_function.h:685:7: note: candidate: template&lt;class _Functor, class, class&gt; std::function&lt;_Res(_ArgTypes ...)&gt;::function(_Functor)
       function&lt;_Res(_ArgTypes...)&gt;::
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/std_function.h:685:7: note:   template argument deduction/substitution failed:
/usr/include/c++/7/bits/std_function.h:464:9: error: no type named ‘type’ in ‘class std::result_of&lt;std::_Bind&lt;at::Tensor (*(std::_Placeholder&lt;1&gt;, torch::nn::MaxPoolOptions&lt;2&gt;))(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool)&gt;&amp;(at::Tensor)&gt;’
         typename = _Requires&lt;_Callable&lt;_Functor&gt;, void&gt;&gt;
         ^~~~~~~~
/usr/include/c++/7/bits/std_function.h:441:7: note: candidate: std::function&lt;_Res(_ArgTypes ...)&gt;::function(std::function&lt;_Res(_ArgTypes ...)&gt;&amp;&amp;) [with _Res = at::Tensor; _ArgTypes = {at::Tensor}]
       function(function&amp;&amp; __x) noexcept : _Function_base()
       ^~~~~~~~
/usr/include/c++/7/bits/std_function.h:441:7: note:   no known conversion for argument 1 from ‘std::_Bind_helper&lt;false, at::Tensor (*&amp;)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool), const std::_Placeholder&lt;1&gt;&amp;, torch::nn::MaxPoolOptions&lt;2&gt; &gt;::type {aka std::_Bind&lt;at::Tensor (*(std::_Placeholder&lt;1&gt;, torch::nn::MaxPoolOptions&lt;2&gt;))(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool)&gt;}’ to ‘std::function&lt;at::Tensor(at::Tensor)&gt;&amp;&amp;’
/usr/include/c++/7/bits/std_function.h:671:5: note: candidate: std::function&lt;_Res(_ArgTypes ...)&gt;::function(const std::function&lt;_Res(_ArgTypes ...)&gt;&amp;) [with _Res = at::Tensor; _ArgTypes = {at::Tensor}]
     function&lt;_Res(_ArgTypes...)&gt;::
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/std_function.h:671:5: note:   no known conversion for argument 1 from ‘std::_Bind_helper&lt;false, at::Tensor (*&amp;)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool), const std::_Placeholder&lt;1&gt;&amp;, torch::nn::MaxPoolOptions&lt;2&gt; &gt;::type {aka std::_Bind&lt;at::Tensor (*(std::_Placeholder&lt;1&gt;, torch::nn::MaxPoolOptions&lt;2&gt;))(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool)&gt;}’ to ‘const std::function&lt;at::Tensor(at::Tensor)&gt;&amp;’
/usr/include/c++/7/bits/std_function.h:421:7: note: candidate: std::function&lt;_Res(_ArgTypes ...)&gt;::function(std::nullptr_t) [with _Res = at::Tensor; _ArgTypes = {at::Tensor}; std::nullptr_t = std::nullptr_t]
       function(nullptr_t) noexcept
       ^~~~~~~~
/usr/include/c++/7/bits/std_function.h:421:7: note:   no known conversion for argument 1 from ‘std::_Bind_helper&lt;false, at::Tensor (*&amp;)(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool), const std::_Placeholder&lt;1&gt;&amp;, torch::nn::MaxPoolOptions&lt;2&gt; &gt;::type {aka std::_Bind&lt;at::Tensor (*(std::_Placeholder&lt;1&gt;, torch::nn::MaxPoolOptions&lt;2&gt;))(const at::Tensor&amp;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, c10::ArrayRef&lt;long int&gt;, bool)&gt;}’ to ‘std::nullptr_t’
/usr/include/c++/7/bits/std_function.h:414:7: note: candidate: std::function&lt;_Res(_ArgTypes ...)&gt;::function() [with _Res = at::Tensor; _ArgTypes = {at::Tensor}]
       function() noexcept
       ^~~~~~~~
/usr/include/c++/7/bits/std_function.h:414:7: note:   candidate expects 0 arguments, 1 provided
CMakeFiles/OpenFace.dir/build.make:62: recipe for target 'CMakeFiles/OpenFace.dir/Template.cpp.o' failed
make[2]: *** [CMakeFiles/OpenFace.dir/Template.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/OpenFace.dir/all' failed
make[1]: *** [CMakeFiles/OpenFace.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
(base) satrajit-c@INDRA:~/Documents/My_Projects/OpenFace/build$ 
</code></pre>
<p>This is the original traceback of the entire code.</p>
<p>I’d really appreciate any help I can get on this as I can’t seem to figure this out.</p>

username: 21fa417e3fb06e56040c
cooked: <p>hi<br>
functional usage<br>
<code>function</code> , <code> Argument1</code>,<code>Argument2</code> <code>Arguments...</code></p>
<p>sample code</p>
<pre><code class="lang-auto">torch::nn::Functional(torch::max_pool2d, {2,2});
</code></pre>

username: satrajit-chatterjee
cooked: <p>Hi, thanks for the quick reply. Unfortunately this doesn’t seem to work. Here’s the new traceback for the solution you proposed</p>
<pre><code class="lang-auto">[ 50%] Building CXX object CMakeFiles/OpenFace.dir/Template.cpp.o
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:17:0:
/home/satrajit-c/Documents/My_Projects/OpenFace/baseModel.h: In constructor ‘BP4DIntensity::BP4DIntensity()’:
/home/satrajit-c/Documents/My_Projects/OpenFace/baseModel.h:27:45: error: no matching function for call to ‘torch::nn::Functional::Functional(at::Tensor (&amp;)(const at::Tensor&amp;, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), &lt;brace-enclosed initializer list&gt;)’
             nn::Functional(max_pool2d, {2,2}),
                                             ^
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/module.h:3:0,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:7:
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:53:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::nullptr_t) [with Contained = torch::nn::FunctionalImpl; std::nullptr_t = std::nullptr_t]
   /* implicit */ ModuleHolder(std::nullptr_t) : impl_(nullptr) {}
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:63:12: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(Head&amp;&amp;, Tail&amp;&amp; ...) [with Head = Head; Tail = {Tail ...}; &lt;template-parameter-2-3&gt; = &lt;template-parameter-1-3&gt;; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&amp;&amp; head, Tail&amp;&amp;... tail)
            ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:70:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::shared_ptr&lt;_Tp&gt;) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr&lt;Contained&gt; module)
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(const torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional()
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 0 arguments, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(const torch::nn::Functional&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(torch::nn::Functional&amp;&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:17:0:
/home/satrajit-c/Documents/My_Projects/OpenFace/baseModel.h:32:45: error: no matching function for call to ‘torch::nn::Functional::Functional(at::Tensor (&amp;)(const at::Tensor&amp;, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), &lt;brace-enclosed initializer list&gt;)’
             nn::Functional(max_pool2d, {2,2}),
                                             ^
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/module.h:3:0,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:7:
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:53:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::nullptr_t) [with Contained = torch::nn::FunctionalImpl; std::nullptr_t = std::nullptr_t]
   /* implicit */ ModuleHolder(std::nullptr_t) : impl_(nullptr) {}
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:63:12: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(Head&amp;&amp;, Tail&amp;&amp; ...) [with Head = Head; Tail = {Tail ...}; &lt;template-parameter-2-3&gt; = &lt;template-parameter-1-3&gt;; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&amp;&amp; head, Tail&amp;&amp;... tail)
            ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:70:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::shared_ptr&lt;_Tp&gt;) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr&lt;Contained&gt; module)
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(const torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional()
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 0 arguments, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(const torch::nn::Functional&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(torch::nn::Functional&amp;&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:17:0:
/home/satrajit-c/Documents/My_Projects/OpenFace/baseModel.h:39:45: error: no matching function for call to ‘torch::nn::Functional::Functional(at::Tensor (&amp;)(const at::Tensor&amp;, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), &lt;brace-enclosed initializer list&gt;)’
             nn::Functional(max_pool2d, {2,2}),
                                             ^
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/module.h:3:0,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:7:
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:53:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::nullptr_t) [with Contained = torch::nn::FunctionalImpl; std::nullptr_t = std::nullptr_t]
   /* implicit */ ModuleHolder(std::nullptr_t) : impl_(nullptr) {}
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:63:12: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(Head&amp;&amp;, Tail&amp;&amp; ...) [with Head = Head; Tail = {Tail ...}; &lt;template-parameter-2-3&gt; = &lt;template-parameter-1-3&gt;; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&amp;&amp; head, Tail&amp;&amp;... tail)
            ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:70:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::shared_ptr&lt;_Tp&gt;) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr&lt;Contained&gt; module)
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(const torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional()
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 0 arguments, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(const torch::nn::Functional&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(torch::nn::Functional&amp;&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:17:0:
/home/satrajit-c/Documents/My_Projects/OpenFace/baseModel.h:46:45: error: no matching function for call to ‘torch::nn::Functional::Functional(at::Tensor (&amp;)(const at::Tensor&amp;, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), &lt;brace-enclosed initializer list&gt;)’
             nn::Functional(max_pool2d, {2,2}),
                                             ^
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/module.h:3:0,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:7:
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:53:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::nullptr_t) [with Contained = torch::nn::FunctionalImpl; std::nullptr_t = std::nullptr_t]
   /* implicit */ ModuleHolder(std::nullptr_t) : impl_(nullptr) {}
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:63:12: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(Head&amp;&amp;, Tail&amp;&amp; ...) [with Head = Head; Tail = {Tail ...}; &lt;template-parameter-2-3&gt; = &lt;template-parameter-1-3&gt;; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&amp;&amp; head, Tail&amp;&amp;... tail)
            ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:70:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::shared_ptr&lt;_Tp&gt;) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr&lt;Contained&gt; module)
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(const torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional()
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 0 arguments, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(const torch::nn::Functional&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(torch::nn::Functional&amp;&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:17:0:
/home/satrajit-c/Documents/My_Projects/OpenFace/baseModel.h:51:45: error: no matching function for call to ‘torch::nn::Functional::Functional(at::Tensor (&amp;)(const at::Tensor&amp;, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), &lt;brace-enclosed initializer list&gt;)’
             nn::Functional(max_pool2d, {2,2})
                                             ^
In file included from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/module.h:3:0,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /home/satrajit-c/Documents/My_Projects/OpenFace/Template.cpp:7:
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:53:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::nullptr_t) [with Contained = torch::nn::FunctionalImpl; std::nullptr_t = std::nullptr_t]
   /* implicit */ ModuleHolder(std::nullptr_t) : impl_(nullptr) {}
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:63:12: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(Head&amp;&amp;, Tail&amp;&amp; ...) [with Head = Head; Tail = {Tail ...}; &lt;template-parameter-2-3&gt; = &lt;template-parameter-1-3&gt;; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&amp;&amp; head, Tail&amp;&amp;... tail)
            ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:70:18: note: candidate: torch::nn::ModuleHolder&lt;Contained&gt;::ModuleHolder(std::shared_ptr&lt;_Tp&gt;) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr&lt;Contained&gt; module)
                  ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(const torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/pimpl.h:26:7: note: candidate: torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;::ModuleHolder(torch::nn::ModuleHolder&lt;torch::nn::FunctionalImpl&gt;&amp;&amp;)
 class ModuleHolder : torch::detail::ModuleHolderIndicator {
       ^~~~~~~~~~~~
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   inherited here
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional()
 TORCH_MODULE(Functional);
 ^
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 0 arguments, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(const torch::nn::Functional&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note: candidate: torch::nn::Functional::Functional(torch::nn::Functional&amp;&amp;)
/home/satrajit-c/Documents/My_Projects/OpenFace/libtorch/include/torch/csrc/api/include/torch/nn/modules/container/functional.h:101:1: note:   candidate expects 1 argument, 2 provided
CMakeFiles/OpenFace.dir/build.make:62: recipe for target 'CMakeFiles/OpenFace.dir/Template.cpp.o' failed
make[2]: *** [CMakeFiles/OpenFace.dir/Template.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/OpenFace.dir/all' failed
make[1]: *** [CMakeFiles/OpenFace.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
</code></pre>

username: 21fa417e3fb06e56040c
cooked: <p>You see here, I use same code, It is just functional , sequential same , I think , you  can get some ideas In my repo</p>
<aside class="onebox githubblob">
  <header class="source">
      <a href="https://github.com/kerry-Cho/SemanticSegmentation-Libtorch/blob/c1b57b609c1cdd23a66286f0c8653a2a86bf2b6a/SemanticSegmentation-Libtorch/models/resnet.h#L150" target="_blank" rel="nofollow noopener">github.com</a>
  </header>
  <article class="onebox-body">
    <h4><a href="https://github.com/kerry-Cho/SemanticSegmentation-Libtorch/blob/c1b57b609c1cdd23a66286f0c8653a2a86bf2b6a/SemanticSegmentation-Libtorch/models/resnet.h#L150" target="_blank" rel="nofollow noopener">kerry-Cho/SemanticSegmentation-Libtorch/blob/c1b57b609c1cdd23a66286f0c8653a2a86bf2b6a/SemanticSegmentation-Libtorch/models/resnet.h#L150</a></h4>
<pre class="onebox"><code class="lang-h"><ol class="start lines" start="140" style="counter-reset: li-counter 139 ;">
<li>	bool zero_init_residual,</li>
<li>	int64_t groups,</li>
<li>	int64_t width_per_group)</li>
<li>	: groups(groups),</li>
<li>	base_width(width_per_group),</li>
<li>	inplanes(64),</li>
<li>	conv1(torch::nn::Conv2dOptions(3, 64, 7).stride(2).padding(3).with_bias(</li>
<li>		false).dilation(1)),</li>
<li>	bn1(64),</li>
<li>	fc(512 * Block::expansion, num_classes),</li>
<li class="selected">	max_pool1(torch::max_pool2d, 3, 2, 1, 1, false) {</li>
<li>
</li>
<li>	_dilation = 1;</li>
<li>
</li>
<li>	layer1 = _make_layer(64, layers[0]);</li>
<li>	layer2 = _make_layer(128, layers[1], 2);</li>
<li>	layer3 = _make_layer(256, layers[2], 2, true);</li>
<li>	layer4 = _make_layer(512, layers[3], 2, true);</li>
<li>
</li>
<li>	register_module("conv1", conv1);</li>
<li>	register_module("bn1", bn1);</li>
</ol></code></pre>


  </article>
  <div class="onebox-metadata">
    
    
  </div>
  <div style="clear: both"></div>
</aside>


username: satrajit-chatterjee
cooked: <p>Alright! It worked. Seems like I just needed to pass all the params:</p>
<pre><code class="lang-auto">nn::Functional(max_pool2d, 2, 2, 1, 1, false)
</code></pre>
<p>Thanks a lot for all your help!!</p>

username: yf225
cooked: <p><code>nn::Functional</code> will be deprecated in the future because we now provide most functionals in module form as well (same as the Python API). For example:</p>
<blockquote>
<p><code>nn::Functional(relu)</code></p>
</blockquote>
<p>can be replaced by</p>
<blockquote>
<p><code>nn::ReLU()</code></p>
</blockquote>
<p>and</p>
<blockquote>
<p><code>nn::Functional(max_pool2d, nn::MaxPool2dOptions(ExpandingArray&lt;2&gt;({2,2})))</code></p>
</blockquote>
<p>can be replaced by</p>
<blockquote>
<p><code>nn::MaxPool2d(nn::MaxPool2dOptions({2,2}))</code></p>
</blockquote>

username: satrajit-chatterjee
cooked: <p>Okay! Thanks a lot for this helpful heads up!!</p>