We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aa37194 commit 40193dcCopy full SHA for 40193dc
py/torch_tensorrt/dynamo/conversion/converter_utils.py
@@ -505,6 +505,13 @@ def convert_with_type_enforcement(
505
_LOGGER.debug(
506
f"Freezing tensor {name}_constant_{index} to TRT IConstantLayer"
507
)
508
+ # If the candidate is a scalar Numpy array, handle it accordingly
509
+ if isinstance(candidate, np.ndarray) and candidate.shape == ():
510
+ _LOGGER.debug(
511
+ f"Scalar numpy detected at {name}_constant_{index}, adding rank (1,)"
512
+ )
513
+ # Convert the scalar to a 1D array (with a single element)
514
+ candidate = np.expand_dims(candidate, axis=0)
515
new_value = get_trt_tensor(
516
ctx, candidate, name + f"_constant_{index}"
517
0 commit comments