Skip to content

Commit cf69aad

Browse files
authored
Merge pull request #395 from VectorInstitute/dbe/fixing_typing_annotation_in_functions
Fixing typing annotation in Bernoulli sample
2 parents 52d50e7 + 4f25c07 commit cf69aad

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fl4health/utils/functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class BernoulliSample(torch.autograd.Function):
1919
"""
2020

2121
@staticmethod
22-
def forward(bernoulli_probs: torch.Tensor) -> torch.Tensor: # type: ignore
22+
def forward(bernoulli_probs: torch.Tensor) -> torch.Tensor:
2323
return torch.bernoulli(input=bernoulli_probs)
2424

2525
@staticmethod
@@ -33,7 +33,7 @@ def setup_context(ctx: Any, inputs: tuple[torch.Tensor], output: torch.Tensor) -
3333
# This method determines the "gradient" of the BernoulliSample function.
3434
# grad_output is supposed to be the gradient w.r.t. the output of the forward method.
3535
@staticmethod
36-
def backward(ctx: torch.Any, grad_output: torch.Tensor) -> torch.Tensor: # type: ignore
36+
def backward(ctx: Any, grad_output: torch.Tensor) -> torch.Tensor: # type: ignore
3737
# ctx.saved_tensors is a tuple (of length 1 in this case). Hence the indexing here.
3838
bernoulli_probs = ctx.saved_tensors[0]
3939
return bernoulli_probs * grad_output

0 commit comments

Comments
 (0)