Skip to content

Commit

Permalink
force evaluated shape to int
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Jan 15, 2025
1 parent c9b45ee commit aad9aaf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion optimum/onnxruntime/modeling_ort.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ def _output_shape_inference(self, axis_name: Union[str, int], dimensions: Dict[s
if token in dimensions:
tokens[idx] = str(dimensions[token])

return eval(" ".join(tokens))
return int(eval(" ".join(tokens)))

# TODO: this method is bloated with state arguments (that are accesible using self) why ?
def _prepare_io_binding(
Expand Down Expand Up @@ -859,6 +859,7 @@ def _prepare_io_binding(
output_shape = []
for axis_name in output_node.shape:
output_shape.append(self._output_shape_inference(axis_name, dimensions))

output_buffer = self._prepare_output_buffer(model, output_shape, output_name)

io_binding.bind_output(
Expand Down

0 comments on commit aad9aaf

Please sign in to comment.