Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
zrr1999 committed Aug 1, 2024
1 parent 88561be commit f4200a6
Showing 1 changed file with 14 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,6 @@ def dispatch_reversed(var: ContainerVariable):
),
)

# bool
Dispatcher.register(
bool,
("ContainerVariable | SymbolicVariable",),
lambda var: var.bool(),
)
Dispatcher.register(
operator.truth,
("ConstantVariable | SymbolicVariable",),
lambda var: var.bool(),
)

# str
Dispatcher.register(
str,
Expand Down Expand Up @@ -981,16 +969,20 @@ def tensor_mod_dispatcher(
),
)
# Symbolic
Dispatcher.register(
float,
("SymbolicVariable",),
lambda var: var.float(),
)
Dispatcher.register(
int,
("SymbolicVariable",),
lambda var: var.int(),
)
for unary_fn in fallback_tensor_unary_method:
Dispatcher.register(
unary_fn,
("SymbolicVariable",),
partial(
lambda fn, var: VariableFactory.from_value(
fn(var.get_py_value()),
var.graph,
tracker=DummyTracker([var]),
),
unary_fn,
),
)

for binary_fn in BINARY_OPS:
for magic_method in magic_method_builtin_dispatch(binary_fn):
if magic_method.name not in get_tensor_methods():
Expand Down

0 comments on commit f4200a6

Please sign in to comment.