C++ static char THIS_FILE[] = __FILE__


C++ static char THIS_FILE[] = __FILE__;

__FILE__为预编译器常量,返回当前编译的文件名,还有比较常用的几个预编译器常量,
__LINE__编译器在编译的文件的第几行;
__DATE__返回当前的日期Jul-20-2004;
__TIME__返回当前的时间hh:mm:ss;   

__TIMESTAMP__的预定义的编译器宏始终返回时间戳信息在太平洋标准的时间内无论本地时间和CL.EXE 的运行位置在计算机上的时区。
     
__STDC__条件编译,意思是:如果定义了标准C或c++,那么编译这句话后面直到#endif 以前的源代码。
_STDC__cplusplus这两个都是标准宏,_STDC_表示是是否符合标准C
_cplusplus表示是否是C++


如下为宏定义:
#ifdef _DEBUG //如果定义了_DEBUG
#define new DEBUG_NEW //则定义new为DEBUG_NEW
#undef THIS_FILE //反定义,即清除THIS_FILE的宏定义
static char THIS_FILE[] = __FILE__;
#endif//结束宏定义     
__FILE__标准C++推荐编译器实现时预定义的宏

看看Thinking in C++(C++编程思想)
__FILE__是由编译器定义的宏,表示当前文件名。
常用于调试。报告错误时,我们可以方便地知道是哪个文件出错
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
class SR_net { public: SR_net(string path, vector<int> input_size, bool fp32, bool cuda = true); private: vector<int64_t> Gdims; int Gfp32; Env env = Env(ORT_LOGGING_LEVEL_ERROR, "RRDB"); SessionOptions session_options = SessionOptions(); Session* Gsession = nullptr; vector<const char*> Ginput_names; vector<const char*> Goutput_names; vector<int> Ginput_size = {}; }; SR_net::SR_net(string path, vector<int> input_size, bool fp32, bool cuda) { this->Ginput_size = input_size; this->Gfp32 = fp32; clock_t startTime_, endTime_; startTime_ = clock(); session_options.SetIntraOpNumThreads(6); if (cuda) { OrtCUDAProviderOptions cuda_option; cuda_option.device_id = 0; cuda_option.arena_extend_strategy = 0; cuda_option.cudnn_conv_algo_search = OrtCudnnConvAlgoSearchExhaustive; cuda_option.gpu_mem_limit = SIZE_MAX; cuda_option.do_copy_in_default_stream = 1; session_options.AppendExecutionProvider_CUDA(cuda_option); } wstring widestr = wstring(path.begin(), path.end()); this->Gsession = new Session(env, widestr.c_str(), this->session_options); this->session_options.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_ALL); AllocatorWithDefaultOptions allocator; this->Ginput_names = { "input" }; this->Goutput_names = { "output" }; endTime_ = clock(); cout << " The model loading time is:" << (double)(endTime_ - startTime_) / CLOCKS_PER_SEC << "s" << endl; } int main() { vector<int> input_shape = {}; SR_net net("E:/prj/SR_C/onnx_file/rrdb_full.onnx", input_shape, true, true); },在这段代码,我如何把SR_net net("E:/prj/SR_C/onnx_file/rrdb_full.onnx", input_shape, true, true);这一行写到主函数的外面?
06-02

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值