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

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:

//
// Created by satrajit-c on 6/12/19.
//

#ifndef BASEMODEL_H
#define BASEMODEL_H

#include <torch/torch.h>
#include <torch/nn/options/pooling.h>
#include <vector>

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<2>({2,2}))),
            ){}

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

    nn::Sequential features;

};

#endif //BASEMODEL_H

The above code is a bit trimmed down to just refer to the essential parts. However this is the error that’s occurring:

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<at::Tensor (*)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool), const std::_Placeholder<1>&, torch::nn::MaxPoolOptions<2> >’:
/usr/include/c++/7/functional:854:12:   required from ‘struct std::_Bind_helper<false, at::Tensor (*&)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool), const std::_Placeholder<1>&, torch::nn::MaxPoolOptions<2> >’
/usr/include/c++/7/functional:875:5:   required by substitution of ‘template<class _Func, class ... _BoundArgs> typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...) [with _Func = at::Tensor (*&)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool); _BoundArgs = {const std::_Placeholder<1>&, torch::nn::MaxPoolOptions<2>}]’
/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&& ...) [with SomeFunction = at::Tensor (*)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool); Args = {torch::nn::MaxPoolOptions<2>}; <template-parameter-1-3> = 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<Contained>::ModuleHolder(Head&&, Tail&& ...) [with Head = at::Tensor (&)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool); Tail = {torch::nn::MaxPoolOptions<2>}; <template-parameter-2-3> = 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&& ...) [with SomeFunction = at::Tensor (*)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool); Args = {torch::nn::MaxPoolOptions<2>}; <template-parameter-1-3> = 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<Contained>::ModuleHolder(Head&&, Tail&& ...) [with Head = at::Tensor (&)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool); Tail = {torch::nn::MaxPoolOptions<2>}; <template-parameter-2-3> = 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<at::Tensor(at::Tensor)>::function(std::_Bind_helper<false, at::Tensor (*&)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool), const std::_Placeholder<1>&, torch::nn::MaxPoolOptions<2> >::type)’
             std::forward<Args>(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<class _Functor, class, class> std::function<_Res(_ArgTypes ...)>::function(_Functor)
       function<_Res(_ArgTypes...)>::
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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<std::_Bind<at::Tensor (*(std::_Placeholder<1>, torch::nn::MaxPoolOptions<2>))(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool)>&(at::Tensor)>’
         typename = _Requires<_Callable<_Functor>, void>>
         ^~~~~~~~
/usr/include/c++/7/bits/std_function.h:441:7: note: candidate: std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = at::Tensor; _ArgTypes = {at::Tensor}]
       function(function&& __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<false, at::Tensor (*&)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool), const std::_Placeholder<1>&, torch::nn::MaxPoolOptions<2> >::type {aka std::_Bind<at::Tensor (*(std::_Placeholder<1>, torch::nn::MaxPoolOptions<2>))(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool)>}’ to ‘std::function<at::Tensor(at::Tensor)>&&’
/usr/include/c++/7/bits/std_function.h:671:5: note: candidate: std::function<_Res(_ArgTypes ...)>::function(const std::function<_Res(_ArgTypes ...)>&) [with _Res = at::Tensor; _ArgTypes = {at::Tensor}]
     function<_Res(_ArgTypes...)>::
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/std_function.h:671:5: note:   no known conversion for argument 1 from ‘std::_Bind_helper<false, at::Tensor (*&)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool), const std::_Placeholder<1>&, torch::nn::MaxPoolOptions<2> >::type {aka std::_Bind<at::Tensor (*(std::_Placeholder<1>, torch::nn::MaxPoolOptions<2>))(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool)>}’ to ‘const std::function<at::Tensor(at::Tensor)>&’
/usr/include/c++/7/bits/std_function.h:421:7: note: candidate: std::function<_Res(_ArgTypes ...)>::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<false, at::Tensor (*&)(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool), const std::_Placeholder<1>&, torch::nn::MaxPoolOptions<2> >::type {aka std::_Bind<at::Tensor (*(std::_Placeholder<1>, torch::nn::MaxPoolOptions<2>))(const at::Tensor&, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, c10::ArrayRef<long int>, bool)>}’ to ‘std::nullptr_t’
/usr/include/c++/7/bits/std_function.h:414:7: note: candidate: std::function<_Res(_ArgTypes ...)>::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$ 

This is the original traceback of the entire code.

I’d really appreciate any help I can get on this as I can’t seem to figure this out.

hi
functional usage
function , Argument1,Argument2 Arguments...

sample code

torch::nn::Functional(torch::max_pool2d, {2,2});

Hi, thanks for the quick reply. Unfortunately this doesn’t seem to work. Here’s the new traceback for the solution you proposed

[ 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 (&)(const at::Tensor&, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), <brace-enclosed initializer list>)’
             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<Contained>::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<Contained>::ModuleHolder(Head&&, Tail&& ...) [with Head = Head; Tail = {Tail ...}; <template-parameter-2-3> = <template-parameter-1-3>; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&& head, Tail&&... 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<Contained>::ModuleHolder(std::shared_ptr<_Tp>) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr<Contained> 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<torch::nn::FunctionalImpl>::ModuleHolder(const torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&)
 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<torch::nn::FunctionalImpl>::ModuleHolder(torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&&)
 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&)
/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&&)
/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 (&)(const at::Tensor&, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), <brace-enclosed initializer list>)’
             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<Contained>::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<Contained>::ModuleHolder(Head&&, Tail&& ...) [with Head = Head; Tail = {Tail ...}; <template-parameter-2-3> = <template-parameter-1-3>; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&& head, Tail&&... 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<Contained>::ModuleHolder(std::shared_ptr<_Tp>) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr<Contained> 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<torch::nn::FunctionalImpl>::ModuleHolder(const torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&)
 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<torch::nn::FunctionalImpl>::ModuleHolder(torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&&)
 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&)
/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&&)
/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 (&)(const at::Tensor&, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), <brace-enclosed initializer list>)’
             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<Contained>::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<Contained>::ModuleHolder(Head&&, Tail&& ...) [with Head = Head; Tail = {Tail ...}; <template-parameter-2-3> = <template-parameter-1-3>; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&& head, Tail&&... 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<Contained>::ModuleHolder(std::shared_ptr<_Tp>) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr<Contained> 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<torch::nn::FunctionalImpl>::ModuleHolder(const torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&)
 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<torch::nn::FunctionalImpl>::ModuleHolder(torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&&)
 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&)
/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&&)
/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 (&)(const at::Tensor&, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), <brace-enclosed initializer list>)’
             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<Contained>::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<Contained>::ModuleHolder(Head&&, Tail&& ...) [with Head = Head; Tail = {Tail ...}; <template-parameter-2-3> = <template-parameter-1-3>; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&& head, Tail&&... 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<Contained>::ModuleHolder(std::shared_ptr<_Tp>) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr<Contained> 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<torch::nn::FunctionalImpl>::ModuleHolder(const torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&)
 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<torch::nn::FunctionalImpl>::ModuleHolder(torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&&)
 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&)
/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&&)
/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 (&)(const at::Tensor&, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, c10::IntArrayRef, bool), <brace-enclosed initializer list>)’
             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<Contained>::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<Contained>::ModuleHolder(Head&&, Tail&& ...) [with Head = Head; Tail = {Tail ...}; <template-parameter-2-3> = <template-parameter-1-3>; Contained = torch::nn::FunctionalImpl]
   explicit ModuleHolder(Head&& head, Tail&&... 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<Contained>::ModuleHolder(std::shared_ptr<_Tp>) [with Contained = torch::nn::FunctionalImpl]
   /* implicit */ ModuleHolder(std::shared_ptr<Contained> 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<torch::nn::FunctionalImpl>::ModuleHolder(const torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&)
 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<torch::nn::FunctionalImpl>::ModuleHolder(torch::nn::ModuleHolder<torch::nn::FunctionalImpl>&&)
 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&)
/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&&)
/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

You see here, I use same code, It is just functional , sequential same , I think , you can get some ideas In my repo

Alright! It worked. Seems like I just needed to pass all the params:

nn::Functional(max_pool2d, 2, 2, 1, 1, false)

Thanks a lot for all your help!!

1 Like

nn::Functional will be deprecated in the future because we now provide most functionals in module form as well (same as the Python API). For example:

nn::Functional(relu)

can be replaced by

nn::ReLU()

and

nn::Functional(max_pool2d, nn::MaxPool2dOptions(ExpandingArray<2>({2,2})))

can be replaced by

nn::MaxPool2d(nn::MaxPool2dOptions({2,2}))

Okay! Thanks a lot for this helpful heads up!!