Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
fairscale
Commits
a5116ecd
You need to sign in or sign up before continuing.
Unverified
Commit
a5116ecd
authored
Jun 28, 2022
by
Crutcher Dunnavant
Committed by
GitHub
Jun 28, 2022
Browse files
Workhandle as dataclass (#1008)
parent
96fcc1ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
fairscale/internal/params.py
fairscale/internal/params.py
+4
-3
No files found.
fairscale/internal/params.py
View file @
a5116ecd
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
# LICENSE file in the root directory of this source tree.
# LICENSE file in the root directory of this source tree.
import
collections.abc
as
abc
import
collections.abc
as
abc
from
dataclasses
import
dataclass
from
math
import
inf
from
math
import
inf
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
from
typing
import
Any
,
Callable
,
Dict
,
List
,
Optional
...
@@ -11,10 +12,10 @@ import torch
...
@@ -11,10 +12,10 @@ import torch
import
torch.distributed
as
dist
import
torch.distributed
as
dist
@
dataclass
class
Workhandle
:
class
Workhandle
:
def
__init__
(
self
,
handle
:
Any
,
callback
:
Optional
[
Callable
])
->
None
:
handle
:
Any
self
.
handle
=
handle
callback
:
Optional
[
Callable
]
=
None
self
.
callback
=
callback
def
get_global_rank
(
group
:
Any
,
rank
:
int
)
->
int
:
def
get_global_rank
(
group
:
Any
,
rank
:
int
)
->
int
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment