You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ImporterContext.hpp
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
2
+
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3
3
*
4
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
5
* copy of this software and associated documentation files (the "Software"),
@@ -48,8 +48,10 @@ class ImporterContext final : public IImporterContext
48
48
mTensorNameCounts; // Keep track of how many times a tensor name shows up, to avoid duplicate naming in TRT.
49
49
StringMap<size_t>
50
50
mLayerNameCounts; // Keep track of how many times a tensor name shows up, to avoid duplicate naming in TRT.
51
-
std::unordered_set<std::string> mUnsupportedShapeTensors; // Container to hold any shape tensors that are the output of layers that do not support shape tensors.
51
+
std::unordered_set<std::string> mUnsupportedShapeTensors; // Container to hold output tensor names of layers that produce shape tensor outputs but do not natively support them.
52
52
StringMap<std::string> mLoopTensors; // Container to map subgraph tensors to their original outer graph names.
53
+
std::string mOnnxFileLocation; // Keep track of the directory of the parsed ONNX file
// Set type only if necessary, to avoid TensorRT warnings
452
477
// about setting type of non-input/output tensors.
453
-
if (t.getType() != SHAPE_TENSOR_TYPE)
478
+
if (t.getType() != shapeTensorType)
454
479
{
455
-
t.setType(SHAPE_TENSOR_TYPE);
480
+
t.setType(shapeTensorType);
456
481
}
457
482
// Some layers do not support shape tensor outputs. Keep track of these tensor names
458
483
// for supportsModel().
459
484
auto type = layer->getType();
460
-
auto elementwiseOp = layer->getType() == nvinfer1::LayerType::kELEMENTWISE ? (static_cast<nvinfer1::IElementWiseLayer*>(layer))->getOperation() : nvinfer1::ElementWiseOperation::kSUM;
461
-
auto reduceOp = layer->getType() == nvinfer1::LayerType::kREDUCE ? (static_cast<nvinfer1::IReduceLayer*>(layer))->getOperation() : nvinfer1::ReduceOperation::kSUM;
462
-
485
+
auto elementwiseOp = type == nvinfer1::LayerType::kELEMENTWISE ? (static_cast<nvinfer1::IElementWiseLayer*>(layer))->getOperation() : nvinfer1::ElementWiseOperation::kSUM;
486
+
auto reduceOp = type == nvinfer1::LayerType::kREDUCE ? (static_cast<nvinfer1::IReduceLayer*>(layer))->getOperation() : nvinfer1::ReduceOperation::kSUM;
463
487
if (!supportsShapeTensor(type, elementwiseOp, reduceOp))
464
488
{
465
-
auto name = layer->getOutput(0)->getName();
489
+
auto name = layer->getName();
466
490
ctx->unsupportedShapeTensors().insert(name);
467
-
LOG_ERROR("Found " << name << " as a shapetensor output from a layer that does not support it!");
0 commit comments