| FourierFeatEnc |
Ran ran on a synthesized input |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("eaec0a6151d6c87a") 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 2, dtype family float, shape (2, 28) 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
class FourierFeatEnc(nn.Module):
"""
Inspired by
https://github.com/facebookresearch/pytorch3d/blob/fc4dd80208bbcf6f834e7e1594db0e106961fd60/pytorch3d/renderer/implicit/harmonic_embedding.py#L10
"""
def __init__(self, k, include_input=True, use_logspace=True, max_freq=None):
super(FourierFeatEnc, self).__init__()
if use_logspace:
freq_bands = 2 ** torch.arange(0, k) * torch.pi
else:
assert max_freq is not None
freq_bands = 2 ** torch.linspace(0, max_freq, steps=k + 1)[:-1] * torch.pi
self.register_buffer('freq_bands', freq_bands, persistent=False)
self.include_input = include_input
def forward(self, x):
embed = (x[..., None] * self.freq_bands).view(*x.size()[:-1], -1)
if self.include_input:
return torch.cat((embed.cos(), embed.sin(), x), dim=-1)
return torch.cat((embed.cos(), embed.sin()), dim=-1)
INIT_ARGS = {
'k': 3,
'include_input': True,
'use_logspace': True,
'max_freq': None,
}
ARGS = {
'x': torch.randn(2, 4),
}
if __name__ == '__main__':
model = FourierFeatEnc(**INIT_ARGS)
output = model(**ARGS)
print(f"Input shape: {ARGS['x'].shape}")
print(f"Output shape: {output.shape}")
print(f"Output:\n{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 2, dtype family float, shape (2, 28) — shape (2, 28) 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)
|
| Mapping2Dto3D |
Ran ran on a synthesized input |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("c4ab41810ab166aa") 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 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 numpy as np
from torch.nn import init
def get_xavier_multiplier(m, gain):
if isinstance(m, nn.Conv1d):
ksize = m.kernel_size[0]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.ConvTranspose1d):
ksize = m.kernel_size[0] // m.stride[0]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.Conv2d):
ksize = m.kernel_size[0] * m.kernel_size[1]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.ConvTranspose2d):
ksize = m.kernel_size[0] * m.kernel_size[1] // m.stride[0] // m.stride[1]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.Conv3d):
ksize = m.kernel_size[0] * m.kernel_size[1] * m.kernel_size[2]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.ConvTranspose3d):
ksize = m.kernel_size[0] * m.kernel_size[1] * m.kernel_size[2] // m.stride[0] // m.stride[1] // m.stride[2]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.Linear):
n1 = m.in_features
n2 = m.out_features
std = gain * np.sqrt(2.0 / (n1 + n2))
else:
return None
return std
def init_weights(net, init_type='xavier_uniform', gain=1):
def init_func(m):
classname = m.__class__.__name__
if hasattr(m, 'weight') and (classname.find('Conv') != -1 or classname.find('Linear') != -1):
if init_type == 'xavier_uniform':
xavier_uniform_(m, gain)
elif init_type == 'normal':
init.normal_(m.weight.data, 0.0, gain)
elif init_type == 'xavier':
init.xavier_normal_(m.weight.data, gain=gain)
elif init_type == 'kaiming':
init.kaiming_normal_(m.weight.data, a=0, mode='fan_in')
elif init_type == 'orthogonal':
init.orthogonal_(m.weight.data, gain=gain)
else:
raise NotImplementedError('initialization method [{}] is not implemented'.format(init_type))
if hasattr(m, 'bias') and m.bias is not None:
init.constant_(m.bias.data, 0.0)
elif classname.find('BatchNorm2d') != -1:
init.normal_(m.weight.data, 1.0, gain)
init.constant_(m.bias.data, 0.0)
net.apply(init_func)
def xavier_uniform_(m, gain):
std = get_xavier_multiplier(m, gain)
m.weight.data.uniform_(-std * np.sqrt(3.0), std * np.sqrt(3.0))
class Mapping2Dto3D(nn.Module):
"""
Modified AtlasNet core function
"""
def __init__(self, input_point_dim, hidden_size=512, num_layers=2, activation='relu'):
"""
template_size: input size
"""
super().__init__()
assert activation in ['relu', 'softplus']
self.input_size = input_point_dim
self.dim_output = 3
self.hidden_neurons = hidden_size
self.num_layers = num_layers
self.linear1 = nn.Linear(self.input_size, self.hidden_neurons)
init_weights(self.linear1)
self.linear_list = nn.ModuleList([nn.Linear(self.hidden_neurons, self.hidden_neurons) for _ in range(self.num_layers)])
for l in self.linear_list:
init_weights(l)
self.last_linear = nn.Linear(self.hidden_neurons, self.dim_output)
init_weights(self.last_linear)
if activation == 'relu':
self.activation = F.relu
elif activation == 'softplus':
self.activation = F.softplus
def _forward(self, x):
x = self.activation(self.linear1(x))
for i in range(self.num_layers):
x = self.activation(self.linear_list[i](x))
return self.last_linear(x)
def forward(self, x):
assert x.shape[-1] == self.input_size
self.xyz_ = self._forward(x)
return self.xyz_
INIT_ARGS = {
'input_point_dim': 4,
'hidden_size': 64,
'num_layers': 2,
'activation': 'relu'
}
ARGS = {
'x': torch.randn(2, 4)
}
if __name__ == '__main__':
model = Mapping2Dto3D(**INIT_ARGS)
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
- 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)
|
| MappingManifold |
Ran ran on a synthesized input |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("2302d94a2911595e") 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 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 numpy as np
from torch.nn import init
def get_xavier_multiplier(m, gain):
if isinstance(m, nn.Conv1d):
ksize = m.kernel_size[0]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.ConvTranspose1d):
ksize = m.kernel_size[0] // m.stride[0]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.Conv2d):
ksize = m.kernel_size[0] * m.kernel_size[1]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.ConvTranspose2d):
ksize = m.kernel_size[0] * m.kernel_size[1] // m.stride[0] // m.stride[1]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.Conv3d):
ksize = m.kernel_size[0] * m.kernel_size[1] * m.kernel_size[2]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.ConvTranspose3d):
ksize = m.kernel_size[0] * m.kernel_size[1] * m.kernel_size[2] // m.stride[0] // m.stride[1] // m.stride[2]
n1 = m.in_channels
n2 = m.out_channels
std = gain * np.sqrt(2.0 / ((n1 + n2) * ksize))
elif isinstance(m, nn.Linear):
n1 = m.in_features
n2 = m.out_features
std = gain * np.sqrt(2.0 / (n1 + n2))
else:
return None
return std
def init_weights(net, init_type='xavier_uniform', gain=1):
def init_func(m):
classname = m.__class__.__name__
if hasattr(m, 'weight') and (classname.find('Conv') != -1 or classname.find('Linear') != -1):
if init_type == 'xavier_uniform':
xavier_uniform_(m, gain)
elif init_type == 'normal':
init.normal_(m.weight.data, 0.0, gain)
elif init_type == 'xavier':
init.xavier_normal_(m.weight.data, gain=gain)
elif init_type == 'kaiming':
init.kaiming_normal_(m.weight.data, a=0, mode='fan_in')
elif init_type == 'orthogonal':
init.orthogonal_(m.weight.data, gain=gain)
else:
raise NotImplementedError('initialization method [{}] is not implemented'.format(init_type))
if hasattr(m, 'bias') and m.bias is not None:
init.constant_(m.bias.data, 0.0)
elif classname.find('BatchNorm2d') != -1:
init.normal_(m.weight.data, 1.0, gain)
init.constant_(m.bias.data, 0.0)
net.apply(init_func)
def xavier_uniform_(m, gain):
std = get_xavier_multiplier(m, gain)
m.weight.data.uniform_(-std * np.sqrt(3.0), std * np.sqrt(3.0))
class MappingManifold(nn.Module):
def __init__(self, input_dim, output_dim, hidden_size=128, num_layers=2):
"""
template_size: input size
"""
super().__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.hidden_neurons = hidden_size
self.num_layers = num_layers
self.linear1 = nn.Linear(self.input_dim, self.hidden_neurons)
init_weights(self.linear1)
self.linear_list = nn.ModuleList([nn.Linear(self.hidden_neurons, self.hidden_neurons) for _ in range(self.num_layers)])
for l in self.linear_list:
init_weights(l)
self.last_linear = nn.Linear(self.hidden_neurons, self.output_dim)
init_weights(self.last_linear)
self.activation = F.relu
def forward(self, x):
x = self.activation(self.linear1(x))
for i in range(self.num_layers):
x = self.activation(self.linear_list[i](x))
return self.last_linear(x)
INIT_ARGS = {
'input_dim': 4,
'output_dim': 3,
'hidden_size': 8,
'num_layers': 2,
}
ARGS = {
'x': torch.randn(2, 4),
}
if __name__ == '__main__':
model = MappingManifold(**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
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
- 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)
|
| SphereTemplate |
Ran ran on a synthesized input |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("13ead961d06dcb59") 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 2, dtype family float, shape (8, 3) 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.functional as F
class SphereTemplate:
def get_random_points(self, npoints, device):
"""
Get random points on a Sphere
Return Tensor of Size [x, 3, x ... x]
"""
with torch.no_grad():
points = torch.randn((npoints, 3)).to(device).float() * 2 - 1
points = F.normalize(points, dim=-1)
return points
def get_regular_points(self, npoints, device):
"""
Get regular points on a Sphere
Return Tensor of Size [x, 3]
"""
import trimesh
mesh = trimesh.creation.icosphere(6)
return torch.tensor(mesh.vertices).to(device).float()
INIT_ARGS = {}
ARGS = {
'npoints': 8,
'device': 'cpu'
}
METHOD = 'get_random_points'
if __name__ == '__main__':
sphere = SphereTemplate(**INIT_ARGS)
result = getattr(sphere, METHOD)(**ARGS)
print(f"Result shape: {result.shape}")
print(f"Result dtype: {result.dtype}")
print(f"Result:\n{result}")
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- torch, trimesh — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float, shape (8, 3) — shape (8, 3) 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)
|
| SquareTemplate |
Ran ran on a synthesized input |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("463c1518a80f4402") 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 2, dtype family float, shape (16, 2) 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 numpy as np
class SquareTemplate:
def __init__(self):
self.regular_num_points = 0
def get_random_points(self, npoints, device):
with torch.no_grad():
rand_grid = (torch.rand((npoints, 2)) * 2 - 1).to(device).float()
return rand_grid
def get_regular_points(self, npoints=2500, device=None):
"""
Get regular points on a Square
"""
assert int(npoints ** 0.5) ** 2 == npoints
assert device is not None, 'device needs to be provided for get_regular_points'
side_length = int(npoints ** 0.5)
uv = np.stack(np.meshgrid(*[np.linspace(-1, 1, side_length)] * 2, indexing='ij'), axis=-1).reshape((-1, 2))
points = torch.FloatTensor(uv).to(device)
return points.requires_grad_()
INIT_ARGS = {}
ARGS = {
'npoints': 16,
'device': 'cpu'
}
METHOD = 'get_random_points'
if __name__ == '__main__':
template = SquareTemplate(**INIT_ARGS)
result = getattr(template, METHOD)(**ARGS)
print("Random points shape:", result.shape)
print("Random points sample:\n", result[:3])
regular_result = template.get_regular_points(npoints=16, device='cpu')
print("Regular points shape:", regular_result.shape)
print("Regular points sample:\n", regular_result[:3])
- Setup block drafted by
- a language model, class construct-then-call prompt, model not recorded
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float, shape (16, 2) — shape (16, 2) 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)
|
| get_xavier_multiplier |
Ran ran, honoured the contract we drafted |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("76fd3b77e741b50d") 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 float64, ndim 0, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 numpy as np
torch.manual_seed(0)
# Test with Conv1d
m_conv1d = nn.Conv1d(in_channels=3, out_channels=5, kernel_size=7)
gain_value = 1.0
ARGS = {
"m": m_conv1d,
"gain": gain_value
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
- 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: none by the harness; any seed is in the setup block
|
| Atlasnet |
Not yet run unverified (harvested, no recorded run) |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("4741580d189cfcf3") How it ran |
| InverseAtlasnet |
Not yet run unverified (harvested, no recorded run) |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("1463d061ca5bebd0") How it ran |
| NeuTex |
Not yet run unverified (harvested, no recorded run) |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("26ae50a466262cc4") How it ran |
| TextureMlp |
Not yet run unverified (harvested, no recorded run) |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("0deb2251d87892c9") How it ran |
| TextureMlpMix |
Not yet run unverified (harvested, no recorded run) |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("3de5f2fdd66c53b6") How it ran |
| init_seq |
Not yet run unverified (harvested, no recorded run) |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("bfb53d55b842d271") How it ran |
| init_weights |
Not yet run unverified (harvested, no recorded run) |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("865220c86d035cad") How it ran |
| xavier_uniform_ |
Not yet run unverified (harvested, no recorded run) |
tum-vision/intrinsic-neural-fields/neutex/neutex.py code served (permissive licence) · get_code("f915ebd2b117d242") How it ran |