Skip to content

Commit 62f28aa

Browse files
jameschapman19github-actions[bot]
authored andcommitted
Format code with black
1 parent 75c719d commit 62f28aa

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

proxtorch/operators/graphnet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ def prox(self, x: torch.Tensor, tau: float) -> torch.Tensor:
1515

1616
def _smooth(self, x: torch.Tensor) -> torch.Tensor:
1717
# The last channel is the for the l1 norm
18-
grad = self.gradient(x)[:-1]/(1-self.l1_ratio)
18+
grad = self.gradient(x)[:-1] / (1 - self.l1_ratio)
1919
# sum of squares of the gradients
20-
norm = torch.sum(grad ** 2)
20+
norm = torch.sum(grad**2)
2121
return 0.5 * norm * self.alpha * (1 - self.l1_ratio)
2222

2323
def _nonsmooth(self, x: torch.Tensor) -> torch.Tensor:

test/test_graphnet.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
def test_converges_to_sparse_smooth():
77
import matplotlib.pyplot as plt
8+
89
torch.manual_seed(0)
910

1011
# generate a spatially sparse signal
@@ -39,7 +40,7 @@ def objective(x):
3940
# optimization loop
4041
for i in range(20000):
4142
optimizer.zero_grad()
42-
p=prox(x)
43+
p = prox(x)
4344
obj = objective(x) + prox(x)
4445
obj.backward()
4546
optimizer.step()

0 commit comments

Comments
 (0)