entry_point
stringlengths
1
65
original_triton_python_code
stringlengths
208
619k
optimised_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
cnn_7layer_alt
import torch import torch.nn as nn import torch.nn.functional as F class cnn_7layer_alt(nn.Module): def __init__(self, in_ch, in_dim, width=2, linear_size=128): super(cnn_7layer_alt, self).__init__() self.conv1 = nn.Conv2d(in_ch, 4 * width, 3, stride=1, padding=1) self.conv2 = nn.Conv2d(4...
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 assert_...
mnmueller/auto_LiRPA
cnn_7layer_alt
false
7,278
[ "BSD-3-Clause" ]
1
55cb270b0b99f07b74541d55706c69fbb9daff66
https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66
Inception
import torch import torch.nn as nn class BasicConv2d(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, output_relu=True): super(BasicConv2d, self).__init__() self.conv = nn.Conv2d(in_planes, out_planes, kernel_size= kernel_size, stride=str...
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 assert_...
moh2236945/pytorch_classification
Inception
false
7,279
[ "MIT" ]
1
8816f08af327e06208b348a78d9c63c133b6a628
https://github.com/moh2236945/pytorch_classification/tree/8816f08af327e06208b348a78d9c63c133b6a628
SharedAgent
import torch import torch.nn.functional as F import torch.nn as nn class SharedAgent(torch.nn.Module): """ A simple two headed / chimera Actor Critic agent. The actor and critic share the body of the network. It is argued that this is because "good" actions correlate to visiting states with "larg...
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 assert_...
mpgussert/fundamentalRL
SharedAgent
false
7,280
[ "MIT" ]
1
4f45436226e0823c21cac316dec8bbf1df697467
https://github.com/mpgussert/fundamentalRL/tree/4f45436226e0823c21cac316dec8bbf1df697467
BoundNot
from _paritybench_helpers import _mock_config import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.nn import MSELoss def isnan(x): if isinstance(x, Patches): return False return torch.isnan(x).any() class Perturbation: 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 import math import numpy as np import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.assert_siz...
mnmueller/auto_LiRPA
BoundNot
false
7,281
[ "BSD-3-Clause" ]
1
55cb270b0b99f07b74541d55706c69fbb9daff66
https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66
Net5
import torch from torch import nn from torch.nn.init import kaiming_normal from torch.nn.init import normal def weights_init(m): if isinstance(m, (nn.Conv1d, nn.Linear)): kaiming_normal(m.weight.data) try: kaiming_normal(m.bias.data) except ValueError: normal(m.bias...
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 from tor...
moritzschaefer/pavooc
Net5
false
7,282
[ "MIT" ]
1
735f5455f9a95a5734436a24e2aa92cf600c91af
https://github.com/moritzschaefer/pavooc/tree/735f5455f9a95a5734436a24e2aa92cf600c91af
Net4
import torch from torch import nn from torch.nn.init import kaiming_normal from torch.nn.init import normal def weights_init(m): if isinstance(m, (nn.Conv1d, nn.Linear)): kaiming_normal(m.weight.data) try: kaiming_normal(m.bias.data) except ValueError: normal(m.bias...
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 from tor...
moritzschaefer/pavooc
Net4
false
7,283
[ "MIT" ]
1
735f5455f9a95a5734436a24e2aa92cf600c91af
https://github.com/moritzschaefer/pavooc/tree/735f5455f9a95a5734436a24e2aa92cf600c91af
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
import torch import torch.nn import torch.onnx class NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency(torch .nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency , 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 import torch.nn import torch....
mrshu/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
false
7,284
[ "MIT" ]
1
335edaa2c485ba0dec877bf4cdbd652e2d5d105c
https://github.com/mrshu/onnxruntime/tree/335edaa2c485ba0dec877bf4cdbd652e2d5d105c
NIN
import string import torch import numpy as np import torch.utils.data import torch import torch.nn as nn def _einsum(a, b, c, x, y): einsum_str = '{},{}->{}'.format(''.join(a), ''.join(b), ''.join(c)) return torch.einsum(einsum_str, x, y) def contract_inner(x, y): """tensordot(x, y, 1).""" x_chars =...
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 string import numpy as np import torch.utils.data import torch import tor...
mrjavoman/Image-Super-Resolution-via-Iterative-Refinement
NIN
false
7,285
[ "Apache-2.0" ]
1
2eb11d972e8e024c3b1d7a84f90895e329b5b408
https://github.com/mrjavoman/Image-Super-Resolution-via-Iterative-Refinement/tree/2eb11d972e8e024c3b1d7a84f90895e329b5b408
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency
import torch import torch.nn import torch.onnx class NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency(torch. nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency, 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 from torch._inductor.runtime import triton_helpers import torch.nn import torch....
mrshu/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency
false
7,286
[ "MIT" ]
1
335edaa2c485ba0dec877bf4cdbd652e2d5d105c
https://github.com/mrshu/onnxruntime/tree/335edaa2c485ba0dec877bf4cdbd652e2d5d105c
BoundReciprocal
from _paritybench_helpers import _mock_config import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.nn import MSELoss def isnan(x): if isinstance(x, Patches): return False return torch.isnan(x).any() class Perturbation: 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 import math import numpy as np import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.assert_siz...
mnmueller/auto_LiRPA
BoundReciprocal
false
7,287
[ "BSD-3-Clause" ]
1
55cb270b0b99f07b74541d55706c69fbb9daff66
https://github.com/mnmueller/auto_LiRPA/tree/55cb270b0b99f07b74541d55706c69fbb9daff66
WeightL1Loss
import torch import torch.nn as nn class WeightL1Loss(nn.Module): def __init__(self): super(WeightL1Loss, self).__init__() def forward(self, pred_loc, label_loc, loss_weight): b, _, sh, sw = pred_loc.size() pred_loc = pred_loc.view(b, 4, -1, sh, sw) diff = (pred_loc - label_l...
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 ...
mshmoon/siamrpn-lightweight
WeightL1Loss
false
7,288
[ "MIT" ]
1
f6527e34c9eaaeb45817b12babd78ee73b1c7525
https://github.com/mshmoon/siamrpn-lightweight/tree/f6527e34c9eaaeb45817b12babd78ee73b1c7525
Corr
import torch import torch.nn as nn import torch.nn.functional as F class Corr(nn.Module): def __init__(self): super(Corr, self).__init__() def forward(self, x, kernel): batch = kernel.size(0) channel = kernel.size(1) x = x.view(1, batch * channel, x.size(2), x.size(3)) ...
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...
mshmoon/siamrpn-lightweight
Corr
false
7,289
[ "MIT" ]
1
f6527e34c9eaaeb45817b12babd78ee73b1c7525
https://github.com/mshmoon/siamrpn-lightweight/tree/f6527e34c9eaaeb45817b12babd78ee73b1c7525
BernoulliLogProb
import torch import torch.nn as nn import torch.utils import torch.utils.data class BernoulliLogProb(nn.Module): def __init__(self): super().__init__() self.bce_with_logits = nn.BCEWithLogitsLoss(reduction='none') def forward(self, logits, target): return -self.bce_with_logits(logits...
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 import torc...
msunardi/vae_experiment
BernoulliLogProb
false
7,290
[ "MIT" ]
1
e3ce39e586f1189d157e753370a90c07713658b3
https://github.com/msunardi/vae_experiment/tree/e3ce39e586f1189d157e753370a90c07713658b3
LogSoftMax
import torch import torch.nn as nn import torch.nn.functional as F class LogSoftMax(nn.Module): def __init__(self): super(LogSoftMax, self).__init__() def forward(self, cls): b, a2, h, w = cls.size() cls = cls.view(b, 2, a2 // 2, h, w) cls = cls.permute(0, 2, 3, 4, 1).contigu...
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 ...
mshmoon/siamrpn-lightweight
LogSoftMax
false
7,291
[ "MIT" ]
1
f6527e34c9eaaeb45817b12babd78ee73b1c7525
https://github.com/mshmoon/siamrpn-lightweight/tree/f6527e34c9eaaeb45817b12babd78ee73b1c7525
DistillLoss
import torch from torch import nn import torch.nn.functional as F class DistillLoss(nn.Module): def __init__(self, temperature, distillation_weight): super().__init__() self.temperature = temperature self.distillation_weight = distillation_weight self.kldiv = nn.KLDivLoss(reductio...
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 ...
mrtunguyen/knowledge_distillation
DistillLoss
false
7,292
[ "MIT" ]
1
dd114e980dbebda6cc247f658eb801ab948ee6ba
https://github.com/mrtunguyen/knowledge_distillation/tree/dd114e980dbebda6cc247f658eb801ab948ee6ba
LinRegModel
import torch import torch.nn as nn class LinRegModel(nn.Module): def __init__(self): super().__init__() self.a = nn.Parameter(torch.randn(1)) self.b = nn.Parameter(torch.randn(1)) def forward(self, x): return self.a * x + self.b def get_inputs(): return [torch.rand([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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
muellerzr/walk-with-deep-learning
LinRegModel
false
7,293
[ "Apache-2.0" ]
1
4adbf26da4885d122ed305eccef3efbb6fb10df5
https://github.com/muellerzr/walk-with-deep-learning/tree/4adbf26da4885d122ed305eccef3efbb6fb10df5
NormalLogProb
import torch import numpy as np import torch.nn as nn import torch.utils import torch.utils.data class NormalLogProb(nn.Module): def __init__(self): super().__init__() def forward(self, loc, scale, z): var = torch.pow(scale, 2) return -0.5 * torch.log(2 * np.pi * var) - torch.pow(z -...
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 import torch.utils import torch.utils.data assert_s...
msunardi/vae_experiment
NormalLogProb
false
7,294
[ "MIT" ]
1
e3ce39e586f1189d157e753370a90c07713658b3
https://github.com/msunardi/vae_experiment/tree/e3ce39e586f1189d157e753370a90c07713658b3
VGGNet
import torch import torch.nn as nn import torch.nn.functional as F class VGGNet(nn.Module): def __init__(self): super(VGGNet, self).__init__() self.conv1 = nn.Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) self.conv2 = nn.Conv2d(32, 32, kernel_size=(3, 3), st...
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 assert_...
miyosuda/oculomotor
VGGNet
false
7,295
[ "Apache-2.0" ]
1
78e7ec61a808d058116c69bff1ea71ecf117c126
https://github.com/miyosuda/oculomotor/tree/78e7ec61a808d058116c69bff1ea71ecf117c126
CNN
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class CNN(nn.Module): """ CNN for heat shock protein classification """ def __init__(self, model_cfg, in_channels, dropout_rate): super(CNN, self).__init__() self.embedder = model_cfg.embedder if self.emb...
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 assert_...
mswzeus/DeeperHSP
CNN
false
7,296
[ "MIT" ]
1
571387f048d3c33fcd78730fdaef57b6c44a27a7
https://github.com/mswzeus/DeeperHSP/tree/571387f048d3c33fcd78730fdaef57b6c44a27a7
BlendLinear
import torch import torch.nn as nn import torch.utils.data class BlendLinear(nn.Module): def __init__(self, dim_in, dim_out, layer_type=nn.Linear, **unused_kwargs): super(BlendLinear, self).__init__() self._layer0 = layer_type(dim_in, dim_out) self._layer1 = layer_type(dim_in, dim_out) ...
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.data assert_size_stride = torch._C._dyn...
musyoku/ffjord
BlendLinear
false
7,297
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
BlendConv2d
import torch import torch.nn as nn import torch.utils.data class BlendConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False, **unused_kwargs): super(BlendConv2d, self).__init__() module = nn.ConvTranspose2d if...
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.data assert_size_stride = torch._C._dyn...
musyoku/ffjord
BlendConv2d
false
7,298
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
GINPreTransition
import torch import typing import torch.nn as nn class MLP(nn.Module): def __init__(self, input_dim, hidden_sizes: 'typing.Iterable[int]', out_dim, activation_function=nn.Sigmoid(), activation_out=None): super(MLP, self).__init__() i_h_sizes = [input_dim] + hidden_sizes self.mlp =...
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 typing impor...
mtiezzi/gnn_site
GINPreTransition
false
7,299
[ "BSD-3-Clause" ]
1
79a13603db876ac24e66a152104faa8b76e1d8e7
https://github.com/mtiezzi/gnn_site/tree/79a13603db876ac24e66a152104faa8b76e1d8e7
ConcatSquashLinear
import torch import torch.nn as nn import torch.utils.data class ConcatSquashLinear(nn.Module): def __init__(self, dim_in, dim_out): super(ConcatSquashLinear, self).__init__() self._layer = nn.Linear(dim_in, dim_out) self._hyper_bias = nn.Linear(1, dim_out, bias=False) self._hyper...
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.data assert_size_stride = torch._C._dyn...
musyoku/ffjord
ConcatSquashLinear
false
7,300
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
ConcatSquashConv2d
import torch import torch.nn as nn import torch.utils.data class ConcatSquashConv2d(nn.Module): def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0, dilation=1, groups=1, bias=True, transpose=False): super(ConcatSquashConv2d, self).__init__() module = nn.ConvTranspose2d if tr...
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.data assert_size_stride = torch._C._dyn...
musyoku/ffjord
ConcatSquashConv2d
false
7,301
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
GatedConv
import torch import torch.nn as nn import torch.utils.data class GatedConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, groups=1): super(GatedConv, self).__init__() self.layer_f = nn.Conv2d(in_channels, out_channels, kernel_size, ...
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.data assert_size_stride = torch._C._dyn...
musyoku/ffjord
GatedConv
false
7,302
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
GatedConv2d
import torch import torch.nn as nn import torch.utils.data class GatedConv2d(nn.Module): def __init__(self, input_channels, output_channels, kernel_size, stride, padding, dilation=1, activation=None): super(GatedConv2d, self).__init__() self.activation = activation self.sigmoid = ...
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.data assert_size_stride = torch._C._dyn...
musyoku/ffjord
GatedConv2d
false
7,303
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
GatedConvTranspose
import torch import torch.nn as nn import torch.utils.data class GatedConvTranspose(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, output_padding=0, groups=1): super(GatedConvTranspose, self).__init__() self.layer_f = nn.ConvTranspose2d(in_chan...
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.data assert_size_stride = torch._C._dyn...
musyoku/ffjord
GatedConvTranspose
false
7,304
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
HyperConv2d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def weights_init(m): classname = m.__class__.__name__ if classname.find('Linear') != -1 or classname.find('Conv') != -1: nn.init.constant_(m.weight, 0) nn.init.normal_(m.bias, 0, 0.01) class HyperConv2...
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.nn.functional as F import torch.utils.data as...
musyoku/ffjord
HyperConv2d
false
7,305
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
BasicBlock
import torch import torch.nn as nn import torch.utils.data class BasicBlock(nn.Module): expansion = 1 def __init__(self, dim): super(BasicBlock, self).__init__() self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1, bias=False) self.bn1 = nn.GroupNorm(2, dim, eps=0.0001) ...
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....
musyoku/ffjord
BasicBlock
false
7,306
[ "MIT" ]
1
9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
https://github.com/musyoku/ffjord/tree/9e431e122e59fa9a71f3f301dec8fdd3db51e0ce
PNTrainingSigmoid
import torch from torch import nn class PNTrainingSigmoid(nn.Module): def __init__(self): super(PNTrainingSigmoid, self).__init__() return def forward(self, output_p, output_n, prior): cost = prior * torch.mean(torch.sigmoid(-output_p)) cost = cost + (1 - prior) * torch.mean(...
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...
mxuq/Imbalance-PU
PNTrainingSigmoid
false
7,307
[ "MIT" ]
1
fd4403b05f98ca6bc8156783e8275888d63f6435
https://github.com/mxuq/Imbalance-PU/tree/fd4403b05f98ca6bc8156783e8275888d63f6435
TwoWordPSDProbe
import torch import torch.nn as nn class Probe(nn.Module): pass class TwoWordPSDProbe(Probe): """ Computes squared L2 distance after projection by a matrix. For a batch of sentences, computes all n^2 pairs of distances for each sentence in the batch. """ def __init__(self, model_dim, probe_...
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...
muziyongshixin/pytorch_SSRP
TwoWordPSDProbe
false
7,308
[ "MIT" ]
1
e54b3098927ba2ff16bdc8f64f3a2bf46d1f72c5
https://github.com/muziyongshixin/pytorch_SSRP/tree/e54b3098927ba2ff16bdc8f64f3a2bf46d1f72c5
GroupPointWise
import torch import torch.nn as nn class GroupPointWise(nn.Module): def __init__(self, in_dim, n_heads=4, proj_factor=1, target_dim=None): super().__init__() if target_dim is not None: proj_ch = target_dim // proj_factor else: proj_ch = in_dim // proj_factor ...
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...
nachiket273/VisTrans
GroupPointWise
false
7,309
[ "MIT" ]
1
99129b02f275424ebff900189ec2055f26bb9912
https://github.com/nachiket273/VisTrans/tree/99129b02f275424ebff900189ec2055f26bb9912
Attention
import math import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='scaled_dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param 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 from torch._inductor.runtime....
n-log-n/ABSA-PyTorch
Attention
false
7,310
[ "MIT" ]
1
27b37e05954940fe37369cc679c080d1d8717362
https://github.com/n-log-n/ABSA-PyTorch/tree/27b37e05954940fe37369cc679c080d1d8717362
FitnetRegressor
import torch import torch.nn.functional as F class FitnetRegressor(torch.nn.Module): def __init__(self, in_feature, out_feature): super(FitnetRegressor, self).__init__() self.in_feature = in_feature self.out_feature = out_feature self.regressor = torch.nn.Conv2d(in_feature, out_fe...
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 assert_size_stride = torch._C...
naver-ai/cgl_fairness
FitnetRegressor
false
7,311
[ "MIT" ]
1
00d3bec233c9b3e0f88496118abaed8321ca3159
https://github.com/naver-ai/cgl_fairness/tree/00d3bec233c9b3e0f88496118abaed8321ca3159
ZeroOneTest
import torch from torch import nn class ZeroOneTest(nn.Module): def __init__(self): super(ZeroOneTest, self).__init__() return def forward(self, output_p, output_n, prior): cost = prior * torch.mean((1 - torch.sign(output_p)) / 2) cost = cost + (1 - prior) * torch.mean((1 + t...
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...
mxuq/Imbalance-PU
ZeroOneTest
false
7,312
[ "MIT" ]
1
fd4403b05f98ca6bc8156783e8275888d63f6435
https://github.com/mxuq/Imbalance-PU/tree/fd4403b05f98ca6bc8156783e8275888d63f6435
Landsat2ViirsNet
import torch from torch import nn from torch.nn import functional as F class Landsat2ViirsNet(nn.Module): def __init__(self, latent_dim=64, init_channels=8, kernel_size=4, image_in_channels=3, image_out_channels=1): super(Landsat2ViirsNet, self).__init__() self.enc1 = nn.Conv2d(in_channel...
import torch from torch import device 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...
mrmauer/detecting_poverty
Landsat2ViirsNet
false
7,313
[ "MIT" ]
1
2c8a28295264674f5bfe06ef1fed6dd8b898b8b5
https://github.com/mrmauer/detecting_poverty/tree/2c8a28295264674f5bfe06ef1fed6dd8b898b8b5
VertexDirectEmbedder
import torch import torch.utils.data from torch import nn def normalize_embeddings(embeddings: 'torch.Tensor', epsilon: 'float'=1e-06 ) ->torch.Tensor: """ Normalize N D-dimensional embedding vectors arranged in a tensor [N, D] Args: embeddings (tensor [N, D]): N D-dimensional embedding vecto...
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 import torch.utils.data from...
nationaldronesau/detectron2
VertexDirectEmbedder
false
7,314
[ "Apache-2.0" ]
1
6afaee60eb6e0032b5b2edfbec1179f7e7b7b75f
https://github.com/nationaldronesau/detectron2/tree/6afaee60eb6e0032b5b2edfbec1179f7e7b7b75f
xTanH
import torch import torch.nn class xTanH(torch.nn.Module): def forward(self, x: 'torch.Tensor'): return x - torch.tanh(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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride...
nayyarv/bayesnets
xTanH
false
7,315
[ "MIT" ]
1
090abd1a0a91c2b9d6d57a182ee5be1f65a22e11
https://github.com/nayyarv/bayesnets/tree/090abd1a0a91c2b9d6d57a182ee5be1f65a22e11
LRN
import torch import torch.nn as nn class LRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS= False): super(LRN, self).__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if self.ACROSS_CHANNELS: self.average = nn.AvgPool3d(kernel_size=...
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_...
nbswords/Paper-implemention-by-Pytorch
LRN
false
7,316
[ "MIT" ]
1
429514c4f51c41ec7b3013683fb79ad4b4ab4638
https://github.com/nbswords/Paper-implemention-by-Pytorch/tree/429514c4f51c41ec7b3013683fb79ad4b4ab4638
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F def focal_loss(input_values, gamma=10): """Computes the focal loss""" p = torch.exp(-input_values) loss = (1 - p) ** gamma * input_values return loss.mean() class FocalLoss(nn.Module): def __init__(self, weight=None, gamma=0.5):...
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 import torc...
naver-ai/cgl_fairness
FocalLoss
false
7,317
[ "MIT" ]
1
00d3bec233c9b3e0f88496118abaed8321ca3159
https://github.com/naver-ai/cgl_fairness/tree/00d3bec233c9b3e0f88496118abaed8321ca3159
MultiHeadSelfAttention
from _paritybench_helpers import _mock_config import math import torch import torch.distributed import torch.nn.functional as F import torch.nn as nn class MultiHeadSelfAttention(nn.Module): def __init__(self, config): super(MultiHeadSelfAttention, self).__init__() self.query = nn.Linear(config.h...
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....
myoons/image-gpt-pytorch
MultiHeadSelfAttention
false
7,318
[ "Apache-2.0" ]
1
d05081250d01ce208796dfb246ea1c9a093237c5
https://github.com/myoons/image-gpt-pytorch/tree/d05081250d01ce208796dfb246ea1c9a093237c5
Matcher
import math import torch import torch.nn as nn class Matcher(nn.Module): """ Matching between a pair of nodes to conduct link prediction. Use multi-head attention as matching model. """ def __init__(self, n_hid): super(Matcher, self).__init__() self.left_linear = nn.Linear...
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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
nchungvh/pyhgt
Matcher
false
7,319
[ "MIT" ]
1
3cb08ea856ca02aaf1664aa7486024a8742c7567
https://github.com/nchungvh/pyhgt/tree/3cb08ea856ca02aaf1664aa7486024a8742c7567
Q
import torch import torch.nn as nn import torch.nn.functional as F class Q(nn.Module): """ Simple fully connected Q function. Also used for skip-Q when concatenating behaviour action and state together. Used for simpler environments such as mountain-car or lunar-lander. """ def __init__(self, sta...
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 ...
ndangtt/LeadingOnesDAC
Q
false
7,320
[ "Apache-2.0" ]
1
953747d8702f179851d7973c65779a1f830e03a1
https://github.com/ndangtt/LeadingOnesDAC/tree/953747d8702f179851d7973c65779a1f830e03a1
DropoutModel8x8
import torch import torch.nn as nn import torch.nn.functional as func class DropoutModel8x8(nn.Module): def __init__(self, channel): """ Define useful layers Argument: channel: number of channel, or depth or number of different sprite types """ super(DropoutModel8x...
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 assert_...
mwxely/Cross-domain-PCGML-Level-Generator
DropoutModel8x8
false
7,321
[ "MIT" ]
1
baa5d214d6cf22272d144aa6c444a778ac202afe
https://github.com/mwxely/Cross-domain-PCGML-Level-Generator/tree/baa5d214d6cf22272d144aa6c444a778ac202afe
Attn
import torch import torch.nn as nn import torch.nn.functional as F from numpy import sqrt class Attn(nn.Module): def __init__(self, hidden_size, batch_first=True): super(Attn, self).__init__() self.hidden_size = hidden_size self.batch_first = batch_first self.weights = nn.Paramete...
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....
nauhc/biLSTM-many-to-one
Attn
false
7,322
[ "MIT" ]
1
14dab1c75b395c88bdddfe751461af7dc30e1166
https://github.com/nauhc/biLSTM-many-to-one/tree/14dab1c75b395c88bdddfe751461af7dc30e1166
VAE
import torch from torch import nn import torch.nn.functional as F class VAE(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(784, 400) self.fc21 = nn.Linear(400, 20) self.fc22 = nn.Linear(400, 20) self.fc3 = nn.Linear(20, 400) self.fc4 = nn.L...
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...
nd1511/argus
VAE
false
7,323
[ "MIT" ]
1
00aaed41ac1321d669ac7060f4d21b24cc3456f0
https://github.com/nd1511/argus/tree/00aaed41ac1321d669ac7060f4d21b24cc3456f0
GCN
from torch.nn import Module import math import torch from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.functional as F class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ 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....
negarhdr/PGCN
GCN
false
7,324
[ "MIT" ]
1
5143049afcfadc5ab0173e6083ebbb4fd8c8903d
https://github.com/negarhdr/PGCN/tree/5143049afcfadc5ab0173e6083ebbb4fd8c8903d
Perceptron
import torch import torch.nn as nn import torch.nn.functional as F class Perceptron(nn.Module): """Implements a 1-layer perceptron.""" def __init__(self, input_dimension, hidden_dimension, output_dimension): super(Perceptron, self).__init__() self._layer1 = nn.Linear(input_dimension, hidden_d...
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 assert_...
negotiatorvivian/SAT-Solver
Perceptron
false
7,325
[ "MIT" ]
1
acbf375ce73103e945aee3e2a225126684a19076
https://github.com/negotiatorvivian/SAT-Solver/tree/acbf375ce73103e945aee3e2a225126684a19076
PerceptronTanh
import torch import torch.nn as nn import torch.nn.functional as F class PerceptronTanh(nn.Module): """Implements a 1-layer perceptron with Tanh activaton.""" def __init__(self, input_dimension, hidden_dimension, output_dimension): super(PerceptronTanh, self).__init__() self._layer1 = nn.Line...
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....
negotiatorvivian/SAT-Solver
PerceptronTanh
false
7,326
[ "MIT" ]
1
acbf375ce73103e945aee3e2a225126684a19076
https://github.com/negotiatorvivian/SAT-Solver/tree/acbf375ce73103e945aee3e2a225126684a19076
ConfidentMSELoss
from torch.nn import Module import torch class ConfidentMSELoss(Module): def __init__(self, threshold=0.96): self.threshold = threshold super().__init__() def forward(self, input, target): n = input.size(0) conf_mask = torch.gt(target, self.threshold).float() input_fl...
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 import Module assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
neuropoly/medicaltorch
ConfidentMSELoss
false
7,327
[ "Apache-2.0" ]
1
ac129fe894cb1906285dfe380ba4f0aa3bdec787
https://github.com/neuropoly/medicaltorch/tree/ac129fe894cb1906285dfe380ba4f0aa3bdec787
Conv2
import math import torch import torch.nn as nn class Conv2(nn.Module): """ A convolution layer with the stride of 2. Input: x: (N, 2L+2, in_channels) numeric tensor global_cond: (N, global_cond_channels) numeric tensor Output: y: (N, L, out_channels) numeric te...
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 math import ...
neverix/voice-conv
Conv2
false
7,328
[ "MIT" ]
1
6df0053a59aa26318bdbc096dd312ecc55596ac0
https://github.com/neverix/voice-conv/tree/6df0053a59aa26318bdbc096dd312ecc55596ac0
Attention
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the query features from the decoder. .. math:: \\begin{array}{ll} x = context*query \\\\ attn_scores = exp(x_i) / sum_j exp(x_j) \\\\ ...
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....
nguyenxuanhoi2903/SRSF_summarization
Attention
false
7,329
[ "MIT" ]
1
3d19e6b7669e0b22bab533fc637a434f379ed392
https://github.com/nguyenxuanhoi2903/SRSF_summarization/tree/3d19e6b7669e0b22bab533fc637a434f379ed392
MinusRbfHSIC
import torch import torch.nn as nn class HSIC(nn.Module): """Base class for the finite sample estimator of Hilbert-Schmidt Independence Criterion (HSIC) ..math:: HSIC (X, Y) := || C_{x, y} ||^2_{HS}, where HSIC (X, Y) = 0 iif X and Y are independent. Empirically, we use the finite sample estimator of HSIC...
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....
naver-ai/cgl_fairness
MinusRbfHSIC
false
7,330
[ "MIT" ]
1
00d3bec233c9b3e0f88496118abaed8321ca3159
https://github.com/naver-ai/cgl_fairness/tree/00d3bec233c9b3e0f88496118abaed8321ca3159
LayerNorm
import torch class LayerNorm(torch.nn.Module): """ A vanilla implementation of layer normalization https://arxiv.org/pdf/1607.06450.pdf norm_x = (x - mean) / sqrt((x - mean) ^ 2) This does not include the trainable parameters gamma and beta for performance speed. Typically, this is norm_x * gamma...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
netdrones/ml-agents
LayerNorm
false
7,331
[ "Apache-2.0" ]
1
7d7d6f149c92ea2067d7cea364d92c8c3b8db3f4
https://github.com/netdrones/ml-agents/tree/7d7d6f149c92ea2067d7cea364d92c8c3b8db3f4
TokenClassifier
import torch import torch.nn as nn def transformer_weights_init(module, std_init_range=0.02, xavier=True): """ Initialize different weights in Transformer model. Args: module: torch.nn.Module to be initialized std_init_range: standard deviation of normal initializer xavier: if True...
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....
ngxingyu/Domain-Transfer-for-Punctuation-Retrieval
TokenClassifier
false
7,332
[ "Apache-2.0" ]
1
f5aa0ea0946c68aaf7fcf49a5085e6c823766a2f
https://github.com/ngxingyu/Domain-Transfer-for-Punctuation-Retrieval/tree/f5aa0ea0946c68aaf7fcf49a5085e6c823766a2f
MultichannelIamge
import math import torch import torch.nn as nn import torch.nn.functional as F class ModulatedConv2d(nn.Module): def __init__(self, channels_in, channels_out, style_dim, kernel_size, demodulate=True): super().__init__() self.weight = nn.Parameter(torch.randn(channels_out, channels_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 import math import torch.nn as nn import torch.nn.functional as F assert_size_st...
nhorton04/mobile_styletransfer
MultichannelIamge
false
7,333
[ "Apache-2.0" ]
1
db8b9a61b67fd58b9e4d61457ee58e36800cfbbe
https://github.com/nhorton04/mobile_styletransfer/tree/db8b9a61b67fd58b9e4d61457ee58e36800cfbbe
Net
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class Net(nn.Module): def __init__(self, input_size, num_classes): super(Net, self).__init__() self.linear1 = nn.Linear(input_size, 128) self.linear2 = nn.Linear(128, 256) self.linear3 = 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....
nce3xin/spam
Net
false
7,334
[ "MIT" ]
1
908421d5cf2dd103e2a7044bf1c8586aaf5f2ada
https://github.com/nce3xin/spam/tree/908421d5cf2dd103e2a7044bf1c8586aaf5f2ada
ResidualBlock
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvLayer, self).__init__() padding = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(padding) self.conv2d = nn.Conv2d(in_channels, ou...
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....
naver-ai/cgl_fairness
ResidualBlock
false
7,335
[ "MIT" ]
1
00d3bec233c9b3e0f88496118abaed8321ca3159
https://github.com/naver-ai/cgl_fairness/tree/00d3bec233c9b3e0f88496118abaed8321ca3159
PositionGenerator
import torch import torch.nn as nn class LayerNorm(nn.Module): """Construct a layernorm module (See citation for details).""" def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(fe...
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 ...
nigelnnk/MATCh-sensitivity
PositionGenerator
false
7,336
[ "MIT" ]
1
aaf2b924ac98c8c5925bbf431481724d11a102f8
https://github.com/nigelnnk/MATCh-sensitivity/tree/aaf2b924ac98c8c5925bbf431481724d11a102f8
EdgeFeaturesLayer
import torch import torch.nn as nn class EdgeFeaturesLayer(nn.Module): def __init__(self, d_model, d_edge, h, dropout): super(EdgeFeaturesLayer, self).__init__() assert d_model % h == 0 d_model // h self.linear = nn.Linear(d_edge, 1, bias=False) with torch.no_grad(): ...
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 assert_...
nigelnnk/MATCh-sensitivity
EdgeFeaturesLayer
false
7,337
[ "MIT" ]
1
aaf2b924ac98c8c5925bbf431481724d11a102f8
https://github.com/nigelnnk/MATCh-sensitivity/tree/aaf2b924ac98c8c5925bbf431481724d11a102f8
Generator
import math import torch import torch.nn as nn class LayerNorm(nn.Module): """Construct a layernorm module (See citation for details).""" def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(to...
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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
nigelnnk/MATCh-sensitivity
Generator
false
7,338
[ "MIT" ]
1
aaf2b924ac98c8c5925bbf431481724d11a102f8
https://github.com/nigelnnk/MATCh-sensitivity/tree/aaf2b924ac98c8c5925bbf431481724d11a102f8
SqueezeNet
import copy import torch import torch.nn as nn import torch.utils.data from torchvision.models.squeezenet import squeezenet1_0 from torchvision.models.squeezenet import squeezenet1_1 import torch.nn.modules.activation class GramMatrix(nn.Module): def forward(self, x): b, c, h, w = x.size() F = x....
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 copy import torch.nn a...
matherm/ummon3
SqueezeNet
false
7,339
[ "BSD-3-Clause" ]
1
08476d21ce17cc95180525d48202a1690dfc8a08
https://github.com/matherm/ummon3/tree/08476d21ce17cc95180525d48202a1690dfc8a08
SequenceClassifier
import torch import torch.nn as nn import torch.nn.functional as F def transformer_weights_init(module, std_init_range=0.02, xavier=True): """ Initialize different weights in Transformer model. Args: module: torch.nn.Module to be initialized std_init_range: standard deviation of normal ini...
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....
ngxingyu/Domain-Transfer-for-Punctuation-Retrieval
SequenceClassifier
false
7,340
[ "Apache-2.0" ]
1
f5aa0ea0946c68aaf7fcf49a5085e6c823766a2f
https://github.com/ngxingyu/Domain-Transfer-for-Punctuation-Retrieval/tree/f5aa0ea0946c68aaf7fcf49a5085e6c823766a2f
ScaleNorm
import math import torch import torch.nn as nn class ScaleNorm(nn.Module): """ScaleNorm""" """All g’s in SCALE NORM are initialized to sqrt(d)""" def __init__(self, scale, eps=1e-05): super(ScaleNorm, self).__init__() self.scale = nn.Parameter(torch.tensor(math.sqrt(scale))) 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 import math import torch.nn ...
nigelnnk/MATCh-sensitivity
ScaleNorm
false
7,341
[ "MIT" ]
1
aaf2b924ac98c8c5925bbf431481724d11a102f8
https://github.com/nigelnnk/MATCh-sensitivity/tree/aaf2b924ac98c8c5925bbf431481724d11a102f8
StyleResidual
import torch from torch import nn import torch.utils.data import torch.optim class StyleResidual(nn.Module): """Styling.""" def __init__(self, d_channel: 'int', d_style: 'int', kernel_size: 'int'=1): super().__init__() self.rs = nn.Conv1d(in_channels=d_style, out_channels=d_channel, ...
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 import torch.utils.data import torch.optim assert_size_stri...
niklub/NeMo
StyleResidual
false
7,342
[ "Apache-2.0" ]
1
4bcb2321cd16835f63afe3dfe993e6d56bcf2c0c
https://github.com/niklub/NeMo/tree/4bcb2321cd16835f63afe3dfe993e6d56bcf2c0c
CQLAgent
import torch import numpy as np import torch as th import torch.nn as nn import torch.nn.functional as F from scipy import optimize class CQLAgent(nn.Module): def __init__(self, input_shape, n_actions, n_opponent_actions, hidden_dim=64): super(CQLAgent, self).__init__() self.fc1 = nn.Line...
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 numpy as np import tor...
netlab-lcy/CMIX
CQLAgent
false
7,343
[ "MIT" ]
1
53e2d8794af2b380295efe06dcb05235089953c1
https://github.com/netlab-lcy/CMIX/tree/53e2d8794af2b380295efe06dcb05235089953c1
MultiHeadAttention
import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """ Applies an multi-head attention mechanism on the output features from the decoder. Refer to 「State-of-the-art Speech Recognition With Sequence-to-Sequence Models」 Paper https://arxiv.org/abs/17...
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....
ngbsLab/Korean-Speech-Recognition
MultiHeadAttention
false
7,344
[ "Apache-2.0" ]
1
3867bf7d23222da6812c9b98a93d3c6f7b3c80fc
https://github.com/ngbsLab/Korean-Speech-Recognition/tree/3867bf7d23222da6812c9b98a93d3c6f7b3c80fc
FocalLoss
import torch import torch.nn as nn import torch.optim import torch.utils.data import torch.autograd class FocalLoss(nn.Module): def __init__(self, gamma=0, eps=1e-07): super(FocalLoss, self).__init__() self.gamma = gamma self.eps = eps self.ce = torch.nn.CrossEntropyLoss() de...
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 ...
nikitajz/google-landmarks
FocalLoss
false
7,345
[ "MIT" ]
1
2051462be4450c193c98b237fc7ebdae783e2b28
https://github.com/nikitajz/google-landmarks/tree/2051462be4450c193c98b237fc7ebdae783e2b28
ClassWisePool
import sys from torch.autograd import Function import torch from torch import nn class ClassWisePoolFunction(Function): @staticmethod def forward(ctx, input, args): ctx.num_maps = args batch_size, num_channels, h, w = input.size() if num_channels % ctx.num_maps != 0: 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 import sys from torch.autograd import Function from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_st...
nishanthta/wsl
ClassWisePool
false
7,346
[ "MIT" ]
1
5fda3b909a314b7f88ffa9ab27a6a142de6b0159
https://github.com/nishanthta/wsl/tree/5fda3b909a314b7f88ffa9ab27a6a142de6b0159
WassersteinLoss
import torch def torch_cdf_loss(tensor_a, tensor_b, p=1): tensor_a = tensor_a / (torch.sum(tensor_a, dim=-1, keepdim=True) + 1e-14) tensor_b = tensor_b / (torch.sum(tensor_b, dim=-1, keepdim=True) + 1e-14) cdf_tensor_a = torch.cumsum(tensor_a, dim=-1) cdf_tensor_b = torch.cumsum(tensor_b, dim=-1) ...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
nikitadhawan/SimCLR
WassersteinLoss
false
7,347
[ "MIT" ]
1
7d87b384b1edb68e7ba86601b26f76e6da214718
https://github.com/nikitadhawan/SimCLR/tree/7d87b384b1edb68e7ba86601b26f76e6da214718
CoxPHLossSorted
import torch def cox_ph_loss_sorted(log_h, event, eps=1e-07): """Requires the input to be sorted by descending duration time. See DatasetDurationSorted. We calculate the negative log of $( rac{h_i}{\\sum_{j \\in R_i} h_j})^d$, where h = exp(log_h) are the hazards and R is the risk set, and d is event...
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...
nikolase90/pycox
CoxPHLossSorted
false
7,348
[ "BSD-2-Clause" ]
1
1c780253da7bab7eba0dc02e1436a68a9b812a66
https://github.com/nikolase90/pycox/tree/1c780253da7bab7eba0dc02e1436a68a9b812a66
leaky_hardtanh
import torch import torch.nn as nn class leaky_hardtanh(nn.Module): def __init__(self, min=-1, max=1, slope=0.01): super(leaky_hardtanh, self).__init__() self.min = min self.max = max self.slope = slope def forward(self, x): x = torch.where(x < self.min, self.min + 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
nikolasmorshuis/gadolinium_prediction
leaky_hardtanh
false
7,349
[ "Apache-2.0" ]
1
7d6640df5b62ce578a947d3a9b9c701c3d1ccd79
https://github.com/nikolasmorshuis/gadolinium_prediction/tree/7d6640df5b62ce578a947d3a9b9c701c3d1ccd79
GlobalAttention
import torch import torch.nn as nn import torch.cuda def aeq(*args): base = args[0] for a in args[1:]: assert a == base, str(args) class Bottle(nn.Module): def forward(self, input): if len(input.size()) <= 2: return super(Bottle, self).forward(input) size = input.siz...
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....
nikhilweee/syntactic-seq2seq
GlobalAttention
false
7,350
[ "MIT" ]
1
807e524167b064fc85c91e5e2fa994de6b739455
https://github.com/nikhilweee/syntactic-seq2seq/tree/807e524167b064fc85c91e5e2fa994de6b739455
NetVLAD
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from sklearn.neighbors import NearestNeighbors class NetVLAD(nn.Module): """NetVLAD layer implementation""" def __init__(self, num_clusters=64, dim=128, normalize_input=True, vladv2=False, use_faiss=True): "...
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....
leochien1110/Patch-NetVLAD
NetVLAD
false
7,351
[ "MIT" ]
1
9282217dd2c9bcf0446a05400fd277e651cecf4e
https://github.com/leochien1110/Patch-NetVLAD/tree/9282217dd2c9bcf0446a05400fd277e651cecf4e
Net
import torch import torch.nn.functional as F from torch import nn import torch.utils.data class Net(nn.Module): def __init__(self, in_dim): super().__init__() self.fc1 = nn.Linear(in_dim, 120, bias=False) nn.init.normal_(self.fc1.weight, mean=0, std=1) self.fc2 = nn.Linear(120, 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 import nn import t...
nmichlo/msc-research
Net
false
7,352
[ "MIT" ]
1
625e57eca77bbfbc4728ccebdb0733e1613bd258
https://github.com/nmichlo/msc-research/tree/625e57eca77bbfbc4728ccebdb0733e1613bd258
StdConv3d
import torch from torch import nn import torch.jit import torch.nn.functional as F import torch.nn.functional class StdConv3d(nn.Conv3d): def forward(self, x): w = self.weight v, m = torch.var_mean(w, dim=[1, 2, 3, 4], keepdim=True, unbiased=False ) w = (w - m) / torch.sqrt(v ...
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....
nntrongnghia/TDSI21-Shoulder-Muscle-Segmentation
StdConv3d
false
7,353
[ "Apache-2.0" ]
1
29f0f83d93e4fdd8127261283dcf9242d9914ba6
https://github.com/nntrongnghia/TDSI21-Shoulder-Muscle-Segmentation/tree/29f0f83d93e4fdd8127261283dcf9242d9914ba6
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 4, (3, 3), 1) self.dropout2d_1 = nn.Dropout2d(p=0.5) self.conv2 = nn.Conv2d(4, 32, (3, 3), 1) self.dropout2d_2 = nn.Dro...
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 ...
nathantau/BigBrain
Net
false
7,354
[ "MIT" ]
1
b9e81ee3ca91fadeccd59043dcc0062af1e6d365
https://github.com/nathantau/BigBrain/tree/b9e81ee3ca91fadeccd59043dcc0062af1e6d365
FF
import torch import torch.nn as nn def conv(in_channels, out_channels, kernel_size, bias=False, stride=1): return nn.Conv2d(in_channels, out_channels, kernel_size, padding= kernel_size // 2, bias=bias, stride=stride) class FF(nn.Module): def __init__(self, n_feat, kernel_size=3, bias=True): ...
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...
noxsine/WTSDNet
FF
false
7,355
[ "MIT" ]
1
7f25fb62c705c730c4d2fab6c86f9cf3535e6d80
https://github.com/noxsine/WTSDNet/tree/7f25fb62c705c730c4d2fab6c86f9cf3535e6d80
PSNRLoss
import torch from torch import nn class PSNRLoss(nn.Module): def __init__(self): super(PSNRLoss, self).__init__() self.criterion = nn.MSELoss(size_average=True) def __repr__(self): return 'PSNR' def forward(self, output, target): mse = self.criterion(output, target) ...
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 from torch import nn assert_...
nthuy190991/geoseg
PSNRLoss
false
7,356
[ "MIT" ]
1
b679af5dc558720df36dddc7abfd4e6ecb46d7de
https://github.com/nthuy190991/geoseg/tree/b679af5dc558720df36dddc7abfd4e6ecb46d7de
CELoss
import torch from torch import nn class CELoss(nn.Module): def __init__(self): super(CELoss, self).__init__() self.criterionBinary = nn.BCELoss(size_average=True) self.criterionMulti = nn.NLLLoss(size_average=True) def __repr__(self): return 'CE' def forward(self, output...
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_...
nthuy190991/geoseg
CELoss
false
7,357
[ "MIT" ]
1
b679af5dc558720df36dddc7abfd4e6ecb46d7de
https://github.com/nthuy190991/geoseg/tree/b679af5dc558720df36dddc7abfd4e6ecb46d7de
RatioModel
import torch import torch.nn.functional as F class RatioModel(torch.nn.Module): def __init__(self, D_in, hidden_unit_num): super().__init__() None self.l1 = torch.nn.Linear(D_in, hidden_unit_num) self.l2 = torch.nn.Linear(hidden_unit_num, hidden_unit_num) self.l3 = torch.n...
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 as...
numahha/wmopo
RatioModel
false
7,358
[ "MIT" ]
1
1557dab2e8168c1f2e53ffbc435b4000680f1d28
https://github.com/numahha/wmopo/tree/1557dab2e8168c1f2e53ffbc435b4000680f1d28
SchedulerTestNet
import torch from torch import nn as nn from torch.nn import functional as F from torch import optim as optim class SchedulerTestNet(torch.nn.Module): """ adapted from: https://github.com/pytorch/pytorch/blob/master/test/test_optim.py """ def __init__(self): super(SchedulerTestNet, self).__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 import nn as nn fr...
oke-aditya/pytorch-lightning-bolts
SchedulerTestNet
false
7,359
[ "Apache-2.0" ]
1
268df20bb442e7385b709b1488d37fd2767aba3c
https://github.com/oke-aditya/pytorch-lightning-bolts/tree/268df20bb442e7385b709b1488d37fd2767aba3c
DynamicsModel
import torch class DynamicsModel(torch.nn.Module): def __init__(self, D_in, D_out, hidden_unit_num): None super(DynamicsModel, self).__init__() self.l1 = torch.nn.Linear(D_in, hidden_unit_num) self.l2 = torch.nn.Linear(hidden_unit_num, D_out) self.logvar = torch.nn.Paramet...
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 assert_size_stride ...
numahha/wmopo
DynamicsModel
false
7,360
[ "MIT" ]
1
1557dab2e8168c1f2e53ffbc435b4000680f1d28
https://github.com/numahha/wmopo/tree/1557dab2e8168c1f2e53ffbc435b4000680f1d28
MultipleInputModel
import torch from torch import nn as nn from torch import optim as optim class TemplateModel(nn.Module): def __init__(self, mix_data=False): """ Base model for testing. The setting ``mix_data=True`` simulates a wrong implementation. """ super().__init__() self.mix_data = mix_data ...
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 as nn from torch import optim as optim assert_size_stride =...
oke-aditya/pytorch-lightning-bolts
MultipleInputModel
false
7,361
[ "Apache-2.0" ]
1
268df20bb442e7385b709b1488d37fd2767aba3c
https://github.com/oke-aditya/pytorch-lightning-bolts/tree/268df20bb442e7385b709b1488d37fd2767aba3c
FakeRKHSConvNet
import math import torch import numpy as np from torch import nn as nn from torch import optim as optim class MaybeBatchNorm2d(nn.Module): def __init__(self, n_ftr, affine, use_bn): super(MaybeBatchNorm2d, self).__init__() self.bn = nn.BatchNorm2d(n_ftr, affine=affine) self.use_bn = use_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....
oke-aditya/pytorch-lightning-bolts
FakeRKHSConvNet
false
7,362
[ "Apache-2.0" ]
1
268df20bb442e7385b709b1488d37fd2767aba3c
https://github.com/oke-aditya/pytorch-lightning-bolts/tree/268df20bb442e7385b709b1488d37fd2767aba3c
AgentA2C
import torch import torch.nn as nn class AgentA2C(nn.Module): def __init__(self, state_shape, n_actions): super().__init__() self.name = 'a2c' self.n_actions = n_actions self.state_shape = state_shape self.hidden1 = nn.Linear(self.state_shape, 100) self.act1 = nn.R...
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 assert_...
onimaru/Reinforcement_Learning
AgentA2C
false
7,363
[ "MIT" ]
1
4c45b51a095cb0cb3c18f6a1542befdcab8a58a4
https://github.com/onimaru/Reinforcement_Learning/tree/4c45b51a095cb0cb3c18f6a1542befdcab8a58a4
VishalNet
import torch import torch.nn as nn class VishalNet(nn.Module): def __init__(self): super(VishalNet, self).__init__() self.cnn1 = nn.Conv1d(1, 60, 81, 1, 40) self.cnn2 = nn.Conv1d(60, 1, 301, 1, 150) def forward(self, input): out1 = nn.functional.relu(self.cnn1(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 import torch.nn as nn assert_...
olivesgatech/Geophysics-2021-Joint-learning-for-spatial-context-based-inversion
VishalNet
false
7,364
[ "MIT" ]
1
56f506dfe62ac3557febb4c8e3c62542b1624a1b
https://github.com/olivesgatech/Geophysics-2021-Joint-learning-for-spatial-context-based-inversion/tree/56f506dfe62ac3557febb4c8e3c62542b1624a1b
L2Norm
import torch from torch import nn class L2Norm(nn.Module): def forward(self, x, eps=1e-06): norm = x.norm(dim=1, keepdim=True).clamp(min=eps) return x / norm 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._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
onlyrico/vit-pytorch
L2Norm
false
7,365
[ "MIT" ]
1
e52ac4195550faa9c3372533d325bf649f7354ad
https://github.com/onlyrico/vit-pytorch/tree/e52ac4195550faa9c3372533d325bf649f7354ad
AgentReinforce
import torch import torch.nn as nn class AgentReinforce(nn.Module): def __init__(self, state_shape, n_actions): super().__init__() self.name = 'reinforce' self.n_actions = n_actions self.state_shape = state_shape self.hidden1 = nn.Linear(self.state_shape, 100) 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 import torch.nn as nn assert_...
onimaru/Reinforcement_Learning
AgentReinforce
false
7,366
[ "MIT" ]
1
4c45b51a095cb0cb3c18f6a1542befdcab8a58a4
https://github.com/onimaru/Reinforcement_Learning/tree/4c45b51a095cb0cb3c18f6a1542befdcab8a58a4
AmdimNCELoss
import torch from torch import nn as nn from torch import optim as optim def tanh_clip(x, clip_val=10.0): """ soft clip values to the range [-clip_val, +clip_val] """ if clip_val is not None: x_clip = clip_val * torch.tanh(1.0 / clip_val * x) else: x_clip = x return x_clip cl...
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....
oke-aditya/pytorch-lightning-bolts
AmdimNCELoss
false
7,367
[ "Apache-2.0" ]
1
268df20bb442e7385b709b1488d37fd2767aba3c
https://github.com/oke-aditya/pytorch-lightning-bolts/tree/268df20bb442e7385b709b1488d37fd2767aba3c
ConditionTime
import torch from torch import nn as nn def condition_time(x, i=0, size=(12, 16), seq_len=15): """create one hot encoded time image-layers, i in [1, seq_len]""" assert i < seq_len times = torch.eye(seq_len, dtype=x.dtype, device=x.device)[i].unsqueeze(-1 ).unsqueeze(-1) ones = torch.ones(1, *s...
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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._emp...
openclimatefix/MetNet
ConditionTime
false
7,368
[ "MIT" ]
1
06eed550e93da6325641958b0d36c15adde1d928
https://github.com/openclimatefix/MetNet/tree/06eed550e93da6325641958b0d36c15adde1d928
_ImpalaBlock
import torch from torch import nn class _ImpalaResBlock(nn.Module): def __init__(self, n_channels: 'int'): super().__init__() self.n_channels = n_channels kernel_size = 3 padding = 1 self.relu = nn.ReLU() self.relu_inplace = nn.ReLU() self.conv1 = nn.Conv2d...
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...
nrfulton/vsrl-framework
_ImpalaBlock
false
7,369
[ "MIT" ]
1
c778824b3285e3e994a4c5846c7b1c2ac03c669b
https://github.com/nrfulton/vsrl-framework/tree/c778824b3285e3e994a4c5846c7b1c2ac03c669b
MILLR
import torch import numpy as np from torch import nn import torch as tc from sklearn.metrics import * from torch.utils.data import DataLoader from torch.utils.data import WeightedRandomSampler class myDataset(torch.utils.data.Dataset): def __init__(self, x, y): self.x = x self.y = y def __le...
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 numpy as np from torch...
mhbl3/PrecursorAnalysis
MILLR
false
7,370
[ "MIT" ]
1
aaa2fe0219ad579b9126fef9cc8594a59ae66815
https://github.com/mhbl3/PrecursorAnalysis/tree/aaa2fe0219ad579b9126fef9cc8594a59ae66815
PEG
import torch from torch import nn class Residual(nn.Module): def __init__(self, fn): super().__init__() self.fn = fn def forward(self, x, **kwargs): return self.fn(x, **kwargs) + x class PEG(nn.Module): def __init__(self, dim, kernel_size=3): super().__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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
onlyrico/vit-pytorch
PEG
false
7,371
[ "MIT" ]
1
e52ac4195550faa9c3372533d325bf649f7354ad
https://github.com/onlyrico/vit-pytorch/tree/e52ac4195550faa9c3372533d325bf649f7354ad
SpatialGather_Module
import torch from torchvision.transforms import functional as F import torch.nn as nn import torch.nn.functional as F class SpatialGather_Module(nn.Module): """ Aggregate the context features according to the initial predicted probability distribution. Employ the soft-weighted method to aggregate ...
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....
openseg-group/panoptic-deeplab
SpatialGather_Module
false
7,372
[ "Apache-2.0" ]
1
818887597e75af77ba32185eb67d8aeac47b54fe
https://github.com/openseg-group/panoptic-deeplab/tree/818887597e75af77ba32185eb67d8aeac47b54fe
Qux
import torch import torch.jit import torch.onnx import torch.nn class Qux(torch.nn.Module): def __init__(self, x): super(Qux, self).__init__() self.x = x def forward(self, a, b): return a - b - self.x def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 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 import torch.jit import torch.onnx import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
opti-mix/glow
Qux
false
7,373
[ "Apache-2.0" ]
1
4ba074df5da9822986a23a6679ab592c22660f6d
https://github.com/opti-mix/glow/tree/4ba074df5da9822986a23a6679ab592c22660f6d
Discriminator
import torch import numpy as np from torch import nn as nn from torch.nn import functional as F from torch import optim as optim class Discriminator(nn.Module): def __init__(self, img_shape, hidden_dim=1024): super().__init__() in_dim = int(np.prod(img_shape)) self.fc1 = nn.Linear(in_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 import numpy as np from torch import nn as nn from torch import optim as optim a...
oke-aditya/pytorch-lightning-bolts
Discriminator
false
7,374
[ "Apache-2.0" ]
1
268df20bb442e7385b709b1488d37fd2767aba3c
https://github.com/oke-aditya/pytorch-lightning-bolts/tree/268df20bb442e7385b709b1488d37fd2767aba3c
ResBlock
import torch from torch import nn class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, bias=False): super(CausalConv1d, self).__init__() self.padding = padding = (kernel_size - 1) * dilation self.conv = nn.Conv1d(in_channels, 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.triton_helpers import libdevice from torch import n...
oleges1/TTS
ResBlock
false
7,375
[ "MIT" ]
1
19b389714078729fae29faf9c23112bdbe4c8dec
https://github.com/oleges1/TTS/tree/19b389714078729fae29faf9c23112bdbe4c8dec
RepeatModule
import torch import torch.jit import torch.onnx import torch.nn class RepeatModule(torch.nn.Module): def __init__(self, repeats): super(RepeatModule, self).__init__() self.repeats = repeats def forward(self, tensor): tensor = tensor + tensor return tensor.repeat(self.repeats)...
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.jit import torch.onnx import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
opti-mix/glow
RepeatModule
false
7,376
[ "Apache-2.0" ]
1
4ba074df5da9822986a23a6679ab592c22660f6d
https://github.com/opti-mix/glow/tree/4ba074df5da9822986a23a6679ab592c22660f6d
Grounding
from _paritybench_helpers import _mock_config import math 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 as th from torchvision.ops.boxes import * from torchvision.transforms.functional import * class Grounding(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 import torch.nn as nn import torch.nn.parallel import torch.optim import torch.u...
necla-ml/ML-Vision
Grounding
false
7,377
[ "BSD-3-Clause" ]
1
66229b29fc0f67c75dbe6304cdb8c5e93fe0bacf
https://github.com/necla-ml/ML-Vision/tree/66229b29fc0f67c75dbe6304cdb8c5e93fe0bacf