Skip to content

Commit 3426069

Browse files
authored
[SOT] Use full instead of to_tensor for symbolic input conversion (#67921)
1 parent 3079387 commit 3426069

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

python/paddle/jit/sot/opcode_translator/executor/function_graph.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,13 +761,18 @@ def gen_load_inputs(
761761
self, inputs: OrderedSet[TensorVariable | SymbolicVariable]
762762
):
763763
for input_var in inputs:
764+
# For SymbolicVariable, we use paddle.full([], value, "int64")
765+
# to convert it to a Tensor
764766
if isinstance(input_var, SymbolicVariable):
765767
self.pycode_gen.gen_load_object(
766-
paddle.to_tensor, "___paddle_to_tensor"
768+
paddle.full,
769+
"___paddle_full",
767770
)
771+
self.pycode_gen.gen_build_list(0)
768772
input_var.tracker.gen_instructions(self.pycode_gen)
769773
if isinstance(input_var, SymbolicVariable):
770-
self.pycode_gen.gen_call_function(1)
774+
self.pycode_gen.gen_load_const("int64")
775+
self.pycode_gen.gen_call_function(3)
771776

772777
def _find_tensor_outputs(
773778
self, outputs: list[VariableBase]

0 commit comments

Comments
 (0)