Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
feifei-111 committed Jul 17, 2023
1 parent 5a70e68 commit 2e7c5c6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions sot/opcode_translator/executor/variable_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,25 @@
)

# isinstance
Dispatcher.register(
isinstance,
("TensorVariable", "VariableBase"),
{},
lambda left, right: ConstantVariable.wrap_literal(
isinstance(paddle.to_tensor(0), right.get_py_value(allow_tensor=True)),
left.graph,
),
)

Dispatcher.register(
isinstance,
("VariableBase", "VariableBase"),
{},
lambda left, right: ConstantVariable.wrap_literal(
left.get_py_type() == right.get_py_value()
or left.get_py_type() in right.get_py_value(),
isinstance(
left.get_py_value(allow_tensor=True),
right.get_py_value(allow_tensor=True),
),
left.graph,
),
)
Expand Down

0 comments on commit 2e7c5c6

Please sign in to comment.