@@ -31,7 +31,7 @@ TEST(TensorPool, BasicTest) {
31
31
Type ty (ElemKind::FloatTy, {1 , 2 , 3 });
32
32
pool.reserve (&ty, 1 );
33
33
34
- Tensor T = std::move (pool.get (&ty).getValue ());
34
+ Tensor T = std::move (pool.get (&ty).value ());
35
35
EXPECT_TRUE (T.getType ().isEqual (ty));
36
36
EXPECT_EQ (T.dims (), ty.dims ());
37
37
@@ -52,12 +52,12 @@ TEST(TensorPool, ReclaimAndGet) {
52
52
Type ty (ElemKind::FloatTy, {1 , 2 , 3 });
53
53
pool.reserve (&ty, 1 );
54
54
55
- Tensor T = std::move (pool.get (&ty).getValue ());
55
+ Tensor T = std::move (pool.get (&ty).value ());
56
56
auto *backingPtr = T.getUnsafePtr ();
57
57
58
58
pool.reclaim (std::move (T));
59
59
60
- Tensor T2 = std::move (pool.get (&ty).getValue ());
60
+ Tensor T2 = std::move (pool.get (&ty).value ());
61
61
// They are the same buffer.
62
62
EXPECT_EQ (T2.getUnsafePtr (), backingPtr);
63
63
@@ -78,8 +78,8 @@ TEST(TensorPool, Extends) {
78
78
Type ty (ElemKind::FloatTy, {1 , 2 , 3 });
79
79
pool.reserve (&ty, 1 );
80
80
81
- Tensor T = std::move (pool.get (&ty).getValue ());
82
- Tensor T2 = std::move (pool.get (&ty).getValue ());
81
+ Tensor T = std::move (pool.get (&ty).value ());
82
+ Tensor T2 = std::move (pool.get (&ty).value ());
83
83
EXPECT_TRUE (T.getType ().isEqual (T2.getType ()));
84
84
EXPECT_TRUE (T.getType ().isEqual (ty));
85
85
EXPECT_TRUE (T2.getType ().isEqual (ty));
@@ -105,15 +105,15 @@ TEST(TensorPool, DoesntExtend) {
105
105
Type ty (ElemKind::FloatTy, {1 , 2 , 3 });
106
106
pool.reserve (&ty, 1 );
107
107
108
- Tensor T = std::move (pool.get (&ty).getValue ());
108
+ Tensor T = std::move (pool.get (&ty).value ());
109
109
Type Tt = T.getType ();
110
110
111
111
auto T2opt = pool.get (&ty);
112
- EXPECT_FALSE (T2opt.hasValue ());
112
+ EXPECT_FALSE (T2opt.has_value ());
113
113
114
114
pool.reclaim (std::move (T));
115
115
116
- T = std::move (pool.get (&ty).getValue ());
116
+ T = std::move (pool.get (&ty).value ());
117
117
EXPECT_EQ (Tt, T.getType ());
118
118
119
119
const auto &stats = pool.getStats ();
@@ -132,8 +132,8 @@ TEST(TensorPool, Noreserve) {
132
132
TensorPool pool;
133
133
Type ty (ElemKind::FloatTy, {1 , 2 , 3 });
134
134
135
- Tensor T = std::move (pool.get (&ty).getValue ());
136
- Tensor T2 = std::move (pool.get (&ty).getValue ());
135
+ Tensor T = std::move (pool.get (&ty).value ());
136
+ Tensor T2 = std::move (pool.get (&ty).value ());
137
137
138
138
EXPECT_TRUE (T.getType ().isEqual (T2.getType ()));
139
139
@@ -162,8 +162,8 @@ TEST(TensorPool, MultipleTypes) {
162
162
std::vector<Tensor> tensors;
163
163
// Ten total allocs.
164
164
for (int i = 0 ; i < 5 ; ++i) {
165
- Tensor T = std::move (pool.get (&ty).getValue ());
166
- Tensor T2 = std::move (pool.get (&ty2).getValue ());
165
+ Tensor T = std::move (pool.get (&ty).value ());
166
+ Tensor T2 = std::move (pool.get (&ty2).value ());
167
167
EXPECT_FALSE (T.getType ().isEqual (T2.getType ()));
168
168
EXPECT_TRUE (T.getType ().isEqual (ty));
169
169
EXPECT_TRUE (T2.getType ().isEqual (ty2));
@@ -200,14 +200,14 @@ TEST(TensorPool, MultipleTypesReclaim) {
200
200
pool.reserve (&ty, 1 );
201
201
pool.reserve (&ty2, 1 );
202
202
203
- Tensor T = std::move (pool.get (&ty).getValue ());
204
- Tensor T2 = std::move (pool.get (&ty2).getValue ());
203
+ Tensor T = std::move (pool.get (&ty).value ());
204
+ Tensor T2 = std::move (pool.get (&ty2).value ());
205
205
206
206
pool.reclaim (std::move (T));
207
207
pool.reclaim (std::move (T2));
208
208
209
- T = std::move (pool.get (&ty).getValue ());
210
- T2 = std::move (pool.get (&ty2).getValue ());
209
+ T = std::move (pool.get (&ty).value ());
210
+ T2 = std::move (pool.get (&ty2).value ());
211
211
212
212
pool.reclaim (std::move (T));
213
213
pool.reclaim (std::move (T2));
@@ -231,7 +231,7 @@ TEST(TensorPool, PlaceholderBindingsReclaim) {
231
231
Module mod;
232
232
233
233
auto *PH = mod.createPlaceholder (&ty, " test" , false );
234
- bindings.insert (PH, std::move (pool.get (&ty).getValue ()));
234
+ bindings.insert (PH, std::move (pool.get (&ty).value ()));
235
235
236
236
// / Insert a non managed tensor.
237
237
auto *PH2 = mod.createPlaceholder (&ty, " test2" , false );
@@ -249,7 +249,7 @@ TEST(TensorPool, PlaceholderBindingsReclaim) {
249
249
EXPECT_EQ (stats.totalGets , 1 );
250
250
EXPECT_EQ (stats.totalReclaims , 1 );
251
251
252
- bindings.insert (PH, std::move (pool.get (&ty).getValue ()));
252
+ bindings.insert (PH, std::move (pool.get (&ty).value ()));
253
253
254
254
bindings.erase (PH);
255
255
const auto &stats2 = pool.getStats ();
@@ -263,7 +263,7 @@ TEST(TensorPool, Clear) {
263
263
TensorPool pool;
264
264
Type ty (ElemKind::FloatTy, {1 , 2 , 3 });
265
265
266
- Tensor T = std::move (pool.get (&ty).getValue ());
266
+ Tensor T = std::move (pool.get (&ty).value ());
267
267
pool.reclaim (std::move (T));
268
268
269
269
const auto &stats = pool.getStats ();
@@ -277,7 +277,7 @@ TEST(TensorPool, Clear) {
277
277
278
278
pool.clear ();
279
279
280
- T = std::move (pool.get (&ty).getValue ());
280
+ T = std::move (pool.get (&ty).value ());
281
281
pool.reclaim (std::move (T));
282
282
283
283
const auto &stats2 = pool.getStats ();
0 commit comments