Caffe2 - C++ API
A deep learning, cross platform ML framework
Related Pages
Modules
Data Structures
Files
C++ API
Python API
GitHub
File List
Globals
torch
csrc
jit
resource_guard.h
1
#pragma once
2
#include <functional>
3
4
namespace
torch
{
5
namespace
jit {
6
7
class
ResourceGuard
{
8
std::function<void()> _destructor;
9
bool
_released;
10
11
public
:
12
ResourceGuard
(std::function<
void
()> destructor)
13
: _destructor(std::move(destructor)), _released(
false
) {}
14
15
~
ResourceGuard
() {
16
if
(!_released)
17
_destructor();
18
}
19
20
void
release() {
21
_released =
true
;
22
}
23
};
24
25
}
// namespace jit
26
}
// namespace torch
torch::jit::ResourceGuard
Definition:
resource_guard.h:7
torch
Definition:
jit_type.h:17
Generated on Thu Mar 21 2019 13:06:24 for Caffe2 - C++ API by
1.8.11