Skip to content

Commit f1cffe8

Browse files
committed
Fix ruff N806: rename uppercase vars B, C to batch, channels
Signed-off-by: UGBOMEH OGOCHUKWU WILLIAMS <williamsugbomeh@gmail.com>
1 parent 093f0b0 commit f1cffe8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

monai/networks/blocks/patchembedding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ def __init__(self, spatial_dims: int, patch_size: tuple) -> None:
3838
self.patch_size = patch_size
3939

4040
def forward(self, x: torch.Tensor) -> torch.Tensor:
41-
B, C = x.shape[0], x.shape[1]
41+
batch, channels = x.shape[0], x.shape[1]
4242
sp = x.shape[2:]
4343
g = tuple(s // p for s, p in zip(sp, self.patch_size))
44-
v: list[int] = [B, C]
44+
v: list[int] = [batch, channels]
4545
for gi, pi in zip(g, self.patch_size):
4646
v += [gi, pi]
4747
x = x.view(*v)
@@ -52,7 +52,7 @@ def forward(self, x: torch.Tensor) -> torch.Tensor:
5252
n_patches = 1
5353
for gi in g:
5454
n_patches *= gi
55-
return x.reshape(B, n_patches, -1)
55+
return x.reshape(batch, n_patches, -1)
5656

5757

5858
class PatchEmbeddingBlock(nn.Module):

0 commit comments

Comments
 (0)