Skip to content

Commit 5956d82

Browse files
committed
Rename padding to margin
1 parent 6ada564 commit 5956d82

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/torchjd/sparse/_aten_function_overrides/shape.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def view_default(t: SparseLatticedTensor, shape: list[int]) -> Tensor:
4040

4141
assert isinstance(t, SparseLatticedTensor)
4242

43-
if not torch.equal(t.padding, torch.zeros_like(t.padding)):
43+
if not torch.equal(t.margin, torch.zeros_like(t.margin)):
4444
raise NotImplementedError()
4545

4646
shape = infer_shape(shape, t.numel())

src/torchjd/sparse/_sparse_latticed_tensor.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,34 +153,34 @@ def decorator(func):
153153
return decorator
154154

155155
@property
156-
def start_padding(self) -> Tensor:
156+
def start_margin(self) -> Tensor:
157157
"""
158-
Returns the number of zeros of padding at the start of each virtual dimension.
158+
Returns the margin at the start of each virtual dimension. Can be negative.
159159
160160
The result is an int tensor of shape [virtual_ndim].
161161
"""
162162

163163
return self.offset
164164

165165
@property
166-
def end_padding(self) -> Tensor:
166+
def end_margin(self) -> Tensor:
167167
"""
168-
Returns the number of zeros of padding at the end of each virtual dimension.
168+
Returns the margin at the end of each virtual dimension. Can be negative.
169169
170170
The result is an int tensor of shape [virtual_ndim].
171171
"""
172172

173173
return self.shape_t - self.physical_image_size - self.offset
174174

175175
@property
176-
def padding(self) -> Tensor:
176+
def margin(self) -> Tensor:
177177
"""
178-
Returns the number of zeros of padding at the start and end of each virtual dimension.
178+
Returns the margin at the start and end of each virtual dimension. Can be negative.
179179
180180
The result is an int tensor of shape [virtual_ndim, 2].
181181
"""
182182

183-
return torch.stack([self.start_padding, self.end_padding], dim=1)
183+
return torch.stack([self.start_margin, self.end_margin], dim=1)
184184

185185
@property
186186
def min_natural_virtual_indices(self) -> Tensor:

0 commit comments

Comments
 (0)