Skip to content
Open
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
2 changes: 2 additions & 0 deletions memory_saving_gradients.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ def gradients(ys, xs, grad_ys=None, checkpoints='collection', **kwargs):
fwd_ops = [op for op in fwd_ops if not '/assign' in op.name]
fwd_ops = [op for op in fwd_ops if not '/Assign' in op.name]
fwd_ops = [op for op in fwd_ops if not '/read' in op.name]
fwd_ops = [op for op in fwd_ops if not '/Read' in op.name]
ts_all = ge.filter_ts(fwd_ops, True) # get the tensors
ts_all = [t for t in ts_all if '/read' not in t.name]
ts_all = [t for t in ts_all if '/Read' not in t.name]
ts_all = set(ts_all) - set(xs) - set(ys)

# construct list of tensors to checkpoint during forward pass, if not
Expand Down