Skip to content

Commit

Permalink
Update torch floor divide ops
Browse files Browse the repository at this point in the history
Summary: Using `//` for torch floor divide is deprecated (and prints an annoying warning). There were 2 instances of this in replicated.py. This diff removes them.

Reviewed By: yuansen23

Differential Revision: D35188089

fbshipit-source-id: e897a42345ab2292fa66c424106badf441e58f95
  • Loading branch information
knottb authored and facebook-github-bot committed Mar 29, 2022
1 parent a6f2ef9 commit cdb20f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypten/mpc/primitives/replicated.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ def truncate(x, y):
rank = x.rank

if rank == 0:
x.share //= y
x.share = x.share.div(y, rounding_mode="trunc")
elif rank == 1:
x2 = comm.get().recv(x.share, 2)
x.share = x.share.add(x2) // y
x.share = x.share.add(x2).div(y, rounding_mode="trunc")
elif rank == 2:
comm.get().send(x.share, 1)
x.share -= x.share
Expand Down

0 comments on commit cdb20f9

Please sign in to comment.