fix: gpu memory leaks

This commit is contained in:
Siwat Sirichai 2025-11-10 22:10:46 +07:00
parent 3a47920186
commit 593611cdb7
13 changed files with 420 additions and 166 deletions

View file

@ -117,9 +117,10 @@ class ModelController:
"""
try:
metadata = self.model_repository.get_metadata(self.model_id)
# Get first input tensor shape
first_input = list(metadata.inputs.values())[0]
batch_dim = first_input["shape"][0]
# Get first input tensor shape (ModelMetadata has input_shapes, not inputs)
first_input_name = metadata.input_names[0]
input_shape = metadata.input_shapes[first_input_name]
batch_dim = input_shape[0]
# batch_dim can be -1 (dynamic), 1 (fixed), or N (fixed batch size)
if batch_dim == -1: