Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducing the weight of NumberProxy used in mincut in rematerialization #425

Merged
merged 5 commits into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion thunder/core/rematerialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from thunder.core import prims, utils
from thunder.core.baseutils import BoundSymbolInterface, ProxyInterface
from thunder.core.prims import PrimIDs
from thunder.core.proxies import TensorProxy, variableify
from thunder.core.proxies import TensorProxy, variableify, NumberProxy
from thunder.core.pytree import tree_flatten, tree_unflatten
from thunder.core.symbol import has_tags
from thunder.core.trace import from_trace, TraceCtx, TraceProvenance
Expand Down Expand Up @@ -332,6 +332,8 @@ def add_edge(src, dst, capacity):
def get_weight(var):
if isinstance(var, TensorProxy):
return WEIGHT * var.dtype.bytes
elif isinstance(var, NumberProxy):
return 0.0
return WEIGHT

def add_edges(var):
Expand Down
Loading