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
Conv2dWS
import torch import torch.nn.functional as F from torch import nn class Conv2dWS(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(Conv2dWS, self).__init__(in_channels, out_channels, kernel_size, 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.triton_helpers import libdevice from torch import n...
cooked-sashimi/Yet-Another-YOLOv4-Pytorch
Conv2dWS
false
15,083
[ "MIT" ]
133
c884ef8849987a75b0e17eba1b739c22d3782e90
https://github.com/cooked-sashimi/Yet-Another-YOLOv4-Pytorch/tree/c884ef8849987a75b0e17eba1b739c22d3782e90
InnerProductModel
import torch class InnerProductModel(torch.nn.Module): @staticmethod def is_valid_model_type(model_type): raise NotImplementedError @staticmethod def get_model_from_type(model_type): raise NotImplementedError @property def loss_criterion(self): return torch.nn.MSELos...
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 reinterpret...
cuiboyuan/plato
InnerProductModel
false
15,084
[ "Apache-2.0" ]
135
260b785cbbf8588c92331d6343211ff72321f90e
https://github.com/cuiboyuan/plato/tree/260b785cbbf8588c92331d6343211ff72321f90e
Myloss
import torch import torch.nn as nn class Myloss(nn.Module): def __init__(self, epsilon=1e-08): super(Myloss, self).__init__() self.epsilon = epsilon return def forward(self, input_, label, weight): entropy = -label * torch.log(input_ + self.epsilon) - (1 - label )...
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 ...
cuishuhao/HDA
Myloss
false
15,085
[ "Apache-2.0" ]
58
1733ca74eee7839b455e9ffd7a169bc54b272745
https://github.com/cuishuhao/HDA/tree/1733ca74eee7839b455e9ffd7a169bc54b272745
AconC
import torch import torch.nn as nn class AconC(nn.Module): """ ACON activation (activate or not). AconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is a learnable parameter according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>. """ def __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...
cuiboyuan/plato
AconC
false
15,086
[ "Apache-2.0" ]
135
260b785cbbf8588c92331d6343211ff72321f90e
https://github.com/cuiboyuan/plato/tree/260b785cbbf8588c92331d6343211ff72321f90e
ECA
import torch from torch import nn class FastGlobalAvgPool2d: def __init__(self, flatten=False): self.flatten = flatten def __call__(self, x): if self.flatten: in_size = x.size() return x.view((in_size[0], in_size[1], -1)).mean(dim=2) else: return 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
cooked-sashimi/Yet-Another-YOLOv4-Pytorch
ECA
false
15,087
[ "MIT" ]
133
c884ef8849987a75b0e17eba1b739c22d3782e90
https://github.com/cooked-sashimi/Yet-Another-YOLOv4-Pytorch/tree/c884ef8849987a75b0e17eba1b739c22d3782e90
BinaryFocalLoss
import torch import torch as th import torch.nn as nn class BinaryFocalLoss(nn.Module): def __init__(self, gamma=2.0, alpha=0.25, size_average=True): super(BinaryFocalLoss, self).__init__() self.gamma = gamma self.alpha = alpha self.size_average = size_average def forward(sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
cumtchenchang/PPGNet
BinaryFocalLoss
false
15,088
[ "MIT" ]
171
9b280aacb887ec584e905b9f9ab006b4f4cb2cc3
https://github.com/cumtchenchang/PPGNet/tree/9b280aacb887ec584e905b9f9ab006b4f4cb2cc3
BCL
import torch import torch.utils.data import torch from torch import nn class BCL(nn.Module): """ batch-balanced contrastive loss no-change,1 change,-1 """ def __init__(self, margin=2.0): super(BCL, self).__init__() self.margin = margin def forward(self, distance, label): ...
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.utils.data import torch from torch import nn assert_size_stride = torch._C._...
cuicaihao/STANet
BCL
false
15,089
[ "BSD-2-Clause" ]
220
4c644e2a65bc9516f1d97b29b12ca864638c0c7e
https://github.com/cuicaihao/STANet/tree/4c644e2a65bc9516f1d97b29b12ca864638c0c7e
MultConst
import torch import torch.nn as nn class MultConst(nn.Module): def forward(self, input): return 255 * input def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
czczup/URST
MultConst
false
15,090
[ "Apache-2.0" ]
119
000ec9f7728f12ffad989ec1d07b1dd579514133
https://github.com/czczup/URST/tree/000ec9f7728f12ffad989ec1d07b1dd579514133
FIN2dCyclic
import torch import torch.utils.data import torch import torch.nn as nn class FIN2dCyclic(nn.Module): def __init__(self, dim): super().__init__() self.instance_norm = nn.InstanceNorm2d(dim, affine=False) self.a_gamma = nn.Parameter(torch.zeros(dim)) self.b_gamma = nn.Parameter(tor...
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.utils.data import torch import torch.nn as nn assert_size_stride =...
cv-rits/CoMoGAN
FIN2dCyclic
false
15,091
[ "Apache-2.0" ]
141
09f2f0f694421e289fcad467ca0b23f52e4da7a4
https://github.com/cv-rits/CoMoGAN/tree/09f2f0f694421e289fcad467ca0b23f52e4da7a4
BCELoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils def binary_cross_entropy(inputs, target, weight=None, reduction='mean', smooth_eps=None, from_logits=False): """cross entropy loss, with support for label smoothing https://arxiv.org/abs/1512.00567""" smooth_eps = smooth...
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...
cwlacewe/SNAS-Series
BCELoss
false
15,092
[ "MIT" ]
133
92ac8031f718235aecaefb9967851f8f355dbca0
https://github.com/cwlacewe/SNAS-Series/tree/92ac8031f718235aecaefb9967851f8f355dbca0
GramMatrix
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, y): b, ch, h, w = y.size() features = y.view(b, ch, w * h) features_t = features.transpose(1, 2) gram = features.bmm(features_t) / (ch * h * w) return gram def get_inputs(): return [tor...
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...
czczup/URST
GramMatrix
false
15,093
[ "Apache-2.0" ]
119
000ec9f7728f12ffad989ec1d07b1dd579514133
https://github.com/czczup/URST/tree/000ec9f7728f12ffad989ec1d07b1dd579514133
MetaAconC
import torch import torch.nn as nn class MetaAconC(nn.Module): """ ACON activation (activate or not). MetaAconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is generated by a small network according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>. "...
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...
cuiboyuan/plato
MetaAconC
false
15,094
[ "Apache-2.0" ]
135
260b785cbbf8588c92331d6343211ff72321f90e
https://github.com/cuiboyuan/plato/tree/260b785cbbf8588c92331d6343211ff72321f90e
PreActBlock
import torch import torch.nn as nn import torch.nn.functional as F class PreActBlock(nn.Module): """Pre-activation version of the BasicBlock.""" expansion = 1 def __init__(self, in_planes, planes, num_group=4, stride=1, bias=False): super(PreActBlock, self).__init__() self.conv1 = nn.Conv...
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...
cwmok/LapIRN
PreActBlock
false
15,095
[ "MIT" ]
53
d8f96770a704b1f190955cc26297c7b01a270b0a
https://github.com/cwmok/LapIRN/tree/d8f96770a704b1f190955cc26297c7b01a270b0a
DomainClassifier
import torch import torch.nn.parallel import torch.optim import torch.nn as nn class DomainClassifier(nn.Module): def __init__(self, input_dim=1024, ndf=64, with_bias=False): super(DomainClassifier, self).__init__() self.conv1 = nn.Conv2d(input_dim, ndf, kernel_size=4, stride=2, paddi...
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.parallel import torch.optim import torch.nn as nn assert_size_st...
chaneyddtt/UDA-Animal-Pose
DomainClassifier
false
15,096
[ "MIT" ]
61
f1ebfda860a2585c60fe86ce1632e910ac97ebc5
https://github.com/chaneyddtt/UDA-Animal-Pose/tree/f1ebfda860a2585c60fe86ce1632e910ac97ebc5
LayerNorm
import torch import torch.nn as nn from torch.nn.parameter import Parameter class LayerNorm(nn.Module): def __init__(self, input_dim, cond_dim=0, center=True, scale=True, epsilon=None, conditional=False, hidden_units=None, hidden_activation='linear', hidden_initializer='xaiver', **kwargs): ...
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 from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided...
cwxcwx0319/Dictionary
LayerNorm
false
15,097
[ "Apache-2.0" ]
82
55fb9a602a212f9c3a69a318fec31da1d07279df
https://github.com/cwxcwx0319/Dictionary/tree/55fb9a602a212f9c3a69a318fec31da1d07279df
ThumbAdaptiveInstanceNorm
import torch import torch.nn as nn class ThumbInstanceNorm(nn.Module): def __init__(self, out_channels=None, affine=True): super(ThumbInstanceNorm, self).__init__() self.thumb_mean = None self.thumb_std = None self.collection = True if affine is True: self.weig...
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_...
czczup/URST
ThumbAdaptiveInstanceNorm
false
15,099
[ "Apache-2.0" ]
119
000ec9f7728f12ffad989ec1d07b1dd579514133
https://github.com/czczup/URST/tree/000ec9f7728f12ffad989ec1d07b1dd579514133
resnet_block
import torch import torch.nn as nn import torch.nn.functional as F class resnet_block(nn.Module): def __init__(self, dim_in, dim_out): super(resnet_block, self).__init__() self.dim_in = dim_in self.dim_out = dim_out if self.dim_in == self.dim_out: self.conv_1 = nn.Conv...
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 ...
czq142857/DECOR-GAN
resnet_block
false
15,102
[ "MIT" ]
55
79c80fc202b8af982989a3e3bb3afe85e606b71f
https://github.com/czq142857/DECOR-GAN/tree/79c80fc202b8af982989a3e3bb3afe85e606b71f
VQVAEQuantize
import torch from torch import nn import torch.nn.functional as F from scipy.cluster.vq import kmeans2 class VQVAEQuantize(nn.Module): """ Neural Discrete Representation Learning, van den Oord et al. 2017 https://arxiv.org/abs/1711.00937 Follows the original DeepMind implementation https://github...
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...
crizCraig/deep-vector-quantization
VQVAEQuantize
false
15,103
[ "MIT" ]
326
c3c026a1ccea369bc892ad6dde5e6d6cd5a508a4
https://github.com/crizCraig/deep-vector-quantization/tree/c3c026a1ccea369bc892ad6dde5e6d6cd5a508a4
ScaledDotProductAttention
import torch import numpy as np import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super(ScaledDotProductAttention, self).__init__() self.temperature = temperature self.dropout = 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....
dani3l125/TDNet
ScaledDotProductAttention
false
15,104
[ "MIT" ]
195
3f8b5378fcc7f97c26b3760ddaf3d4402cf477d1
https://github.com/dani3l125/TDNet/tree/3f8b5378fcc7f97c26b3760ddaf3d4402cf477d1
decoder3
import torch import torch.nn as nn class decoder3(nn.Module): def __init__(self): super(decoder3, self).__init__() self.reflecPad7 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv7 = nn.Conv2d(256, 128, 3, 1, 0) self.relu7 = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingNea...
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....
czczup/URST
decoder3
false
15,105
[ "Apache-2.0" ]
119
000ec9f7728f12ffad989ec1d07b1dd579514133
https://github.com/czczup/URST/tree/000ec9f7728f12ffad989ec1d07b1dd579514133
SelfCorrelationComputation
import torch import torch.nn as nn import torch.nn.functional as F class SelfCorrelationComputation(nn.Module): def __init__(self, kernel_size=(5, 5), padding=2): super(SelfCorrelationComputation, self).__init__() self.kernel_size = kernel_size self.unfold = nn.Unfold(kernel_size=kernel_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 import torch.nn as nn assert...
dahyun-kang/renet
SelfCorrelationComputation
false
15,106
[ "MIT" ]
50
43a4e5af96b56c99a0cd63e35bd272db72f7f3a4
https://github.com/dahyun-kang/renet/tree/43a4e5af96b56c99a0cd63e35bd272db72f7f3a4
discriminator
import torch import torch.nn as nn import torch.nn.functional as F class discriminator(nn.Module): def __init__(self, d_dim, z_dim): super(discriminator, self).__init__() self.d_dim = d_dim self.z_dim = z_dim self.conv_1 = nn.Conv3d(1, self.d_dim, 4, stride=1, padding=0, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
czq142857/DECOR-GAN
discriminator
false
15,107
[ "MIT" ]
55
79c80fc202b8af982989a3e3bb3afe85e606b71f
https://github.com/czq142857/DECOR-GAN/tree/79c80fc202b8af982989a3e3bb3afe85e606b71f
EntmaxBisect
from torch.autograd import Function import torch import torch.nn as nn def entmax_bisect(X, alpha=1.5, dim=-1, n_iter=50, ensure_sum_one=True): """alpha-entmax: normalizing sparse transform (a la softmax). Solves the optimization problem: max_p <x, p> - H_a(p) s.t. p >= 0, sum(p) == 1. wh...
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.autograd import F...
antoniogois/entmax
EntmaxBisect
false
15,108
[ "MIT" ]
298
7ff3fa6b09ee53e04514173aacae9de90c95ca75
https://github.com/antoniogois/entmax/tree/7ff3fa6b09ee53e04514173aacae9de90c95ca75
decoder4
import torch import torch.nn as nn class decoder4(nn.Module): def __init__(self): super(decoder4, self).__init__() self.reflecPad11 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv11 = nn.Conv2d(512, 256, 3, 1, 0) self.relu11 = nn.ReLU(inplace=True) self.unpool = nn.Upsampling...
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....
czczup/URST
decoder4
false
15,109
[ "Apache-2.0" ]
119
000ec9f7728f12ffad989ec1d07b1dd579514133
https://github.com/czczup/URST/tree/000ec9f7728f12ffad989ec1d07b1dd579514133
CrossEntropyLossWithAuxiliary
import torch import torch.nn as nn import torch.nn.parallel from torch.optim.lr_scheduler import * from torchvision.models import * from torchvision.transforms import * class CrossEntropyLossWithAuxiliary(nn.CrossEntropyLoss): """Cross-entropy loss that can add auxiliary loss if present.""" def forward(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 math as tl_math import torch.nn as nn ...
dani3l125/torchprune
CrossEntropyLossWithAuxiliary
false
15,110
[ "MIT" ]
74
f2589ec7514bd531ddaa7da3aed6388bb13712d3
https://github.com/dani3l125/torchprune/tree/f2589ec7514bd531ddaa7da3aed6388bb13712d3
SelfAttention
import torch import torch.nn as nn class SelfAttention(nn.Module): """A simple self-attention solution.""" def __init__(self, data_dim, dim_q): super(SelfAttention, self).__init__() self._layers = [] self._fc_q = nn.Linear(data_dim, dim_q) self._layers.append(self._fc_q) ...
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...
daia99/brain-tokyo-workshop
SelfAttention
false
15,111
[ "Apache-2.0" ]
1,097
cd470255230afddba2b80d99a9641b682f4d0762
https://github.com/daia99/brain-tokyo-workshop/tree/cd470255230afddba2b80d99a9641b682f4d0762
FPNOutput
import torch import torch.nn as nn class ConvBNReLU(nn.Module): def __init__(self, in_chan, out_chan, ks=1, stride=1, padding=0, norm_layer=None, bias=True, *args, **kwargs): super(ConvBNReLU, self).__init__() self.conv = nn.Conv2d(in_chan, out_chan, kernel_size=ks, stride= 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
dani3l125/TDNet
FPNOutput
false
15,112
[ "MIT" ]
195
3f8b5378fcc7f97c26b3760ddaf3d4402cf477d1
https://github.com/dani3l125/TDNet/tree/3f8b5378fcc7f97c26b3760ddaf3d4402cf477d1
NSELoss
import torch class NSELoss(torch.nn.Module): """Calculate (batch-wise) NSE Loss. Each sample i is weighted by 1 / (std_i + eps)^2, where std_i is the standard deviation of the discharge from the basin, to which the sample belongs. Parameters: ----------- eps : float Constant, added ...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
danielsuo/toy_flood
NSELoss
false
15,113
[ "MIT" ]
49
471d3c4091d86d4a00fbf910937d4e60fdaf79a1
https://github.com/danielsuo/toy_flood/tree/471d3c4091d86d4a00fbf910937d4e60fdaf79a1
MLP_CRITIC
from _paritybench_helpers import _mock_config import torch import torch.nn as nn def weights_init(m): classname = m.__class__.__name__ if classname.find('Linear') != -1: m.weight.data.normal_(0.0, 0.02) m.bias.data.fill_(0) elif classname.find('BatchNorm') != -1: m.weight.data.norm...
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...
Huihui-z/CE-GZSL
MLP_CRITIC
false
15,114
[ "MIT" ]
58
7bf5358ac4727ea1dc2dc9dec2f453b014500bd8
https://github.com/Huihui-z/CE-GZSL/tree/7bf5358ac4727ea1dc2dc9dec2f453b014500bd8
OhemCELoss2D
import math import torch import torch.nn as nn class OhemCELoss2D(nn.CrossEntropyLoss): """2D Cross Entropy Loss with Auxilary Loss""" def __init__(self, n_min, thresh=0.7, ignore_index=-1): super(OhemCELoss2D, self).__init__(None, None, ignore_index, reduction='none') self.thresh...
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 math import tor...
dani3l125/TDNet
OhemCELoss2D
false
15,115
[ "MIT" ]
195
3f8b5378fcc7f97c26b3760ddaf3d4402cf477d1
https://github.com/dani3l125/TDNet/tree/3f8b5378fcc7f97c26b3760ddaf3d4402cf477d1
RewardCriterion
import torch import torch.nn as nn from torch.autograd import Variable from torch.autograd import * def to_contiguous(tensor): if tensor.is_contiguous(): return tensor else: return tensor.contiguous() class RewardCriterion(nn.Module): def __init__(self): super(RewardCriterion, 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 import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
daqingliu/CAVP
RewardCriterion
false
15,116
[ "MIT" ]
49
d383affde78dbc75e369095c27954dcdd79478d0
https://github.com/daqingliu/CAVP/tree/d383affde78dbc75e369095c27954dcdd79478d0
CircularPad
import torch from torch import nn class CircularPad(nn.Module): def __init__(self, pad): super(CircularPad, self).__init__() self.pad = pad self.zeropad = torch.nn.modules.padding.ConstantPad2d((pad, pad, 0, 0), 0) def forward(self, x): x = torch.cat([x[..., -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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
daniilidis-group/emvn
CircularPad
false
15,117
[ "MIT" ]
46
1888e2a47b02e911e08afa40ba7341662cf3d6ea
https://github.com/daniilidis-group/emvn/tree/1888e2a47b02e911e08afa40ba7341662cf3d6ea
classifier
import torch import torch.nn as nn import torch.nn.functional as F class classifier(nn.Module): def __init__(self, ef_dim, z_dim, class_num, voxel_size): super(classifier, self).__init__() self.ef_dim = ef_dim self.z_dim = z_dim self.class_num = class_num self.voxel_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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
czq142857/DECOR-GAN
classifier
false
15,118
[ "MIT" ]
55
79c80fc202b8af982989a3e3bb3afe85e606b71f
https://github.com/czq142857/DECOR-GAN/tree/79c80fc202b8af982989a3e3bb3afe85e606b71f
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....
carson-sky/Patch-NetVLAD
NetVLAD
false
15,119
[ "MIT" ]
278
7b913626b34dbbe250d6921a6a093512ee513eac
https://github.com/carson-sky/Patch-NetVLAD/tree/7b913626b34dbbe250d6921a6a093512ee513eac
SingleSP
from _paritybench_helpers import _mock_config import torch import torch.nn as nn from torch.autograd import * import torch.nn.functional as F class SingleSP(nn.Module): def __init__(self, opt): super(SingleSP, self).__init__() self.rnn_size = opt.rnn_size self.att_hid_size = opt.att_hid_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....
daqingliu/CAVP
SingleSP
false
15,120
[ "MIT" ]
49
d383affde78dbc75e369095c27954dcdd79478d0
https://github.com/daqingliu/CAVP/tree/d383affde78dbc75e369095c27954dcdd79478d0
FLogSigmoid
import torch import torch.nn as nn class FLogSigmoid(nn.Module): """ Test for nn.functional types """ def __init__(self): super(FLogSigmoid, self).__init__() def forward(self, x): from torch.nn import functional as F return F.logsigmoid(x) def get_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, math as tl_math import torc...
dawnclaude/onnx2keras
FLogSigmoid
false
15,121
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
SpatialAttention
import torch import torch.nn as nn import torch.nn import torch.utils.data class SpatialAttention(nn.Module): def __init__(self, input_dim, context_dim): super().__init__() self.conv_context = nn.Conv2d(context_dim, input_dim, 1, stride=1, padding=0, bias=False) self.sm = nn.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....
dariopavllo/textured-3d-gan
SpatialAttention
false
15,122
[ "MIT" ]
77
d419cee94c5913a900e08b15c0438eb2c89ce4d4
https://github.com/dariopavllo/textured-3d-gan/tree/d419cee94c5913a900e08b15c0438eb2c89ce4d4
AsymmetricLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class AsymmetricLoss(nn.Module): def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=False): super(AsymmetricLoss...
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...
davidaderup/query2labels
AsymmetricLoss
false
15,123
[ "MIT" ]
164
5a10c861dda85d94ba01ec6ad4119eef67a9f441
https://github.com/davidaderup/query2labels/tree/5a10c861dda85d94ba01ec6ad4119eef67a9f441
AsymmetricLossOptimized
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class AsymmetricLossOptimized(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations""" def __init__(sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
davidaderup/query2labels
AsymmetricLossOptimized
false
15,124
[ "MIT" ]
164
5a10c861dda85d94ba01ec6ad4119eef67a9f441
https://github.com/davidaderup/query2labels/tree/5a10c861dda85d94ba01ec6ad4119eef67a9f441
FHardtanh
import random import torch import torch.nn as nn class FHardtanh(nn.Module): """ Test for nn.functional types """ def __init__(self): super(FHardtanh, self).__init__() self.min_val = random.random() self.max_val = self.min_val + random.random() def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import random import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_s...
dawnclaude/onnx2keras
FHardtanh
false
15,125
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
OutputSP
from _paritybench_helpers import _mock_config import torch import torch.nn as nn from torch.autograd import * import torch.nn.functional as F class OutputSP(nn.Module): def __init__(self, opt): super(OutputSP, self).__init__() self.rnn_size = opt.rnn_size self.att_hid_size = opt.att_hid_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....
daqingliu/CAVP
OutputSP
false
15,126
[ "MIT" ]
49
d383affde78dbc75e369095c27954dcdd79478d0
https://github.com/daqingliu/CAVP/tree/d383affde78dbc75e369095c27954dcdd79478d0
FClipTest
import torch import numpy as np import torch.nn as nn class FClipTest(nn.Module): """ Test for nn.functional types """ def __init__(self): self.low = np.random.uniform(-1, 1) self.high = np.random.uniform(1, 2) super(FClipTest, self).__init__() def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.ass...
dawnclaude/onnx2keras
FClipTest
false
15,127
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
EALSTM
import torch from typing import Tuple import torch.nn as nn class EALSTM(nn.Module): """Implementation of the Entity-Aware-LSTM (EA-LSTM) TODO: Include paper ref and latex equations Parameters ---------- input_size_dyn : int Number of dynamic features, which are those, passed to the LSTM...
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 ...
danielsuo/toy_flood
EALSTM
false
15,128
[ "MIT" ]
49
471d3c4091d86d4a00fbf910937d4e60fdaf79a1
https://github.com/danielsuo/toy_flood/tree/471d3c4091d86d4a00fbf910937d4e60fdaf79a1
FMul
import torch import torch.nn as nn class FMul(nn.Module): def __init__(self): super(FMul, self).__init__() def forward(self, x, y): x = x * y x = x * 10.0 return x 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
dawnclaude/onnx2keras
FMul
false
15,129
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
GroupWiseLinear
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 class GroupWiseLinear(nn.Module): def __init__(self, num_class, hidden_dim, bias=True): super().__init__() self.num_class = num_class 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 torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed as...
davidaderup/query2labels
GroupWiseLinear
false
15,130
[ "MIT" ]
164
5a10c861dda85d94ba01ec6ad4119eef67a9f441
https://github.com/davidaderup/query2labels/tree/5a10c861dda85d94ba01ec6ad4119eef67a9f441
EncoderImagePrecomp
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(x, dim=-1): return x / x.norm(2, dim=dim, keepdim=True).clamp(min=1e-06) class EncoderImagePrecomp(nn.Module): """ image encoder """ def __init__(self, img_dim, embed_size, no_imgno...
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....
davidatbu/MLVGSNL
EncoderImagePrecomp
false
15,131
[ "MIT" ]
97
88d42424a0a7badb43e22cd3950948c9522faaa1
https://github.com/davidatbu/MLVGSNL/tree/88d42424a0a7badb43e22cd3950948c9522faaa1
FDiv
import torch import torch.nn as nn class FDiv(nn.Module): def __init__(self): super(FDiv, self).__init__() def forward(self, x, y): x = x / 2 y = y / 2 x = x / y return x def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_ini...
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...
dawnclaude/onnx2keras
FDiv
false
15,132
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
img_encoder
import torch import torch.nn as nn import torch.nn.functional as F class resnet_block(nn.Module): def __init__(self, dim_in, dim_out): super(resnet_block, self).__init__() self.dim_in = dim_in self.dim_out = dim_out if self.dim_in == self.dim_out: self.conv_1 = nn.Conv...
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....
czq142857/DECOR-GAN
img_encoder
false
15,133
[ "MIT" ]
55
79c80fc202b8af982989a3e3bb3afe85e606b71f
https://github.com/czq142857/DECOR-GAN/tree/79c80fc202b8af982989a3e3bb3afe85e606b71f
LSTM
import torch from typing import Tuple import torch.nn as nn class LSTM(nn.Module): """Implementation of the standard LSTM. TODO: Include ref and LaTeX equations Parameters ---------- input_size : int Number of input features hidden_size : int Number of hidden/memory cells. ...
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 ...
danielsuo/toy_flood
LSTM
false
15,134
[ "MIT" ]
49
471d3c4091d86d4a00fbf910937d4e60fdaf79a1
https://github.com/danielsuo/toy_flood/tree/471d3c4091d86d4a00fbf910937d4e60fdaf79a1
GatedConv2d
import torch import torch.nn as nn from torch.nn import functional as F class GatedConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation=1): super(GatedConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, 2 * out_channels, kernel_si...
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...
davidreiman/nsf
GatedConv2d
false
15,136
[ "MIT" ]
231
ed70316c3bf1acd4ffdf309f1773172c34e48320
https://github.com/davidreiman/nsf/tree/ed70316c3bf1acd4ffdf309f1773172c34e48320
decoder5
import torch import torch.nn as nn class decoder5(nn.Module): def __init__(self): super(decoder5, self).__init__() self.reflecPad15 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv15 = nn.Conv2d(512, 512, 3, 1, 0) self.relu15 = nn.ReLU(inplace=True) self.unpool = nn.Upsampling...
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....
czczup/URST
decoder5
false
15,137
[ "Apache-2.0" ]
119
000ec9f7728f12ffad989ec1d07b1dd579514133
https://github.com/czczup/URST/tree/000ec9f7728f12ffad989ec1d07b1dd579514133
FPELU
import random import torch import torch.nn as nn class FPELU(nn.Module): """ Test for nn.functional types """ def __init__(self): super(FPELU, self).__init__() self.alpha = random.random() def forward(self, x): from torch.nn import functional as F return F.elu(x, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import random import torch.nn as nn assert_size_stride = torch._C._dynamo.guard...
dawnclaude/onnx2keras
FPELU
false
15,138
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
FLeakyReLU
import random import torch import torch.nn as nn class FLeakyReLU(nn.Module): """ Test for nn.functional types """ def __init__(self): super(FLeakyReLU, self).__init__() self.negative_slope = random.random() def forward(self, x): from torch.nn import functional as F ...
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 random import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.gu...
dawnclaude/onnx2keras
FLeakyReLU
false
15,139
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
FSELU
import torch import torch.nn as nn class FSELU(nn.Module): """ Test for nn.functional types """ def __init__(self): super(FSELU, self).__init__() def forward(self, x): from torch.nn import functional as F return F.selu(x) def get_inputs(): return [torch.rand([4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
dawnclaude/onnx2keras
FSELU
false
15,140
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
FThreshold
import random import torch import torch.nn as nn class FThreshold(nn.Module): """ Test for nn.functional types """ def __init__(self): super(FThreshold, self).__init__() self.threshold = random.random() self.value = self.threshold + random.random() def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import random import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.gu...
dawnclaude/onnx2keras
FThreshold
false
15,141
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
LayerLeakyReLU
import random import torch import torch.nn as nn class LayerLeakyReLU(nn.Module): """ Test for nn.layers based types """ def __init__(self): super(LayerLeakyReLU, self).__init__() self.negative_slope = random.random() self.leaky_relu = nn.LeakyReLU(negative_slope=self.negative...
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 random import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.gu...
dawnclaude/onnx2keras
LayerLeakyReLU
false
15,142
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
MultiHeadAttention
import math import torch import torch.nn as nn import torch.nn.functional as F def attention(q, k, v, d_k, mask=None, dropout=None): """ :param q: queries, B x N_HEADS x seq_len x d_k :param k: keys, same dim as q :param v: values, same dim as q :param d_k: d_model/n_heads = 128/8 = 16 :param ...
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....
davide-belli/generative-graph-transformer
MultiHeadAttention
false
15,143
[ "MIT" ]
51
949aacf57246e8c28df7dfa38e5c59bf8b2b0ee8
https://github.com/davide-belli/generative-graph-transformer/tree/949aacf57246e8c28df7dfa38e5c59bf8b2b0ee8
FSub
import torch import torch.nn as nn class FSub(nn.Module): def __init__(self): super(FSub, self).__init__() def forward(self, x, y): x = x - y - 8.3 return x 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
dawnclaude/onnx2keras
FSub
false
15,144
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
FFloorTest
import torch import torch.nn as nn class FFloorTest(nn.Module): """ Test for nn.functional types """ def __init__(self): super(FFloorTest, self).__init__() def forward(self, x): return x.floor() def get_inputs(): return [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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
dawnclaude/onnx2keras
FFloorTest
false
15,145
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
FTanh
import torch import torch.nn as nn class FTanh(nn.Module): """ Test for nn.functional types """ def __init__(self): super(FTanh, self).__init__() def forward(self, x): from torch.nn import functional as F return F.tanh(x) def get_inputs(): return [torch.rand([4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
dawnclaude/onnx2keras
FTanh
false
15,146
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
LayerTanh
import torch import torch.nn as nn class LayerTanh(nn.Module): """ Test for nn.layers based types """ def __init__(self): super(LayerTanh, self).__init__() self.tanh = nn.Tanh() def forward(self, x): x = self.tanh(x) return x def get_inputs(): return [torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
dawnclaude/onnx2keras
LayerTanh
false
15,147
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
PointNetfeat
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data class PointNetfeat(nn.Module): """ Simple PointNet that extracts point-wise feature by concatenating local and global features. Uses group norm instead of batch norm. """ def __init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
davrempe/caspr
PointNetfeat
false
15,148
[ "MIT" ]
65
a02edb4be11f5ccfe563b2a7869ee8e731e0f8ff
https://github.com/davrempe/caspr/tree/a02edb4be11f5ccfe563b2a7869ee8e731e0f8ff
LayerThreshold
import random import torch import torch.nn as nn class LayerThreshold(nn.Module): """ Test for nn.layers based types """ def __init__(self): super(LayerThreshold, self).__init__() self.threshold = random.random() self.value = self.threshold + random.random() self.thres...
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 random import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.gu...
dawnclaude/onnx2keras
LayerThreshold
false
15,149
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
LayerReLU6
import torch import torch.nn as nn class LayerReLU6(nn.Module): """ Test for nn.layers based types """ def __init__(self): super(LayerReLU6, self).__init__() self.relu = nn.ReLU6() def forward(self, x): x = self.relu(x) return x def get_inputs(): return [tor...
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...
dawnclaude/onnx2keras
LayerReLU6
false
15,150
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
LayerHardtanh
import random import torch import torch.nn as nn class LayerHardtanh(nn.Module): """ Test for nn.layers based types """ def __init__(self): super(LayerHardtanh, self).__init__() self.min_val = random.random() self.max_val = self.min_val + random.random() self.htanh = 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 random import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_s...
dawnclaude/onnx2keras
LayerHardtanh
false
15,151
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
ffnn
import torch import torch.nn as nn import torch.utils.data.dataloader import torch.nn def get_shape(t): return list(t.shape) class ffnn(nn.Module): def __init__(self, emb_size, num_layers, hidden_size, output_size, dropout, output_weights_initializer=None): super(ffnn, 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 import torch.nn as nn import torch.utils.data.dataloader import torch.nn assert_...
db-bionlp/CLNER
ffnn
false
15,152
[ "MIT" ]
46
77910311acf0411252b9fea8c3e6efb7175eb21f
https://github.com/db-bionlp/CLNER/tree/77910311acf0411252b9fea8c3e6efb7175eb21f
LayerELU
import random import torch import torch.nn as nn class LayerELU(nn.Module): """ Test for nn.layers based types """ def __init__(self): super(LayerELU, self).__init__() self.alpha = random.random() self.elu = nn.ELU(alpha=self.alpha) def forward(self, x): x = 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.triton_helpers import libdevice import random import torch.nn as nn assert_size_stride = torch._C._dynamo.guard...
dawnclaude/onnx2keras
LayerELU
false
15,153
[ "MIT" ]
115
3d2a47c0a228b91fd434232274e216e491da36e3
https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3
VoxelFeatureExtractor
import torch from torch import nn class VoxelFeatureExtractor(nn.Module): """Computes mean of non-zero points within voxel.""" def forward(self, feature, occupancy): """ :feature FloatTensor of shape (N, K, C) :return FloatTensor of shape (N, C) """ denominator = occup...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
dd-iuonac/vision3d
VoxelFeatureExtractor
false
15,154
[ "MIT" ]
131
9ea514c80eb99d265c3247321e59bfc1c2ccd94a
https://github.com/dd-iuonac/vision3d/tree/9ea514c80eb99d265c3247321e59bfc1c2ccd94a
ScalarMix
import torch import torch.nn as nn import torch.utils.data.dataloader import torch.nn class ScalarMix(nn.Module): def __init__(self, n_layers, dropout=0): super(ScalarMix, self).__init__() self.n_layers = n_layers self.dropout = dropout self.weights = nn.Parameter(torch.zeros(n_la...
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.data.dataloader import torch.nn ...
db-bionlp/CLNER
ScalarMix
false
15,155
[ "MIT" ]
46
77910311acf0411252b9fea8c3e6efb7175eb21f
https://github.com/db-bionlp/CLNER/tree/77910311acf0411252b9fea8c3e6efb7175eb21f
EmissionModel
import torch import torch.utils.data class EmissionModel(torch.nn.Module): """ - forward(): computes the log probability of an observation. - sample(): given a state, sample an observation for that state. """ def __init__(self, N, M): super(EmissionModel, self).__init__() self.N = N ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
dendisuhubdy/pytorch_HMM
EmissionModel
false
15,156
[ "Apache-2.0" ]
88
3235326027328e1b0377b17f9dad8fcc56a3668c
https://github.com/dendisuhubdy/pytorch_HMM/tree/3235326027328e1b0377b17f9dad8fcc56a3668c
BiaffineAttention
import torch import torch.nn as nn import torch.utils.data.dataloader from torch.nn import Parameter from torch.nn.parameter import Parameter import torch.nn class BiaffineAttention(nn.Module): """ Adopted from NeuroNLP2: https://github.com/XuezheMax/NeuroNLP2/blob/master/neuronlp2/nn/modules/attentio...
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....
db-bionlp/CLNER
BiaffineAttention
false
15,157
[ "MIT" ]
46
77910311acf0411252b9fea8c3e6efb7175eb21f
https://github.com/db-bionlp/CLNER/tree/77910311acf0411252b9fea8c3e6efb7175eb21f
HDRLoss
import torch import torch.nn as nn class HDRLoss(nn.Module): """High dynamic range loss.""" def __init__(self, eps=0.01): """Initializes loss with numerical stability epsilon.""" super(HDRLoss, self).__init__() self._eps = eps def forward(self, denoised, target): """Compu...
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...
delldu/Noise2Noise
HDRLoss
false
15,158
[ "MIT" ]
224
f519f208776a60efadac208c109c9b7f432504b5
https://github.com/delldu/Noise2Noise/tree/f519f208776a60efadac208c109c9b7f432504b5
Conv2d
import torch import torch.nn as nn from torch.distributions import transforms as transform class Flow(transform.Transform, nn.Module): """ Main class for a single flow. """ def __init__(self, amortized='none'): """ Initialize as both transform and module """ transform.Transform.__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 import torch.nn as nn from torch.distributions import transforms as transform as...
dendisuhubdy/flow_synthesizer
Conv2d
false
15,159
[ "MIT" ]
93
1561e8ce2520258acb3d228beebbb626a8abc04f
https://github.com/dendisuhubdy/flow_synthesizer/tree/1561e8ce2520258acb3d228beebbb626a8abc04f
cnn_layer
import torch import torch.nn as nn import torch.utils.data.dataloader import torch.nn class cnn_layer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, bias=True): super(cnn_layer, self).__init__() self.conv = torch.nn.Conv1d(in_channels=in_channe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
db-bionlp/CLNER
cnn_layer
false
15,160
[ "MIT" ]
46
77910311acf0411252b9fea8c3e6efb7175eb21f
https://github.com/db-bionlp/CLNER/tree/77910311acf0411252b9fea8c3e6efb7175eb21f
bilinear_classifier
import torch import torch.nn as nn import torch.utils.data.dataloader import torch.nn class Sparse_dropout(nn.Module): def __init__(self, p): super(Sparse_dropout, self).__init__() self.dropout_rate = p def forward(self, input, noise_shape): if not self.training: return i...
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.dataloader import torch.nn assert_...
db-bionlp/CLNER
bilinear_classifier
false
15,161
[ "MIT" ]
46
77910311acf0411252b9fea8c3e6efb7175eb21f
https://github.com/db-bionlp/CLNER/tree/77910311acf0411252b9fea8c3e6efb7175eb21f
LSID
import math import torch import torch.nn as nn def pixel_shuffle(input, upscale_factor, depth_first=False): """Rearranges elements in a tensor of shape :math:`[*, C*r^2, H, W]` to a tensor of shape :math:`[C, H*r, W*r]`. See :class:`~torch.nn.PixelShuffle` for details. Args: input (Tensor): ...
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 math import torch.nn a...
cydonia999/Learning_to_See_in_the_Dark_PyTorch
LSID
false
15,162
[ "MIT" ]
77
470a6a8e9c6367d8fa88ee6d1dea211dd9fb1f81
https://github.com/cydonia999/Learning_to_See_in_the_Dark_PyTorch/tree/470a6a8e9c6367d8fa88ee6d1dea211dd9fb1f81
HexaLinearScore
import math import torch import torch.nn as nn import torch.utils.data.dataloader import torch.nn class HexaLinearScore(nn.Module): """ Outer product version of hexalinear function for sequence labeling. """ def __init__(self, wemb_size, tagset_size, temb_size=20, rank=396, std= 0.1545, norma...
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.utils.data.dataloader import torc...
db-bionlp/CLNER
HexaLinearScore
false
15,163
[ "MIT" ]
46
77910311acf0411252b9fea8c3e6efb7175eb21f
https://github.com/db-bionlp/CLNER/tree/77910311acf0411252b9fea8c3e6efb7175eb21f
GraphAttentionLayer
import torch import torch.nn as nn from torch.nn.parameter import Parameter from torch.autograd import Variable import torch.nn.functional as F class GraphAttentionLayer(nn.Module): def __init__(self, requires_grad=True): super(GraphAttentionLayer, self).__init__() if requires_grad: 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....
dawnranger/pytorch-AGNN
GraphAttentionLayer
false
15,164
[ "MIT" ]
137
461f71b45e5eaddb50cff31a537b06cb1a50ba8f
https://github.com/dawnranger/pytorch-AGNN/tree/461f71b45e5eaddb50cff31a537b06cb1a50ba8f
QuadriLinearScore
import math import torch import torch.nn as nn import torch.utils.data.dataloader import torch.nn class QuadriLinearScore(nn.Module): """ Outer product version of quadrilinear function for sequence labeling. """ def __init__(self, wemb_size, tagset_size, temb_size=20, rank=396, std= 0.1545, 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 import math import torch.nn as nn import torch.utils.data.dataloader import torc...
db-bionlp/CLNER
QuadriLinearScore
false
15,165
[ "MIT" ]
46
77910311acf0411252b9fea8c3e6efb7175eb21f
https://github.com/db-bionlp/CLNER/tree/77910311acf0411252b9fea8c3e6efb7175eb21f
DecoderLayer
import math import torch import torch.nn as nn import torch.nn.functional as F def attention(q, k, v, d_k, mask=None, dropout=None): """ :param q: queries, B x N_HEADS x seq_len x d_k :param k: keys, same dim as q :param v: values, same dim as q :param d_k: d_model/n_heads = 128/8 = 16 :param ...
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....
davide-belli/generative-graph-transformer
DecoderLayer
false
15,166
[ "MIT" ]
51
949aacf57246e8c28df7dfa38e5c59bf8b2b0ee8
https://github.com/davide-belli/generative-graph-transformer/tree/949aacf57246e8c28df7dfa38e5c59bf8b2b0ee8
LayerNorm
import math import torch import torch as th import torch.nn as nn from torch.nn import Parameter class LayerNorm(nn.Module): """ Layer Normalization based on Ba & al.: 'Layer Normalization' https://arxiv.org/pdf/1607.06450.pdf """ def __init__(self, input_size: 'int', learnable: 'bool'=True, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import torch as th import torch.nn as nn from torch.nn import Param...
denizetkar/lstms.pth
LayerNorm
false
15,167
[ "Apache-2.0" ]
130
c1d6af1e106e17c51604ae8acdb5114828adff19
https://github.com/denizetkar/lstms.pth/tree/c1d6af1e106e17c51604ae8acdb5114828adff19
BaLayerNorm
import torch import torch as th import torch.nn as nn from torch.nn import Parameter class BaLayerNorm(nn.Module): """ Layer Normalization based on Ba & al.: 'Layer Normalization' https://arxiv.org/pdf/1607.06450.pdf This implementation mimicks the original torch implementation at: https://gi...
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 as th import torch.nn as nn from torch.nn import Parameter assert_...
denizetkar/lstms.pth
BaLayerNorm
false
15,168
[ "Apache-2.0" ]
130
c1d6af1e106e17c51604ae8acdb5114828adff19
https://github.com/denizetkar/lstms.pth/tree/c1d6af1e106e17c51604ae8acdb5114828adff19
GatedConv2d
import torch import torch.nn as nn class GatedConv2d(nn.Module): def __init__(self, in_c, out_c, kernel, stride, pad, dilation=1, act= torch.relu): super(GatedConv2d, self).__init__() self.activation = act self.sigmoid = nn.Sigmoid() self.h = nn.Conv2d(in_c, out_c, kernel,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
dendisuhubdy/flow_synthesizer
GatedConv2d
false
15,169
[ "MIT" ]
93
1561e8ce2520258acb3d228beebbb626a8abc04f
https://github.com/dendisuhubdy/flow_synthesizer/tree/1561e8ce2520258acb3d228beebbb626a8abc04f
MinibatchStddev
import torch from torch import nn def Tstdeps(val): return torch.sqrt(((val - val.mean()) ** 2).mean() + 1e-08) class MinibatchStddev(nn.Module): def __init__(self): super(MinibatchStddev, self).__init__() self.eps = 1.0 def forward(self, x): stddev_mean = Tstdeps(x) ne...
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_...
deepsound-project/pggan-pytorch
MinibatchStddev
false
15,170
[ "MIT" ]
115
dab2ec79229c3800253a209304dbb1e7ac1d1219
https://github.com/deepsound-project/pggan-pytorch/tree/dab2ec79229c3800253a209304dbb1e7ac1d1219
ChanNorm
import torch from torch import nn class ChanNorm(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.eps = eps self.g = nn.Parameter(torch.ones(1, dim, 1, 1)) self.b = nn.Parameter(torch.zeros(1, dim, 1, 1)) def forward(self, x): std = torch.var(x,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
destefani/lightweight-gan
ChanNorm
false
15,171
[ "MIT" ]
1,187
5ba61c21c8c9c8d4574a4a3ddd4759f86debf9bf
https://github.com/destefani/lightweight-gan/tree/5ba61c21c8c9c8d4574a4a3ddd4759f86debf9bf
GatedDense
import torch import torch.nn as nn class GatedDense(nn.Module): def __init__(self, input_size, output_size, activation=torch.relu): super(GatedDense, self).__init__() self.activation = activation self.sigmoid = nn.Sigmoid() self.h = nn.Linear(input_size, output_size) 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_...
dendisuhubdy/flow_synthesizer
GatedDense
false
15,172
[ "MIT" ]
93
1561e8ce2520258acb3d228beebbb626a8abc04f
https://github.com/dendisuhubdy/flow_synthesizer/tree/1561e8ce2520258acb3d228beebbb626a8abc04f
LinearBlock
import torch from functools import partial import torch.nn as nn def dispatcher(dispatch_fn): def decorated(key, *args): if callable(key): return key if key is None: key = 'none' return dispatch_fn(key, *args) return decorated @dispatcher def activ_dispatch(a...
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 functools import partial...
derwind/dmfont
LinearBlock
false
15,173
[ "MIT" ]
95
17a91a9cc1917d2485eaa8e92b68245578920c76
https://github.com/derwind/dmfont/tree/17a91a9cc1917d2485eaa8e92b68245578920c76
PopulationColourRGBTransforms
from _paritybench_helpers import _mock_config import torch import numpy as np class PopulationColourRGBTransforms(torch.nn.Module): """RGB color transforms and ordering of patches.""" def __init__(self, config, device, num_patches=1, pop_size=1, requires_grad=True): super(PopulationColourRGBT...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_...
deepmind/arnheim
PopulationColourRGBTransforms
false
15,174
[ "Apache-2.0" ]
186
cc9d2dd12391faa460b58bff1cc5be82145a5965
https://github.com/deepmind/arnheim/tree/cc9d2dd12391faa460b58bff1cc5be82145a5965
ConvBlock
import torch import torch.nn.functional as F from functools import partial import torch.nn as nn def dispatcher(dispatch_fn): def decorated(key, *args): if callable(key): return key if key is None: key = 'none' return dispatch_fn(key, *args) return decorated ...
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 functools import partial...
derwind/dmfont
ConvBlock
false
15,175
[ "MIT" ]
95
17a91a9cc1917d2485eaa8e92b68245578920c76
https://github.com/derwind/dmfont/tree/17a91a9cc1917d2485eaa8e92b68245578920c76
Attention
import torch import torch.nn.functional as F import torch.nn as nn def dispatcher(dispatch_fn): def decorated(key, *args): if callable(key): return key if key is None: key = 'none' return dispatch_fn(key, *args) return decorated def spectral_norm(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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
derwind/dmfont
Attention
false
15,176
[ "MIT" ]
95
17a91a9cc1917d2485eaa8e92b68245578920c76
https://github.com/derwind/dmfont/tree/17a91a9cc1917d2485eaa8e92b68245578920c76
EncoderImageWeightNormPrecomp
import torch from collections import OrderedDict import torch.nn as nn import torch.nn.init from torch.nn.utils.weight_norm import weight_norm def l2norm(X, dim, eps=1e-08): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) retur...
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 collections im...
devilslot/SCAN
EncoderImageWeightNormPrecomp
false
15,177
[ "Apache-2.0" ]
428
01812aa98e2ebe39695c8906589b6fe66b2a0d6e
https://github.com/devilslot/SCAN/tree/01812aa98e2ebe39695c8906589b6fe66b2a0d6e
CopyChannels
import torch class CopyChannels(torch.nn.Module): def __init__(self, multiple=3, dim=1): super(CopyChannels, self).__init__() self.multiple = multiple self.dim = dim def forward(self, x): return torch.cat([x for _ in range(self.multiple)], dim=self.dim) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda reinterpret...
dianjixz/AutoDL
CopyChannels
false
15,178
[ "Apache-2.0" ]
1,044
48db4eb04d55ce69e93d4a3bdc24592bdb34a868
https://github.com/dianjixz/AutoDL/tree/48db4eb04d55ce69e93d4a3bdc24592bdb34a868
CReLU
import torch import torch.nn.functional as F import torch.nn as nn class CReLU(nn.Module): def __init__(self): super(CReLU, self).__init__() def forward(self, x): return torch.cat((F.leaky_relu(x, 0.01, inplace=True), F.leaky_relu (-x, 0.01, inplace=True)), 1) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
dipikakhullar/ocr
CReLU
false
15,179
[ "MIT" ]
284
a55e70d82f42803be5ed63f8f59e4fa597fcf8d6
https://github.com/dipikakhullar/ocr/tree/a55e70d82f42803be5ed63f8f59e4fa597fcf8d6
ResBlock
import torch import torch.nn.functional as F from functools import partial import torch.nn as nn def dispatcher(dispatch_fn): def decorated(key, *args): if callable(key): return key if key is None: key = 'none' return dispatch_fn(key, *args) return decorated ...
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.functional as...
derwind/dmfont
ResBlock
false
15,180
[ "MIT" ]
95
17a91a9cc1917d2485eaa8e92b68245578920c76
https://github.com/derwind/dmfont/tree/17a91a9cc1917d2485eaa8e92b68245578920c76
IdentityPadding
import torch import torch.nn as nn import torch.nn.functional as F class IdentityPadding(nn.Module): def __init__(self, in_channels, out_channels, stride): super(IdentityPadding, self).__init__() self.pooling = nn.MaxPool2d(1, stride=stride) self.add_channels = out_channels - in_channels ...
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...
dnddnjs/pytorch-vision
IdentityPadding
false
15,181
[ "MIT" ]
48
d432b467774f838bef37372d6cff3576c6559803
https://github.com/dnddnjs/pytorch-vision/tree/d432b467774f838bef37372d6cff3576c6559803
BertSelfOutput
from _paritybench_helpers import _mock_config import torch import torch.nn as 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__() ...
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 ...
dfhby0/CBLUE
BertSelfOutput
false
15,182
[ "Apache-2.0" ]
293
36bdb52f17c4379d4a5f8b407890ba294017b5e2
https://github.com/dfhby0/CBLUE/tree/36bdb52f17c4379d4a5f8b407890ba294017b5e2
TwoLayerNet
import torch import torch.nn class TwoLayerNet(torch.nn.Module): def __init__(self, D_in, H, D_out): super(TwoLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, D_out) def forward(self, x): h_relu = self.linear1(x).clamp(min=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 import torch.nn assert_size_s...
dionhaefner/delve
TwoLayerNet
false
15,183
[ "MIT" ]
69
811756520cbfd8dce4427c53203ac193f61a94d1
https://github.com/dionhaefner/delve/tree/811756520cbfd8dce4427c53203ac193f61a94d1
MultiHeadAttention
import torch import numpy as np def scaled_dot_product_attention(q, k, v, mask): matmul_qk = torch.matmul(q, k.permute(0, 1, 3, 2)) dk = k.shape[-1] scaled_attention_logits = matmul_qk / np.sqrt(dk) if mask is not None: scaled_attention_logits += mask * -1000000000.0 attention_weights = 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
depengchen123/ctrl
MultiHeadAttention
false
15,184
[ "BSD-3-Clause" ]
1,559
8673e9ec1bf6441ad8d793a626cdfd8c1fd9c4e4
https://github.com/depengchen123/ctrl/tree/8673e9ec1bf6441ad8d793a626cdfd8c1fd9c4e4
BatchNorm
import torch import numpy as np from abc import abstractmethod from torch import tensor import torch.nn as nn import numpy.random as rng class BaseFlow(nn.Module): """ """ def __init__(self, n_inputs, **kwargs): super().__init__() self.n_inputs = n_inputs @abstractmethod def forward(...
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 from abc import abstractmethod from torch i...
diana-hep/madminer
BatchNorm
false
15,185
[ "MIT" ]
46
3a585d2887a31886cdeadddb0a284f0472146fce
https://github.com/diana-hep/madminer/tree/3a585d2887a31886cdeadddb0a284f0472146fce
LayerCake
import torch import torch.nn class LayerCake(torch.nn.Module): def __init__(self, D_in, H1, H2, H3, H4, H5, D_out): """ In the constructor we instantiate two nn.Linear modules and assign them as member variables. """ super(LayerCake, self).__init__() self.linear1 =...
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 assert_size_s...
dionhaefner/delve
LayerCake
false
15,186
[ "MIT" ]
69
811756520cbfd8dce4427c53203ac193f61a94d1
https://github.com/dionhaefner/delve/tree/811756520cbfd8dce4427c53203ac193f61a94d1