Skip to content

Commit ff87956

Browse files
committed
fix: Fix testcases using old InputRange API
Signed-off-by: Dheeraj Peri <peri.dheeraj@gmail.com>
1 parent da2cbc0 commit ff87956

File tree

4 files changed

+4
-52
lines changed

4 files changed

+4
-52
lines changed

core/compiler.cpp

+1-41
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ GraphAndMapping ConstructFallbackGraph(
261261
if (seg_block.target() == partitioning::SegmentedBlock::kTensorRT) {
262262
std::vector<ir::Input> inputs;
263263
for (auto& shape : seg_block.in_shape()) {
264-
inputs.push_back(ir::InputRange(shape));
264+
inputs.push_back(ir::Input(shape));
265265
}
266266
// update the input ranges for each segments
267267
convert_cfg.inputs = inputs;
@@ -332,46 +332,6 @@ torch::jit::script::Module CompileGraphWithFallback(const torch::jit::script::Mo
332332
return mod;
333333
}
334334

335-
// <<<<<<< HEAD
336-
// =======
337-
// std::unordered_map<torch::jit::Value*, torch::jit::Value*> old_to_new_g;
338-
// // add global graph's input to old_to_new_g mapping
339-
// for (auto input : g->inputs()) {
340-
// util::getOrAddInputForValue(input, new_g, old_to_new_g);
341-
// }
342-
// for (auto& seg_block : segmented_blocks) {
343-
// std::string cur_block_target =
344-
// seg_block.target() == partitioning::SegmentedBlock::kTensorRT ? "TensorRT" : "Torch";
345-
// LOG_INFO(*seg_block.g() << "(Sub Graph" << cur_block_target << "Block)\n");
346-
// std::ostringstream trt_engine_id;
347-
// trt_engine_id << reinterpret_cast<const int*>(&seg_block);
348-
// if (seg_block.target() == partitioning::SegmentedBlock::kTensorRT) {
349-
// std::vector<ir::Input> inputs;
350-
// for (auto& shape : seg_block.in_shape()) {
351-
// inputs.push_back(ir::Input(shape));
352-
// }
353-
// // update the input ranges for each segments
354-
// convert_cfg.inputs = inputs;
355-
// auto engine = conversion::ConvertBlockToEngine(seg_block.block(), convert_cfg, named_params);
356-
// auto temp_g = std::make_shared<torch::jit::Graph>();
357-
// auto device_spec = convert_cfg.engine_settings.device;
358-
// auto cuda_device = runtime::CudaDevice(device_spec.gpu_id, device_spec.device_type);
359-
// AddEngineToGraph(new_mod, temp_g, engine, cuda_device, trt_engine_id.str(), true);
360-
//
361-
// seg_block.update_graph(temp_g);
362-
// AddSegmentedBlockToGraph(new_g, seg_block, old_to_new_g);
363-
// } else {
364-
// AddSegmentedBlockToGraph(new_g, seg_block, old_to_new_g);
365-
// }
366-
// }
367-
//
368-
// for (auto& output : g->outputs()) {
369-
// new_g->registerOutput(old_to_new_g[output]);
370-
// }
371-
//
372-
// LOG_INFO(*new_g << "(FallbackGraph)\n");
373-
//
374-
// >>>>>>> master
375335
auto new_method = new_mod._ivalue()->compilation_unit()->create_function(method.name(), new_g);
376336
auto schema = util::GenerateGraphSchema(new_method->name(), new_g);
377337
new_mod.type()->addMethod(new_method);

tests/core/partitioning/test_conditionals.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ TEST(Partitioning, FallbackOnConditionalsCorrectly) {
3131
return;
3232
}
3333

34-
std::vector<trtorch::core::ir::InputRange> input_ranges{trtorch::core::ir::InputRange({3, 3, 16, 16})};
35-
trtorch::core::CompileSpec cfg(input_ranges);
34+
std::vector<trtorch::core::ir::Input> inputs{trtorch::core::ir::Input({3, 3, 16, 16})};
35+
trtorch::core::CompileSpec cfg(inputs);
3636
cfg.partition_info.enabled = true;
3737
torch::jit::script::Module new_mod = trtorch::core::CompileGraph(mod, cfg);
3838
auto g = new_mod.get_method("forward").graph();

tests/core/partitioning/test_shape_analysis.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ TEST(Partitioning, InferBranchModelSegmentedBlockShapeCorrectly) {
107107
inputs.push_back(trtorch::core::ir::Input({16, 32, 3, 3}));
108108
inputs.push_back(trtorch::core::ir::Input({16}));
109109

110-
std::unordered_map<torch::jit::Value*, trtorch::core::ir::InputRange> inputs_map;
110+
std::unordered_map<torch::jit::Value*, trtorch::core::ir::Input> inputs_map;
111111
for (size_t i = 0; i < g->inputs().size(); ++i) {
112112
inputs_map.insert({g->inputs()[i], inputs[i]});
113113
}

tests/modules/hub.py

-8
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,10 @@
5454
"model": torch.hub.load('pytorch/vision:v0.9.0', 'resnet50', pretrained=True),
5555
"path": "both"
5656
},
57-
"fcn_resnet101": {
58-
"model": torch.hub.load('pytorch/vision:v0.9.0', 'fcn_resnet101', pretrained=True),
59-
"path": "script"
60-
},
6157
"ssd": {
6258
"model": torch.hub.load('NVIDIA/DeepLearningExamples:torchhub', 'nvidia_ssd', model_math="fp32"),
6359
"path": "trace"
6460
},
65-
"faster_rcnn": {
66-
"model": models.detection.fasterrcnn_resnet50_fpn(pretrained=True),
67-
"path": "script"
68-
},
6961
"efficientnet_b0": {
7062
"model": timm.create_model('efficientnet_b0', pretrained=True),
7163
"path": "script"

0 commit comments

Comments
 (0)