10
10
#include " c10/util/intrusive_ptr.h"
11
11
#include " core/conversion/tensorcontainer/TensorContainer.h"
12
12
13
- namespace trtorch {
13
+ namespace torch_tensorrt {
14
14
namespace core {
15
15
namespace conversion {
16
16
@@ -24,7 +24,7 @@ bool OpSupported(const torch::jit::Node* n) {
24
24
c10::optional<torch::jit::IValue> EvaluateNode (ConversionCtx* ctx, const torch::jit::Node* n, int level, int limit) {
25
25
// Check to see if you can just go through and eval all of these AOT (saves
26
26
// the recursion) Also probably a better way to deal with the two error cases;
27
- TRTORCH_CHECK (
27
+ TORCHTRT_CHECK (
28
28
level < limit,
29
29
" Failed to evaluate node: " << *n << " Reason: Exceeded evaluation stack limit (limit=" << limit << " )" );
30
30
@@ -56,7 +56,7 @@ c10::optional<torch::jit::IValue> EvaluateNode(ConversionCtx* ctx, const torch::
56
56
}
57
57
}
58
58
} else {
59
- TRTORCH_THROW_ERROR (
59
+ TORCHTRT_THROW_ERROR (
60
60
" Failed to evaluate node: " << *n << " Reason: Node inputs cannot be evaluated at conversion time\n "
61
61
<< " File a bug: https://www.github.com/NVIDIA/TRTorch/issues" );
62
62
return {};
@@ -101,28 +101,28 @@ void AddLayer(ConversionCtx* ctx, const torch::jit::Node* n) {
101
101
}
102
102
} else {
103
103
// Node input has not been converted yet or is a prim op
104
- TRTORCH_THROW_ERROR (
104
+ TORCHTRT_THROW_ERROR (
105
105
" Unable to retrieve all node inputs for node: "
106
106
<< util::node_info (n) << " (ctx.AddLayer)\n Specifically failed to retrieve value for input: " << *input_node);
107
107
}
108
108
}
109
109
110
110
if (n->inputs ().size () != node_args.size ()) {
111
- TRTORCH_THROW_ERROR (" Unable to retrieve all node inputs for node: " << *n);
111
+ TORCHTRT_THROW_ERROR (" Unable to retrieve all node inputs for node: " << *n);
112
112
}
113
113
114
114
auto schema = n->maybeSchema ();
115
- TRTORCH_CHECK (schema, " Unable to get schema for Node " << util::node_info (n) << " (conversion.AddLayer)" );
115
+ TORCHTRT_CHECK (schema, " Unable to get schema for Node " << util::node_info (n) << " (conversion.AddLayer)" );
116
116
117
117
auto converter = converters::get_node_converter_for (schema);
118
- TRTORCH_CHECK (
118
+ TORCHTRT_CHECK (
119
119
converter,
120
120
" Unable to convert node: "
121
121
<< util::node_info (n) << " (conversion.AddLayer)\n Schema: " << *schema << " \n Converter for " << schema->name ()
122
122
<< " requested, but no such converter was found.\n If you need a converter for this operator, you can try implementing one yourself\n "
123
123
<< " or request a converter: https://www.github.com/NVIDIA/TRTorch/issues" );
124
124
125
- TRTORCH_CHECK (
125
+ TORCHTRT_CHECK (
126
126
converter (ctx, n, node_args),
127
127
" Converter for " << *schema << " failed to convert node: " << util::node_info (n)
128
128
<< " please report this error to https://www.github.com/NVIDIA/TRTorch/issues" );
@@ -158,7 +158,7 @@ void AddInputs(
158
158
159
159
for (auto input : input_tensors) {
160
160
const torch::jit::Value* in = input;
161
- TRTORCH_CHECK (
161
+ TORCHTRT_CHECK (
162
162
input_specs.find (in) != input_specs.end (),
163
163
" Cannot find an input spec associated with input: " << in->debugName ());
164
164
ir::Input& spec = input_specs.find (in)->second ;
@@ -170,7 +170,7 @@ void AddInputs(
170
170
<< " in engine (conversion.AddInputs)" );
171
171
172
172
auto trt_in = ctx->net ->addInput (name.c_str (), spec.dtype , spec.input_shape );
173
- TRTORCH_CHECK (trt_in, " Failed to add input node: " << in->debugName () << " (conversion.AddInputs)" );
173
+ TORCHTRT_CHECK (trt_in, " Failed to add input node: " << in->debugName () << " (conversion.AddInputs)" );
174
174
trt_in->setAllowedFormats (1U << static_cast <int >(spec.format ));
175
175
176
176
profile->setDimensions (trt_in->getName (), nvinfer1::OptProfileSelector::kMIN , spec.min );
@@ -185,7 +185,7 @@ void AddInputs(
185
185
ctx->num_inputs += 1 ;
186
186
}
187
187
188
- TRTORCH_CHECK (
188
+ TORCHTRT_CHECK (
189
189
profile->isValid (),
190
190
" Optimization profile is invalid, please check the input range provided (conversion.AddInputs)" );
191
191
@@ -213,7 +213,7 @@ void MarkOutputs(ConversionCtx* ctx, at::ArrayRef<const torch::jit::Value*> outp
213
213
ctx->logger , " Marking Output " << out->debugName () << " named " << name << " in engine (ctx.MarkOutput)" );
214
214
ctx->num_outputs += 1 ;
215
215
} else {
216
- TRTORCH_THROW_ERROR (" Unknown output type. Only a single tensor or a TensorList type is supported." );
216
+ TORCHTRT_THROW_ERROR (" Unknown output type. Only a single tensor or a TensorList type is supported." );
217
217
}
218
218
}
219
219
} else {
@@ -258,7 +258,7 @@ void MapIValues(
258
258
auto input = ctx->value_tensor_map [p.first ];
259
259
ctx->value_tensor_map [p.second ] = input;
260
260
} else {
261
- TRTORCH_THROW_ERROR (
261
+ TORCHTRT_THROW_ERROR (
262
262
" Cannot find Value " << p.first ->debugName () << " either evaluated values or tensor maps (MapIValues)" );
263
263
}
264
264
}
@@ -271,7 +271,7 @@ void EvaluateConditionalBlock(ConversionCtx* ctx, const torch::jit::Node* n, boo
271
271
output_type_includes_tensor = true ;
272
272
}
273
273
}
274
- TRTORCH_CHECK (
274
+ TORCHTRT_CHECK (
275
275
!(contained_in_loop && output_type_includes_tensor),
276
276
" TRTorch currently cannot compile conditionals within loops" );
277
277
@@ -301,7 +301,7 @@ void EvaluateConditionalBlock(ConversionCtx* ctx, const torch::jit::Node* n, boo
301
301
} else if (converters::node_is_convertable (bn)) {
302
302
AddLayer (ctx, bn);
303
303
} else {
304
- TRTORCH_THROW_ERROR (
304
+ TORCHTRT_THROW_ERROR (
305
305
" TRTorch is unable to compile this conditional, a converter or evaluator is not available for node " << *bn);
306
306
}
307
307
}
@@ -332,7 +332,7 @@ void EvaluateLoopBlock(ConversionCtx* ctx, const torch::jit::Node* n) {
332
332
} else if (bn->kind () == torch::jit::prim::If) {
333
333
EvaluateConditionalBlock (ctx, bn, true );
334
334
} else {
335
- TRTORCH_CHECK (
335
+ TORCHTRT_CHECK (
336
336
evaluators::shouldEvalAtConversionTime (bn),
337
337
" TRTorch currently can only compile loops that are evaluatable at conversion time but node "
338
338
<< *bn << " cannot be evaluated." );
@@ -383,7 +383,7 @@ void ConvertBlockToNetDef(
383
383
if (n->outputs ().size () > 1 ) { // For ListUnpack scenario
384
384
if (eval.value ().isTuple ()) {
385
385
auto eval_list = eval.value ().toTuple ();
386
- TRTORCH_CHECK (
386
+ TORCHTRT_CHECK (
387
387
eval_list->elements ().size () == n->outputs ().size (),
388
388
" Size of evaluated results: " << eval_list->elements ().size ()
389
389
<< " and node outputs size: " << n->outputs ().size () << " must match." );
@@ -395,7 +395,7 @@ void ConvertBlockToNetDef(
395
395
ctx->AssociateValueAndIValue (n->output (i), eval_output);
396
396
}
397
397
} else {
398
- TRTORCH_THROW_ERROR (" Unsupported return type for evaluated node" );
398
+ TORCHTRT_THROW_ERROR (" Unsupported return type for evaluated node" );
399
399
}
400
400
} else if (eval.value ().isCustomClass ()) {
401
401
auto container = eval.value ().toCustomClass <TensorContainer>();
@@ -452,7 +452,7 @@ std::unordered_map<c10::OperatorName, std::string> GetUnsupportedOpsInBlock(cons
452
452
for (const auto n : b->nodes ()) {
453
453
if (n->kind () != torch::jit::prim::Loop && n->kind () != torch::jit::prim::If && !OpSupported (n)) {
454
454
auto schema = n->maybeSchema ();
455
- TRTORCH_CHECK (
455
+ TORCHTRT_CHECK (
456
456
schema,
457
457
" Unable to get schema for Node " << util::node_info (n) << " (conversion.VerifyCoverterSupportForBlock)" );
458
458
std::stringstream ss;
@@ -480,7 +480,7 @@ std::set<std::string> ConvertableOpsInBlock(const torch::jit::Block* b) {
480
480
}
481
481
if (converters::node_is_convertable (n)) {
482
482
auto schema = n->maybeSchema ();
483
- TRTORCH_CHECK (
483
+ TORCHTRT_CHECK (
484
484
schema, " Unable to get schema for Node " << util::node_info (n) << " (conversion.CheckForConvertableOps)" );
485
485
std::stringstream ss;
486
486
ss << *schema;
@@ -518,7 +518,7 @@ bool VerifyConverterSupportForBlock(const torch::jit::Block* b, bool suppress_er
518
518
if (suppress_errors) {
519
519
LOG_ERROR (
520
520
" Unsupported operator: " << *schema << std::endl
521
- << trtorch ::core::util::GetPyTorchSourceCode (n) << std::endl);
521
+ << torch_tensorrt ::core::util::GetPyTorchSourceCode (n) << std::endl);
522
522
}
523
523
}
524
524
}
@@ -548,4 +548,4 @@ bool VerifyConverterSupportForBlock(const torch::jit::Block* b, bool suppress_er
548
548
549
549
} // namespace conversion
550
550
} // namespace core
551
- } // namespace trtorch
551
+ } // namespace torch_tensorrt
0 commit comments