Skip to content

Commit

Permalink
Workhandle as dataclass (#1008)
Browse files Browse the repository at this point in the history
  • Loading branch information
crutcher committed Jun 29, 2022
1 parent 96fcc1c commit a5116ec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fairscale/internal/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
# LICENSE file in the root directory of this source tree.

import collections.abc as abc
from dataclasses import dataclass
from math import inf
from typing import Any, Callable, Dict, List, Optional

import torch
import torch.distributed as dist


@dataclass
class Workhandle:
def __init__(self, handle: Any, callback: Optional[Callable]) -> None:
self.handle = handle
self.callback = callback
handle: Any
callback: Optional[Callable] = None


def get_global_rank(group: Any, rank: int) -> int:
Expand Down

0 comments on commit a5116ec

Please sign in to comment.