text stringlengths 24 1.04M | metadata stringlengths 233 497 |
|---|---|
### File: ibnnet/holder.h
#pragma once
template <typename T>
class TensorRTHolder {
T* holder;
public:
explicit TensorRTHolder(T* holder_) : holder(holder_) {}
~TensorRTHolder() {
if (holder)
holder->destroy();
}
TensorRTHolder(const TensorRTHolder&) = delete;
TensorRTHolder... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/holder.h", "license": "mit", "size": 1060} |
### File: ibnnet/ibnnet.cpp
#include "ibnnet.h"
//#define USE_FP16
namespace trt {
IBNNet::IBNNet(trt::EngineConfig &enginecfg, const IBN ibn) : _engineCfg(enginecfg) {
switch(ibn) {
case IBN::A:
_ibn = "a";
break;
case IBN::B:
_ibn... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/ibnnet.cpp", "license": "mit", "size": 8424} |
### File: ibnnet/ibnnet.h
#pragma once
#include "utils.h"
#include "holder.h"
#include "layers.h"
#include "InferenceEngine.h"
#include <memory>
#include <vector>
#include <chrono>
#include <opencv2/opencv.hpp>
extern Logger gLogger;
using namespace trtxapi;
namespace trt {
enum IBN {
A, // resnet50-ibna... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/ibnnet.h", "license": "mit", "size": 1113} |
### File: ibnnet/layers.cpp
#include "layers.h"
namespace trtxapi {
ITensor* MeanStd(INetworkDefinition *network, std::map<std::string, Weights>& weightMap, ITensor* input, const std::string lname, const float* mean, const float* std, const bool div255) {
if(div255) {
Weights Div_225{ DataType... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/layers.cpp", "license": "mit", "size": 9103} |
### File: ibnnet/layers.h
#pragma once
#include <map>
#include <math.h>
#include <assert.h>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
using namespace nvinfer1;
namespace trtxapi {
ITensor* MeanStd(INetworkDefinition *network,
std::map<std::string, Weights>& weightMap,
ITensor* input,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/layers.h", "license": "mit", "size": 1277} |
### File: ibnnet/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICE... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/logging.h", "license": "mit", "size": 16550} |
### File: ibnnet/main.cpp
#include <thread>
#include <vector>
#include <memory>
#include "ibnnet.h"
#include "InferenceEngine.h"
// stuff we know about the network and the input/output blobs
static const int MAX_BATCH_SIZE = 4;
static const int INPUT_H = 224;
static const int INPUT_W = 224;
static const int OUTPUT_SIZ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/main.cpp", "license": "mit", "size": 2942} |
### File: ibnnet/utils.cpp
#include "utils.h"
// Load weights from files shared with TensorRT samples.
// TensorRT weight files have a simple space delimited format:
// [type] [size] <data x size in hex>
std::map<std::string, Weights> loadWeights(const std::string file) {
std::cout << "Loading weights: " << file <... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/utils.cpp", "license": "mit", "size": 1157} |
### File: ibnnet/utils.h
#pragma once
#include <map>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "assert.h"
#include <fstream>
#include <iostream>
#include <memory>
using namespace nvinfer1;
#define CHECK(status) \
do \
{ ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "ibnnet/utils.h", "license": "mit", "size": 897} |
### File: inception/inceptionv3/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(inception)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and ten... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv3/CMakeLists.txt", "license": "mit", "size": 702} |
### File: inception/inceptionv3/inception_v3.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv3/inception_v3.cpp", "license": "mit", "size": 20434} |
### File: inception/inceptionv3/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.or... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv3/logging.h", "license": "mit", "size": 16550} |
### File: inception/inceptionv4/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(InceptionV4)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
find_package(CUDA REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/include)
# includ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/CMakeLists.txt", "license": "mit", "size": 989} |
### File: inception/inceptionv4/inception_v4.cpp
# include "inception_v4.h"
namespace trtx {
InceptionV4::InceptionV4(const InceptionV4Params ¶ms)
: mParams(params)
, mContext(nullptr)
, mEngine(nullptr)
{
}
/**
* Builds the tensorrt engine and serializes it.
**/
bool Inc... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/inception_v4.cpp", "license": "mit", "size": 8961} |
### File: inception/inceptionv4/inception_v4.h
#ifndef TRTX_INCEPTION_NETWORK_H
#define TRTX_INCEPTION_NETWORK_H
#include <memory>
#include <vector>
#include <chrono>
#include <opencv2/opencv.hpp>
#include "logging.h"
#include "utils.h"
#include "layers_api.h"
static Logger gLogger;
using namespace trtxlayers;
na... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/inception_v4.h", "license": "mit", "size": 1896} |
### File: inception/inceptionv4/layers_api.cpp
#include "layers_api.h"
namespace trtxlayers {
IScaleLayer* addBatchNorm2d(
INetworkDefinition *network,
std::map<std::string, Weights>& weightMap,
ITensor& input,
std::string lname,
float eps
)
{
float *gamm... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/layers_api.cpp", "license": "mit", "size": 14932} |
### File: inception/inceptionv4/layers_api.h
#ifndef TRTX_LAYERS_API_H
#define TRTX_LAYERS_API_H
#include <map>
#include <math.h>
#include <assert.h>
#include <iostream>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
using namespace nvinfer1;
namespace trtxlayers {
// Declare your layers here
IScaleLay... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/layers_api.h", "license": "mit", "size": 2242} |
### File: inception/inceptionv4/logging.h
/*
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.or... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/logging.h", "license": "mit", "size": 16650} |
### File: inception/inceptionv4/main.cpp
#include "inception_v4.h"
/**
* Initializes Inception class params in the
* InceptionV4Params structure.
**/
trtx::InceptionV4Params initializeParams()
{
trtx::InceptionV4Params params;
params.batchSize = 1;
params.fp16 = false;
params.inputH = 299;
pa... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/main.cpp", "license": "mit", "size": 2317} |
### File: inception/inceptionv4/utils.cpp
# include "utils.h"
// Load weights from files.
// TensorRT weight files have a simple space delimited format:
// [type] [size] <data x size in hex>
std::map<std::string, Weights> loadWeights(const std::string file) {
std::cout << "Loading weights: " << file << std::endl;... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/utils.cpp", "license": "mit", "size": 1151} |
### File: inception/inceptionv4/utils.h
# ifndef TRTX_UTILS_H
# define TRTX_UTILS_H
#include <map>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "assert.h"
#include <fstream>
#include <iostream>
#include <memory>
#ifndef CUDA_CHECK
#define CUDA_CHECK(callstr)\
{\
cudaError_t error_code = cal... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "inception/inceptionv4/utils.h", "license": "mit", "size": 608} |
### File: lenet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(lenet)
add_definitions(-std=c++11)
set(TARGET_NAME "lenet")
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda a... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "lenet/CMakeLists.txt", "license": "mit", "size": 801} |
### File: lenet/lenet.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <map>
#include <chrono>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0)\
{\
std::cerr << "Cuda failure: " << ret << std::endl;\
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "lenet/lenet.cpp", "license": "mit", "size": 9869} |
### File: lenet/lenet.py
import argparse
import os
import struct
import sys
import numpy as np
import pycuda.autoinit
import pycuda.driver as cuda
import tensorrt as trt
INPUT_H = 32
INPUT_W = 32
OUTPUT_SIZE = 10
INPUT_BLOB_NAME = "data"
OUTPUT_BLOB_NAME = "prob"
weight_path = "./lenet5.wts"
engine_path = "./lenet5.... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "lenet/lenet.py", "license": "mit", "size": 6005} |
### File: lenet/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICEN... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "lenet/logging.h", "license": "mit", "size": 16584} |
### File: lenet/macros.h
#ifndef __MACROS_H
#define __MACROS_H
#if NV_TENSORRT_MAJOR >= 8
#define TRT_NOEXCEPT noexcept
#define TRT_CONST_ENQUEUE const
#else
#define TRT_NOEXCEPT
#define TRT_CONST_ENQUEUE
#endif
#endif // __MACROS_H
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "lenet/macros.h", "license": "mit", "size": 211} |
### File: lprnet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(LPRnet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
find_package(CUDA REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/include)
if (CMAKE_SYSTEM_PROCESSOR M... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "lprnet/CMakeLists.txt", "license": "mit", "size": 1018} |
### File: lprnet/LPRnet.cpp
#include <iostream>
#include <chrono>
#include <map>
#include <opencv2/opencv.hpp>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <map>
#include <sstream>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (re... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "lprnet/LPRnet.cpp", "license": "mit", "size": 20352} |
### File: lprnet/genwts.py
import torch
from torch.autograd import Variable
from LPRNet.model import LPRNET
import struct
model_path = './weights/Final_LPRNet_model.pth'
CHARS = ['京', '沪', '津', '渝', '冀', '晋', '蒙', '辽', '吉', '黑',
'苏', '浙', '皖', '闽', '赣', '鲁', '豫', '鄂', '湘', '粤',
'桂', '琼', '川', '贵', '... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "lprnet/genwts.py", "license": "mit", "size": 1379} |
### File: lprnet/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICE... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "lprnet/logging.h", "license": "mit", "size": 16550} |
### File: mlp/CMakeLists.txt
cmake_minimum_required(VERSION 3.14) # change the version, if asked by compiler
project(mlp)
set(CMAKE_CXX_STANDARD 14)
# include and link dirs of tensorrt, you need adapt them if yours are different
include_directories(/usr/include/x86_64-linux-gnu/)
link_directories(/usr/lib/x86_64-lin... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "mlp/CMakeLists.txt", "license": "mit", "size": 681} |
### File: mlp/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "mlp/logging.h", "license": "mit", "size": 16559} |
### File: mlp/mlp.cpp
#include "NvInfer.h" // TensorRT library
#include "iostream" // Standard input/output library
#include "logging.h" // logging file -- by NVIDIA
#include <map> // for weight maps
#include <fstream> // for file-handling
#include <chrono> // for timing the execution
// ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "mlp/mlp.cpp", "license": "mit", "size": 10302} |
### File: mlp/mlp.py
import argparse
import os
import numpy as np
import struct
# required for the model creation
import tensorrt as trt
# required for the inference using TRT engine
import pycuda.autoinit
import pycuda.driver as cuda
# Sizes of input and output for TensorRT model
INPUT_SIZE = 1
OUTPUT_SIZE = 1
# p... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "mlp/mlp.py", "license": "mit", "size": 7806} |
### File: mnasnet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(mnasnet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and tensorrt, you need ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "mnasnet/CMakeLists.txt", "license": "mit", "size": 689} |
### File: mnasnet/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LIC... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "mnasnet/logging.h", "license": "mit", "size": 16550} |
### File: mnasnet/mnasnet.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0)\... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "mnasnet/mnasnet.cpp", "license": "mit", "size": 14271} |
### File: mobilenet/mobilenetv2/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(mobilenet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and ten... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "mobilenet/mobilenetv2/CMakeLists.txt", "license": "mit", "size": 702} |
### File: mobilenet/mobilenetv2/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.or... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "mobilenet/mobilenetv2/logging.h", "license": "mit", "size": 16550} |
### File: mobilenet/mobilenetv2/mobilenet_v2.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "mobilenet/mobilenetv2/mobilenet_v2.cpp", "license": "mit", "size": 14457} |
### File: mobilenet/mobilenetv2/mobilenet_v2.py
import os
import sys
import struct
import argparse
import numpy as np
import pycuda.autoinit
import pycuda.driver as cuda
import tensorrt as trt
BATCH_SIZE = 1
INPUT_H = 224
INPUT_W = 224
OUTPUT_SIZE = 1000
INPUT_BLOB_NAME = "data"
OUTPUT_BLOB_NAME = "prob"
EPS = 1e-5
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "mobilenet/mobilenetv2/mobilenet_v2.py", "license": "mit", "size": 10482} |
### File: mobilenet/mobilenetv3/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(mobilenetv3)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
find_package(CUDA REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/include)
# includ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "mobilenet/mobilenetv3/CMakeLists.txt", "license": "mit", "size": 740} |
### File: mobilenet/mobilenetv3/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.or... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "mobilenet/mobilenetv3/logging.h", "license": "mit", "size": 16550} |
### File: mobilenet/mobilenetv3/mobilenet_v3.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "mobilenet/mobilenetv3/mobilenet_v3.cpp", "license": "mit", "size": 21983} |
### File: mobilenet/mobilenetv3/mobilenet_v3.py
import os
import sys
import struct
import argparse
import numpy as np
import pycuda.autoinit
import pycuda.driver as cuda
import tensorrt as trt
BATCH_SIZE = 1
INPUT_H = 224
INPUT_W = 224
OUTPUT_SIZE = 1000
BS = 1
INPUT_BLOB_NAME = "data"
OUTPUT_BLOB_NAME = "prob"
EPS =... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "mobilenet/mobilenetv3/mobilenet_v3.py", "license": "mit", "size": 17447} |
### File: psenet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(PSENet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
find_package(CUDA REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of c... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/CMakeLists.txt", "license": "mit", "size": 958} |
### File: psenet/gen_tf_wts.py
from sys import prefix
import tensorflow as tf
from tensorflow.python import pywrap_tensorflow
import numpy as np
import struct
model_dir = "model"
ckpt = tf.train.get_checkpoint_state(model_dir)
ckpt_path = ckpt.model_checkpoint_path
reader = pywrap_tensorflow.NewCheckpoint... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/gen_tf_wts.py", "license": "mit", "size": 851} |
### File: psenet/layers.cpp
#include "layers.h"
IScaleLayer* addBatchNorm2d(INetworkDefinition* network, std::map<std::string, Weights>& weightMap, ITensor& input, std::string lname, float eps)
{
float* gamma = (float*)weightMap[lname + "gamma"].values; // scale
float* beta = (float*)weightMap[lname + "be... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/layers.cpp", "license": "mit", "size": 4686} |
### File: psenet/layers.h
#ifndef TENSORRTX_LAYERS_H
#define TENSORRTX_LAYERS_H
#include <map>
#include <math.h>
#include <assert.h>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
using namespace nvinfer1;
IScaleLayer *addBatchNorm2d(INetworkDefinition *network, std::map<std::string, Weights> &weightMap, ITensor... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/layers.h", "license": "mit", "size": 691} |
### File: psenet/main.cpp
#include "psenet.h"
int main(int argc, char** argv)
{
PSENet psenet(1200, 640, 0.90, 6, 4);
if (argc == 2 && std::string(argv[1]) == "-s")
{
std::cout << "Serializling Engine" << std::endl;
psenet.serializeEngine();
return 0;
}
else if ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/main.cpp", "license": "mit", "size": 952} |
### File: psenet/psenet.cpp
#include "psenet.h"
#include <string>
#include <queue>
#define MAX_INPUT_SIZE 1200
#define MIN_INPUT_SIZE 128
#define OPT_INPUT_W 640
#define OPT_INPUT_H 640
PSENet::PSENet(int max_side_len, int min_side_len, float threshold, int num_kernel, int stride) : max_side_len_(max_side_len)... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/psenet.cpp", "license": "mit", "size": 19208} |
### File: psenet/psenet.h
#ifndef TENSORRTX_PSENET_H
#define TENSORRTX_PSENET_H
#include <memory>
#include <vector>
#include <chrono>
#include <opencv2/opencv.hpp>
#include "utils.h"
#include "layers.h"
class PSENet
{
public:
PSENet(int max_side_len, int min_side_len, float threshold, int num_kernel, int st... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/psenet.h", "license": "mit", "size": 1258} |
### File: psenet/utils.cpp
#include "utils.h"
// Load weights from files shared with TensorRT samples.
// TensorRT weight files have a simple space delimited format:
// [type] [size] <data x size in hex>
std::map<std::string, Weights> loadWeights(const std::string file)
{
std::cout << "Loading weights: " <<... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/utils.cpp", "license": "mit", "size": 2300} |
### File: psenet/utils.h
#ifndef TENSORRTX_UTILS_H
#define TENSORRTX_UTILS_H
#include <map>
#include <opencv2/opencv.hpp>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "assert.h"
#include <fstream>
using namespace nvinfer1;
std::map<std::string, Weights> loadWeights(const std::string file);... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "psenet/utils.h", "license": "mit", "size": 2339} |
### File: rcnn/BatchedNms.cu
#include <cuda.h>
#include <thrust/device_ptr.h>
#include <thrust/sequence.h>
#include <thrust/execution_policy.h>
#include <thrust/gather.h>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include <cstdint>
#include <vector>
#include "BatchedNmsPlugin.h"
#in... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/BatchedNms.cu", "license": "mit", "size": 6782} |
### File: rcnn/BatchedNmsPlugin.h
#pragma once
#include <NvInfer.h>
#include <vector>
#include <cassert>
#include "macros.h"
using namespace nvinfer1;
#define PLUGIN_NAME "BatchedNms"
#define PLUGIN_VERSION "1"
#define PLUGIN_NAMESPACE ""
namespace nvinfer1 {
int batchedNms(int nms_method, int batchSize,
const... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/BatchedNmsPlugin.h", "license": "mit", "size": 6684} |
### File: rcnn/CMakeLists.txt
cmake_minimum_required(VERSION 3.1)
project(rcnn)
add_definitions(-std=c++14)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE Debug)
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};--extended-lambda)
find_package(CUDA REQUIRED)
include_directories(${PR... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/CMakeLists.txt", "license": "mit", "size": 1335} |
### File: rcnn/MaskRcnnInference.cu
#include "MaskRcnnInferencePlugin.h"
#include "macros.h"
namespace nvinfer1 {
__device__ float Logist(float data) { return 1.0f / (1.0f + expf(-data)); }
__global__ void MaskRcnnInferenceKernel(
const int nthreads,
const int detections_per_im,
const int output_size,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/MaskRcnnInference.cu", "license": "mit", "size": 2398} |
### File: rcnn/MaskRcnnInferencePlugin.h
#pragma once
#include <NvInfer.h>
#include <vector>
#include <cassert>
#include "macros.h"
using namespace nvinfer1;
#define PLUGIN_NAME "MaskRcnnInference"
#define PLUGIN_VERSION "1"
#define PLUGIN_NAMESPACE ""
namespace nvinfer1 {
int maskRcnnInference(int batchSize,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/MaskRcnnInferencePlugin.h", "license": "mit", "size": 6157} |
### File: rcnn/PredictorDecode.cu
#include <thrust/device_ptr.h>
#include <thrust/sequence.h>
#include <thrust/execution_policy.h>
#include <thrust/gather.h>
#include <algorithm>
#include <cstdint>
#include "PredictorDecodePlugin.h"
#include "./cuda_utils.h"
#include "macros.h"
#ifdef CUDA_11
#include <cub/device/de... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/PredictorDecode.cu", "license": "mit", "size": 4760} |
### File: rcnn/PredictorDecodePlugin.h
#pragma once
#include <NvInfer.h>
#include <cassert>
#include <vector>
#include "macros.h"
using namespace nvinfer1;
#define PLUGIN_NAME "PredictorDecode"
#define PLUGIN_VERSION "1"
#define PLUGIN_NAMESPACE ""
namespace nvinfer1 {
int predictorDecode(int batchSize,
const voi... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/PredictorDecodePlugin.h", "license": "mit", "size": 7685} |
### File: rcnn/RoiAlign.cu
#include <cuda.h>
#include <thrust/device_ptr.h>
#include <thrust/device_vector.h>
#include <thrust/sequence.h>
#include <thrust/execution_policy.h>
#include <thrust/gather.h>
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include <cstdint>
#include <vector>
#include <cmath>
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/RoiAlign.cu", "license": "mit", "size": 6069} |
### File: rcnn/RoiAlignPlugin.h
#pragma once
#include <NvInfer.h>
#include <cassert>
#include <vector>
#include "macros.h"
using namespace nvinfer1;
#define PLUGIN_NAME "RoiAlign"
#define PLUGIN_VERSION "1"
#define PLUGIN_NAMESPACE ""
namespace nvinfer1 {
int roiAlign(int batchSize, const void *const *inputs, void... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/RoiAlignPlugin.h", "license": "mit", "size": 7063} |
### File: rcnn/RpnDecode.cu
#include <thrust/device_ptr.h>
#include <thrust/sequence.h>
#include <thrust/execution_policy.h>
#include <thrust/gather.h>
#include <thrust/tabulate.h>
#include <thrust/count.h>
#include <thrust/find.h>
#include <algorithm>
#include <cstdint>
#include "RpnDecodePlugin.h"
#include "./cuda_... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/RpnDecode.cu", "license": "mit", "size": 5839} |
### File: rcnn/RpnDecodePlugin.h
#pragma once
#include <NvInfer.h>
#include <cassert>
#include <vector>
#include "macros.h"
using namespace nvinfer1;
#define PLUGIN_NAME "RpnDecode"
#define PLUGIN_VERSION "1"
#define PLUGIN_NAMESPACE ""
namespace nvinfer1 {
int rpnDecode(int batchSize, const void *const *inputs,
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/RpnDecodePlugin.h", "license": "mit", "size": 7431} |
### File: rcnn/RpnNms.cu
#include <cuda.h>
#include <thrust/device_ptr.h>
#include <thrust/gather.h>
#include <algorithm>
#include <iostream>
#include <stdexcept>
#include <cstdint>
#include <vector>
#include <cmath>
#include "RpnNmsPlugin.h"
#include "./cuda_utils.h"
#include "macros.h"
#ifdef CUDA_11
#include <cub... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/RpnNms.cu", "license": "mit", "size": 5225} |
### File: rcnn/RpnNmsPlugin.h
#pragma once
#include <NvInfer.h>
#include <vector>
#include <cassert>
#include "macros.h"
using namespace nvinfer1;
#define PLUGIN_NAME "RpnNms"
#define PLUGIN_VERSION "1"
#define PLUGIN_NAMESPACE ""
namespace nvinfer1 {
int rpnNms(int batchSize,
const void *const *inputs, void ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/RpnNmsPlugin.h", "license": "mit", "size": 6162} |
### File: rcnn/backbone.hpp
#pragma once
#include <vector>
#include <map>
#include <string>
#include "common.hpp"
/* when stride>1, whether to put stride in the first 1x1 convolution or the bottleneck 3x3 convolution.
set false when use backbone from torchvision*/
#define STRIDE_IN_1X1 true
enum RESNETTYPE {
R18 ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/backbone.hpp", "license": "mit", "size": 7498} |
### File: rcnn/calibrator.hpp
#pragma once
#include "NvInfer.h"
#include <string>
#include <vector>
#include <iostream>
#include <iterator>
#include <fstream>
#include <algorithm>
#include "./cuda_utils.h"
#include "common.hpp"
#include "macros.h"
//! \class Int8EntropyCalibrator2
//!
//! \brief Implements Entropy ca... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/calibrator.hpp", "license": "mit", "size": 4173} |
### File: rcnn/common.hpp
#pragma once
#include <NvInfer.h>
#include <cuda_runtime_api.h>
#include <assert.h>
#include <dirent.h>
#include <fstream>
#include <sstream>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <opencv2/opencv.hpp>
#include "./logging.h"
#inc... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/common.hpp", "license": "mit", "size": 3059} |
### File: rcnn/cuda_utils.h
#pragma once
#include <cuda_runtime_api.h>
#include <stdexcept>
#include <cstdint>
#define CUDA_ALIGN 256
template <typename T>
inline size_t get_size_aligned(size_t num_elem) {
size_t size = num_elem * sizeof(T);
size_t extra_align = 0;
if (size % CUDA_ALIGN != 0) {
e... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/cuda_utils.h", "license": "mit", "size": 1114} |
### File: rcnn/gen_wts.py
from detectron2.layers import Conv2d
from torch import nn
import torch
import numpy as np
import struct
def fuse_conv_and_bn(conv):
# Fuse convolution and batchnorm layers https://tehnokv.com/posts/fusing-batchnorm-and-conv/
bn = conv.norm
# init
fusedconv = nn.Conv2d(conv.in_c... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/gen_wts.py", "license": "mit", "size": 3026} |
### File: rcnn/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENS... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/logging.h", "license": "mit", "size": 16384} |
### File: rcnn/macros.h
#pragma once
#include <NvInfer.h>
#include <cuda.h>
#if CUDA_VERSION >=11000
#define CUDA_11
#endif
#if NV_TENSORRT_MAJOR >= 8
#define TRT_NOEXCEPT noexcept
#define TRT_CONST_ENQUEUE const
#else
#define TRT_NOEXCEPT
#define TRT_CONST_ENQUEUE
#endif
| {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/macros.h", "license": "mit", "size": 252} |
### File: rcnn/rcnn.cpp
#include <iostream>
#include <opencv2/opencv.hpp>
#include "backbone.hpp"
#include "RpnDecodePlugin.h"
#include "RpnNmsPlugin.h"
#include "RoiAlignPlugin.h"
#include "PredictorDecodePlugin.h"
#include "BatchedNmsPlugin.h"
#include "MaskRcnnInferencePlugin.h"
#include "calibrator.hpp"
#define DE... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "rcnn/rcnn.cpp", "license": "mit", "size": 24066} |
### File: real-esrgan/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(real-esrgan)
add_definitions(-std=c++11)
add_definitions(-DAPI_EXPORTS)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
find_package(CUDA REQUIRED)
if(WIN32)
enable_language(CUDA)
endif(W... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/CMakeLists.txt", "license": "mit", "size": 1205} |
### File: real-esrgan/common.hpp
#ifndef REAL_ESRGAN_COMMON_H_
#define REAL_ESRGAN_COMMON_H_
#include <fstream>
#include <map>
#include <sstream>
#include <vector>
#include <opencv2/opencv.hpp>
#include "NvInfer.h"
using namespace nvinfer1;
// TensorRT weight files have a simple space delimited format:
// [type] [si... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/common.hpp", "license": "mit", "size": 5800} |
### File: real-esrgan/cuda_utils.h
#ifndef TRTX_CUDA_UTILS_H_
#define TRTX_CUDA_UTILS_H_
#include <cuda_runtime_api.h>
#include <stdint.h>
#include <cstdio>
#include <vector>
#include <iostream>
#ifndef CUDA_CHECK
#define CUDA_CHECK(callstr)\
{\
cudaError_t error_code = callstr;\
if (error_code !=... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/cuda_utils.h", "license": "mit", "size": 494} |
### File: real-esrgan/gen_wts.py
import argparse
import os
import struct
from basicsr.archs.rrdbnet_arch import RRDBNet
from realesrgan import RealESRGANer
from realesrgan.archs.srvgg_arch import SRVGGNetCompact
def main():
"""Inference demo for Real-ESRGAN.
"""
parser = argparse.ArgumentParser()
#pars... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/gen_wts.py", "license": "mit", "size": 4245} |
### File: real-esrgan/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/logging.h", "license": "mit", "size": 16584} |
### File: real-esrgan/macros.h
#ifndef __MACROS_H
#define __MACROS_H
#ifdef API_EXPORTS
#if defined(_MSC_VER)
#define API __declspec(dllexport)
#else
#define API __attribute__((visibility("default")))
#endif
#else
#if defined(_MSC_VER)
#define API __declspec(dllimport)
#else
#define API
#endif
#endif // API_EXPORTS
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/macros.h", "license": "mit", "size": 462} |
### File: real-esrgan/postprocess.cu
#include "cuda_utils.h"
using namespace std;
// postprocess (NCHW->NHWC, RGB->BGR, *255, ROUND, uint8)
__global__ void postprocess_kernel(uint8_t* output, float* input,
const int batchSize, const int height, const int width, const int channel,
const int thread_count)
{
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/postprocess.cu", "license": "mit", "size": 1650} |
### File: real-esrgan/postprocess.hpp
#pragma once
#include <NvInfer.h>
#include <fstream>
#include "macros.h"
#include <assert.h>
struct Postprocess {
int N;
int C;
int H;
int W;
};
namespace nvinfer1
{
class PostprocessPluginV2 : public IPluginV2IOExt
{
public:
PostprocessPluginV... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/postprocess.hpp", "license": "mit", "size": 5718} |
### File: real-esrgan/preprocess.cu
#include "cuda_utils.h"
using namespace std;
// preprocess (NHWC->NCHW, BGR->RGB, [0, 255]->[0, 1](Normalize))
__global__ void preprocess_kernel(float* output, uint8_t* input,
const int batchSize, const int height, const int width, const int channel,
const int thread_count)... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/preprocess.cu", "license": "mit", "size": 1596} |
### File: real-esrgan/preprocess.hpp
#pragma once
#include <NvInfer.h>
#include <fstream>
#include "macros.h"
#include <assert.h>
struct Preprocess {
int N;
int C;
int H;
int W;
};
namespace nvinfer1
{
class PreprocessPluginV2 : public IPluginV2IOExt
{
public:
PreprocessPluginV2(co... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/preprocess.hpp", "license": "mit", "size": 5691} |
### File: real-esrgan/real-esrgan.cpp
#include "cuda_utils.h"
#include "common.hpp"
#include "preprocess.hpp"// preprocess plugin
#include "postprocess.hpp"// postprocess plugin
#include "logging.h"
#include "utils.h"
#include <unistd.h>//access()
#define DEVICE 0 // GPU id
#define BATCH_SIZE 1
// stuff we know abo... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/real-esrgan.cpp", "license": "mit", "size": 12298} |
### File: real-esrgan/utils.h
#ifndef TRTX_REAL_ESRGAN_UTILS_H_
#define TRTX_REAL_ESRGAN_UTILS_H_
#include <dirent.h>
#include <opencv2/opencv.hpp>
static inline int read_files_in_dir(const char *p_dir_name, std::vector<std::string> &file_names) {
DIR *p_dir = opendir(p_dir_name);
if (p_dir == nullptr) {
... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "real-esrgan/utils.h", "license": "mit", "size": 830} |
### File: refinedet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(refinedet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
# tensorrt
include_directories(/data_2/tensorrt/TensorRT-7.0.0.11/include/) #include_directories(/usr/... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "refinedet/CMakeLists.txt", "license": "mit", "size": 1548} |
### File: refinedet/calibrator.cpp
#include <iostream>
#include <iterator>
#include <fstream>
#include <opencv2/dnn/dnn.hpp>
#include "calibrator.h"
#include "cuda_runtime_api.h"
#include "utils.h"
Int8EntropyCalibrator2::Int8EntropyCalibrator2(int batchsize, int input_w, int input_h, const char* img_dir, const char* ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "refinedet/calibrator.cpp", "license": "mit", "size": 2943} |
### File: refinedet/calibrator.h
#ifndef ENTROPY_CALIBRATOR_H
#define ENTROPY_CALIBRATOR_H
#include "NvInfer.h"
#include <string>
#include <vector>
//! \class Int8EntropyCalibrator2
//!
//! \brief Implements Entropy calibrator 2.
//! CalibrationAlgoType is kENTROPY_CALIBRATION_2.
//!
class Int8EntropyCalibrator2 : p... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "refinedet/calibrator.h", "license": "mit", "size": 1173} |
### File: refinedet/configure.h
#define USE_FP32 // set USE_INT8 or USE_FP16 or USE_FP32
const int num_class = 25; //num_class + 1 //Including background class
//SERIALIZE: It indicates that to generate engin by serialization, the following path needs to be set,path_wts_ and path_save_engine
//INFER: It shows t... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "refinedet/configure.h", "license": "mit", "size": 1948} |
### File: refinedet/gen_wts_refinedet.py
import torch
import torch.nn as nn
import struct
from models.refinedet import build_refinedet
num_classes = 25
path_model = "/data_2/project_2021/pytorch_refinedet/2021/20210308.pth"
path_save_wts = "./refinedet0312.wts"
input_size = 320
net = build_refinedet('test', input_s... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "refinedet/gen_wts_refinedet.py", "license": "mit", "size": 709} |
### File: refinedet/logging.h
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/L... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "refinedet/logging.h", "license": "mit", "size": 16551} |
### File: refinedet/refinedet.cpp
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "utils.h"
#include "logging.h"
#include "calibrator.h"
#include "configure.h"
#include <torch/script.h> // One-stop ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "refinedet/refinedet.cpp", "license": "mit", "size": 43909} |
### File: refinedet/utils.h
#ifndef __TRT_UTILS_H_
#define __TRT_UTILS_H_
#include <iostream>
#include <vector>
#include <algorithm>
#include <cudnn.h>
#include <dirent.h>
#include <opencv2/opencv.hpp>
#ifndef CUDA_CHECK
#define CUDA_CHECK(callstr) \... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "refinedet/utils.h", "license": "mit", "size": 1905} |
### File: repvgg/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(repvgg)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and tensorrt, you need ad... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "repvgg/CMakeLists.txt", "license": "mit", "size": 685} |
### File: repvgg/gen_wts.py
import argparse
import struct
import torch
def main(args):
# Load model
state_dict = torch.load(args.weight)
with open(args.save_path, "w") as f:
f.write("{}\n".format(len(state_dict.keys())))
for k, v in state_dict.items():
vr = v.reshape(-1).cpu()... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "repvgg/gen_wts.py", "license": "mit", "size": 895} |
### File: repvgg/logging.h
#ifndef TENSORRT_LOGGING_H
#define TENSORRT_LOGGING_H
#include "NvInferRuntimeCommon.h"
#include <cassert>
#include <iostream>
// Logger for TensorRT info/warning/errors
class Logger : public nvinfer1::ILogger
{
public:
Logger() : Logger(Severity::kINFO) {}
Logger(Severity severity... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "repvgg/logging.h", "license": "mit", "size": 1156} |
### File: repvgg/repvgg.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#include <algorithm>
#define CHECK(status) \
do ... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "repvgg/repvgg.cpp", "license": "mit", "size": 12934} |
### File: resnet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(resnet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and tensorrt, you need ad... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "resnet/CMakeLists.txt", "license": "mit", "size": 1278} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.