1
1
#include " core/util/prelude.h"
2
- #include " core/conversion/arg/Arg .h"
2
+ #include " core/conversion/var/Var .h"
3
3
4
4
namespace trtorch {
5
5
namespace core {
6
6
namespace conversion {
7
7
8
- Arg::Arg () {
8
+ Var::Var () {
9
9
ptr_.none = nullptr ;
10
10
type_ = Type::kNone ;
11
11
}
12
12
13
- Arg::Arg (const torch::jit::IValue* p)
13
+ Var::Var (const torch::jit::IValue* p)
14
14
: type_(Type::kIValue ) {
15
15
ptr_.ivalue = p;
16
16
}
17
17
18
- Arg::Arg (nvinfer1::ITensor* p)
18
+ Var::Var (nvinfer1::ITensor* p)
19
19
: type_(Type::kITensor ) {
20
20
ptr_.tensor = p;
21
21
}
22
22
23
- Arg::Arg (const Arg & a) {
23
+ Var::Var (const Var & a) {
24
24
switch (a.type_ ) {
25
25
case Type::kITensor :
26
26
ptr_.tensor = a.ptr_ .tensor ;
@@ -37,7 +37,7 @@ Arg::Arg(const Arg& a) {
37
37
}
38
38
}
39
39
40
- Arg& Arg ::operator =(const Arg & a) {
40
+ Var& Var ::operator =(const Var & a) {
41
41
switch (a.type_ ) {
42
42
case Type::kITensor :
43
43
ptr_.tensor = a.ptr_ .tensor ;
@@ -55,23 +55,23 @@ Arg& Arg::operator=(const Arg& a) {
55
55
return (*this );
56
56
}
57
57
58
- Arg& Arg ::operator =(const torch::jit::IValue* in) {
58
+ Var& Var ::operator =(const torch::jit::IValue* in) {
59
59
ptr_.ivalue = in;
60
60
type_ = Type::kIValue ;
61
61
return (*this );
62
62
}
63
63
64
- Arg& Arg ::operator =(nvinfer1::ITensor* in) {
64
+ Var& Var ::operator =(nvinfer1::ITensor* in) {
65
65
ptr_.tensor = in;
66
66
type_ = Type::kITensor ;
67
67
return (*this );
68
68
}
69
69
70
- Arg ::Type Arg ::type () const {
70
+ Var ::Type Var ::type () const {
71
71
return type_;
72
72
}
73
73
74
- std::string Arg ::type_name () const {
74
+ std::string Var ::type_name () const {
75
75
switch (type_) {
76
76
case Type::kITensor :
77
77
return " nvinfer1::ITensor" ;
@@ -85,41 +85,41 @@ std::string Arg::type_name() const {
85
85
}
86
86
}
87
87
88
- const torch::jit::IValue* Arg ::IValue () const {
89
- TRTORCH_CHECK (isIValue (), " Requested IValue from Arg , however arg type is " << type_name ());
88
+ const torch::jit::IValue* Var ::IValue () const {
89
+ TRTORCH_CHECK (isIValue (), " Requested IValue from Var , however Var type is " << type_name ());
90
90
if (type_ == Type::kIValue ) {
91
91
return ptr_.ivalue ;
92
92
} else {
93
93
return nullptr ;
94
94
}
95
95
}
96
96
97
- nvinfer1::ITensor* Arg ::ITensor () const {
98
- TRTORCH_CHECK (isITensor (), " Requested ITensor from Arg , however arg type is " << type_name ());
97
+ nvinfer1::ITensor* Var ::ITensor () const {
98
+ TRTORCH_CHECK (isITensor (), " Requested ITensor from Var , however Var type is " << type_name ());
99
99
if (type_ == Type::kITensor ) {
100
100
return ptr_.tensor ;
101
101
} else {
102
102
return nullptr ;
103
103
}
104
104
}
105
105
106
- bool Arg ::isITensor () const {
106
+ bool Var ::isITensor () const {
107
107
if (type_ == Type::kITensor ) {
108
108
return true ;
109
109
} else {
110
110
return false ;
111
111
}
112
112
}
113
113
114
- bool Arg ::isIValue () const {
114
+ bool Var ::isIValue () const {
115
115
if (type_ == Type::kIValue ) {
116
116
return true ;
117
117
} else {
118
118
return false ;
119
119
}
120
120
}
121
121
122
- bool Arg ::isNone () const {
122
+ bool Var ::isNone () const {
123
123
if (type_ == Type::kNone ) {
124
124
return true ;
125
125
} else {
0 commit comments