Skip to content

Commit

Permalink
fix compile problem for torch 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanzexi committed Mar 24, 2021
1 parent 9b2139e commit 640a788
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Expand Up @@ -18,22 +18,24 @@ cache:

jobs:
include:
- name: "CUDA 10.0"
- name: "CUDA 10.0 + TRT 7.0 + Torch 1.3"
env:
- CUDA=10.0.130-1
- CUDA_SHORT=10.0
- CUDNN_MAJOR=7
- CUDNN=7.6.5.*
- TENSORRT=7.0.0
- UBUNTU_VERSION=ubuntu1804
- name: "CUDA 10.2"
- TORCH=1.3.1
- name: "CUDA 10.2 + TRT 7.2 + Torch 1.7"
env:
- CUDA=10.2.89-1
- CUDA_SHORT=10.2
- CUDNN_MAJOR=8
- CUDNN=8.0.4.*
- TENSORRT=7.2.3
- UBUNTU_VERSION=ubuntu1804
- TORCH=1.7.0

before_install:
- INSTALLER=cuda-repo-${UBUNTU_VERSION}_${CUDA}_amd64.deb
Expand All @@ -56,7 +58,7 @@ before_install:

install:
- pip3 install --user $(whoami) --upgrade pip
- pip3 install torch==1.3.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
- pip3 install torch==${TORCH}+cpu -f https://download.pytorch.org/whl/torch_stable.html

before_script:
- wget https://github.com/Neargye/tensorflow/releases/download/v1.15.0/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz -O tensorflow.tar.gz
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Expand Up @@ -233,9 +233,11 @@ if(ENABLE_TORCH)
endif(MSVC)

message(STATUS "Find Torch VERSION: ${Torch_VERSION}")
add_definitions(-DTORCH_VERSION_MAJOR=${Torch_VERSION_MAJOR})
add_definitions(-DTORCH_VERSION_MINOR=${Torch_VERSION_MINOR})
add_definitions(-DTORCH_VERSION_PATCH=${Torch_VERSION_PATCH})
if (${Torch_VERSION} VERSION_GREATER_EQUAL "1.7.0")
add_definitions(-DNEW_TORCH_API=1)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

include_directories(${TORCH_INCLUDE_DIRS})
add_subdirectory(${PROJECT_SOURCE_DIR}/source/fwd_torch)
Expand Down
1 change: 0 additions & 1 deletion source/fwd_torch/CMakeLists.txt
Expand Up @@ -30,7 +30,6 @@ file(GLOB TORCH_CRT_SOURCES torch_cvt/torch_desc_creators/*.h)
file(GLOB TORCH_PASS_SOURCES torch_cvt/torch_passes/*.h torch_cvt/torch_passes/*.cpp)

add_library(fwd_torch
torch_version.h
${TORCH_LIB_SOURCES}
${TORCH_CVT_SOURCES}
${TORCH_CRT_SOURCES}
Expand Down
Expand Up @@ -32,7 +32,6 @@

#include "common/trt_layer_desc.h"
#include "fwd_torch/fwd_torch_renaming.h"
#include "fwd_torch/torch_version.h"

#ifdef _MSC_VER
// 关闭 Torch 太多的编译警告
Expand Down
Expand Up @@ -30,7 +30,6 @@

#include <memory>

#include "fwd_torch/torch_version.h"

#ifdef NEW_TORCH_API
namespace torch {
Expand Down
1 change: 0 additions & 1 deletion source/unit_test/unit_test.h
Expand Up @@ -42,7 +42,6 @@

#include "fwd_torch/torch_engine/torch_engine.h"
#include "fwd_torch/torch_engine/torch_infer.h"
#include "fwd_torch/torch_version.h"

#ifdef _MSC_VER
const c10::DeviceType device = c10::kCPU;
Expand Down

0 comments on commit 640a788

Please sign in to comment.