| Blur |
Ran ran on a synthesized input |
xxxnell/spatial-smoothing/models/smoothing_block.py code served (permissive licence) · get_code("5e06a1320d7d8bc6") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 5, 6) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
class SamePad(nn.Module):
def __init__(self, filter_size, pad_mode='constant', **kwargs):
super(SamePad, self).__init__()
self.pad_size = [int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0)), int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0))]
self.pad_mode = pad_mode
def forward(self, x):
x = F.pad(x, self.pad_size, mode=self.pad_mode)
return x
def extra_repr(self):
return 'pad_size=%s, pad_mode=%s' % (self.pad_size, self.pad_mode)
class Blur(nn.Module):
def __init__(self, in_filters, sfilter=(1, 1), pad_mode='replicate', **kwargs):
super(Blur, self).__init__()
filter_size = len(sfilter)
self.pad = SamePad(filter_size, pad_mode=pad_mode)
self.filter_proto = torch.tensor(sfilter, dtype=torch.float, requires_grad=False)
self.filter = torch.einsum('i, j -> i j', self.filter_proto, self.filter_proto)
self.filter = self.filter / torch.sum(self.filter)
self.filter = self.filter.repeat([in_filters, 1, 1, 1])
self.filter = torch.nn.Parameter(self.filter, requires_grad=False)
def forward(self, x):
x = self.pad(x)
x = F.conv2d(x, self.filter, groups=x.size()[1])
return x
def extra_repr(self):
return 'pad=%s, filter_proto=%s' % (self.pad, self.filter_proto.tolist())
INIT_ARGS = {
'in_filters': 4,
'sfilter': (1, 2),
'pad_mode': 'replicate'
}
ARGS = {
'x': torch.randn(2, 4, 5, 6)
}
if __name__ == '__main__':
blur = Blur(**INIT_ARGS)
output = blur(**ARGS)
print(f"Input shape: {ARGS['x'].shape}")
print(f"Output shape: {output.shape}")
print("Success!")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 4, dtype family float, shape (2, 4, 5, 6) — shape (2, 4, 5, 6) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| Blur |
Ran ran on a synthesized input |
xxxnell/how-do-vits-work/models/smoothing_block.py code served (permissive licence) · get_code("5e8b0ed1757e7193") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 3, 5) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
class SamePad(nn.Module):
def __init__(self, filter_size, pad_mode='constant', **kwargs):
super(SamePad, self).__init__()
self.pad_size = [int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0)), int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0))]
self.pad_mode = pad_mode
def forward(self, x):
x = F.pad(x, self.pad_size, mode=self.pad_mode)
return x
def extra_repr(self):
return 'pad_size=%s, pad_mode=%s' % (self.pad_size, self.pad_mode)
class Blur(nn.Module):
def __init__(self, in_filters, sfilter=(1, 1), pad_mode='replicate', **kwargs):
super(Blur, self).__init__()
filter_size = len(sfilter)
self.pad = SamePad(filter_size, pad_mode=pad_mode)
self.filter_proto = torch.tensor(sfilter, dtype=torch.float, requires_grad=False)
self.filter = torch.tensordot(self.filter_proto, self.filter_proto, dims=0)
self.filter = self.filter / torch.sum(self.filter)
self.filter = self.filter.repeat([in_filters, 1, 1, 1])
self.filter = torch.nn.Parameter(self.filter, requires_grad=False)
def forward(self, x):
x = self.pad(x)
x = F.conv2d(x, self.filter, groups=x.size()[1])
return x
def extra_repr(self):
return 'pad=%s, filter_proto=%s' % (self.pad, self.filter_proto.tolist())
INIT_ARGS = {
'in_filters': 4,
'sfilter': (1, 1),
'pad_mode': 'replicate'
}
ARGS = {
'x': torch.randn(2, 4, 3, 5)
}
if __name__ == '__main__':
blur = Blur(**INIT_ARGS)
output = blur(**ARGS)
print(f"Input shape: {ARGS['x'].shape}")
print(f"Output shape: {output.shape}")
print("Success!")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 4, dtype family float, shape (2, 4, 3, 5) — shape (2, 4, 3, 5) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| SamePad |
Ran ran on a synthesized input |
xxxnell/spatial-smoothing/models/smoothing_block.py code served (permissive licence) · get_code("7d31fb2fc7950e03") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 7, 7) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
class SamePad(nn.Module):
def __init__(self, filter_size, pad_mode='constant', **kwargs):
super(SamePad, self).__init__()
self.pad_size = [int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0)), int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0))]
self.pad_mode = pad_mode
def forward(self, x):
x = F.pad(x, self.pad_size, mode=self.pad_mode)
return x
def extra_repr(self):
return 'pad_size=%s, pad_mode=%s' % (self.pad_size, self.pad_mode)
INIT_ARGS = {
'filter_size': 5,
'pad_mode': 'constant'
}
ARGS = {
'x': torch.randn(2, 4, 3, 3)
}
if __name__ == '__main__':
module = SamePad(**INIT_ARGS)
output = module(**ARGS)
print(f"Input shape: {ARGS['x'].shape}")
print(f"Output shape: {output.shape}")
print(f"Module: {module}")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 4, dtype family float, shape (2, 4, 7, 7) — shape (2, 4, 7, 7) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| TanhBlurBlock |
Ran ran on a synthesized input |
xxxnell/spatial-smoothing/models/smoothing_block.py code served (permissive licence) · get_code("c452d32abae32178") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import types as _types
class SamePad(nn.Module):
def __init__(self, filter_size, pad_mode='constant', **kwargs):
super(SamePad, self).__init__()
self.pad_size = [int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0)), int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0))]
self.pad_mode = pad_mode
def forward(self, x):
x = F.pad(x, self.pad_size, mode=self.pad_mode)
return x
def extra_repr(self):
return 'pad_size=%s, pad_mode=%s' % (self.pad_size, self.pad_mode)
class Blur(nn.Module):
def __init__(self, in_filters, sfilter=(1, 1), pad_mode='replicate', **kwargs):
super(Blur, self).__init__()
filter_size = len(sfilter)
self.pad = SamePad(filter_size, pad_mode=pad_mode)
self.filter_proto = torch.tensor(sfilter, dtype=torch.float, requires_grad=False)
self.filter = torch.einsum('i, j -> i j', self.filter_proto, self.filter_proto)
self.filter = self.filter / torch.sum(self.filter)
self.filter = self.filter.repeat([in_filters, 1, 1, 1])
self.filter = torch.nn.Parameter(self.filter, requires_grad=False)
def forward(self, x):
x = self.pad(x)
x = F.conv2d(x, self.filter, groups=x.size()[1])
return x
def extra_repr(self):
return 'pad=%s, filter_proto=%s' % (self.pad, self.filter_proto.tolist())
def blur(in_filters, sfilter=(1, 1), pad_mode='constant'):
if tuple(sfilter) == (1, 1) and pad_mode in ['constant', 'zero']:
layer = nn.AvgPool2d(kernel_size=2, stride=1, padding=1)
else:
layer = Blur(in_filters, sfilter=sfilter, pad_mode=pad_mode)
return layer
def relu():
return nn.ReLU()
layers = _types.SimpleNamespace(**{n: globals()[n] for n in ['Blur', 'SamePad', 'blur', 'relu'] if n in globals()})
class TanhBlurBlock(nn.Module):
def __init__(self, in_filters, temp=10.0, sfilter=(1, 1), pad_mode='constant', **kwargs):
super(TanhBlurBlock, self).__init__()
self.temp = temp
self.relu = layers.relu()
self.tanh = nn.Tanh()
self.blur = layers.blur(in_filters, sfilter=sfilter, pad_mode=pad_mode)
def forward(self, x):
x = self.temp * self.tanh(x / self.temp)
x = self.relu(x)
x = self.blur(x)
return x
def extra_repr(self):
return 'temp=%.3e' % self.temp
INIT_ARGS = {
'in_filters': 4,
'temp': 10.0,
'sfilter': (1, 1),
'pad_mode': 'constant'
}
ARGS = {
'x': torch.randn(2, 4, 3, 3)
}
if __name__ == '__main__':
model = TanhBlurBlock(**INIT_ARGS)
output = model(**ARGS)
print(f"Input shape: {ARGS['x'].shape}")
print(f"Output shape: {output.shape}")
print("Success!")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 4, dtype family float, shape (2, 4, 4, 4) — shape (2, 4, 4, 4) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| TanhBlurBlock |
Ran ran on a synthesized input |
xxxnell/how-do-vits-work/models/smoothing_block.py code served (permissive licence) · get_code("d858d5b3ac196749") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 4, dtype family float, shape (2, 4, 4, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import types as _types
class SamePad(nn.Module):
def __init__(self, filter_size, pad_mode='constant', **kwargs):
super(SamePad, self).__init__()
self.pad_size = [int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0)), int((filter_size - 1) / 2.0), int(math.ceil((filter_size - 1) / 2.0))]
self.pad_mode = pad_mode
def forward(self, x):
x = F.pad(x, self.pad_size, mode=self.pad_mode)
return x
def extra_repr(self):
return 'pad_size=%s, pad_mode=%s' % (self.pad_size, self.pad_mode)
class Blur(nn.Module):
def __init__(self, in_filters, sfilter=(1, 1), pad_mode='replicate', **kwargs):
super(Blur, self).__init__()
filter_size = len(sfilter)
self.pad = SamePad(filter_size, pad_mode=pad_mode)
self.filter_proto = torch.tensor(sfilter, dtype=torch.float, requires_grad=False)
self.filter = torch.tensordot(self.filter_proto, self.filter_proto, dims=0)
self.filter = self.filter / torch.sum(self.filter)
self.filter = self.filter.repeat([in_filters, 1, 1, 1])
self.filter = torch.nn.Parameter(self.filter, requires_grad=False)
def forward(self, x):
x = self.pad(x)
x = F.conv2d(x, self.filter, groups=x.size()[1])
return x
def extra_repr(self):
return 'pad=%s, filter_proto=%s' % (self.pad, self.filter_proto.tolist())
def blur(in_filters, sfilter=(1, 1), pad_mode='constant'):
if tuple(sfilter) == (1, 1) and pad_mode in ['constant', 'zero']:
layer = nn.AvgPool2d(kernel_size=2, stride=1, padding=1)
else:
layer = Blur(in_filters, sfilter=sfilter, pad_mode=pad_mode)
return layer
def relu():
return nn.ReLU()
layers = _types.SimpleNamespace(**{n: globals()[n] for n in ['Blur', 'SamePad', 'blur', 'relu'] if n in globals()})
class TanhBlurBlock(nn.Module):
def __init__(self, in_filters, temp=10.0, sfilter=(1, 1), pad_mode='constant', **kwargs):
super(TanhBlurBlock, self).__init__()
self.temp = temp
self.relu = layers.relu()
self.tanh = nn.Tanh()
self.blur = layers.blur(in_filters, sfilter=sfilter, pad_mode=pad_mode)
def forward(self, x):
x = self.temp * self.tanh(x / self.temp)
x = self.relu(x)
x = self.blur(x)
return x
def extra_repr(self):
return 'temp=%.3e' % self.temp
INIT_ARGS = {
'in_filters': 4,
'temp': 10.0,
'sfilter': (1, 1),
'pad_mode': 'constant'
}
ARGS = {
'x': torch.randn(2, 4, 3, 3)
}
if __name__ == '__main__':
model = TanhBlurBlock(**INIT_ARGS)
output = model(**ARGS)
print(f"Output shape: {output.shape}")
print(f"Output: {output}")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 4, dtype family float, shape (2, 4, 4, 4) — shape (2, 4, 4, 4) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
|
| blur |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
xxxnell/spatial-smoothing/models/smoothing_block.py code served (permissive licence) · get_code("a913c63854e37921") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned AvgPool2d. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
ARGS = {
'in_filters': 3,
'sfilter': (1, 1),
'pad_mode': 'constant'
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type AvgPool2d — a AvgPool2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AvgPool2d output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| blur |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
xxxnell/how-do-vits-work/models/smoothing_block.py code served (permissive licence) · get_code("5ccfb7ec6032f45e") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned AvgPool2d. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
ARGS = {
'in_filters': 3,
'sfilter': (1, 1),
'pad_mode': 'constant'
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type AvgPool2d — a AvgPool2d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a AvgPool2d output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| relu |
Ran ran on a synthesized input |
xxxnell/spatial-smoothing/models/smoothing_block.py code served (permissive licence) · get_code("d419f818792d3793") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ReLU. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import torch.nn as nn
torch.manual_seed(0)
ARGS = {}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ReLU — a ReLU output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ReLU output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|