File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
py/torch_tensorrt/dynamo/runtime Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ void setup_input_tensors(
141141 at::Tensor contig_input = inputs[i].view (shape).contiguous ();
142142 formatted_inputs.emplace_back (std::move (contig_input));
143143
144- if (need_cudagraphs_record) {
144+ if (need_cudagraphs_record or compiled_engine-> allocated_outputs . size () == 0 ) {
145145 // Create a new persistent input buffer
146146 compiled_engine->input_buffers [i] = std::move (formatted_inputs.back ().clone ());
147147 }
Original file line number Diff line number Diff line change @@ -417,7 +417,9 @@ def setup_input_tensors(
417417 inputs_cpu = contiguous_inputs [i ].cpu ().to (torch .int64 ).numpy ().copy ()
418418 self .context .set_tensor_address (input_name , inputs_cpu .ctypes .data )
419419 else :
420- if need_cudagraphs_record :
420+ if (
421+ need_cudagraphs_record or self .output_tensors is None
422+ ): # First time execution:
421423 self .context .set_input_shape (
422424 input_name , tuple (contiguous_inputs [i ].shape )
423425 )
You can’t perform that action at this time.
0 commit comments