MCPcopy
hub / github.com/NVIDIA/TensorRT-LLM / is_dynamic

Method is_dynamic

tensorrt_llm/functional.py:528–544  ·  view source on GitHub ↗

If the argument 'dim' is None, that function returns a boolean that indicates if the tensor contains a dynamic dimension (True) or not (False). In that case, the first dimension is excluded (as it usually corresponds to the batch size). If the argument is an integer

(self, dim=None)

Source from the content-addressed store, hash-verified

526 return repeat(self, sizes)
527
528 def is_dynamic(self, dim=None):
529 '''
530 If the argument 'dim' is None, that function returns a boolean that
531 indicates if the tensor contains a dynamic dimension (True) or not
532 (False). In that case, the first dimension is excluded (as it usually
533 corresponds to the batch size). If the argument is an integer, that
534 functions returns a boolean that indicates if the dimension 'dim' is
535 dynamic (True) or not (False).
536 '''
537 if dim is not None:
538 return self.trt_tensor.shape[dim] == -1
539
540 for i, s in enumerate(self.trt_tensor.shape):
541 if i != 0 and s == -1:
542 return True
543
544 return False
545
546 # graph writer related functions
547

Callers 13

flipFunction · 0.80
interpolateFunction · 0.80
group_normFunction · 0.80
avg_pool2dFunction · 0.80
conv_transpose2dFunction · 0.80
splitFunction · 0.80
chunkFunction · 0.80
forwardMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected