entry_point
stringlengths
1
65
original_triton_code
stringlengths
4.5k
619k
python_code
stringlengths
208
60.9k
triton_code
stringlengths
1.15k
275k
repo_name
stringlengths
7
115
module_name
stringlengths
1
65
synthetic
bool
1 class
uuid
int64
0
18.5k
licenses
listlengths
1
6
stars
int64
0
19.8k
sha
stringlengths
40
40
repo_link
stringlengths
72
180
pytorch_code
stringlengths
200
4.05k
FencepostModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.optim import torch.autograd import torch.nn import torch.nn.init class FencepostModule(nn.Module): def __init__(self, input_dim, repr_dim, n_labels, disentangle=False, label_bias=True, span_bias=False, activation='tanh'): super(FencepostModule, self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
FilippoC/-deep-syntactic-dependency-parsing-release
FencepostModule
false
17,281
[ "MIT" ]
4
30e2571ea930c2fd81559f5a2a971e3738cc6d39
https://github.com/FilippoC/-deep-syntactic-dependency-parsing-release/tree/30e2571ea930c2fd81559f5a2a971e3738cc6d39
import torch import torch.nn as nn import torch.optim import torch.autograd import torch.nn import torch.nn.init class Model(nn.Module): def __init__(self, input_dim, repr_dim, n_labels, disentangle=False, label_bias=True, span_bias=False, activation='tanh'): super().__init__() self.disen...
CenterCosineSimilarity
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class CenterCosineSimilarity(nn.Module): def __init__(self, feat_dim, num_centers, eps=1e-08): super(CenterCosineSimilarity, self).__init__() self.centers = nn.Parameter(torch.randn(num_centers, feat_dim)) self.eps = eps def forward(self, feat): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
GT-RIPL/DistillMatch-SSCL
CenterCosineSimilarity
false
17,282
[ "MIT" ]
9
e572671fd6994b3c43ad6e46e9efb3588804524c
https://github.com/GT-RIPL/DistillMatch-SSCL/tree/e572671fd6994b3c43ad6e46e9efb3588804524c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, feat_dim, num_centers, eps=1e-08): super().__init__() self.centers = nn.Parameter(torch.randn(num_centers, feat_dim)) self.eps = eps def forward(self, feat): norm_f = torch.norm(feat, p=2, dim=-1, k...
BBoxTransform
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class BBoxTransform(nn.Module): def forward(self, anchors, regression): """ decode_box_outputs adapted from https://github.com/google/automl/blob/master/efficientdet/anchors.py Args: anchors: [batchsize, boxes, (y1, x1, y2, x2)] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
DerryHub/the-TaobaoLive-Commodity-Identify-Competition
BBoxTransform
false
17,283
[ "MIT" ]
4
7e5e5c4fbddd9949fe01810d58bd7994889c007c
https://github.com/DerryHub/the-TaobaoLive-Commodity-Identify-Competition/tree/7e5e5c4fbddd9949fe01810d58bd7994889c007c
import torch import torch.nn as nn class Model(nn.Module): def forward(self, anchors, regression): """ decode_box_outputs adapted from https://github.com/google/automl/blob/master/efficientdet/anchors.py Args: anchors: [batchsize, boxes, (y1, x1, y2, x2)] regressi...
SmoothCrossEntropyLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn.modules.loss import _WeightedLoss import torch.nn.functional as F class SmoothCrossEntropyLoss(_WeightedLoss): """ Smooth labelling for pytorch. Source: https://stackoverflow.com/questions/55681502/label-smoothing-in-pytorch """ def __init__(self, weight=None, reduction...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules....
Fuminides/athena
SmoothCrossEntropyLoss
false
17,284
[ "MIT" ]
10
78ad7ad5236dc8f12adc0401c52add3931292e69
https://github.com/Fuminides/athena/tree/78ad7ad5236dc8f12adc0401c52add3931292e69
import torch from torch.nn.modules.loss import _WeightedLoss import torch.nn.functional as F class Model(_WeightedLoss): """ Smooth labelling for pytorch. Source: https://stackoverflow.com/questions/55681502/label-smoothing-in-pytorch """ def __init__(self, weight=None, reduction='mean', smoothin...
LinearExcitability
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn from torch.nn.parameter import Parameter def linearExcitability(input, weight, excitability=None, bias=None): """ Applies a linear transformation to the incoming data: :math:`y = c(xA^T) + b`. Shape: - input: :math:`(N, *, in\\_features)` ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn from torch.nn.parameter import Parameter assert...
GMvandeVen/progressive-learning-pytorch
LinearExcitability
false
17,285
[ "MIT" ]
4
165645b2d7595d94d036f765c9a311d505e667a3
https://github.com/GMvandeVen/progressive-learning-pytorch/tree/165645b2d7595d94d036f765c9a311d505e667a3
import math import torch from torch import nn from torch.nn.parameter import Parameter def linearExcitability(input, weight, excitability=None, bias=None): """ Applies a linear transformation to the incoming data: :math:`y = c(xA^T) + b`. Shape: - input: :math:`(N, *, in\\_features)` ...
LSGanLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.optim class LSGanLoss(nn.Module): def __init__(self, layer=3): super(LSGanLoss, self).__init__() self.layer = layer def forward(self, real, fake): loss_G = 0 loss_D = 0 for i in range(self.layer): loss_G = los...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.optim assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
ForrestPi/faceSwapProjects
LSGanLoss
false
17,286
[ "MIT" ]
5
daf2649a2791a25aa541c4d6d3b7e1d6552be5d7
https://github.com/ForrestPi/faceSwapProjects/tree/daf2649a2791a25aa541c4d6d3b7e1d6552be5d7
import torch from torch import nn import torch.optim class Model(nn.Module): def __init__(self, layer=3): super().__init__() self.layer = layer def forward(self, real, fake): loss_G = 0 loss_D = 0 for i in range(self.layer): loss_G = loss_G + torch.mean((f...
conv_layer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class conv_layer(nn.Module): """Standard convolutional layer. Possible to return pre-activations.""" def __init__(self, in_planes, out_planes, kernel_size=3, stride=1, padding=1, drop=0, batch_norm=False, nl=nn.ReLU(), bias=True, gated =False): super(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
GMvandeVen/progressive-learning-pytorch
conv_layer
false
17,288
[ "MIT" ]
4
165645b2d7595d94d036f765c9a311d505e667a3
https://github.com/GMvandeVen/progressive-learning-pytorch/tree/165645b2d7595d94d036f765c9a311d505e667a3
import torch from torch import nn class Model(nn.Module): """Standard convolutional layer. Possible to return pre-activations.""" def __init__(self, in_planes, out_planes, kernel_size=3, stride=1, padding=1, drop=0, batch_norm=False, nl=nn.ReLU(), bias=True, gated =False): super().__i...
Downsample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: return nn.Conv3d(*args, **kwargs) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
GastonMazzei/escher-project-website
Downsample
false
17,289
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
import torch import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: return nn.Conv3d(*args, **kwargs) ...
CPUForgetMult
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.init class CPUForgetMult(torch.nn.Module): def __init__(self): super(CPUForgetMult, self).__init__() def forward(self, f, x, hidden_init=None): result = [] forgets = f.split(1, dim=0) prev_h = hidden_init for i, h in enumerate((f * x).spli...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.init assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
FurKan7/resim_renklendirme-colorizing-of-picture-
CPUForgetMult
false
17,290
[ "MIT" ]
8
a431a42cd00a60f85948795bc872a272897fbc76
https://github.com/FurKan7/resim_renklendirme-colorizing-of-picture-/tree/a431a42cd00a60f85948795bc872a272897fbc76
import torch import torch.nn.init class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, f, x, hidden_init=None): result = [] forgets = f.split(1, dim=0) prev_h = hidden_init for i, h in enumerate((f * x).split(1, dim=0)): i...
MLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class MLP(nn.Module): def __init__(self, width): super().__init__() self.width = width self.c_fc = nn.Linear(width, width * 4) self.c_proj = nn.Linear(width * 4, width) self.gelu = nn.GELU() def forward(self, x): return self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
GastonMazzei/escher-project-website
MLP
false
17,291
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, width): super().__init__() self.width = width self.c_fc = nn.Linear(width, width * 4) self.c_proj = nn.Linear(width * 4, width) self.gelu = nn.GELU() def forward(self, x): return sel...
rSoftMax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F from torch.functional import F class rSoftMax(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self, x): batch = x.size(0) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
DerryHub/the-TaobaoLive-Commodity-Identify-Competition
rSoftMax
false
17,292
[ "MIT" ]
4
7e5e5c4fbddd9949fe01810d58bd7994889c007c
https://github.com/DerryHub/the-TaobaoLive-Commodity-Identify-Competition/tree/7e5e5c4fbddd9949fe01810d58bd7994889c007c
import torch import torch.nn as nn import torch.nn.functional as F from torch.functional import F class Model(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self, x): batch = x.size(0) ...
GroupNorm32
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class GroupNorm32(nn.GroupNorm): def __init__(self, num_groups, num_channels, swish, eps=1e-05): super().__init__(num_groups=num_groups, num_channels=num_channels, eps=eps) self.swish = swish def forward(self, x):...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
GastonMazzei/escher-project-website
GroupNorm32
false
17,293
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.GroupNorm): def __init__(self, num_groups, num_channels, swish, eps=1e-05): super().__init__(num_groups=num_groups, num_channels=num_channels, eps=eps) self.swish = swish def forward(self, x): ...
downsampleLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class downsampleLayer(nn.Module): """ A downsample layer of UNet. LeakyReLU is used as the activation func. """ def __init__(self, infeature, outfeature, kernelSize, strides=2, paddings=1, bn=False): super(downsampleLayer, self).__init__() s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
GentleDell/DEBOR
downsampleLayer
false
17,294
[ "BSD-3-Clause" ]
4
cd566f173599fe7419e7baf312f63830c28d5de2
https://github.com/GentleDell/DEBOR/tree/cd566f173599fe7419e7baf312f63830c28d5de2
import torch import torch.nn as nn class Model(nn.Module): """ A downsample layer of UNet. LeakyReLU is used as the activation func. """ def __init__(self, infeature, outfeature, kernelSize, strides=2, paddings=1, bn=False): super().__init__() self.conv = nn.Conv2d(infeature,...
GraphLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class GraphLinear(nn.Module): """ Generalization of 1x1 convolutions on Graphs """ def __init__(self, in_channels, out_channels): super(GraphLinear, self).__init__() self.in_channels = in_channels self.out_channels = out_channels self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
GentleDell/DEBOR
GraphLinear
false
17,295
[ "BSD-3-Clause" ]
4
cd566f173599fe7419e7baf312f63830c28d5de2
https://github.com/GentleDell/DEBOR/tree/cd566f173599fe7419e7baf312f63830c28d5de2
import torch import torch.nn as nn class Model(nn.Module): """ Generalization of 1x1 convolutions on Graphs """ def __init__(self, in_channels, out_channels): super().__init__() self.in_channels = in_channels self.out_channels = out_channels self.W = nn.Parameter(torch...
Upsample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
GastonMazzei/escher-project-website
Upsample
false
17,296
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
import torch import torch.nn.functional as F import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: re...
upsampleLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class upsampleLayer(nn.Module): """ A upsample layer of UNet. ReLU is the activation func. The skip connection can be cutted if not given. Because RGB-UV is not a completion task but a image transition task. """ def __init__(self, infeature, outfeature, ker...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
GentleDell/DEBOR
upsampleLayer
false
17,297
[ "BSD-3-Clause" ]
4
cd566f173599fe7419e7baf312f63830c28d5de2
https://github.com/GentleDell/DEBOR/tree/cd566f173599fe7419e7baf312f63830c28d5de2
import torch import torch.nn as nn class Model(nn.Module): """ A upsample layer of UNet. ReLU is the activation func. The skip connection can be cutted if not given. Because RGB-UV is not a completion task but a image transition task. """ def __init__(self, infeature, outfeature, kernelSize,...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.optim from torch import nn class Attention(nn.Module): """ Attention network for calculate attention value """ def __init__(self, encoder_dim, decoder_dim, attention_dim): """ :param encoder_dim: input size of encoder network :param decoder_dim: input...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Fpiotro/MOLECULAR-TRANSLATION
Attention
false
17,298
[ "MIT" ]
5
050dd0c093ee4e68326c2404c5b4dbf53ca6c8a0
https://github.com/Fpiotro/MOLECULAR-TRANSLATION/tree/050dd0c093ee4e68326c2404c5b4dbf53ca6c8a0
import torch import torch.optim from torch import nn class Model(nn.Module): """ Attention network for calculate attention value """ def __init__(self, encoder_dim, decoder_dim, attention_dim): """ :param encoder_dim: input size of encoder network :param decoder_dim: input siz...
USConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils def make_divisible(v, divisor=8, min_value=1): """ forked from slim: https://github.com/tensorflow/models/blob/ 0344c5503ee55e24f0de7f37336a6e08f10976fd/ research/slim/nets/mobilenet/mobilenet.py#L62-L69 """ if min_value is None: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils assert_size_stride = torch._C._dynamo.g...
Gaussianer/FasterSeg
USConv2d
false
17,299
[ "MIT" ]
6
f2e102b433275ac9f3387a8c2ae8439b2687bfda
https://github.com/Gaussianer/FasterSeg/tree/f2e102b433275ac9f3387a8c2ae8439b2687bfda
import torch import torch.nn as nn import torch.utils def make_divisible(v, divisor=8, min_value=1): """ forked from slim: https://github.com/tensorflow/models/blob/ 0344c5503ee55e24f0de7f37336a6e08f10976fd/ research/slim/nets/mobilenet/mobilenet.py#L62-L69 """ if min_value is None: ...
GlobalAvgPool2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils class GlobalAvgPool2d(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(GlobalAvgPool2d, self).__init__() def forward(self, inputs): in_size = inputs.size() inputs = inp...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
Gaussianer/FasterSeg
GlobalAvgPool2d
false
17,300
[ "MIT" ]
6
f2e102b433275ac9f3387a8c2ae8439b2687bfda
https://github.com/Gaussianer/FasterSeg/tree/f2e102b433275ac9f3387a8c2ae8439b2687bfda
import torch import torch.nn as nn import torch.utils class Model(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super().__init__() def forward(self, inputs): in_size = inputs.size() inputs = inputs.view((in_size[0], in_size[1...
TwoMLPHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torchvision.transforms import functional as F from torch import nn import torch.nn.functional as F import torch.utils.data class TwoMLPHead(nn.Module): """ Standard heads for FPN-based models Arguments: in_channels (int): number of input channels representation_size (int...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
BoChenYS/ROPE
TwoMLPHead
false
17,301
[ "BSD-3-Clause" ]
6
3e50f134259b555cf547e4a3ef8b14cf5cda4e00
https://github.com/BoChenYS/ROPE/tree/3e50f134259b555cf547e4a3ef8b14cf5cda4e00
import torch from torchvision.transforms import functional as F from torch import nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): """ Standard heads for FPN-based models Arguments: in_channels (int): number of input channels representation_size (int): si...
F_fully_connected_leaky
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class F_fully_connected_leaky(nn.Module): """Fully connected tranformation, not reversible, but used below.""" def __init__(self, size_in, size, internal_size=None, dropout=0.0, batch_norm=False, leaky_slope=0.01): super(F_fully_connected_leaky, self).__init_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
Goobley/Radynversion
F_fully_connected_leaky
false
17,302
[ "MIT" ]
7
f44edc77b6eb7ef2bdbd8e8aabda3bf9822d3695
https://github.com/Goobley/Radynversion/tree/f44edc77b6eb7ef2bdbd8e8aabda3bf9822d3695
import torch from torch import nn class Model(nn.Module): """Fully connected tranformation, not reversible, but used below.""" def __init__(self, size_in, size, internal_size=None, dropout=0.0, batch_norm=False, leaky_slope=0.01): super().__init__() if not internal_size: i...
SqueezeAndExcitation
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class SqueezeAndExcitation(nn.Module): def __init__(self, planes, squeeze): super(SqueezeAndExcitation, self).__init__() self.squeeze = nn.Linear(planes, sque...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
FujitsuLaboratories/CAC
SqueezeAndExcitation
false
17,303
[ "Apache-2.0" ]
8
d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
https://github.com/FujitsuLaboratories/CAC/tree/d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class Model(nn.Module): def __init__(self, planes, squeeze): super().__init__() self.squeeze = nn.Linear(planes, squeeze) self.expand = nn.Linear(sque...
SigmoidFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils class SigmoidFocalLoss(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super(SigmoidFocalLoss, self).__init__() self.ignore_label = ignore_label self.gamma = gamma self.alpha = alpha ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Gaussianer/FasterSeg
SigmoidFocalLoss
false
17,304
[ "MIT" ]
6
f2e102b433275ac9f3387a8c2ae8439b2687bfda
https://github.com/Gaussianer/FasterSeg/tree/f2e102b433275ac9f3387a8c2ae8439b2687bfda
import torch import torch.nn as nn import torch.utils class Model(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super().__init__() self.ignore_label = ignore_label self.gamma = gamma self.alpha = alpha self.reduction = reduction ...
PairwiseLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class PairwiseLoss(nn.Module): def __init__(self): super().__init__() self.m = 0 def forward(self, pos_out, neg_out): distance = 1 - pos_out + neg_out loss = torch.mean(torch.max(torch.tensor(0), distance)) return loss def get_inpu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
GrantXie/wikidata-wikifier
PairwiseLoss
false
17,305
[ "MIT" ]
3
a65c9b71596e390999af9de7638eb8c8c13c1581
https://github.com/GrantXie/wikidata-wikifier/tree/a65c9b71596e390999af9de7638eb8c8c13c1581
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.m = 0 def forward(self, pos_out, neg_out): distance = 1 - pos_out + neg_out loss = torch.mean(torch.max(torch.tensor(0), distance)) return loss def get_inputs(): ...
MultiheadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch as th import torch.nn as nn class QKVMultiheadAttention(nn.Module): def __init__(self, n_heads: 'int', n_ctx: 'int'): super().__init__() self.n_heads = n_heads self.n_ctx = n_ctx def forward(self, qkv): bs, n_ctx, width = qkv.shape ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
GastonMazzei/escher-project-website
MultiheadAttention
false
17,306
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
import math import torch import torch as th import torch.nn as nn class QKVMultiheadAttention(nn.Module): def __init__(self, n_heads: 'int', n_ctx: 'int'): super().__init__() self.n_heads = n_heads self.n_ctx = n_ctx def forward(self, qkv): bs, n_ctx, width = qkv.shape ...
PairwiseNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class PairwiseNetwork(nn.Module): def __init__(self, hidden_size): super().__init__() self.fc1 = nn.Linear(hidden_size, 2 * hidden_size) self.fc2 = nn.Linear(2 * hidden_size, hidden_size) self.fc3 = nn.Linear(hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
GrantXie/wikidata-wikifier
PairwiseNetwork
false
17,307
[ "MIT" ]
3
a65c9b71596e390999af9de7638eb8c8c13c1581
https://github.com/GrantXie/wikidata-wikifier/tree/a65c9b71596e390999af9de7638eb8c8c13c1581
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, hidden_size): super().__init__() self.fc1 = nn.Linear(hidden_size, 2 * hidden_size) self.fc2 = nn.Linear(2 * hidden_size, hidden_size) self.fc3 = nn.Linear(hidden_size, hi...
SoftCrossEntropyLoss2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils class SoftCrossEntropyLoss2d(nn.Module): def __init__(self): super(SoftCrossEntropyLoss2d, self).__init__() def forward(self, inputs, targets): loss = 0 inputs = -F.log_softmax(inputs, dim=1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Gaussianer/FasterSeg
SoftCrossEntropyLoss2d
false
17,308
[ "MIT" ]
6
f2e102b433275ac9f3387a8c2ae8439b2687bfda
https://github.com/Gaussianer/FasterSeg/tree/f2e102b433275ac9f3387a8c2ae8439b2687bfda
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils class Model(nn.Module): def __init__(self): super().__init__() def forward(self, inputs, targets): loss = 0 inputs = -F.log_softmax(inputs, dim=1) for index in range(inputs.size()[0]): ...
Affine
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn import torch.autograd from torch.nn import init class Affine(nn.Module): """ This module implements the affine parameters gamma and beta seen in Eq. 10 in Pezeshki et al. (2016). It differs from the way affine is used in batchnorm out of the box of PyTorch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn import torch.autograd from torch.nn import init assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Goschjann/ssltsc
Affine
false
17,309
[ "MIT" ]
5
08d6b1bf711bb1c8f19f9bfb66a98d4e423e932e
https://github.com/Goschjann/ssltsc/tree/08d6b1bf711bb1c8f19f9bfb66a98d4e423e932e
import math import torch from torch import nn import torch.autograd from torch.nn import init class Model(nn.Module): """ This module implements the affine parameters gamma and beta seen in Eq. 10 in Pezeshki et al. (2016). It differs from the way affine is used in batchnorm out of the box of PyTorch....
PositionEmbs
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class PositionEmbs(nn.Module): def __init__(self, num_patches, emb_dim, dropout_rate=0.1): super(PositionEmbs, self).__init__() self.pos_embedding = nn.Parameter(torch.randn(1, num_patches + 2, emb_dim)) if dropout_rate > 0: self.d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Graeme22/VisionTransformer-Pytorch
PositionEmbs
false
17,310
[ "Apache-2.0" ]
5
4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
https://github.com/Graeme22/VisionTransformer-Pytorch/tree/4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
import torch from torch import nn class Model(nn.Module): def __init__(self, num_patches, emb_dim, dropout_rate=0.1): super().__init__() self.pos_embedding = nn.Parameter(torch.randn(1, num_patches + 2, emb_dim)) if dropout_rate > 0: self.dropout = nn.Dropout(dropo...
DistilledLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F class DistilledLoss(nn.Module): """ Intended for use with a DistillationTrainer. Combines vanilla cross entropy loss with a modified form of KL divergence loss. Attempts to minimize the KL divergence between the student and distilled lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Graeme22/VisionTransformer-Pytorch
DistilledLoss
false
17,311
[ "Apache-2.0" ]
5
4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
https://github.com/Graeme22/VisionTransformer-Pytorch/tree/4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """ Intended for use with a DistillationTrainer. Combines vanilla cross entropy loss with a modified form of KL divergence loss. Attempts to minimize the KL divergence between the student and distilled logits ...
APLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class ZIF(torch.autograd.Function): @staticmethod def forward(ctx, input, gama): out = (input > 0).float() L = torch.tensor([gama]) ctx.save_for_b...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed assert_size_st...
Gus-Lab/temporal_efficient_training
APLayer
false
17,312
[ "MIT" ]
5
f9bde4107ed653cc8dd3ee58689bf3b55f6b89ba
https://github.com/Gus-Lab/temporal_efficient_training/tree/f9bde4107ed653cc8dd3ee58689bf3b55f6b89ba
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class ZIF(torch.autograd.Function): @staticmethod def forward(ctx, input, gama): out = (input > 0).float() L = torch.tensor([gama]) ctx.save_for_b...
Conv2dSame
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torchvision.transforms import * import torch.nn import torch import torch.nn as nn class Conv2dSame(torch.nn.Module): """2D convolution that pads to keep spatial dimensions equal. Cannot deal with stride. Only quadratic kernels (=scalar kernel_size). """ def __init__(self, in_channe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torchvis...
COMHTVM/lensless
Conv2dSame
false
17,313
[ "MIT" ]
6
0d67a310bab08551d7422fa792f3422a7ee7d9cb
https://github.com/COMHTVM/lensless/tree/0d67a310bab08551d7422fa792f3422a7ee7d9cb
import torch from torchvision.transforms import * import torch.nn import torch import torch.nn as nn class Model(torch.nn.Module): """2D convolution that pads to keep spatial dimensions equal. Cannot deal with stride. Only quadratic kernels (=scalar kernel_size). """ def __init__(self, in_channels, o...
Combinator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.autograd class Combinator(nn.Module): """ The vanilla combinator function g() that combines vertical and lateral connections as explained in Pezeshki et al. (2016). The weights are initialized as described in Eq. 17 and the g() is defined in Eq. 16. ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.autograd assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dy...
Goschjann/ssltsc
Combinator
false
17,314
[ "MIT" ]
5
08d6b1bf711bb1c8f19f9bfb66a98d4e423e932e
https://github.com/Goschjann/ssltsc/tree/08d6b1bf711bb1c8f19f9bfb66a98d4e423e932e
import torch from torch import nn import torch.autograd class Model(nn.Module): """ The vanilla combinator function g() that combines vertical and lateral connections as explained in Pezeshki et al. (2016). The weights are initialized as described in Eq. 17 and the g() is defined in Eq. 16. ""...
ResidualAttentionBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch as th import torch.nn as nn class LayerNorm(nn.LayerNorm): """ Implementation that supports fp16 inputs but fp32 gains/biases. """ def forward(self, x: 'th.Tensor'): return super().forward(x.float()) class QKVMultiheadAttention(nn.Module): def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
GastonMazzei/escher-project-website
ResidualAttentionBlock
false
17,315
[ "MIT" ]
5
b3861eeeca11a7c31502f539ded9ae718f3d9e2e
https://github.com/GastonMazzei/escher-project-website/tree/b3861eeeca11a7c31502f539ded9ae718f3d9e2e
import math import torch import torch as th import torch.nn as nn class LayerNorm(nn.LayerNorm): """ Implementation that supports fp16 inputs but fp32 gains/biases. """ def forward(self, x: 'th.Tensor'): return super().forward(x.float()) class QKVMultiheadAttention(nn.Module): def __in...
BasicBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): def __init__(self, inplanes, planes, droprate=0.2, attention=None): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, padding=1, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Galaxies99/alpha-protein
BasicBlock
false
17,316
[ "MIT" ]
4
db4b77ab48d5905ade5d4a66004f8387773718fa
https://github.com/Galaxies99/alpha-protein/tree/db4b77ab48d5905ade5d4a66004f8387773718fa
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, inplanes, planes, droprate=0.2, attention=None): super().__init__() self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, padding=1, bias=False) self.in1 = nn.Instan...
SpaceToDepth
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class SpaceToDepth(nn.Module): def __init__(self, block_size=4): super().__init__() assert block_size == 4 self.bs = block_size def forward(self, x): N, C, H, W ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed assert_size_stride = torch._C._dynamo....
GuillaumeAI/gia-labeling-ImageNet21K
SpaceToDepth
false
17,317
[ "MIT" ]
4
825ff49f1558f848fc8a798e2e393b708e75bb0e
https://github.com/GuillaumeAI/gia-labeling-ImageNet21K/tree/825ff49f1558f848fc8a798e2e393b708e75bb0e
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): def __init__(self, block_size=4): super().__init__() assert block_size == 4 self.bs = block_size def forward(self, x): N, C, H, W = x.siz...
PA
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class PA(nn.Module): def __init__(self, dim): super().__init__() self.pa_conv = nn.Conv2d(dim, dim, 3, 1, 1, groups=dim) def forward(self, x): return x * self.pa_conv(x).sigmoid() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Genevievekim/segformer
PA
false
17,318
[ "MIT" ]
10
4a0800746ade51101ec2573c683b06eccadb9683
https://github.com/Genevievekim/segformer/tree/4a0800746ade51101ec2573c683b06eccadb9683
import torch from torch import nn class Model(nn.Module): def __init__(self, dim): super().__init__() self.pa_conv = nn.Conv2d(dim, dim, 3, 1, 1, groups=dim) def forward(self, x): return x * self.pa_conv(x).sigmoid() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get...
DilatedBasicBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class DilatedBasicBlock(nn.Module): def __init__(self, inplanes, planes, kernel_size=3, dilation=1): super(DilatedBasicBlock, self).__init__() padding_size = kernel_size + (kernel_size - 1) * (dilation - 1) - 1 assert padding_size % 2 == 0 paddin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Galaxies99/alpha-protein
DilatedBasicBlock
false
17,319
[ "MIT" ]
4
db4b77ab48d5905ade5d4a66004f8387773718fa
https://github.com/Galaxies99/alpha-protein/tree/db4b77ab48d5905ade5d4a66004f8387773718fa
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, inplanes, planes, kernel_size=3, dilation=1): super().__init__() padding_size = kernel_size + (kernel_size - 1) * (dilation - 1) - 1 assert padding_size % 2 == 0 padding_size = int(padding_size / 2) ...
ConvLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, norm ='instance'): super().__init__() padding_size = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(padding_size) self.conv_layer = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Gradient-PG/live-nst
ConvLayer
false
17,320
[ "MIT" ]
5
02244172646375ff4a4a417bc8220064fadae5a9
https://github.com/Gradient-PG/live-nst/tree/02244172646375ff4a4a417bc8220064fadae5a9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, norm ='instance'): super().__init__() padding_size = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(padding_size) self.conv_layer = nn.C...
Bottleneck
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Bottleneck(nn.Module): def __init__(self, inplanes, planes, droprate=0.2, attention=None): super(Bottleneck, self).__init__() self.conv1 = nn.Conv2d(inplanes, inplanes, kernel_size=1, stride=1, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Galaxies99/alpha-protein
Bottleneck
false
17,321
[ "MIT" ]
4
db4b77ab48d5905ade5d4a66004f8387773718fa
https://github.com/Galaxies99/alpha-protein/tree/db4b77ab48d5905ade5d4a66004f8387773718fa
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, inplanes, planes, droprate=0.2, attention=None): super().__init__() self.conv1 = nn.Conv2d(inplanes, inplanes, kernel_size=1, stride=1, bias=False) self.in1 = nn.Insta...
DECModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from typing import Optional from torch.nn import Parameter class DECModule(nn.Module): def __init__(self, cluster_number: 'int', embedding_dimension: 'int', alpha: 'float'=1.0, cluster_centers: 'Optional[torch.Tensor]'=None ) ->None: """ Module to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from typing import Optional from torch.nn import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_str...
Guanzhou-Ke/conan
DECModule
false
17,322
[ "MIT" ]
5
5eb0a051e3a2893a12fe690ac443471abbcd1ee3
https://github.com/Guanzhou-Ke/conan/tree/5eb0a051e3a2893a12fe690ac443471abbcd1ee3
import torch from torch import nn from typing import Optional from torch.nn import Parameter class Model(nn.Module): def __init__(self, cluster_number: 'int', embedding_dimension: 'int', alpha: 'float'=1.0, cluster_centers: 'Optional[torch.Tensor]'=None ) ->None: """ Module to han...
SEModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class FastAvgPool2d(nn.Module): def __init__(self, flatten=False): super(FastAvgPool2d, self).__init__() self.flatten = flatten def forward(self, x): if self.flatten: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
GuillaumeAI/gia-labeling-ImageNet21K
SEModule
false
17,323
[ "MIT" ]
4
825ff49f1558f848fc8a798e2e393b708e75bb0e
https://github.com/GuillaumeAI/gia-labeling-ImageNet21K/tree/825ff49f1558f848fc8a798e2e393b708e75bb0e
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class FastAvgPool2d(nn.Module): def __init__(self, flatten=False): super().__init__() self.flatten = flatten def forward(self, x): if self.flatten: in_size =...
FSM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class FSM(nn.Module): def __init__(self, c1, c2): super().__init__() self.conv_atten = nn.Conv2d(c1, c1, 1, bias=False) self.conv = nn.Conv2d(c1, c2, 1, bias=False) def forward(self, x: 'T...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Genevievekim/segformer
FSM
false
17,324
[ "MIT" ]
10
4a0800746ade51101ec2573c683b06eccadb9683
https://github.com/Genevievekim/segformer/tree/4a0800746ade51101ec2573c683b06eccadb9683
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, c1, c2): super().__init__() self.conv_atten = nn.Conv2d(c1, c1, 1, bias=False) self.conv = nn.Conv2d(c1, c2, 1, bias=False) def forward(self, x: ...
Downsample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor from torch import nn class Downsample(nn.Module): """Downsample transition stage""" def __init__(self, c1, c2): super().__init__() self.proj = nn.Conv2d(c1, c2, 3, 2, 1) def forward(self, x: 'Tensor') ->Tensor: x = x.permute(0, 3, 1, 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Genevievekim/segformer
Downsample
false
17,325
[ "MIT" ]
10
4a0800746ade51101ec2573c683b06eccadb9683
https://github.com/Genevievekim/segformer/tree/4a0800746ade51101ec2573c683b06eccadb9683
import torch from torch import Tensor from torch import nn class Model(nn.Module): """Downsample transition stage""" def __init__(self, c1, c2): super().__init__() self.proj = nn.Conv2d(c1, c2, 3, 2, 1) def forward(self, x: 'Tensor') ->Tensor: x = x.permute(0, 3, 1, 2) x ...
MLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor from torch import nn class MLP(nn.Module): def __init__(self, dim, embed_dim): super().__init__() self.proj = nn.Linear(dim, embed_dim) def forward(self, x: 'Tensor') ->Tensor: x = x.flatten(2).transpose(1, 2) x = self.proj(x) ret...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Genevievekim/segformer
MLP
false
17,326
[ "MIT" ]
10
4a0800746ade51101ec2573c683b06eccadb9683
https://github.com/Genevievekim/segformer/tree/4a0800746ade51101ec2573c683b06eccadb9683
import torch from torch import Tensor from torch import nn class Model(nn.Module): def __init__(self, dim, embed_dim): super().__init__() self.proj = nn.Linear(dim, embed_dim) def forward(self, x: 'Tensor') ->Tensor: x = x.flatten(2).transpose(1, 2) x = self.proj(x) r...
Join
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.random class Join(torch.nn.Module): """Join layer """ def forward(self, unary: 'torch.Tensor', binary: 'torch.Tensor', index1: 'torch.Tensor', index2: 'torch.Tensor'): """Join the unary and binary tensors. :param unary: [u, |U|] the tensor with unary pred...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.random assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stri...
HEmile/KENN-PyTorch
Join
false
17,327
[ "BSD-3-Clause" ]
5
e39386f298587ab70ecea88180121ef8cf6ff9bc
https://github.com/HEmile/KENN-PyTorch/tree/e39386f298587ab70ecea88180121ef8cf6ff9bc
import torch import torch.random class Model(torch.nn.Module): """Join layer """ def forward(self, unary: 'torch.Tensor', binary: 'torch.Tensor', index1: 'torch.Tensor', index2: 'torch.Tensor'): """Join the unary and binary tensors. :param unary: [u, |U|] the tensor with unary pre...
VGG11
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F class VGG11(nn.Module): def __init__(self, num_classes=10, out_ch_conv1=17, out_ch_conv2=27, out_ch_conv3=39, out_ch_conv4=35, out_ch_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
FujitsuLaboratories/CAC
VGG11
false
17,328
[ "Apache-2.0" ]
8
d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
https://github.com/FujitsuLaboratories/CAC/tree/d12df8e47f61eaf7d7b0ed355e2d1aa296453f86
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_classes=10, out_ch_conv1=17, out_ch_conv2=27, out_ch_conv3=39, out_ch_conv4=35, out_ch_...
Sin
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class Sin(nn.Module): """An element-wise sin activation wrapped as a nn.Module. Shape: - Input: `(N, *)` where `*` means, any number of additional dimensions - Output: `(N, *)`, same shape as the input Examples: >>> m = Sin() >>> input = torch.randn(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
HJReachability/safety_rl
Sin
false
17,329
[ "BSD-3-Clause" ]
5
00b441b41cea2a5062ffdc4ac30903b51364c2f9
https://github.com/HJReachability/safety_rl/tree/00b441b41cea2a5062ffdc4ac30903b51364c2f9
import torch from torch import nn class Model(nn.Module): """An element-wise sin activation wrapped as a nn.Module. Shape: - Input: `(N, *)` where `*` means, any number of additional dimensions - Output: `(N, *)`, same shape as the input Examples: >>> m = Sin() >>> input = torch.rand...
Standard
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn.functional import softmax from torch.nn import Linear from torch.nn import Dropout import torch.random class Standard(torch.nn.Module): def __init__(self, in_features: 'int'): super().__init__() self.h1 = Linear(in_features, 50) self.d1 = Dropout() self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HEmile/KENN-PyTorch
Standard
false
17,330
[ "BSD-3-Clause" ]
5
e39386f298587ab70ecea88180121ef8cf6ff9bc
https://github.com/HEmile/KENN-PyTorch/tree/e39386f298587ab70ecea88180121ef8cf6ff9bc
import torch from torch.nn.functional import softmax from torch.nn import Linear from torch.nn import Dropout import torch.random class Model(torch.nn.Module): def __init__(self, in_features: 'int'): super().__init__() self.h1 = Linear(in_features, 50) self.d1 = Dropout() self.h2 ...
ConcatCell
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch as th import torch.nn as nn class ConcatCell(nn.Module): def __init__(self, input_dim): super(ConcatCell, self).__init__() self.input_dim = input_dim def forward(self, x1, x2): return th.cat([x1, x2], dim=-1) def get_output_dim(self): return sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
HKUST-KnowComp/DisCOC
ConcatCell
false
17,331
[ "MIT" ]
4
d9e10d4938ef485254551fdb6c1a36eb31a26cfd
https://github.com/HKUST-KnowComp/DisCOC/tree/d9e10d4938ef485254551fdb6c1a36eb31a26cfd
import torch import torch as th import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim): super().__init__() self.input_dim = input_dim def forward(self, x1, x2): return th.cat([x1, x2], dim=-1) def get_output_dim(self): return self.input_dim * 2 def...
ZeroPad1d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class ZeroPad1d(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left = pad_left self.p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler assert_size_str...
GT-SALT/FormalityStyleTransfer
ZeroPad1d
false
17,332
[ "MIT" ]
8
a86d287d0c48238f7cd39f6f34b465b0b7ccb2f4
https://github.com/GT-SALT/FormalityStyleTransfer/tree/a86d287d0c48238f7cd39f6f34b465b0b7ccb2f4
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Model(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left = pad_left self.pad_r...
ResidualLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, norm ='instance'): super().__init__() padding_size = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(padding_size) self.conv_layer = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Gradient-PG/live-nst
ResidualLayer
false
17,333
[ "MIT" ]
5
02244172646375ff4a4a417bc8220064fadae5a9
https://github.com/Gradient-PG/live-nst/tree/02244172646375ff4a4a417bc8220064fadae5a9
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, norm ='instance'): super().__init__() padding_size = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(padding_size) self.conv_layer = ...
GlobalNonLocal
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class GlobalNonLocal(nn.Module): def __init__(self, in_channel=64): super(GlobalNonLocal, self).__init__() assert in_channel % 2 == 0 self.hidden_channel = in_channel // 2 self.theta = nn.Conv2d(in_channel, self.hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Galaxies99/alpha-protein
GlobalNonLocal
false
17,334
[ "MIT" ]
4
db4b77ab48d5905ade5d4a66004f8387773718fa
https://github.com/Galaxies99/alpha-protein/tree/db4b77ab48d5905ade5d4a66004f8387773718fa
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channel=64): super().__init__() assert in_channel % 2 == 0 self.hidden_channel = in_channel // 2 self.theta = nn.Conv2d(in_channel, self.hidden_channel, kernel_size ...
Fp32GroupNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Fp32GroupNorm(nn.GroupNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, input)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data import torch.onnx.operators impor...
GT-SALT/FormalityStyleTransfer
Fp32GroupNorm
false
17,335
[ "MIT" ]
8
a86d287d0c48238f7cd39f6f34b465b0b7ccb2f4
https://github.com/GT-SALT/FormalityStyleTransfer/tree/a86d287d0c48238f7cd39f6f34b465b0b7ccb2f4
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Model(nn.GroupNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, input): ...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class DiceLoss(nn.Module): def __init__(self, eps=1e-07): super(DiceLoss, self).__init__() self.eps = eps def forward(self, pred, target): pred = torch.sigmoid(pred) intersection = (pred * target).sum() loss = 1 - 2.0 * intersection /...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
ForrestPi/semanticSegmentation
DiceLoss
false
17,336
[ "MIT" ]
7
1e5519279e2a9574f09eaf91439138b74b0f860c
https://github.com/ForrestPi/semanticSegmentation/tree/1e5519279e2a9574f09eaf91439138b74b0f860c
import torch from torch import nn class Model(nn.Module): def __init__(self, eps=1e-07): super().__init__() self.eps = eps def forward(self, pred, target): pred = torch.sigmoid(pred) intersection = (pred * target).sum() loss = 1 - 2.0 * intersection / (pred.sum() + ta...
EncoderBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class MlpBlock(nn.Module): def __init__(self, in_dim, mlp_dim, out_dim, dropout_rate=0.1): super(MlpBlock, self).__init__() self.fc1 = nn.Linear(in_dim, mlp_dim) self.fc2 = nn.Linear(mlp_dim, out_dim) self.act = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Graeme22/VisionTransformer-Pytorch
EncoderBlock
false
17,337
[ "Apache-2.0" ]
5
4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
https://github.com/Graeme22/VisionTransformer-Pytorch/tree/4e8abecf27e92dffd8d00f3d9b5ad4a21079cd0e
import torch from torch import nn import torch.nn.functional as F class MlpBlock(nn.Module): def __init__(self, in_dim, mlp_dim, out_dim, dropout_rate=0.1): super().__init__() self.fc1 = nn.Linear(in_dim, mlp_dim) self.fc2 = nn.Linear(mlp_dim, out_dim) self.act = nn.GELU() ...
TorchDense
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class TorchDense(nn.Module): def __init__(self, state_shape, action_size: 'int'): super(TorchDense, self).__init__() input_size_flatten = self.num_flat_features(state_shape) self.flatten = nn.Flatten(start_dim=1, end_dim=-1) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
Hadjubuntu/sweet-rl
TorchDense
false
17,338
[ "MIT" ]
3
f0dedadf8a7187e9b9b70436f05c637960fd72a7
https://github.com/Hadjubuntu/sweet-rl/tree/f0dedadf8a7187e9b9b70436f05c637960fd72a7
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, state_shape, action_size: 'int'): super().__init__() input_size_flatten = self.num_flat_features(state_shape) self.flatten = nn.Flatten(start_dim=1, end_dim=-1) self.h1 = nn.Linear(inp...
LayerNormConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torchvision.transforms import * import torch.nn import torch import torch.nn as nn class LayerNormConv2d(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super().__init__() self.num_features = num_features self.affine = affine self.eps = eps ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torchvision.transforms import * import torch.nn import torch import torch....
COMHTVM/lensless
LayerNormConv2d
false
17,339
[ "MIT" ]
6
0d67a310bab08551d7422fa792f3422a7ee7d9cb
https://github.com/COMHTVM/lensless/tree/0d67a310bab08551d7422fa792f3422a7ee7d9cb
import torch from torchvision.transforms import * import torch.nn import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super().__init__() self.num_features = num_features self.affine = affine self.eps = eps if...
GradientLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class GradientLoss(nn.Module): """ L1 loss on the gradient of the picture """ def __init__(self): super(GradientLoss, self).__init__() def forward(self, a): gradient_a_x = torch.abs(a[:, :, :, :-1] - a[:, :, :, 1:]) gradient_a_y = torch.a...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
GuYuanjie/Deep-Retinex-fusion
GradientLoss
false
17,340
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch from torch import nn class Model(nn.Module): """ L1 loss on the gradient of the picture """ def __init__(self): super().__init__() def forward(self, a): gradient_a_x = torch.abs(a[:, :, :, :-1] - a[:, :, :, 1:]) gradient_a_y = torch.abs(a[:, :, :-1, :] - a[:,...
BCEWithLogitsLossWithOHEM
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class BCEWithLogitsLossWithOHEM(nn.Module): def __init__(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
ForrestPi/semanticSegmentation
BCEWithLogitsLossWithOHEM
false
17,341
[ "MIT" ]
7
1e5519279e2a9574f09eaf91439138b74b0f860c
https://github.com/ForrestPi/semanticSegmentation/tree/1e5519279e2a9574f09eaf91439138b74b0f860c
import torch from torch import nn def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class Model(nn.Module): def __init__(self, ohem_ratio=1.0, pos_...
GrayscaleLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class GrayscaleLayer(nn.Module): def __init__(self): super(GrayscaleLayer, self).__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) class GrayscaleLoss(nn.Module): def __init__(self): super(GrayscaleLoss, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GuYuanjie/Deep-Retinex-fusion
GrayscaleLoss
false
17,342
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch from torch import nn class GrayscaleLayer(nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) class Model(nn.Module): def __init__(self): super().__init__() self.gray_scale = GrayscaleLayer() ...
GenNoise
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class GenNoise(nn.Module): def __init__(self, dim2): super(GenNoise, self).__init__() self.dim2 = dim2 def forward(self, x): a = list(x.size()) a[1] = self.dim2 b = torch.zeros(a).type_as(x.data) b.normal_() x = torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GuYuanjie/Deep-Retinex-fusion
GenNoise
false
17,343
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch from torch import nn class Model(nn.Module): def __init__(self, dim2): super().__init__() self.dim2 = dim2 def forward(self, x): a = list(x.size()) a[1] = self.dim2 b = torch.zeros(a).type_as(x.data) b.normal_() x = torch.autograd.Variable...
CrossEntropyLossWithOHEM
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class CrossEntropyLossWithOHEM(nn.Module): def __init__(self, o...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
ForrestPi/semanticSegmentation
CrossEntropyLossWithOHEM
false
17,344
[ "MIT" ]
7
1e5519279e2a9574f09eaf91439138b74b0f860c
https://github.com/ForrestPi/semanticSegmentation/tree/1e5519279e2a9574f09eaf91439138b74b0f860c
import torch from torch import nn def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class Model(nn.Module): def __init__(self, ohem_ratio=1.0, weig...
SoftCrossEntropyLossWithOHEM
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class SoftCrossEntropyLossWithOHEM(n...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
ForrestPi/semanticSegmentation
SoftCrossEntropyLossWithOHEM
false
17,345
[ "MIT" ]
7
1e5519279e2a9574f09eaf91439138b74b0f860c
https://github.com/ForrestPi/semanticSegmentation/tree/1e5519279e2a9574f09eaf91439138b74b0f860c
import torch from torch import nn import torch.nn.functional as F def _ohem_mask(loss, ohem_ratio): with torch.no_grad(): values, _ = torch.topk(loss.reshape(-1), int(loss.nelement() * ohem_ratio)) mask = loss >= values[-1] return mask.float() class Model(nn.Module): def __i...
GrayscaleLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class GrayscaleLayer(nn.Module): def __init__(self): super(GrayscaleLayer, self).__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GuYuanjie/Deep-Retinex-fusion
GrayscaleLayer
false
17,346
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
MultiAttributeLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F class MultiAttributeLoss(torch.nn.Module): def __init__(self): super(MultiAttributeLoss, self).__init__() def forward(self, input, target): product = 1 count = len(input) for i in range(count): attribute_loss = F.cross_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
GregoryEHunter/generalization_to_OOD_category_viewpoint_combinations
MultiAttributeLoss
false
17,347
[ "MIT" ]
10
52aacbb3420639cae64ce65085c17b245e5ef865
https://github.com/GregoryEHunter/generalization_to_OOD_category_viewpoint_combinations/tree/52aacbb3420639cae64ce65085c17b245e5ef865
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, input, target): product = 1 count = len(input) for i in range(count): attribute_loss = F.cross_entropy(input[i], target[i]) ...
NonBlurryLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class NonBlurryLoss(nn.Module): def __init__(self): """ Loss on the distance to 0.5 """ super(NonBlurryLoss, self).__init__() self.mse = nn.MSELoss() def forward(self, x): return 1 - self.mse(x, torch.ones_like(x) * 0.5) def...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
GuYuanjie/Deep-Retinex-fusion
NonBlurryLoss
false
17,348
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch from torch import nn class Model(nn.Module): def __init__(self): """ Loss on the distance to 0.5 """ super().__init__() self.mse = nn.MSELoss() def forward(self, x): return 1 - self.mse(x, torch.ones_like(x) * 0.5) def get_inputs(): return [...
GrayLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class GrayLoss(nn.Module): def __init__(self): super(GrayLoss, self).__init__() self.l1 = nn.L1Loss() def forward(self, x): y = torch.ones_like(x) / 2.0 return 1 / self.l1(x, y) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
GuYuanjie/Deep-Retinex-fusion
GrayLoss
false
17,349
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() self.l1 = nn.L1Loss() def forward(self, x): y = torch.ones_like(x) / 2.0 return 1 / self.l1(x, y) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs()...
FixedBlurLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn.functional as F from torch import nn class FixedBlurLayer(nn.Module): def __init__(self, kernel): super(FixedBlurLayer, self).__init__() self.kernel = kernel to_pad_x = int((self.kernel.shape[0] - 1) / 2) to_pad_y = int((self.kernel....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
GuYuanjie/Deep-Retinex-fusion
FixedBlurLayer
false
17,350
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch import numpy as np import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, kernel): super().__init__() self.kernel = kernel to_pad_x = int((self.kernel.shape[0] - 1) / 2) to_pad_y = int((self.kernel.shape[1] - 1) / 2) se...
NoiseNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn class NoiseNet(nn.Module): def __init__(self, channels=3, kernel_size=5): super(NoiseNet, self).__init__() self.kernel_size = kernel_size self.channels = channels to_pad = int((self.kernel_size - 1) / 2) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
GuYuanjie/Deep-Retinex-fusion
NoiseNet
false
17,351
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, channels=3, kernel_size=5): super().__init__() self.kernel_size = kernel_size self.channels = channels to_pad = int((self.kernel_size - 1) / 2) self.padder = nn.Ref...
VarianceLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn.functional as F from torch import nn class VarianceLayer(nn.Module): def __init__(self, patch_size=5, channels=1): self.patch_size = patch_size super(VarianceLayer, self).__init__() mean_mask = np.ones((channels, channels, patch_size, patch_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np from torch import nn assert_size_stride = torch._C._dynamo.gu...
GuYuanjie/Deep-Retinex-fusion
VarianceLayer
false
17,352
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch import numpy as np import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, patch_size=5, channels=1): self.patch_size = patch_size super().__init__() mean_mask = np.ones((channels, channels, patch_size, patch_size)) / ( patc...
CovarianceLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn.functional as F from torch import nn class CovarianceLayer(nn.Module): def __init__(self, patch_size=5, channels=1): self.patch_size = patch_size super(CovarianceLayer, self).__init__() mean_mask = np.ones((channels, channels, patch_size, pa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np from torch import nn assert_size_stride = torch._C._dynamo.gu...
GuYuanjie/Deep-Retinex-fusion
CovarianceLayer
false
17,353
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch import numpy as np import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, patch_size=5, channels=1): self.patch_size = patch_size super().__init__() mean_mask = np.ones((channels, channels, patch_size, patch_size)) / ( patc...
PAM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from typing import Union import torch.nn.functional as F from typing import Tuple from torch import nn from typing import Dict from typing import List def strip_param_name(param_name: 'str') ->str: """Input an module's param name, return it's origin name with out parent modules' name Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HAL-42/AlchemyCat
PAM
false
17,354
[ "Apache-2.0" ]
8
ca924755ff48e2ff74543bb0e446376eb2b1f150
https://github.com/HAL-42/AlchemyCat/tree/ca924755ff48e2ff74543bb0e446376eb2b1f150
import torch from typing import Union import torch.nn.functional as F from typing import Tuple from torch import nn from typing import Dict from typing import List def strip_param_name(param_name: 'str') ->str: """Input an module's param name, return it's origin name with out parent modules' name Args: ...
UpsamplerModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn class UpsamplerModel(nn.Module): def __init__(self, output_shape, factor): assert output_shape[0] % factor == 0 assert output_shape[1] % factor == 0 super(UpsamplerModel, self).__init__() self.output_shape = output_shape ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np from torch import nn assert_size_stride = torch._C._dynamo.guards.asse...
GuYuanjie/Deep-Retinex-fusion
UpsamplerModel
false
17,355
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch import numpy as np from torch import nn class Model(nn.Module): def __init__(self, output_shape, factor): assert output_shape[0] % factor == 0 assert output_shape[1] % factor == 0 super().__init__() self.output_shape = output_shape seed = np.ones((1, 1, output...
GeLU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch from torch import nn def gelu(x): return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) class GeLU(nn.Module): def __init__(self): super().__init__() def forward(self, x): return gelu(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from torch import nn assert_size_stride = torch._C._dynamo.guards.a...
HS-YN/PanoAVQA
GeLU
false
17,356
[ "MIT" ]
3
657b83421ce64ea18b3e79fb580afc7034403ccc
https://github.com/HS-YN/PanoAVQA/tree/657b83421ce64ea18b3e79fb580afc7034403ccc
import math import torch from torch import nn def gelu(x): return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return gelu(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init...
NLKProjection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class TwoLayerNet(nn.Module): def __init__(self, dim, hidden_dim, output_dim): super(TwoLayerNet, self).__init__() self.layer1 = nn.Linear(dim, hidden_dim) self.layer2 = nn.Linear(hidden_dim, output_dim) nn.init.xav...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
HKUST-KnowComp/EFO-1-QA-benchmark
NLKProjection
false
17,357
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
import torch from torch import nn import torch.nn.functional as F class TwoLayerNet(nn.Module): def __init__(self, dim, hidden_dim, output_dim): super().__init__() self.layer1 = nn.Linear(dim, hidden_dim) self.layer2 = nn.Linear(hidden_dim, output_dim) nn.init.xavier_uniform_(self...
NLKDifferenceCenter
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class NLKDifferenceCenter(nn.Module): def __init__(self, dim, hidden_dim): super(NLKDifferenceCenter, self).__init__() self.dim = dim self.hidden_dim = hidden_dim self.layer1 = nn.Linear(self.dim, self.hidden_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HKUST-KnowComp/EFO-1-QA-benchmark
NLKDifferenceCenter
false
17,358
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dim, hidden_dim): super().__init__() self.dim = dim self.hidden_dim = hidden_dim self.layer1 = nn.Linear(self.dim, self.hidden_dim) self.layer2 = nn.Linear(self.hid...
StdLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn from torch.nn import functional class GrayscaleLayer(nn.Module): def __init__(self): super(GrayscaleLayer, self).__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) class StdLoss(nn.Module): def __init__(self): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np from torch import nn assert_size_stride = torch._C._dynamo.gu...
GuYuanjie/Deep-Retinex-fusion
StdLoss
false
17,359
[ "MIT" ]
5
ffa2a1689fd512c8820fd87cbf665c09bcb142b4
https://github.com/GuYuanjie/Deep-Retinex-fusion/tree/ffa2a1689fd512c8820fd87cbf665c09bcb142b4
import torch import numpy as np from torch import nn from torch.nn import functional class GrayscaleLayer(nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.mean(x, 1, keepdim=True) class Model(nn.Module): def __init__(self): """ Loss...
CenterIntersection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class CenterIntersection(nn.Module): def __init__(self, dim): super(CenterIntersection, self).__init__() self.dim = dim self.layer1 = nn.Linear(self.dim, self.dim) self.layer2 = nn.Linear(self.dim, self.dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HKUST-KnowComp/EFO-1-QA-benchmark
CenterIntersection
false
17,360
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim self.layer1 = nn.Linear(self.dim, self.dim) self.layer2 = nn.Linear(self.dim, self.dim) nn.init.xavier_uniform_(self.layer1....
SkipBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class SkipBlock(nn.Module): def __init__(self, input_dim, output_dim, activation): """ Skip Connection for feed-forward block based on ResNet idea: Refer: - Youtube: https://www.youtube.com/watch?v=ZILIbUvp5lk ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
HareeshBahuleyan/size-fit-net
SkipBlock
false
17,361
[ "MIT" ]
8
2c5e10799b529f94748ccefc080d2af22f3e93d4
https://github.com/HareeshBahuleyan/size-fit-net/tree/2c5e10799b529f94748ccefc080d2af22f3e93d4
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim, activation): """ Skip Connection for feed-forward block based on ResNet idea: Refer: - Youtube: https://www.youtube.com/watch?v=ZILIbUvp5lk ...
Mean
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from typing import Optional from torch import nn class Mean(nn.Module): def __init__(self, dim: 'Optional[int]'=None, keepdim: 'bool'=False): super().__init__() self.dim = dim self.keepdim = keepdim def forward(self, input: 'torch.Tensor') ->torch.Tensor: return ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from typing import Optional from torch import nn assert_size_stride = torch._C._dynamo.gu...
HiroakiMikami/mlprogram
Mean
false
17,362
[ "MIT" ]
9
573e94c567064705fa65267dd83946bf183197de
https://github.com/HiroakiMikami/mlprogram/tree/573e94c567064705fa65267dd83946bf183197de
import torch from typing import Optional from torch import nn class Model(nn.Module): def __init__(self, dim: 'Optional[int]'=None, keepdim: 'bool'=False): super().__init__() self.dim = dim self.keepdim = keepdim def forward(self, input: 'torch.Tensor') ->torch.Tensor: return...
Highway
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class Highway(nn.Module): def __init__(self, input_size): super(Highway, self).__init__() self.fc1 = nn.Linear(input_size, input_size, bias=True) self.fc2 = nn.Linear(input_size, input_size, bias=True) self.sigmoid = nn.Sigmoid() self.relu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
HephaestusProject/pytorch-CharLM
Highway
false
17,363
[ "MIT" ]
4
ebe8b9a04c4ba4dcf78d1f2673edb90731a5f3ad
https://github.com/HephaestusProject/pytorch-CharLM/tree/ebe8b9a04c4ba4dcf78d1f2673edb90731a5f3ad
import torch from torch import nn class Model(nn.Module): def __init__(self, input_size): super().__init__() self.fc1 = nn.Linear(input_size, input_size, bias=True) self.fc2 = nn.Linear(input_size, input_size, bias=True) self.sigmoid = nn.Sigmoid() self.relu = nn.ReLU() ...
NLKDifferenceOffset
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class NLKDifferenceOffset(nn.Module): def __init__(self, dim, hidden_dim): super(NLKDifferenceOffset, self).__init__() self.dim = dim self.hidden_dim = hidden_dim self.layer1 = nn.Linear(self.dim, self.hidden_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HKUST-KnowComp/EFO-1-QA-benchmark
NLKDifferenceOffset
false
17,364
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dim, hidden_dim): super().__init__() self.dim = dim self.hidden_dim = hidden_dim self.layer1 = nn.Linear(self.dim, self.hidden_dim) self.layer2 = nn.Linear(self.hid...
MockModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class MockModule(nn.Module): def __init__(self, k: 'int'): super().__init__() self.p = nn.Parameter(torch.tensor(k, dtype=torch.float)) def forward(self, x, y=None): assert len(x.shape) == 2 out = x + self.p if y is not None: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
HiroakiMikami/mlprogram
MockModule
false
17,365
[ "MIT" ]
9
573e94c567064705fa65267dd83946bf183197de
https://github.com/HiroakiMikami/mlprogram/tree/573e94c567064705fa65267dd83946bf183197de
import torch from torch import nn class Model(nn.Module): def __init__(self, k: 'int'): super().__init__() self.p = nn.Parameter(torch.tensor(k, dtype=torch.float)) def forward(self, x, y=None): assert len(x.shape) == 2 out = x + self.p if y is not None: o...
LogicProjection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class LogicProjection(nn.Module): def __init__(self, entity_dim, relation_dim, hidden_dim, num_layers, bounded): super(LogicProjection, self).__init__() self.entity_dim = entity_dim self.relation_dim = relation_dim ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
HKUST-KnowComp/EFO-1-QA-benchmark
LogicProjection
false
17,366
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, entity_dim, relation_dim, hidden_dim, num_layers, bounded): super().__init__() self.entity_dim = entity_dim self.relation_dim = relation_dim self.hidden_dim = hidde...
ExponentialLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn.modules.loss import _Loss class ExponentialLoss(_Loss): def __init__(self): super(ExponentialLoss, self).__init__() self.mseCriterion = torch.nn.modules.MSELoss() def forward(self, img, ref): return self.mseCriterion(img, ref) + 0.005 * self.mseCriterion(to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules....
HMS-CardiacMR/MyoMapNet-Myocardial-Parametric-Mapping
ExponentialLoss
false
17,367
[ "MIT" ]
4
1e2dee8d6d1f97722eba91618462537faf9efba7
https://github.com/HMS-CardiacMR/MyoMapNet-Myocardial-Parametric-Mapping/tree/1e2dee8d6d1f97722eba91618462537faf9efba7
import torch from torch.nn.modules.loss import _Loss class Model(_Loss): def __init__(self): super().__init__() self.mseCriterion = torch.nn.modules.MSELoss() def forward(self, img, ref): return self.mseCriterion(img, ref) + 0.005 * self.mseCriterion(torch .exp(img), torc...
CNNLayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class CNNLayerNorm(nn.Module): """Layer normalization built for cnns input""" def __init__(self, n_feats): super(CNNLayerNorm, self).__init__() self.layer_norm = nn.LayerNorm(n_feats) def forward(self, x): x = x.transpose(2, 3).contiguous() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
HikaruHotta/M2M-VC-CycleGAN
CNNLayerNorm
false
17,368
[ "MIT" ]
5
a93b06221c787cc3e13b2d92fee728b811e5d526
https://github.com/HikaruHotta/M2M-VC-CycleGAN/tree/a93b06221c787cc3e13b2d92fee728b811e5d526
import torch import torch.nn as nn class Model(nn.Module): """Layer normalization built for cnns input""" def __init__(self, n_feats): super().__init__() self.layer_norm = nn.LayerNorm(n_feats) def forward(self, x): x = x.transpose(2, 3).contiguous() x = self.layer_norm(x...
BoxOffsetIntersection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class BoxOffsetIntersection(nn.Module): def __init__(self, dim): super(BoxOffsetIntersection, self).__init__() self.dim = dim self.layer1 = nn.Linear(self.dim, self.dim) self.layer2 = nn.Linear(self.dim, self.dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
HKUST-KnowComp/EFO-1-QA-benchmark
BoxOffsetIntersection
false
17,369
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim self.layer1 = nn.Linear(self.dim, self.dim) self.layer2 = nn.Linear(self.dim, self.dim) nn.init.xavier_uniform_(self.layer1....
MLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from typing import Optional from torch import nn from collections import OrderedDict class MLP(nn.Module): def __init__(self, in_channel: 'int', out_channel: 'int', hidden_channel: 'int', n_linear: 'int', activation: 'Optional[nn.Module]'=None): super().__init__() ass...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from typing import Optional f...
HiroakiMikami/mlprogram
MLP
false
17,370
[ "MIT" ]
9
573e94c567064705fa65267dd83946bf183197de
https://github.com/HiroakiMikami/mlprogram/tree/573e94c567064705fa65267dd83946bf183197de
import torch from typing import Optional from torch import nn from collections import OrderedDict class Model(nn.Module): def __init__(self, in_channel: 'int', out_channel: 'int', hidden_channel: 'int', n_linear: 'int', activation: 'Optional[nn.Module]'=None): super().__init__() a...
weighted_mse
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn.modules.loss import _Loss class weighted_mse(_Loss): def __init__(self): super(weighted_mse, self).__init__() def forward(self, input, output, weight): return torch.sum(weight * (input - output) ** 2) / input.numel() def get_inputs(): return [torch.rand([4, 4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.guards.asse...
HMS-CardiacMR/MyoMapNet-Myocardial-Parametric-Mapping
weighted_mse
false
17,371
[ "MIT" ]
4
1e2dee8d6d1f97722eba91618462537faf9efba7
https://github.com/HMS-CardiacMR/MyoMapNet-Myocardial-Parametric-Mapping/tree/1e2dee8d6d1f97722eba91618462537faf9efba7
import torch from torch.nn.modules.loss import _Loss class Model(_Loss): def __init__(self): super().__init__() def forward(self, input, output, weight): return torch.sum(weight * (input - output) ** 2) / input.numel() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, ...
ActLog
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ActLog(nn.Module): def __init__(self, eps=1e-06): super(ActLog, self).__init__() self.eps = eps def forward(self, x): return torch.log(torch.clamp(x, min=self.eps)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_input...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
High-East/BCI-ToolBox
ActLog
false
17,372
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, eps=1e-06): super().__init__() self.eps = eps def forward(self, x): return torch.log(torch.clamp(x, min=self.eps)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retu...
BetaIntersection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class BetaIntersection(nn.Module): def __init__(self, dim): super(BetaIntersection, self).__init__() self.dim = dim self.layer1 = nn.Linear(2 * self.dim, 2 * self.dim) self.layer2 = nn.Linear(2 * self.dim, self.dim)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HKUST-KnowComp/EFO-1-QA-benchmark
BetaIntersection
false
17,373
[ "MIT" ]
9
600fb02c76ab631f93ee362ceb789216ec085790
https://github.com/HKUST-KnowComp/EFO-1-QA-benchmark/tree/600fb02c76ab631f93ee362ceb789216ec085790
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim self.layer1 = nn.Linear(2 * self.dim, 2 * self.dim) self.layer2 = nn.Linear(2 * self.dim, self.dim) nn.init.xavier_uniform_(...
ActSquare
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ActSquare(nn.Module): def __init__(self): super(ActSquare, self).__init__() pass def forward(self, x): return torch.square(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
High-East/BCI-ToolBox
ActSquare
false
17,374
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() pass def forward(self, x): return torch.square(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Selection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Selection(nn.Module): """ Selection neurons to sample from a latent representation for a decoder agent. An abstract representation :math:`l_i` is disturbed by a value :math:`r_i` sampled from a normal standard distribution which is scaled by the selection neur...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
HendrikPN/reinforced_scinet
Selection
false
17,375
[ "Apache-2.0" ]
4
b57c9d1d997cc56647db4faa0690364e7039a5ee
https://github.com/HendrikPN/reinforced_scinet/tree/b57c9d1d997cc56647db4faa0690364e7039a5ee
import torch import torch.nn as nn class Model(nn.Module): """ Selection neurons to sample from a latent representation for a decoder agent. An abstract representation :math:`l_i` is disturbed by a value :math:`r_i` sampled from a normal standard distribution which is scaled by the selection neuron :...
MaxPoolStride1
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class MaxPoolStride1(nn.Module): def __init__(self, kernel_size): super(MaxPoolStride1, self).__init__() self.kernel_size = kernel_size self.pad = kernel_size - 1 def forward(self, x): padded_x = F.pad(x, (0, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
HongBeenKim/pams-skku
MaxPoolStride1
false
17,376
[ "MIT" ]
8
0a12b132e4bf42570b000f60b9a1fc2c65382174
https://github.com/HongBeenKim/pams-skku/tree/0a12b132e4bf42570b000f60b9a1fc2c65382174
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, kernel_size): super().__init__() self.kernel_size = kernel_size self.pad = kernel_size - 1 def forward(self, x): padded_x = F.pad(x, (0, self.pad, 0, self.pad), mode=...
LogVarLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class LogVarLayer(nn.Module): """ The log variance layer: calculates the log variance of the data along given 'dim' (natural logarithm) """ def __init__(self, dim): super(LogVarLayer, self).__init__() self.dim = dim def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
High-East/BCI-ToolBox
LogVarLayer
false
17,377
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
import torch import torch.nn as nn class Model(nn.Module): """ The log variance layer: calculates the log variance of the data along given 'dim' (natural logarithm) """ def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): return torch.log(t...
Conv2dWithConstraint
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Conv2dWithConstraint(nn.Conv2d): def __init__(self, *config, max_norm=1, **kwconfig): self.max_norm = max_norm super(Conv2dWithConstraint, self).__init__(*config, **kwconfig) def forward(self, x): self.weight.data = torch.renorm(self.weight.da...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
High-East/BCI-ToolBox
Conv2dWithConstraint
false
17,378
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
import torch import torch.nn as nn class Model(nn.Conv2d): def __init__(self, *config, max_norm=1, **kwconfig): self.max_norm = max_norm super().__init__(*config, **kwconfig) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=2, dim=0, maxnorm=self....
Gating
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class Gating(nn.Module): def __init__(self, in0_size: 'int', in1_size: 'int', query_size: 'int', hidden_size: 'int'): super(Gating, self).__init__() self.q = nn.Linear(in0_size, query_size, bias=False) self.w_k0 = nn.Linear(in0_size, query_size, b...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HiroakiMikami/mlprogram
Gating
false
17,379
[ "MIT" ]
9
573e94c567064705fa65267dd83946bf183197de
https://github.com/HiroakiMikami/mlprogram/tree/573e94c567064705fa65267dd83946bf183197de
import torch from torch import nn class Model(nn.Module): def __init__(self, in0_size: 'int', in1_size: 'int', query_size: 'int', hidden_size: 'int'): super().__init__() self.q = nn.Linear(in0_size, query_size, bias=False) self.w_k0 = nn.Linear(in0_size, query_size, bias=False) ...
LinearWithConstraint
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class LinearWithConstraint(nn.Linear): def __init__(self, *config, max_norm=1, **kwconfig): self.max_norm = max_norm super(LinearWithConstraint, self).__init__(*config, **kwconfig) def forward(self, x): self.weight.data = torch.renorm(self.weight.da...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
High-East/BCI-ToolBox
LinearWithConstraint
false
17,380
[ "MIT" ]
10
57015ae5fd008e8636889b9afba49c64c3a35ff3
https://github.com/High-East/BCI-ToolBox/tree/57015ae5fd008e8636889b9afba49c64c3a35ff3
import torch import torch.nn as nn class Model(nn.Linear): def __init__(self, *config, max_norm=1, **kwconfig): self.max_norm = max_norm super().__init__(*config, **kwconfig) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=2, dim=0, maxnorm=self....
L2Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from random import * class L2Norm(nn.Module): def __init__(self, n_channels, scale=1.0): super(L2Norm, self).__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(torch.Tensor(self.n_channe...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from random import * assert_size_stride = torch._C._dynam...
Hoclor/CoSADUV-Contextual-Saliency-for-Detecting-Anomalies-in-UAV-Video
L2Norm
false
17,381
[ "MIT" ]
4
674b72af15ba8833317b8daa9d1e614ea63151c1
https://github.com/Hoclor/CoSADUV-Contextual-Saliency-for-Detecting-Anomalies-in-UAV-Video/tree/674b72af15ba8833317b8daa9d1e614ea63151c1
import torch import torch.nn as nn from random import * class Model(nn.Module): def __init__(self, n_channels, scale=1.0): super().__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(torch.Tensor(self.n_channels)) ...