Repository: pytorch
Issue: ubuntu16.04+vscode compile libtorch error
Labels: module: build,triaged

I use libtorch for the first time，when I cmake this project, it has no error， but I make this project ,it has many errors.
If anyone knows how to solve it, please let me know and I will be very grateful.
The specific situation is as follows:

CMakeLists.txt
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(libtorch_test)
# SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/media/clscy/新加卷/songpeng/libtorch_test/libtorch")
find_package(Torch REQUIRED)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
find_package(OpenCV REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem system)
# find_package(PythonLibs REQUIRED)
if(NOT Boost_FOUND)
    message("Not found Boost")
endif()
include_directories(${Boost_INCLUDE_DIRS})
add_executable(libtorch_test libtorch_test.cpp)
target_link_libraries(libtorch_test "${TORCH_LIBRARIES}" "${OpenCV_LIBS}" "${Boost_LIBRARIES}")
set_property(TARGET libtorch_test PROPERTY CXX_STANDARD 11)

tasks.json
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "cmake build",
            "type": "shell",
            "command": "cmake",
            "args":[ ],
            "options":{
                "cwd":"/media/clscy/新加卷/songpeng/libtorch_test/build"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/build/libtorch_test",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "cmake build",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}
libtorch_test.cpp
#include<iostream>
#include<torch/torch.h>
using namespace std;
//using namespace torch;
int main()
{
    Tensor tensor = torch::eye(3);
    cout << tensor << std::endl;
    //cout<<"hello world!"<<endl;
    return 0;
}

errors:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:894:10: note:   no known conversion for argument 1 from ‘const c10::Device’ to ‘const c10::TensorOptions&’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:895:10: note: candidate: at::Tensor at::Tensor::to(c10::Device, c10::ScalarType, bool, bool, c10::optional<c10::MemoryFormat>) const
   Tensor to(Device device, ScalarType dtype, bool non_blocking=false, bool copy
          ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:895:10: note:   candidate expects 5 arguments, 1 provided
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:896:10: note: candidate: at::Tensor at::Tensor::to(c10::ScalarType, bool, bool, c10::optional<c10::MemoryFormat>) const
   Tensor to(ScalarType dtype, bool non_blocking=false, bool copy=false, c10::op
          ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:896:10: note:   no known conversion for argument 1 from ‘const c10::Device’ to ‘c10::ScalarType’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:897:10: note: candidate: at::Tensor at::Tensor::to(const at::Tensor&, bool, bool, c10::optional<c10::MemoryFormat>) const
   Tensor to(const Tensor & other, bool non_blocking=false, bool copy=false, c10
          ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:897:10: note:   no known conversion for argument 1 from ‘const c10::Device’ to ‘const at::Tensor&’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:1088:17: note: candidate: at::Tensor at::Tensor::to(caffe2::TypeMeta, bool, bool) const
   inline Tensor to(caffe2::TypeMeta type_meta, bool non_blocking=false, bool co
                 ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:1088:17: note:   no known conversion for argument 1 from ‘const c10::Device’ to ‘caffe2::TypeMeta’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:1091:17: note: candidate: at::Tensor at::Tensor::to(c10::Device, caffe2::TypeMeta, bool, bool) const
   inline Tensor to(Device device, caffe2::TypeMeta type_meta, bool non_blocking
                 ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:1091:17: note:   candidate expects 4 arguments, 1 provided
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn.h:3:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:56: error: no matching function for call to ‘at::Tensor::to(const c10::Device&) const’
       auto data = device && tensor.device() != *device ?
                                                        ^
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Tensor.h:3:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Context.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/ATen.h:5,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:894:10: note: candidate: at::Tensor at::Tensor::to(const c10::TensorOptions&, bool, bool, c10::optional<c10::MemoryFormat>) const
   Tensor to(const TensorOptions & options, bool non_blocking=false, bool copy=f
          ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:894:10: note:   no known conversion for argument 1 from ‘const c10::Device’ to ‘const c10::TensorOptions&’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:895:10: note: candidate: at::Tensor at::Tensor::to(c10::Device, c10::ScalarType, bool, bool, c10::optional<c10::MemoryFormat>) const
   Tensor to(Device device, ScalarType dtype, bool non_blocking=false, bool copy
          ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:895:10: note:   candidate expects 5 arguments, 1 provided
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:896:10: note: candidate: at::Tensor at::Tensor::to(c10::ScalarType, bool, bool, c10::optional<c10::MemoryFormat>) const
   Tensor to(ScalarType dtype, bool non_blocking=false, bool copy=false, c10::op
          ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:896:10: note:   no known conversion for argument 1 from ‘const c10::Device’ to ‘c10::ScalarType’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:897:10: note: candidate: at::Tensor at::Tensor::to(const at::Tensor&, bool, bool, c10::optional<c10::MemoryFormat>) const
   Tensor to(const Tensor & other, bool non_blocking=false, bool copy=false, c10
          ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:897:10: note:   no known conversion for argument 1 from ‘const c10::Device’ to ‘const at::Tensor&’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:1088:17: note: candidate: at::Tensor at::Tensor::to(caffe2::TypeMeta, bool, bool) const
   inline Tensor to(caffe2::TypeMeta type_meta, bool non_blocking=false, bool co
                 ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:1088:17: note:   no known conversion for argument 1 from ‘const c10::Device’ to ‘caffe2::TypeMeta’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:1091:17: note: candidate: at::Tensor at::Tensor::to(c10::Device, caffe2::TypeMeta, bool, bool) const
   inline Tensor to(Device device, caffe2::TypeMeta type_meta, bool non_blocking
                 ^
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:1091:17: note:   candidate expects 4 arguments, 1 provided
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/core/ScalarType.h:7:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/core/Scalar.h:10,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Tensor.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Context.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/ATen.h:5,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::ExpandingArray<3ul>]’:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/options/pooling.h:428:8:   required from ‘void torch::nn::Cloneable<Derived>::clone_(torch::nn::Module&, const c10::optional<c10::Device>&) [with Derived = torch::nn::FractionalMaxPool3dImpl]’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/optim/sgd.h:48:17:   required from here
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::ExpandingArray<3ul>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
                       ^
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:6:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/expanding_array.h:23:7: note:   in call to ‘torch::ExpandingArray<3ul>& torch::ExpandingArray<3ul>::operator=(const torch::ExpandingArray<3ul>&)’
 class ExpandingArray {
       ^
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/core/ScalarType.h:7:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/core/Scalar.h:10,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Tensor.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Context.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/ATen.h:5,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::ExpandingArray<3ul, double>]’:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/options/pooling.h:428:8:   required from ‘void torch::nn::Cloneable<Derived>::clone_(torch::nn::Module&, const c10::optional<c10::Device>&) [with Derived = torch::nn::FractionalMaxPool3dImpl]’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/optim/sgd.h:48:17:   required from here
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::ExpandingArray<3ul, double>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
                       ^
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:6:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/expanding_array.h:23:7: note:   in call to ‘torch::ExpandingArray<3ul, double>& torch::ExpandingArray<3ul, double>::operator=(const torch::ExpandingArray<3ul, double>&)’
 class ExpandingArray {
       ^
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/core/ScalarType.h:7:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/core/Scalar.h:10,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Tensor.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Context.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/ATen.h:5,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::ExpandingArray<2ul>]’:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/options/pooling.h:428:8:   required from ‘void torch::nn::Cloneable<Derived>::clone_(torch::nn::Module&, const c10::optional<c10::Device>&) [with Derived = torch::nn::FractionalMaxPool2dImpl]’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/optim/sgd.h:48:17:   required from here
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::ExpandingArray<2ul>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
                       ^
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:6:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/expanding_array.h:23:7: note:   in call to ‘torch::ExpandingArray<2ul>& torch::ExpandingArray<2ul>::operator=(const torch::ExpandingArray<2ul>&)’
 class ExpandingArray {
       ^
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/core/ScalarType.h:7:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/core/Scalar.h:10,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/core/TensorBody.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Tensor.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/Context.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/ATen/ATen.h:5,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/types.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/data.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/util/Optional.h: In instantiation of ‘c10::optional<T>& c10::optional<T>::operator=(c10::optional<T>&&) [with T = torch::ExpandingArray<2ul, double>]’:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/options/pooling.h:428:8:   required from ‘void torch::nn::Cloneable<Derived>::clone_(torch::nn::Module&, const c10::optional<c10::Device>&) [with Derived = torch::nn::FractionalMaxPool2dImpl]’
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/optim/sgd.h:48:17:   required from here
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/c10/util/Optional.h:396:23: error: passing ‘const torch::ExpandingArray<2ul, double>’ as ‘this’ argument discards qualifiers [-fpermissive]
       contained_val() = std::move(*rhs);
                       ^
In file included from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/options/conv.h:6:0,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/functional/conv.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn/functional.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/nn.h:4,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/all.h:7,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
                 from /media/clscy/新加卷/songpeng/libtorch_test/libtorch_test.cpp:6:
/media/clscy/新加卷/songpeng/libtorch_test/libtorch/include/torch/csrc/api/include/torch/expanding_array.h:23:7: note:   in call to ‘torch::ExpandingArray<2ul, double>& torch::ExpandingArray<2ul, double>::operator=(const torch::ExpandingArray<2ul, double>&)’
 class ExpandingArray {
       ^
CMakeFiles/libtorch_test.dir/build.make:62: recipe for target 'CMakeFiles/libtorch_test.dir/libtorch_test.cpp.o' failed
make[2]: *** [CMakeFiles/libtorch_test.dir/libtorch_test.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/libtorch_test.dir/all' failed
make[1]: *** [CMakeFiles/libtorch_test.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2


cc @malfet @seemethere @walterddr