File tree Expand file tree Collapse file tree 1 file changed +19
-13
lines changed
core/conversion/evaluators Expand file tree Collapse file tree 1 file changed +19
-13
lines changed Original file line number Diff line number Diff line change 10
10
#include " core/conversion/evaluators/evaluators.h"
11
11
#include " core/conversion/evaluators/eval_macros.h"
12
12
13
- // #include <csignal>
14
-
15
13
namespace trtorch {
16
14
namespace core {
17
15
namespace conversion {
@@ -247,21 +245,29 @@ auto aten_registrations TRTORCH_UNUSED = RegisterNodeEvaluators()
247
245
})
248
246
}).evaluator({
249
247
c10::Symbol::fromQualString (" aten::add_" ),
250
- [](const torch::jit::Node* n, kwargs& args) -> c10::optional<torch::jit::IValue> {
251
- LOG_DEBUG (" aten::add_ evaluator is found" );
248
+ [](const torch::jit::Node* n, kwargs& args) -> c10::optional<torch::jit::IValue> {
249
+ if (args.at (n->input (0 )).IValue ()->isList ()) {
250
+ auto a = args.at (n->input (0 )).IValue ()->toListRef ();
251
+ auto b = args.at (n->input (1 )).IValue ()->toListRef ();
252
252
253
- // std::raise(SIGINT);
253
+ c10::ListTypePtr lt = n->output ()->type ()->expect <c10::ListType>();
254
+ c10::TypePtr elementType = lt->getElementType ();
254
255
255
- if (args.at (n->input (0 )).IValue ()->isList ()) {
256
- auto a = args.at (n->input (0 )).IValue ()->to <c10::List<c10::IValue>>();
257
- auto b = args.at (n->input (1 )).IValue ()->to <c10::List<c10::IValue>>();
256
+ auto merged = c10::impl::GenericList (elementType);
257
+ merged.reserve (a.size () + b.size ());
258
258
259
- // incorrect syntax
260
- // for (auto each : b) {
261
- // a.push_back(each);
262
- // }
259
+ for (auto each : a) {
260
+ merged.emplace_back (each);
261
+ }
263
262
264
- return a;
263
+ for (auto each : b) {
264
+ merged.emplace_back (each);
265
+ }
266
+
267
+ return merged;
268
+ } else {
269
+ TRTORCH_THROW_ERROR (" Unimplemented data type for aten::add_ evaluator: " << args.at (n->input (0 )).IValue ()->type ()->str ());
270
+ return {};
265
271
}
266
272
},
267
273
EvalOptions ().validSchemas ({
You can’t perform that action at this time.
0 commit comments