Skip to content

Commit 2dc7dc4

Browse files
mserturkfacebook-github-bot
authored andcommitted
name xpress variables and constraints
Summary: We are adding explicit variable and constraint names to the xpress model formulation. This helps us achieve two objectives: 1. Make the problem formulation human readable (at least somewhat!) when we export it 2. Problem formulation becomes deterministic which enables us to hash it which can be used to cache the results Reviewed By: micrain Differential Revision: D72754854 fbshipit-source-id: 4bd085239f11e80f1cf477cb7b873ce4958f55c1
1 parent 787e711 commit 2dc7dc4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

torchrec/distributed/planner/types.py

+12
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,18 @@ class ShardInfo:
362362
_index_in_shards: int
363363
_index_in_search_space: int
364364

365+
def __hash__(self) -> int:
366+
return hash(
367+
(
368+
self.key,
369+
self.sharding_type,
370+
self.compute_kernel,
371+
self.table_name,
372+
self.shard,
373+
self.module_fqn,
374+
)
375+
)
376+
365377

366378
class ShardingOption:
367379
"""

0 commit comments

Comments
 (0)