@@ -235,4 +235,85 @@ TEST(Evaluators, FloorFloatIntEvaluatesCorrectly) {
235235 auto trt_results = trtorch::tests::util::EvaluateGraph (g->block (), {});
236236
237237 ASSERT_TRUE (jit_results[0 ] == trt_results[0 ]);
238+ }
239+
240+ TEST (Evaluators, ATenAppendWithITensorEvaluatesCorrectly) {
241+ const auto graph = R"IR(
242+ graph(%0 : Tensor, %1 : Tensor):
243+ %2 : int = prim::Constant[value=0]()
244+ %3 : Tensor[] = prim::ListConstruct(%0)
245+ %4 : Tensor[] = aten::append(%3, %1)
246+ %5 : Tensor = aten::cat(%4, %2)
247+ return (%5))IR" ;
248+
249+ auto g = std::make_shared<torch::jit::Graph>();
250+ torch::jit::parseIR (graph, &*g);
251+
252+ auto in0 = at::randint (1 , 10 , {3 , 3 }, {at::kCUDA });
253+ auto in1 = at::randint (1 , 10 , {3 , 3 }, {at::kCUDA });
254+
255+ auto params = trtorch::core::conversion::get_named_params (g->inputs (), {});
256+ auto jit_results = trtorch::tests::util::RunGraph (g, params, {in0, in1});
257+
258+ params = trtorch::core::conversion::get_named_params (g->inputs (), {});
259+ auto trt_results = trtorch::tests::util::RunGraphEngine (g, params, {in0, in1});
260+
261+ ASSERT_TRUE (trtorch::tests::util::almostEqual (jit_results[0 ], trt_results[0 ].reshape_as (jit_results[0 ]), 2e-6 ));
262+ }
263+
264+ TEST (Evaluators, ATenAppendWithTensorEvaluatesCorrectly) {
265+ const auto graph = R"IR(
266+ graph(%0 : Tensor):
267+ %1 : int[] = prim::Constant[value=[3,3]]()
268+ %2 : None = prim::Constant() # :0:0
269+ %20 : Device = prim::Constant[value="cuda"]()
270+ %3 : Tensor = aten::zeros(%1, %2, %2, %20, %2)
271+ %4 : Tensor = aten::zeros(%1, %2, %2, %20, %2)
272+ %5 : int = prim::Constant[value=0]()
273+ %15 : int = prim::Constant[value=1]()
274+ %6 : Tensor[] = prim::ListConstruct(%3)
275+ %7 : Tensor[] = aten::append(%6, %4)
276+ %8 : Tensor = aten::cat(%7, %5)
277+ %9 : Tensor = aten::add(%8, %0, %15)
278+ return (%9))IR" ;
279+
280+ auto g = std::make_shared<torch::jit::Graph>();
281+ torch::jit::parseIR (graph, &*g);
282+
283+ auto in0 = at::randint (1 , 10 , {6 , 3 }, {at::kCUDA });
284+
285+ auto params = trtorch::core::conversion::get_named_params (g->inputs (), {});
286+ auto jit_results = trtorch::tests::util::RunGraph (g, params, {in0});
287+
288+ params = trtorch::core::conversion::get_named_params (g->inputs (), {});
289+ auto trt_results = trtorch::tests::util::RunGraphEngine (g, params, {in0});
290+
291+ ASSERT_TRUE (trtorch::tests::util::almostEqual (jit_results[0 ], trt_results[0 ].reshape_as (jit_results[0 ]), 2e-6 ));
292+ }
293+
294+ TEST (Evaluators, ATenAppendWithITensorAndTensorEvaluatesCorrectly) {
295+ const auto graph = R"IR(
296+ graph(%0 : Tensor):
297+ %1 : int[] = aten::size(%0)
298+ %2 : None = prim::Constant() # :0:0
299+ %20 : Device = prim::Constant[value="cuda"]()
300+ %3 : Tensor = aten::zeros(%1, %2, %2, %20, %2)
301+ %4 : int = prim::Constant[value=0]()
302+ %5 : Tensor[] = prim::ListConstruct(%0)
303+ %6 : Tensor[] = aten::append(%5, %3)
304+ %7 : Tensor = aten::cat(%6, %4)
305+ return (%7))IR" ;
306+
307+ auto g = std::make_shared<torch::jit::Graph>();
308+ torch::jit::parseIR (graph, &*g);
309+
310+ auto in0 = at::randint (1 , 10 , {3 , 3 }, {at::kCUDA });
311+
312+ auto params = trtorch::core::conversion::get_named_params (g->inputs (), {});
313+ auto jit_results = trtorch::tests::util::RunGraph (g, params, {in0});
314+
315+ params = trtorch::core::conversion::get_named_params (g->inputs (), {});
316+ auto trt_results = trtorch::tests::util::RunGraphEngine (g, params, {in0});
317+
318+ ASSERT_TRUE (trtorch::tests::util::almostEqual (jit_results[0 ], trt_results[0 ].reshape_as (jit_results[0 ]), 2e-6 ));
238319}
0 commit comments