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
LayerNorm
import torch import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter import Parameter from torch.nn.modules.normalization import LayerNorm from torch.optim.lr_scheduler import * class LayerNorm(nn.Module): def __init__(self, hidden_size, eps=0.0001): super(LayerNorm, 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._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter im...
anlewy/mt-dnn
LayerNorm
false
14,879
[ "MIT" ]
2,075
eeb6f01ce0630e61a52b8c9c6f7537cd34978e45
https://github.com/anlewy/mt-dnn/tree/eeb6f01ce0630e61a52b8c9c6f7537cd34978e45
KDLoss
import torch import torch.nn as nn import torch.nn.functional as F class KDLoss(nn.Module): def __init__(self, temp: 'float', reduction: 'str'): super(KDLoss, self).__init__() self.temp = temp self.reduction = reduction self.kl_loss = nn.KLDivLoss(reduction=reduction) def for...
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...
angpo/VKD
KDLoss
false
14,880
[ "MIT" ]
68
2a136e00dad4c73612d6efe087675604ac2416eb
https://github.com/angpo/VKD/tree/2a136e00dad4c73612d6efe087675604ac2416eb
Correct
import torch from torch import nn import torch.utils.data.distributed class Correct(nn.Module): def forward(self, classifier, target): return classifier.max(dim=1)[1] == target def get_inputs(): return [torch.rand([4, 4, 4, 4]), 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 import torch.utils.data.distributed assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda ...
aoranwu/grace
Correct
false
14,881
[ "BSD-2-Clause" ]
88
1e28915f6f6e8189ef33c0c7d8d3ce314e0a493e
https://github.com/aoranwu/grace/tree/1e28915f6f6e8189ef33c0c7d8d3ce314e0a493e
Pooler
import torch import torch.nn.functional as F import torch.nn as nn from torch.optim.lr_scheduler import * def linear(x): return x def activation(func_a): """Activation function wrapper """ try: f = eval(func_a) except: f = linear return f class DropoutWrapper(nn.Module): ...
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.functional as F import torch.nn as nn from torch.optim.lr_schedu...
anlewy/mt-dnn
Pooler
false
14,882
[ "MIT" ]
2,075
eeb6f01ce0630e61a52b8c9c6f7537cd34978e45
https://github.com/anlewy/mt-dnn/tree/eeb6f01ce0630e61a52b8c9c6f7537cd34978e45
Conv2dTime
import torch import torch.nn as nn class Conv2dTime(nn.Conv2d): """ Implements time dependent 2d convolutions, by appending the time variable as an extra channel. """ def __init__(self, in_channels, *args, **kwargs): super(Conv2dTime, self).__init__(in_channels + 1, *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...
anway/augmented-neural-odes
Conv2dTime
false
14,883
[ "MIT" ]
449
561cfa540ef292d117ba9cf083758281774f3f22
https://github.com/anway/augmented-neural-odes/tree/561cfa540ef292d117ba9cf083758281774f3f22
MaskedHuberLoss
import torch import torch.nn as nn class MaskedHuberLoss(torch.nn.Module): def __init__(self): super(MaskedHuberLoss, self).__init__() def forward(self, output, labels, mask): lossHuber = nn.SmoothL1Loss(reduction='none') l = lossHuber(output * mask, labels * mask) l = l.sum(...
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...
anshulpaigwar/GndNet
MaskedHuberLoss
false
14,884
[ "MIT" ]
73
24328602a8cbaeabe67cafbf1b96c35f5c5c9023
https://github.com/anshulpaigwar/GndNet/tree/24328602a8cbaeabe67cafbf1b96c35f5c5c9023
Lambda3
import torch from typing import Tuple from torch import nn from abc import ABC from abc import abstractmethod class Regularizer(nn.Module, ABC): @abstractmethod def forward(self, factors: 'Tuple[torch.Tensor]'): pass class Lambda3(Regularizer): def __init__(self, weight: 'float'): supe...
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 typing import Tuple from torch import nn from abc import ABC from abc impo...
apoorvumang/Temporal_KGQA
Lambda3
false
14,885
[ "MIT" ]
49
3e2a7c31865235ee2511a7ae0ea0701c12896327
https://github.com/apoorvumang/Temporal_KGQA/tree/3e2a7c31865235ee2511a7ae0ea0701c12896327
N3
import torch from typing import Tuple from torch import nn from abc import ABC from abc import abstractmethod class Regularizer(nn.Module, ABC): @abstractmethod def forward(self, factors: 'Tuple[torch.Tensor]'): pass class N3(Regularizer): def __init__(self, weight: 'float'): super(N3,...
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 typing import Tuple from torch import nn from abc import ABC from ab...
apoorvumang/Temporal_KGQA
N3
false
14,886
[ "MIT" ]
49
3e2a7c31865235ee2511a7ae0ea0701c12896327
https://github.com/apoorvumang/Temporal_KGQA/tree/3e2a7c31865235ee2511a7ae0ea0701c12896327
ConConv
import torch import torch.nn as nn class ConConv(nn.Module): def __init__(self, inplanes_x1, inplanes_x2, planes): super(ConConv, self).__init__() self.conv = nn.Conv2d(inplanes_x1 + inplanes_x2, planes, kernel_size=1, bias=True) def forward(self, x1, x2): x1 = torch.cat(...
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...
anve96/DE_resnet_unet_hyb
ConConv
false
14,887
[ "BSD-3-Clause" ]
45
f0751854c8707cc4f228bb9d52d93635cc3584ae
https://github.com/anve96/DE_resnet_unet_hyb/tree/f0751854c8707cc4f228bb9d52d93635cc3584ae
Conv2
import math import torch import torch.nn as nn import torch.utils.data.distributed 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: ...
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 ...
aperquin/Extended_VQVAE
Conv2
false
14,888
[ "MIT" ]
55
46d309643c3fe3663e6fbd2fd6dd6b768341863b
https://github.com/aperquin/Extended_VQVAE/tree/46d309643c3fe3663e6fbd2fd6dd6b768341863b
ConvFunc
import torch import torch.nn as nn class ConvFunc(nn.Module): """Convolutional block, non-ODE. Parameters ---------- device : torch.device img_size : tuple of ints Tuple of (channels, height, width). num_filters : int Number of convolutional filters. augment_dim: 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 import torch.nn as nn assert_...
anway/augmented-neural-odes
ConvFunc
false
14,889
[ "MIT" ]
449
561cfa540ef292d117ba9cf083758281774f3f22
https://github.com/anway/augmented-neural-odes/tree/561cfa540ef292d117ba9cf083758281774f3f22
ContinousRotReprDecoder
import torch import torch.nn as nn import torch.nn.functional as F class ContinousRotReprDecoder(nn.Module): def __init__(self): super(ContinousRotReprDecoder, self).__init__() def forward(self, module_input): reshaped_input = module_input.view(-1, 3, 2) b1 = F.normalize(reshaped_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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
antic11d/human_body_prior
ContinousRotReprDecoder
false
14,890
[ "Xnet", "X11" ]
412
ba4eaf9ee69a83a874805b764e0f984ba057ffc6
https://github.com/antic11d/human_body_prior/tree/ba4eaf9ee69a83a874805b764e0f984ba057ffc6
TorchEntityRecognizer
import torch from typing import List from collections import OrderedDict from torch import nn def is_dropout_module(module: 'nn.Module', dropout_modules: 'List[nn.Module]'=[nn.Dropout, nn.Dropout2d, nn.Dropout3d]) ->bool: """Detect if a PyTorch Module is a Dropout layer module (nn.Module): Module to check...
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....
apjanco/projects
TorchEntityRecognizer
false
14,891
[ "MIT" ]
823
2f8850140ba13ab18b9cf622e46e79013d41701f
https://github.com/apjanco/projects/tree/2f8850140ba13ab18b9cf622e46e79013d41701f
Cnv2d_separable
import time import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from time import time as time class Cnv2d_separable(nn.Module): def __init__(self, n_input_ch, n_output_ch, kernel_size, stride, padding, bias=False, red_portion=0.5): super(Cnv2d_separable, 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 import time import torch.nn as nn import torch.nn.parallel import torch.utils.da...
aosokin/biogans
Cnv2d_separable
false
14,892
[ "Apache-2.0" ]
105
cb72bb0457be335fad6c27a16bb1761b937a6d06
https://github.com/aosokin/biogans/tree/cb72bb0457be335fad6c27a16bb1761b937a6d06
HuberLoss
import torch import torch.nn as nn class HuberLoss(nn.Module): def __init__(self, delta=1): super().__init__() self.delta = delta def forward(self, sr, hr): l1 = torch.abs(sr - hr) mask = l1 < self.delta sq_loss = 0.5 * l1 ** 2 abs_loss = self.delta * (l1 - 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 ...
around-star/FLAVR
HuberLoss
false
14,893
[ "Apache-2.0" ]
223
3b0b703fd1c67eb053511a3532f539ff468866a8
https://github.com/around-star/FLAVR/tree/3b0b703fd1c67eb053511a3532f539ff468866a8
MAPELoss
import torch import torch.nn as nn class MAPELoss(nn.Module): def forward(self, input, target): return (torch.abs(input - target) / (torch.abs(target) + 0.01)).mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), 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 math as tl_math import torch.nn as nn ...
arpan-dhatt/oidn
MAPELoss
false
14,894
[ "Apache-2.0" ]
1,206
9419411ba4b343b475b53587cadd44c83d68dc2a
https://github.com/arpan-dhatt/oidn/tree/9419411ba4b343b475b53587cadd44c83d68dc2a
GeodesicLoss
import torch import torch.nn as nn class GeodesicLoss(nn.Module): def __init__(self, eps=1e-07): super().__init__() self.eps = eps def forward(self, m1, m2): m = torch.bmm(m1, m2.transpose(1, 2)) cos = (m[:, 0, 0] + m[:, 1, 1] + m[:, 2, 2] - 1) / 2 theta = torch.acos(...
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....
arsalan0004/6DRepNet
GeodesicLoss
false
14,895
[ "MIT" ]
84
cdfb2b151785eb89fef70907a6f2a19fa0acf4ae
https://github.com/arsalan0004/6DRepNet/tree/cdfb2b151785eb89fef70907a6f2a19fa0acf4ae
GradientLoss
import torch import torch.nn as nn def tensor_gradient(input): input0 = input[..., :-1, :-1] didy = input[..., 1:, :-1] - input0 didx = input[..., :-1, 1:] - input0 return torch.cat((didy, didx), -3) class GradientLoss(nn.Module): def forward(self, input, target): return torch.abs(tenso...
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 ...
arpan-dhatt/oidn
GradientLoss
false
14,896
[ "Apache-2.0" ]
1,206
9419411ba4b343b475b53587cadd44c83d68dc2a
https://github.com/arpan-dhatt/oidn/tree/9419411ba4b343b475b53587cadd44c83d68dc2a
SMAPELoss
import torch import torch.nn as nn class SMAPELoss(nn.Module): def forward(self, input, target): return (torch.abs(input - target) / (torch.abs(input) + torch.abs( target) + 0.01)).mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs...
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 ...
arpan-dhatt/oidn
SMAPELoss
false
14,897
[ "Apache-2.0" ]
1,206
9419411ba4b343b475b53587cadd44c83d68dc2a
https://github.com/arpan-dhatt/oidn/tree/9419411ba4b343b475b53587cadd44c83d68dc2a
PairwiseRankerModel
import torch import torch.onnx import torch.nn as nn class PairwiseRankerModel(nn.Module): def __init__(self, embedding_size): super(PairwiseRankerModel, self).__init__() self.query_doc_transform = torch.nn.Linear(in_features= embedding_size * 2, out_features=embedding_size) 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.onnx import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
appotry/sample-apps
PairwiseRankerModel
false
14,898
[ "Apache-2.0" ]
167
6b107ffc67fc917d66fabdeff893b5b7cb157c61
https://github.com/appotry/sample-apps/tree/6b107ffc67fc917d66fabdeff893b5b7cb157c61
NetDropout
import torch from torch import nn from torch.nn import functional as F class NetDropout(nn.Module): def __init__(self, nclasses, img, nchans1=10, dropout_prob=0.4): super().__init__() nchannels, _nrows, _ncols = img.shape self.conv1 = nn.Conv2d(nchannels, nchans1, kernel_size=3, padding=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....
arpitvaghela/probml-notebooks
NetDropout
false
14,899
[ "MIT" ]
166
32ecb309dd474b989fd1c6ce4ad6dab7a25bbead
https://github.com/arpitvaghela/probml-notebooks/tree/32ecb309dd474b989fd1c6ce4ad6dab7a25bbead
ComplexActLayer
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class ComplexActLayer(nn.Module): """ Activation differently 'real' part and 'img' part In implemented DCUnet on this repository, Real part is activated to log space. And Phase(img) part, it is distributed in [-pi, 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
ashishpatel26/source_separation
ComplexActLayer
false
14,900
[ "Apache-2.0" ]
269
6f755889654d7207fc89ba03a2f49d9ba92df8ea
https://github.com/ashishpatel26/source_separation/tree/6f755889654d7207fc89ba03a2f49d9ba92df8ea
CNN
import torch class CNN(torch.nn.Module): def __init__(self, n_classes): super(CNN, self).__init__() self.conv = torch.nn.Sequential() self.conv.add_module('conv_1', torch.nn.Conv2d(1, 4, kernel_size=2)) self.conv.add_module('dropout_1', torch.nn.Dropout()) self.conv.add_mo...
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...
anukaal/opytimizer
CNN
false
14,901
[ "Apache-2.0" ]
528
5f1ccc0da80e6a4cabd99578fa24cf4f6466f9b9
https://github.com/anukaal/opytimizer/tree/5f1ccc0da80e6a4cabd99578fa24cf4f6466f9b9
distLinear
import torch import torch.nn as nn import torch.optim import torch.utils.data.sampler from torch.nn.utils.weight_norm import WeightNorm class distLinear(nn.Module): def __init__(self, indim, outdim): super(distLinear, self).__init__() self.L = nn.Linear(indim, outdim, bias=False) self.cla...
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 ...
artificially-ai/FewShotVision
distLinear
false
14,902
[ "MIT" ]
90
02c1132828bc9caba4cadd0b2f731bd63f66b826
https://github.com/artificially-ai/FewShotVision/tree/02c1132828bc9caba4cadd0b2f731bd63f66b826
UnpoolingAsConvolution
import torch import torch.nn as nn def get_incoming_shape(incoming): size = incoming.size() return [size[0], size[1], size[2], size[3]] def interleave(tensors, axis): old_shape = get_incoming_shape(tensors[0])[1:] new_shape = [-1] + old_shape new_shape[axis] *= len(tensors) stacked = torch.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...
anve96/DE_resnet_unet_hyb
UnpoolingAsConvolution
false
14,903
[ "BSD-3-Clause" ]
45
f0751854c8707cc4f228bb9d52d93635cc3584ae
https://github.com/anve96/DE_resnet_unet_hyb/tree/f0751854c8707cc4f228bb9d52d93635cc3584ae
SEBlock
import torch import torch.nn as nn import torch.nn.functional as F class SEBlock(nn.Module): def __init__(self, input_channels, internal_neurons): super(SEBlock, self).__init__() self.down = nn.Conv2d(in_channels=input_channels, out_channels= internal_neurons, kernel_size=1, stride=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 import torch.nn as nn assert_...
arsalan0004/6DRepNet
SEBlock
false
14,904
[ "MIT" ]
84
cdfb2b151785eb89fef70907a6f2a19fa0acf4ae
https://github.com/arsalan0004/6DRepNet/tree/cdfb2b151785eb89fef70907a6f2a19fa0acf4ae
CoordConv
import torch import torch.nn as nn class _AddCoords(nn.Module): def __init__(self, use_radius=False): super().__init__() self.use_radius = use_radius self.extra_channels = 3 if self.use_radius else 2 def forward(self, input): batch_size, _, h, w = input.size() def ge...
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...
ashutosh1919/neuro-symbolic-sudoku-solver
CoordConv
false
14,905
[ "Apache-2.0" ]
52
ecb4274ff66d3b6a86f64584e0a767bf785f107f
https://github.com/ashutosh1919/neuro-symbolic-sudoku-solver/tree/ecb4274ff66d3b6a86f64584e0a767bf785f107f
ProbabilityLinear
import torch import torch.nn as nn import torch.nn.functional as F def normalize_prob(a, dim=-1): """Perform 1-norm along the specific dimension.""" return a / a.sum(dim=dim, keepdim=True) class ProbabilityLinear(nn.Linear): def __init__(self, in_features, out_features, bias=False, norm=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....
ashutosh1919/neuro-symbolic-sudoku-solver
ProbabilityLinear
false
14,906
[ "Apache-2.0" ]
52
ecb4274ff66d3b6a86f64584e0a767bf785f107f
https://github.com/ashutosh1919/neuro-symbolic-sudoku-solver/tree/ecb4274ff66d3b6a86f64584e0a767bf785f107f
ProbabilityBilinear
import torch import torch.nn as nn import torch.nn.functional as F def normalize_prob(a, dim=-1): """Perform 1-norm along the specific dimension.""" return a / a.sum(dim=dim, keepdim=True) class ProbabilityBilinear(nn.Bilinear): def __init__(self, in1_features, in2_features, out_features, bias=False, ...
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 ...
ashutosh1919/neuro-symbolic-sudoku-solver
ProbabilityBilinear
false
14,907
[ "Apache-2.0" ]
52
ecb4274ff66d3b6a86f64584e0a767bf785f107f
https://github.com/ashutosh1919/neuro-symbolic-sudoku-solver/tree/ecb4274ff66d3b6a86f64584e0a767bf785f107f
GeneralSoftmax
import enum import functools import torch import torch.nn as nn import torch.nn.functional as F def _canonize_enum_value(value): if type(value) is str: value = value.lower() return value def masked_softmax(logits, mask=None, dim=-1): eps = 1e-20 probs = F.softmax(logits, dim=dim) if mask...
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 enum import fun...
ashutosh1919/neuro-symbolic-sudoku-solver
GeneralSoftmax
false
14,908
[ "Apache-2.0" ]
52
ecb4274ff66d3b6a86f64584e0a767bf785f107f
https://github.com/ashutosh1919/neuro-symbolic-sudoku-solver/tree/ecb4274ff66d3b6a86f64584e0a767bf785f107f
TLU
import torch from torch import nn from torch.nn import Parameter from torch.nn.parameter import Parameter class TLU(nn.Module): def __init__(self, num_features): """max(y, tau) = max(y - tau, 0) + tau = ReLU(y - tau) + tau""" super(TLU, self).__init__() self.num_features = num_features ...
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 from torch.nn import Parameter from torch.nn.parameter import Parame...
asvk/fast-reid
TLU
false
14,909
[ "Apache-2.0" ]
71
cf246e9bee5b5e5d154de98ba0395b7a5d0d0ab7
https://github.com/asvk/fast-reid/tree/cf246e9bee5b5e5d154de98ba0395b7a5d0d0ab7
ResidualLinear
import torch import torch.nn as nn class ResidualLinear(nn.Module): def __init__(self, hidden_dim, norm1=None, norm2=None): super().__init__() self.linear1 = nn.Linear(hidden_dim, hidden_dim) self.norm1 = norm1 self.linear2 = nn.Linear(hidden_dim, hidden_dim) self.norm2 = ...
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_...
ashutosh1919/neuro-symbolic-sudoku-solver
ResidualLinear
false
14,910
[ "Apache-2.0" ]
52
ecb4274ff66d3b6a86f64584e0a767bf785f107f
https://github.com/ashutosh1919/neuro-symbolic-sudoku-solver/tree/ecb4274ff66d3b6a86f64584e0a767bf785f107f
Conv1d_mp
import torch import torch.nn as nn class Conv1d_mp(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', kernel_size: 'int', stride: 'int'=1, padding: 'int'=1): super(Conv1d_mp, self).__init__() self._kernel_size = kernel_size self._stride = stride 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_...
atosystem/MIDI-BERT
Conv1d_mp
false
14,911
[ "MIT" ]
109
61f7efb3be85a2a847e6585237036e052235a6a0
https://github.com/atosystem/MIDI-BERT/tree/61f7efb3be85a2a847e6585237036e052235a6a0
TripletLoss
import torch import torch.nn as nn import torch.nn.functional as F class TripletLoss(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a negative sample """ def __init__(self, margin=1.0): super(TripletLoss, self).__init__() self.margin = mar...
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.nn as nn assert...
awesome-archive/CAIL2019
TripletLoss
false
14,912
[ "MIT" ]
300
31e917752676ad77d247a47e04f17a8f9ea68721
https://github.com/awesome-archive/CAIL2019/tree/31e917752676ad77d247a47e04f17a8f9ea68721
TripletLoss_op
import torch import torch.nn as nn import torch.nn.functional as F class TripletLoss_op(nn.Module): def __init__(self, margin=1.0): super(TripletLoss_op, self).__init__() self.margin = margin def forward(self, op, anchor, positive, negative, size_average=True): distance_positive = (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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
awesome-archive/CAIL2019
TripletLoss_op
false
14,913
[ "MIT" ]
300
31e917752676ad77d247a47e04f17a8f9ea68721
https://github.com/awesome-archive/CAIL2019/tree/31e917752676ad77d247a47e04f17a8f9ea68721
L2Norm
import torch from itertools import product as product from math import sqrt as sqrt import torch.nn as nn import torch.nn.init as init import torch.utils.data class L2Norm(nn.Module): def __init__(self, n_channels, scale): super(L2Norm, self).__init__() self.n_channels = n_channels self.g...
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 itertools import product as product from math import sqrt as sqrt import t...
avisekiit/adversarial_object_detection
L2Norm
false
14,915
[ "MIT" ]
795
263f264b3f2bdb0f116ebbb30ec4a805f357b3a6
https://github.com/avisekiit/adversarial_object_detection/tree/263f264b3f2bdb0f116ebbb30ec4a805f357b3a6
Atan
import torch import torch.nn as nn class Atan(nn.Module): def forward(self, x): return torch.atan(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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
awlange/pysurvival
Atan
false
14,916
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
InverseSqrt
import torch import torch.nn as nn class InverseSqrt(nn.Module): def forward(self, x, alpha=1.0): return x / torch.sqrt(1.0 + alpha * x * 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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
awlange/pysurvival
InverseSqrt
false
14,917
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
BipolarSigmoid
import torch import torch.nn as nn class BipolarSigmoid(nn.Module): def forward(self, x): return (1.0 - torch.exp(-x)) / (1.0 + torch.exp(-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 math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
awlange/pysurvival
BipolarSigmoid
false
14,918
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
BertSelfOutput
from _paritybench_helpers import _mock_config import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, 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.triton_helpers import libdevice from torch import n...
BIT-ENGD/eeqa
BertSelfOutput
false
14,919
[ "MIT" ]
142
2995abbaff1fb47131246a247ee7ed62aa94f4c3
https://github.com/BIT-ENGD/eeqa/tree/2995abbaff1fb47131246a247ee7ed62aa94f4c3
MaskedCrossEntropyCriterion
import torch import torch.nn as nn from torch.nn.modules.loss import _WeightedLoss class MaskedCrossEntropyCriterion(_WeightedLoss): def __init__(self, ignore_index=[-100], reduce=None): super(MaskedCrossEntropyCriterion, self).__init__() self.padding_idx = ignore_index self.reduce = redu...
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....
awesome-archive/inversecooking
MaskedCrossEntropyCriterion
false
14,920
[ "MIT" ]
591
bd07fad6e2efb7ed3bf496f0e19913ed063b3729
https://github.com/awesome-archive/inversecooking/tree/bd07fad6e2efb7ed3bf496f0e19913ed063b3729
Sinc
import torch import torch.nn as nn class Sinc(nn.Module): def forward(self, x, epsilon=1e-09): return torch.sin(x + epsilon) / (x + epsilon) 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 math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
awlange/pysurvival
Sinc
false
14,921
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
CAModel
import torch import torch.nn as nn import torch.nn.functional as F class CAModel(nn.Module): def __init__(self, env_d): super(CAModel, self).__init__() self.conv1 = nn.Conv2d(env_d * 3, 144, 1) self.conv2 = nn.Conv2d(144, env_d, 1) nn.init.zeros_(self.conv2.weight) nn.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 as nn assert_...
anishau/Growing-Neural-Cellular-Automata-Pytorch
CAModel
false
14,922
[ "Apache-2.0" ]
47
0e99815060ea4977597059fac5b556fe24e80dff
https://github.com/anishau/Growing-Neural-Cellular-Automata-Pytorch/tree/0e99815060ea4977597059fac5b556fe24e80dff
BentIdentity
import torch import torch.nn as nn class BentIdentity(nn.Module): def forward(self, x, alpha=1.0): return x + (torch.sqrt(1.0 + x * x) - 1.0) / 2.0 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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
awlange/pysurvival
BentIdentity
false
14,923
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
LeCunTanh
import torch import torch.nn as nn class LeCunTanh(nn.Module): def forward(self, x): return 1.7159 * torch.tanh(2.0 / 3 * 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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
awlange/pysurvival
LeCunTanh
false
14,924
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
Gaussian
import torch import torch.nn as nn class Gaussian(nn.Module): def forward(self, x): return torch.exp(-x * x / 2.0) 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 math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
awlange/pysurvival
Gaussian
false
14,925
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
CosReLU
import torch import torch.nn as nn class CosReLU(nn.Module): def forward(self, x): return torch.cos(x) + torch.relu(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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
awlange/pysurvival
CosReLU
false
14,926
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
LogLog
import torch import torch.nn as nn class LogLog(nn.Module): def forward(self, x): return 1.0 - torch.exp(-torch.exp(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 math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
awlange/pysurvival
LogLog
false
14,927
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
SinReLU
import torch import torch.nn as nn class SinReLU(nn.Module): def forward(self, x): return torch.sin(x) + torch.relu(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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
awlange/pysurvival
SinReLU
false
14,928
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
MLP
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self, num_classes, n_1, n_2): super(MLP, self).__init__() self.fc1 = nn.Linear(784, n_1) self.fc2 = nn.Linear(n_1, n_2) self.fc3 = nn.Linear(n_2, num_classes) def forward(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 import torch.nn as nn assert_...
awslabs/adatune
MLP
false
14,929
[ "Apache-2.0" ]
266
aecbc498f4545f038c71252e085c2e70a35941c7
https://github.com/awslabs/adatune/tree/aecbc498f4545f038c71252e085c2e70a35941c7
BartClassificationHead
import torch import torch.utils.data from torch import nn class BartClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, input_dim, inner_dim, num_classes, pooler_dropout): super().__init__() self.dense = nn.Linear(input_dim, inner_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.triton_helpers import libdevice import torch.utils....
awslabs/gap-text2sql
BartClassificationHead
false
14,930
[ "Apache-2.0" ]
75
83af3f08a6c108f7cbacb8125e2a7ec9255c81b0
https://github.com/awslabs/gap-text2sql/tree/83af3f08a6c108f7cbacb8125e2a7ec9255c81b0
CNN
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) self.conv2_drop = nn.Dropout2d() self.fc1 = 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 import triton_helpers from torch._inductor.runtime....
awesome-archive/DeepLearningWithPyTorch
CNN
false
14,931
[ "MIT" ]
85
921e3c1bc33f88e2b749dd1f9dac8a414bd4a1ee
https://github.com/awesome-archive/DeepLearningWithPyTorch/tree/921e3c1bc33f88e2b749dd1f9dac8a414bd4a1ee
MINCNet
import torch import torch.utils.data import torch.nn as nn class MINCNet(nn.Module): def __init__(self): super(MINCNet, self).__init__() self.ReLU = nn.ReLU(True) self.conv11 = nn.Conv2d(3, 64, 3, 1, 1) self.conv12 = nn.Conv2d(64, 64, 3, 1, 1) self.maxpool1 = nn.MaxPool2d(...
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.utils.data impor...
arthur-qiu/BasicSR
MINCNet
false
14,932
[ "Apache-2.0" ]
106
2e5f131edfc2adf912a1ed3b8c818a63d590a282
https://github.com/arthur-qiu/BasicSR/tree/2e5f131edfc2adf912a1ed3b8c818a63d590a282
BertLayerNorm
from torch.nn import Module import torch import torch.nn as nn class BertLayerNorm(Module): def __init__(self, hidden_size, eps=1e-12): super(BertLayerNorm, self).__init__() self.shape = torch.Size((hidden_size,)) self.eps = eps self.weight = nn.Parameter(torch.ones(hidden_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 from torch.nn import Module import torch.nn as nn assert_size_stride = torch._C...
axiserr/Hetu
BertLayerNorm
false
14,933
[ "Apache-2.0" ]
82
0052f727488db0570d6b37f63549b43b0920bc29
https://github.com/axiserr/Hetu/tree/0052f727488db0570d6b37f63549b43b0920bc29
Softmax
import torch import torch.nn as nn class Softmax(nn.Module): def forward(self, x): y = torch.exp(x) return y / torch.sum(y, dim=0) 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 math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
awlange/pysurvival
Softmax
false
14,934
[ "Apache-2.0" ]
242
841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
https://github.com/awlange/pysurvival/tree/841b9bc6ce700ba8898d2a1488aa9cd25ee7a8e6
LearnedPositionalEmbedding
import torch import torch.utils.data from torch import nn def create_position_ids_from_input_ids(input_ids, padding_idx): """ Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols are ignored. This is modified from fairseq's `utils.make_positions...
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.utils.data from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
awslabs/gap-text2sql
LearnedPositionalEmbedding
false
14,935
[ "Apache-2.0" ]
75
83af3f08a6c108f7cbacb8125e2a7ec9255c81b0
https://github.com/awslabs/gap-text2sql/tree/83af3f08a6c108f7cbacb8125e2a7ec9255c81b0
LinearActivation
from torch.nn import Module import torch import torch.nn as nn class LinearActivation(Module): def __init__(self, in_features, out_features, act='gelu', bias=True): super(LinearActivation, self).__init__() self.Linear = nn.Linear(in_features, out_features, bias=bias) if act == '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.triton_helpers import libdevice from torch.nn impor...
axiserr/Hetu
LinearActivation
false
14,936
[ "Apache-2.0" ]
82
0052f727488db0570d6b37f63549b43b0920bc29
https://github.com/axiserr/Hetu/tree/0052f727488db0570d6b37f63549b43b0920bc29
BertSelfAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn.functional as F import torch.nn as nn class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_attention_heads != 0: ...
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....
axiserr/Hetu
BertSelfAttention
false
14,937
[ "Apache-2.0" ]
82
0052f727488db0570d6b37f63549b43b0920bc29
https://github.com/axiserr/Hetu/tree/0052f727488db0570d6b37f63549b43b0920bc29
BertOutput
from _paritybench_helpers import _mock_config from torch.nn import Module import torch import torch.nn as nn class BertLayerNorm(Module): def __init__(self, hidden_size, eps=1e-12): super(BertLayerNorm, self).__init__() self.shape = torch.Size((hidden_size,)) self.eps = eps self.w...
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.nn impor...
axiserr/Hetu
BertOutput
false
14,938
[ "Apache-2.0" ]
82
0052f727488db0570d6b37f63549b43b0920bc29
https://github.com/axiserr/Hetu/tree/0052f727488db0570d6b37f63549b43b0920bc29
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...
ayulockin/Image-Super-Resolution-via-Iterative-Refinement
NIN
false
14,939
[ "Apache-2.0" ]
1,764
8a75df33d9ed1a2cc0da22f36f576abfc9482913
https://github.com/ayulockin/Image-Super-Resolution-via-Iterative-Refinement/tree/8a75df33d9ed1a2cc0da22f36f576abfc9482913
CAM_Module
from torch.nn import Module import torch import torch.nn as nn from torch.nn import Parameter from torch.nn import Softmax class C(nn.Module): """ This class is for a convolutional layer. """ def __init__(self, nIn, nOut, kSize, stride=1): """ :param nIn: number of input channels ...
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....
ayushmankumar7/pytorch-lanenet
CAM_Module
false
14,940
[ "MIT" ]
160
db9f116ba3f42dbfabf064e4a89ec068e9da4ee4
https://github.com/ayushmankumar7/pytorch-lanenet/tree/db9f116ba3f42dbfabf064e4a89ec068e9da4ee4
ZeroConv1d
import torch from torch import nn class ZeroConv1d(nn.Module): def __init__(self, in_channel, out_channel): super().__init__() self.conv = nn.Conv1d(in_channel, out_channel, 1, padding=0) self.conv.weight.data.zero_() self.conv.bias.data.zero_() self.scale = nn.Parameter(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._inductor.runtime.triton_helpers import math as tl_math from torch im...
batikim09/FloWaveNet
ZeroConv1d
false
14,941
[ "MIT" ]
499
791f51aff530b2af4f9aa0d9fcb4af53d28a0997
https://github.com/batikim09/FloWaveNet/tree/791f51aff530b2af4f9aa0d9fcb4af53d28a0997
L2N
import torch from torch import nn import torch.autograd def l2n(x, eps=1e-06): return x / (torch.norm(x, p=2, dim=1, keepdim=True) + eps).expand_as(x) class L2N(nn.Module): def __init__(self, eps=1e-06): super(L2N, self).__init__() self.eps = eps def forward(self, x): return l2...
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 torch import nn import torch.autograd assert_size_stride = torch._C._dynam...
bestfitting/instance_level_recognition
L2N
false
14,942
[ "Apache-2.0" ]
103
683f021b4e65876835f028797ec28b0d1071bb45
https://github.com/bestfitting/instance_level_recognition/tree/683f021b4e65876835f028797ec28b0d1071bb45
Conv
import torch from torch import nn class Conv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, dilation=1, causal=True): super(Conv, self).__init__() self.causal = causal if self.causal: self.padding = dilation * (kernel_size - 1) else: ...
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...
batikim09/FloWaveNet
Conv
false
14,943
[ "MIT" ]
499
791f51aff530b2af4f9aa0d9fcb4af53d28a0997
https://github.com/batikim09/FloWaveNet/tree/791f51aff530b2af4f9aa0d9fcb4af53d28a0997
BertAttention
from _paritybench_helpers import _mock_config from torch.nn import Module import math import torch import torch.nn.functional as F import torch.nn as nn class BertLayerNorm(Module): def __init__(self, hidden_size, eps=1e-12): super(BertLayerNorm, self).__init__() self.shape = torch.Size((hidden_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 from torch._inductor.runtime....
axiserr/Hetu
BertAttention
false
14,944
[ "Apache-2.0" ]
82
0052f727488db0570d6b37f63549b43b0920bc29
https://github.com/axiserr/Hetu/tree/0052f727488db0570d6b37f63549b43b0920bc29
CRF
import torch import torch.nn as nn class CRF(nn.Module): """ Implements Conditional Random Fields that can be trained via backpropagation. """ def __init__(self, num_tags): super(CRF, self).__init__() self.num_tags = num_tags self.transitions = nn.Parameter(torch.Tensor(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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
ay94/CrossNER
CRF
false
14,945
[ "MIT" ]
77
2e7ba2a7798c961e3f29fbc51252c5a8d40224bf
https://github.com/ay94/CrossNER/tree/2e7ba2a7798c961e3f29fbc51252c5a8d40224bf
MuSigmaEncoder
import torch from torch import nn class MuSigmaEncoder(nn.Module): """ Maps a representation r to mu and sigma which will define the normal distribution from which we sample the latent variable z. Parameters ---------- r_dim : int Dimension of output representation r. z_dim : 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 assert_s...
benjaminalt/neural-processes
MuSigmaEncoder
false
14,946
[ "MIT" ]
170
03d4f921fe0598c77787eecc53cbed23e326a5f5
https://github.com/benjaminalt/neural-processes/tree/03d4f921fe0598c77787eecc53cbed23e326a5f5
SigmoidFocalLoss
import torch import torch.nn as nn class SigmoidFocalLoss(nn.Module): def __init__(self, gamma, alpha): super().__init__() self.gamma = gamma self.alpha = alpha def forward(self, out, target): n_class = out.shape[1] class_ids = torch.arange(1, n_class + 1, dtype=targe...
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 ...
berserkrambo/fcos-pytorch
SigmoidFocalLoss
false
14,947
[ "MIT" ]
63
a064eccf6d45fc85da401151dcefe7a3b01a065b
https://github.com/berserkrambo/fcos-pytorch/tree/a064eccf6d45fc85da401151dcefe7a3b01a065b
RNNAgent
from _paritybench_helpers import _mock_config import torch import torch.nn.functional as F import torch.nn as nn class RNNAgent(nn.Module): def __init__(self, input_shape, args): super(RNNAgent, self).__init__() self.args = args self.fc1 = nn.Linear(input_shape, args.rnn_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 import torch.nn as nn assert_...
benellis3/pymarl2
RNNAgent
false
14,948
[ "Apache-2.0" ]
401
0875995a0e0b9692ea64484478b369c7f6c0cf44
https://github.com/benellis3/pymarl2/tree/0875995a0e0b9692ea64484478b369c7f6c0cf44
Masked_MSE_Loss
import torch import torch.nn as nn def check_loss_input(im0, im1, w): """ im0 is out and im1 is target and w is mask""" assert list(im0.size())[2:] == list(im1.size())[2:], 'spatial dim mismatch' if w is not None: assert list(im0.size())[2:] == list(w.size())[2: ], 'spatial dim mismatc...
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...
bg459/gan-ensembling-loader
Masked_MSE_Loss
false
14,949
[ "MIT" ]
86
5ff6fae5fd5ced0a48ef2cd3dcb1d74aa1dadce8
https://github.com/bg459/gan-ensembling-loader/tree/5ff6fae5fd5ced0a48ef2cd3dcb1d74aa1dadce8
SelfAttention
import torch import torch.nn.functional as F import torch.nn as nn class SelfAttention(nn.Module): def __init__(self, input_size, heads, embed_size): super().__init__() self.input_size = input_size self.heads = heads self.emb_size = embed_size self.tokeys = nn.Linear(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....
benellis3/pymarl2
SelfAttention
false
14,950
[ "Apache-2.0" ]
401
0875995a0e0b9692ea64484478b369c7f6c0cf44
https://github.com/benellis3/pymarl2/tree/0875995a0e0b9692ea64484478b369c7f6c0cf44
HeatedUpScalar
import torch import torch.nn as nn class HeatedUpScalar(nn.Module): def __init__(self, first_value, last_value, nb_steps, scope='task', ** kwargs): super().__init__() self.scope = scope self.first_value = first_value self.step = (max(first_value, last_value) - min(first_va...
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...
billpsomas/incremental_learning.pytorch
HeatedUpScalar
false
14,951
[ "MIT" ]
277
a401a6609fc61c74698739cf937c0ece1c10913f
https://github.com/billpsomas/incremental_learning.pytorch/tree/a401a6609fc61c74698739cf937c0ece1c10913f
NacCell
import torch from torch import Tensor from torch import nn from torch.nn.parameter import Parameter from torch.nn.init import xavier_uniform_ from torch.nn.functional import linear from torch import sigmoid from torch import tanh class NacCell(nn.Module): """Basic NAC unit implementation from https://arxiv.o...
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 T...
bharathgs/NALU
NacCell
false
14,952
[ "MIT" ]
118
5d52cc270786563b67837a3856841baafba20e60
https://github.com/bharathgs/NALU/tree/5d52cc270786563b67837a3856841baafba20e60
Masked_L1_Loss
import torch import torch.nn as nn def check_loss_input(im0, im1, w): """ im0 is out and im1 is target and w is mask""" assert list(im0.size())[2:] == list(im1.size())[2:], 'spatial dim mismatch' if w is not None: assert list(im0.size())[2:] == list(w.size())[2: ], 'spatial dim mismatc...
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...
bg459/gan-ensembling-loader
Masked_L1_Loss
false
14,953
[ "MIT" ]
86
5ff6fae5fd5ced0a48ef2cd3dcb1d74aa1dadce8
https://github.com/bg459/gan-ensembling-loader/tree/5ff6fae5fd5ced0a48ef2cd3dcb1d74aa1dadce8
FixupBasicBlock
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed import torch.nn def conv3x3(in_planes, out_planes, stride=1): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, ...
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...
bethgelab/robustness
FixupBasicBlock
false
14,954
[ "Apache-2.0" ]
67
aa0a6798fe3973bae5f47561721b59b39f126ab7
https://github.com/bethgelab/robustness/tree/aa0a6798fe3973bae5f47561721b59b39f126ab7
EncoderLayer
import math import torch from torch import nn import torch.nn.functional as F import torch.utils.data.distributed def matmul(x, y): if x.dim() == y.dim(): return x @ y if x.dim() == y.dim() - 1: return (x.unsqueeze(-2) @ y).squeeze(-2) return (x @ y.unsqueeze(-2)).squeeze(-2) class FeedF...
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....
bhubanendra-mishra/dense-video-cap
EncoderLayer
false
14,955
[ "BSD-3-Clause" ]
174
43914e17769701b9cf98eda203ae4c465b315fab
https://github.com/bhubanendra-mishra/dense-video-cap/tree/43914e17769701b9cf98eda203ae4c465b315fab
UNet
import torch import torch.nn as nn import torch.nn.functional as F def Conv(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, 3, padding=1) def concat(a, b): return torch.cat((a, b), 1) def pool(x): return F.max_pool2d(x, 2, 2) def relu(x): return F.relu(x, inplace=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 import torch.nn as nn import ...
arpan-dhatt/oidn
UNet
false
14,956
[ "Apache-2.0" ]
1,206
9419411ba4b343b475b53587cadd44c83d68dc2a
https://github.com/arpan-dhatt/oidn/tree/9419411ba4b343b475b53587cadd44c83d68dc2a
SparsemaxBisect
from torch.autograd import Function import torch import torch.nn as nn def sparsemax_bisect(X, dim=-1, n_iter=50, ensure_sum_one=True): """sparsemax: normalizing sparse transform (a la softmax), via bisection. Solves the projection: min_p ||x - p||_2 s.t. p >= 0, sum(p) == 1. Parameters ...
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.autograd import Function import torch.nn as nn assert_size_stride = torch._C._...
antoniogois/entmax
SparsemaxBisect
false
14,957
[ "MIT" ]
298
7ff3fa6b09ee53e04514173aacae9de90c95ca75
https://github.com/antoniogois/entmax/tree/7ff3fa6b09ee53e04514173aacae9de90c95ca75
FactorScalar
import torch import torch.nn as nn class FactorScalar(nn.Module): def __init__(self, initial_value=1.0, **kwargs): super().__init__() self.factor = nn.Parameter(torch.tensor(initial_value)) def on_task_end(self): pass def on_epoch_end(self): pass def forward(self, i...
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...
billpsomas/incremental_learning.pytorch
FactorScalar
false
14,958
[ "MIT" ]
277
a401a6609fc61c74698739cf937c0ece1c10913f
https://github.com/billpsomas/incremental_learning.pytorch/tree/a401a6609fc61c74698739cf937c0ece1c10913f
InvertedFactorScalar
import torch import torch.nn as nn class InvertedFactorScalar(nn.Module): def __init__(self, initial_value=1.0, **kwargs): super().__init__() self._factor = nn.Parameter(torch.tensor(initial_value)) @property def factor(self): return 1 / (self._factor + 1e-07) def on_task_en...
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...
billpsomas/incremental_learning.pytorch
InvertedFactorScalar
false
14,959
[ "MIT" ]
277
a401a6609fc61c74698739cf937c0ece1c10913f
https://github.com/billpsomas/incremental_learning.pytorch/tree/a401a6609fc61c74698739cf937c0ece1c10913f
MinibatchStdLayer
import torch import torch.nn as nn class MinibatchStdLayer(nn.Module): def __init__(self, group_size=4): super().__init__() self.group_size = group_size def forward(self, x): group_size = min(self.group_size, x.shape[0]) s = x.shape y = x.view([group_size, -1, s[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._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
bg459/gan-ensembling-loader
MinibatchStdLayer
false
14,960
[ "MIT" ]
86
5ff6fae5fd5ced0a48ef2cd3dcb1d74aa1dadce8
https://github.com/bg459/gan-ensembling-loader/tree/5ff6fae5fd5ced0a48ef2cd3dcb1d74aa1dadce8
LinearModel
import torch import torch.nn as nn class LinearModel(nn.Module): """Linear model applying on the logits alpha * x + beta. By default, this model is initialized as an identity operation. See https://arxiv.org/abs/1905.13260 for an example usage. :param alpha: A learned scalar. :param beta: A lea...
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...
billpsomas/incremental_learning.pytorch
LinearModel
false
14,961
[ "MIT" ]
277
a401a6609fc61c74698739cf937c0ece1c10913f
https://github.com/billpsomas/incremental_learning.pytorch/tree/a401a6609fc61c74698739cf937c0ece1c10913f
WeightedL1Loss
import torch import numpy as np import torch.nn as nn class WeightedL1Loss(nn.Module): def __init__(self, code_weights: 'list'=None): """ Args: code_weights: (#codes) float list if not None. Code-wise weights. """ super(WeightedL1Loss, 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._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np import torch.nn as nn assert_size_stride = ...
blakechen97/SASA
WeightedL1Loss
false
14,962
[ "Apache-2.0" ]
46
cd79f60e923242590b64cb0cc70203a524e7e9a7
https://github.com/blakechen97/SASA/tree/cd79f60e923242590b64cb0cc70203a524e7e9a7
TransposeLayer
import torch class TransposeLayer(torch.nn.Module): """Transpose the input.""" def forward(self, data): return data.t().contiguous() def get_inputs(): return [torch.rand([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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
bolajiy/beer
TransposeLayer
false
14,963
[ "MIT" ]
46
6fe968c7ca4864437890aa6bd705755c2580696e
https://github.com/bolajiy/beer/tree/6fe968c7ca4864437890aa6bd705755c2580696e
WeightedBinaryCrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F class WeightedBinaryCrossEntropyLoss(nn.Module): """ Transform input to fit the fomation of PyTorch offical cross entropy loss with anchor-wise weighting. """ def __init__(self): super(WeightedBinaryCrossEntropyLoss, 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 import torc...
blakechen97/SASA
WeightedBinaryCrossEntropyLoss
false
14,964
[ "Apache-2.0" ]
46
cd79f60e923242590b64cb0cc70203a524e7e9a7
https://github.com/blakechen97/SASA/tree/cd79f60e923242590b64cb0cc70203a524e7e9a7
ResidualConvUnit
import torch import torch.nn as nn import torch.fft import torch.utils.cpp_extension import torch.nn class ResidualConvUnit(nn.Module): def __init__(self, cin, activation, bn): super().__init__() self.conv = nn.Conv2d(cin, cin, kernel_size=3, stride=1, padding=1, bias=True) 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 import torch.nn as nn import torch.fft import torch.utils.cpp_extension import t...
autonomousvision/stylegan_xl
ResidualConvUnit
false
14,965
[ "MIT" ]
214
8c76531bcbf0931c295ecd1d32f75af998d1411f
https://github.com/autonomousvision/stylegan_xl/tree/8c76531bcbf0931c295ecd1d32f75af998d1411f
StandardizedConv2d
import torch import torch.nn as nn import torch.nn.functional as F class StandardizedConv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(StandardizedConv2d, self).__init__(in_channels, out_channels, ...
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 ...
blazejdolicki/vissl
StandardizedConv2d
false
14,966
[ "MIT" ]
2,512
9c10748a19fb1c637f32687142c8cd685f2410ff
https://github.com/blazejdolicki/vissl/tree/9c10748a19fb1c637f32687142c8cd685f2410ff
AdaptiveInstanceNorm
import torch import torch.nn as nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') ...
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 ...
blandocs/Tag2Pix
AdaptiveInstanceNorm
false
14,967
[ "MIT" ]
232
733d729067608dbe2c1122c9128f2f38bc0a8edd
https://github.com/blandocs/Tag2Pix/tree/733d729067608dbe2c1122c9128f2f38bc0a8edd
LabelSmoothingBCE
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed class LabelSmoothingBCE(nn.Module): def __init__(self, smoothing=0.0): super(LabelSmoothingBCE, self).__init__() self.criterion = nn.BCEWithLogitsLoss(reduction='none') self.confidence = 1.0 - 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._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
boldsort/craftassist
LabelSmoothingBCE
false
14,968
[ "MIT" ]
626
8058d115a250e30deb60d969b7b1a5fefd6e974c
https://github.com/boldsort/craftassist/tree/8058d115a250e30deb60d969b7b1a5fefd6e974c
NormalIsotropicCovarianceLayer
import abc import math import torch class ProbabilisticLayer(torch.nn.Module, metaclass=abc.ABCMeta): """Probabilistic layer to be used by the encoder/decoder of a Variational AutoEncoder. """ @abc.abstractmethod def forward(self, inputs): """Compute the parameters of the distribution co...
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...
bolajiy/beer
NormalIsotropicCovarianceLayer
false
14,969
[ "MIT" ]
46
6fe968c7ca4864437890aa6bd705755c2580696e
https://github.com/bolajiy/beer/tree/6fe968c7ca4864437890aa6bd705755c2580696e
NormalDiagonalCovarianceLayer
import abc import math import torch class ProbabilisticLayer(torch.nn.Module, metaclass=abc.ABCMeta): """Probabilistic layer to be used by the encoder/decoder of a Variational AutoEncoder. """ @abc.abstractmethod def forward(self, inputs): """Compute the parameters of the distribution co...
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...
bolajiy/beer
NormalDiagonalCovarianceLayer
false
14,970
[ "MIT" ]
46
6fe968c7ca4864437890aa6bd705755c2580696e
https://github.com/bolajiy/beer/tree/6fe968c7ca4864437890aa6bd705755c2580696e
SkipLastTargetChannelWrapper
import torch import torch.nn as nn from torch.nn import MSELoss class SkipLastTargetChannelWrapper(nn.Module): """ Loss wrapper which removes additional target channel """ def __init__(self, loss, squeeze_channel=False): super(SkipLastTargetChannelWrapper, self).__init__() self.loss =...
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...
bounesh/pytorch-3dunet
SkipLastTargetChannelWrapper
false
14,971
[ "MIT" ]
1,236
60278d01eaacc69feee731979826a0c26e223427
https://github.com/bounesh/pytorch-3dunet/tree/60278d01eaacc69feee731979826a0c26e223427
WeightedSmoothL1Loss
import torch import torch.nn as nn class WeightedSmoothL1Loss(nn.SmoothL1Loss): def __init__(self, threshold, initial_weight, apply_below_threshold=True): super().__init__(reduction='none') self.threshold = threshold self.apply_below_threshold = apply_below_threshold self.weight =...
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...
bounesh/pytorch-3dunet
WeightedSmoothL1Loss
false
14,972
[ "MIT" ]
1,236
60278d01eaacc69feee731979826a0c26e223427
https://github.com/bounesh/pytorch-3dunet/tree/60278d01eaacc69feee731979826a0c26e223427
GELU
import torch import numpy as np from torch import nn import torch.nn.functional as F class GELU(nn.Module): def __init__(self): super(GELU, self).__init__() def forward(self, x): return 0.5 * x * (1 + F.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) def get_inputs...
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 torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bubbliiiing/classification-pytorch
GELU
false
14,973
[ "MIT" ]
88
ee62c05bd3094c3fab48bada5a57cb2ed8b61c11
https://github.com/bubbliiiing/classification-pytorch/tree/ee62c05bd3094c3fab48bada5a57cb2ed8b61c11
HighwayNetwork
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed class HighwayNetwork(nn.Module): def __init__(self, in_dim, out_dim): super(HighwayNetwork, self).__init__() self.gate_proj = nn.Linear(in_dim, out_dim) self.lin_proj = nn.Linear(in_dim, out_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 import torch.nn as nn import ...
boldsort/craftassist
HighwayNetwork
false
14,974
[ "MIT" ]
626
8058d115a250e30deb60d969b7b1a5fefd6e974c
https://github.com/boldsort/craftassist/tree/8058d115a250e30deb60d969b7b1a5fefd6e974c
ResidualFeedFowardBlock
import torch class ResidualFeedFowardBlock(torch.nn.Module): """Block of two feed-forward layer with a reisdual connection: f(W1^T x + b1) f(W2^T h1 + b2 ) h2 + x x ------------------> h1 --------------------> h2 ----------> y | ...
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 ...
bolajiy/beer
ResidualFeedFowardBlock
false
14,976
[ "MIT" ]
46
6fe968c7ca4864437890aa6bd705755c2580696e
https://github.com/bolajiy/beer/tree/6fe968c7ca4864437890aa6bd705755c2580696e
EpeLoss
import torch import torch.nn as nn class EpeLoss(nn.Module): def __init__(self, eps=0): super(EpeLoss, self).__init__() self.eps = eps def forward(self, pred, label): loss = ((pred - label).pow(2).sum(1) + self.eps).sqrt() return loss.view(loss.shape[0], -1).mean(1) def get...
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_...
brightvioletlight/MaskFlownet-Pytorch
EpeLoss
false
14,977
[ "MIT" ]
75
4158bac3b2fe50bfdf4216b4890ce24a8011227a
https://github.com/brightvioletlight/MaskFlownet-Pytorch/tree/4158bac3b2fe50bfdf4216b4890ce24a8011227a
ExtResNetBlock
import torch import torch.nn as nn def conv3d(in_channels, out_channels, kernel_size, bias, padding): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding): """ Create a list o...
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 ...
bounesh/pytorch-3dunet
ExtResNetBlock
false
14,979
[ "MIT" ]
1,236
60278d01eaacc69feee731979826a0c26e223427
https://github.com/bounesh/pytorch-3dunet/tree/60278d01eaacc69feee731979826a0c26e223427
BCEDiceLoss
import torch import torch.nn as nn def flatten(tensor): """Flattens a given tensor such that the channel axis is first. The shapes are transformed as follows: (N, C, D, H, W) -> (C, N * D * H * W) """ C = tensor.size(1) axis_order = (1, 0) + tuple(range(2, tensor.dim())) transposed = te...
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...
bounesh/pytorch-3dunet
BCEDiceLoss
false
14,980
[ "MIT" ]
1,236
60278d01eaacc69feee731979826a0c26e223427
https://github.com/bounesh/pytorch-3dunet/tree/60278d01eaacc69feee731979826a0c26e223427
EpeLossWithMask
import torch import torch.nn as nn class EpeLossWithMask(nn.Module): def __init__(self, eps=1e-08, q=None): super(EpeLossWithMask, self).__init__() self.eps = eps self.q = q def forward(self, pred, label, mask): if self.q is not None: loss = ((pred - label).abs()....
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_...
brightvioletlight/MaskFlownet-Pytorch
EpeLossWithMask
false
14,981
[ "MIT" ]
75
4158bac3b2fe50bfdf4216b4890ce24a8011227a
https://github.com/brightvioletlight/MaskFlownet-Pytorch/tree/4158bac3b2fe50bfdf4216b4890ce24a8011227a