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
ReshapeF
import torch import torch.utils.data import torch from torch import nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out =...
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 from torch import nn assert_size_stride = ...
guyii54/Contrastive-I2I
ReshapeF
false
6,767
[ "BSD-3-Clause" ]
1
e73daa0f9d3770c2280a304c39678d5b22440647
https://github.com/guyii54/Contrastive-I2I/tree/e73daa0f9d3770c2280a304c39678d5b22440647
SCConv_Layer
import torch import torch.nn as nn import torch.nn.functional as F class SCConv_Layer(nn.Module): def __init__(self, num_node_feats, num_edge_feats, num_triangle_feats, output_size, bias=True, f=F.relu): super().__init__() self.n2n_weights = nn.Linear(num_node_feats, output_size, bias=bia...
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 ...
ggoh29/Simplicial-neural-network-benchmark
SCConv_Layer
false
6,768
[ "MIT" ]
1
9a12bcd054251790d85e3971f5473dcffaa5664b
https://github.com/ggoh29/Simplicial-neural-network-benchmark/tree/9a12bcd054251790d85e3971f5473dcffaa5664b
FusedLeakyReLU
import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return F.leaky_relu(input + bias, negative_slope) * scale class FusedLeakyReLU(nn.Module): def __init__(self, channel, negative_slope...
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 import torch from torch import nn import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.asser...
guyii54/Contrastive-I2I
FusedLeakyReLU
false
6,769
[ "BSD-3-Clause" ]
1
e73daa0f9d3770c2280a304c39678d5b22440647
https://github.com/guyii54/Contrastive-I2I/tree/e73daa0f9d3770c2280a304c39678d5b22440647
DCRBranch
import torch import torch.nn as nn import torch.utils.data import torch.optim import torch.utils.data.distributed class DCRBranch(nn.Module): """Branch Network for DCR""" def __init__(self, num_classes, in_channels, mid_channels, normalized_embeddings=False): super().__init__() self.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 import torch.nn as nn import torch.utils.data import torch.optim import torch.ut...
gyfastas/CS7319E1G16
DCRBranch
false
6,770
[ "MIT" ]
1
03126af04766abcb269d0c8db481c96c856d21ef
https://github.com/gyfastas/CS7319E1G16/tree/03126af04766abcb269d0c8db481c96c856d21ef
LinearAttentionLayer
import torch import torch.nn.functional as F from torch import nn class LinearAttentionLayer(nn.Module): def __init__(self, input_dim): super().__init__() self.linear = nn.Linear(input_dim, 1) def forward(self, question, question_mask): qtn = question.view(-1, question.shape[-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....
gustavhartz/legal-contract-elements
LinearAttentionLayer
false
6,771
[ "MIT" ]
1
7a1e1f0024f9d336c7166f51b4325acf03db86a2
https://github.com/gustavhartz/legal-contract-elements/tree/7a1e1f0024f9d336c7166f51b4325acf03db86a2
DownsampleA
import torch import torch.nn as nn class DownsampleA(nn.Module): def __init__(self, nIn, nOut, stride): super(DownsampleA, self).__init__() assert stride == 2 self.avg = nn.AvgPool2d(kernel_size=1, stride=stride) def forward(self, x): x = self.avg(x) return torch.cat(...
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...
hamedomidvar/associativeconv
DownsampleA
false
6,772
[ "MIT" ]
1
9930915abd3625871354df676865fc44eb92abf3
https://github.com/hamedomidvar/associativeconv/tree/9930915abd3625871354df676865fc44eb92abf3
Reverse
import torch class Reverse(torch.nn.Module): def __init__(self): super().__init__() def forward(self, audio): return torch.flip(audio, dims=[1]) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
h0ngwen/torchaudio-augmentations
Reverse
false
6,773
[ "MIT" ]
1
d044f9d020e12032ab9280acf5f34a337e72d212
https://github.com/h0ngwen/torchaudio-augmentations/tree/d044f9d020e12032ab9280acf5f34a337e72d212
PolarityInversion
import torch class PolarityInversion(torch.nn.Module): def __init__(self): super().__init__() def forward(self, audio): audio = torch.neg(audio) return audio 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
h0ngwen/torchaudio-augmentations
PolarityInversion
false
6,774
[ "MIT" ]
1
d044f9d020e12032ab9280acf5f34a337e72d212
https://github.com/h0ngwen/torchaudio-augmentations/tree/d044f9d020e12032ab9280acf5f34a337e72d212
ToRGB
import math import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, up...
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.utils.data import torch from torch import nn import tor...
guyii54/Contrastive-I2I
ToRGB
false
6,775
[ "BSD-3-Clause" ]
1
e73daa0f9d3770c2280a304c39678d5b22440647
https://github.com/guyii54/Contrastive-I2I/tree/e73daa0f9d3770c2280a304c39678d5b22440647
ResidualMLP
import torch import torch.nn as nn class ResidualMLP(nn.Module): def __init__(self, input_dim, target_dim, hidden_dim=64): super(ResidualMLP, self).__init__() self.linear1 = nn.Linear(input_dim, hidden_dim) self.linear2 = nn.Linear(hidden_dim, hidden_dim) self.linear3 = nn.Linear(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
greydanus/piecewise_node
ResidualMLP
false
6,776
[ "Apache-2.0" ]
1
9d218d4ec1bab486ae954ad2e84732a5f952770f
https://github.com/greydanus/piecewise_node/tree/9d218d4ec1bab486ae954ad2e84732a5f952770f
ModulatedConv2d
import math import torch import torch.utils.data import torch from torch import nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, up...
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 ...
guyii54/Contrastive-I2I
ModulatedConv2d
false
6,777
[ "BSD-3-Clause" ]
1
e73daa0f9d3770c2280a304c39678d5b22440647
https://github.com/guyii54/Contrastive-I2I/tree/e73daa0f9d3770c2280a304c39678d5b22440647
Multiply
import torch from abc import ABC class BaseOperator(ABC): """ Abstract class defining the basic structure for operator implementations in Hummingbird. """ def __init__(self, regression=False, classification=False, transformer= False, anomaly_detection=False, **kwargs): """ Arg...
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 abc import ABC assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stri...
hannahaih/hummingbird
Multiply
false
6,778
[ "MIT" ]
1
b8ec670b3c90ec7e87d3ae4a2b268075bd5eae65
https://github.com/hannahaih/hummingbird/tree/b8ec670b3c90ec7e87d3ae4a2b268075bd5eae65
PoolingF
import torch import torch.utils.data import torch from torch import nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data impo...
guyii54/Contrastive-I2I
PoolingF
false
6,779
[ "BSD-3-Clause" ]
1
e73daa0f9d3770c2280a304c39678d5b22440647
https://github.com/guyii54/Contrastive-I2I/tree/e73daa0f9d3770c2280a304c39678d5b22440647
HierarchicalPolicy
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as f class HierarchicalPolicy(nn.Module): def __init__(self, args): super(HierarchicalPolicy, self).__init__() self.fc_1 = nn.Linear(args.state_shape, 128) self.fc_2 = nn.Linear(128...
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....
hanhanAnderson/LSF-SAC
HierarchicalPolicy
false
6,780
[ "MIT" ]
1
3e2daf0da23b0ea08e92948c87f7e583f3fb1ed9
https://github.com/hanhanAnderson/LSF-SAC/tree/3e2daf0da23b0ea08e92948c87f7e583f3fb1ed9
NumericLabelEncoder
import torch from abc import ABC class BaseOperator(ABC): """ Abstract class defining the basic structure for operator implementations in Hummingbird. """ def __init__(self, regression=False, classification=False, transformer= False, anomaly_detection=False, **kwargs): """ Arg...
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 abc import ABC assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stri...
hannahaih/hummingbird
NumericLabelEncoder
false
6,781
[ "MIT" ]
1
b8ec670b3c90ec7e87d3ae4a2b268075bd5eae65
https://github.com/hannahaih/hummingbird/tree/b8ec670b3c90ec7e87d3ae4a2b268075bd5eae65
PositionalEncoding
import torch from torch import nn class PositionalEncoding(nn.Module): def __init__(self, patch_num, d_model, dropout=0.1): super(PositionalEncoding, self).__init__() self.pe = nn.Parameter(torch.rand(patch_num + 1, d_model)) self.add_positional_encoding = lambda x: x + self.pe[:x.size(1)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
hankyul2/ImageClassification
PositionalEncoding
false
6,782
[ "Apache-2.0" ]
1
c4df6bf3dc1ee804f9885d586aa581ebb4d7ca05
https://github.com/hankyul2/ImageClassification/tree/c4df6bf3dc1ee804f9885d586aa581ebb4d7ca05
StdConv
import torch from torch import nn class StdConv(nn.Conv2d): def forward(self, x): return self._conv_forward(x, self.standarize(self.weight), self.bias) def standarize(self, x): return (x - x.mean(dim=(1, 2, 3), keepdim=True)) / (x.std(dim=(1, 2, 3), keepdim=True) + 1e-06) def g...
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...
hankyul2/ImageClassification
StdConv
false
6,783
[ "Apache-2.0" ]
1
c4df6bf3dc1ee804f9885d586aa581ebb4d7ca05
https://github.com/hankyul2/ImageClassification/tree/c4df6bf3dc1ee804f9885d586aa581ebb4d7ca05
rec_attention
from _paritybench_helpers import _mock_config import torch import torch.utils.data import torch.nn as nn def batch_product(iput, mat2): result = None for i in range(iput.size()[0]): op = torch.mm(iput[i], mat2) op = op.unsqueeze(0) if result is None: result = op els...
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....
gzerveas/TransformChrome
rec_attention
false
6,784
[ "MIT" ]
1
ab1046009aff2ec863aa65223dcfcd750d41ab86
https://github.com/gzerveas/TransformChrome/tree/ab1046009aff2ec863aa65223dcfcd750d41ab86
ConvertPointsToHomogeneous
import torch import torch.nn as nn def convert_points_to_homogeneous(points): """Function that converts points from Euclidean to homogeneous space. See :class:`~torchgeometry.ConvertPointsToHomogeneous` for details. Examples:: >>> input = torch.rand(2, 4, 3) # BxNx3 >>> output = tgm.co...
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...
hassony2/frankmocap
ConvertPointsToHomogeneous
false
6,785
[ "BSD-3-Clause" ]
1
50aae41d9b41d2f344ae1709bbf1b25974209fa9
https://github.com/hassony2/frankmocap/tree/50aae41d9b41d2f344ae1709bbf1b25974209fa9
Hidden2Discrete
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init class Hidden2Discrete(nn.Module): def __init__(self, input_size, y_size, k_size, is_lstm=False, has_bias=True ): super(Hidden2Discrete, self).__init__() self.y_size = y_size self.k_size = k_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
haojiepan1/CrossWOZ
Hidden2Discrete
false
6,786
[ "Apache-2.0" ]
1
6d7b4c4cfb73a528b76074764687906abecc90b6
https://github.com/haojiepan1/CrossWOZ/tree/6d7b4c4cfb73a528b76074764687906abecc90b6
ConvertPointsFromHomogeneous
import torch import torch.nn as nn def convert_points_from_homogeneous(points): """Function that converts points from homogeneous to Euclidean space. See :class:`~torchgeometry.ConvertPointsFromHomogeneous` for details. Examples:: >>> input = torch.rand(2, 4, 3) # BxNx3 >>> output = tg...
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...
hassony2/frankmocap
ConvertPointsFromHomogeneous
false
6,787
[ "BSD-3-Clause" ]
1
50aae41d9b41d2f344ae1709bbf1b25974209fa9
https://github.com/hassony2/frankmocap/tree/50aae41d9b41d2f344ae1709bbf1b25974209fa9
GCN_conv
import math import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter class GCN_conv(nn.Module): def __init__(self, in_ft, out_ft, bias=False, dropout=0.0, activation=F .relu): super(GCN_conv, self).__init__() self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.util...
haoyfan/Dual-SVDAE
GCN_conv
false
6,788
[ "MIT" ]
1
1fcb61960606d743438f33b740cb434dbfcfd727
https://github.com/haoyfan/Dual-SVDAE/tree/1fcb61960606d743438f33b740cb434dbfcfd727
SelfAttn
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init import torch as th class SelfAttn(nn.Module): def __init__(self, hidden_size): super(SelfAttn, self).__init__() self.query = nn.Linear(hidden_size, 1) def forward(self, keys, values, attn_mask=None): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
haojiepan1/CrossWOZ
SelfAttn
false
6,789
[ "Apache-2.0" ]
1
6d7b4c4cfb73a528b76074764687906abecc90b6
https://github.com/haojiepan1/CrossWOZ/tree/6d7b4c4cfb73a528b76074764687906abecc90b6
NormKLLoss
import torch import torch.nn.init import torch as th from torch.nn.modules.loss import _Loss class NormKLLoss(_Loss): def __init__(self, unit_average=False): super(NormKLLoss, self).__init__() self.unit_average = unit_average def forward(self, recog_mu, recog_logvar, prior_mu, prior_logvar):...
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.init from torch.nn.modules.loss import _Loss assert_size_...
haojiepan1/CrossWOZ
NormKLLoss
false
6,790
[ "Apache-2.0" ]
1
6d7b4c4cfb73a528b76074764687906abecc90b6
https://github.com/haojiepan1/CrossWOZ/tree/6d7b4c4cfb73a528b76074764687906abecc90b6
Zeronet
import torch import torch.nn as nn class Zeronet(nn.Module): def forward(self, x): """ Return a zero-out copy of x :param x: torch.Tensor :return: x*0, type torch.Tensor """ return torch.zeros_like(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
hedixia/xhd_source
Zeronet
false
6,791
[ "MIT" ]
1
cb176bceb5f5349d68206aaf60014e251de36300
https://github.com/hedixia/xhd_source/tree/cb176bceb5f5349d68206aaf60014e251de36300
BinaryDiceLoss
import torch import torch.nn as nn class BinaryDiceLoss(nn.Module): """二分类版本的Dice Loss""" def __init__(self, smooth: 'int'=1, exponent: 'int'=1, reduction: 'str' ='mean', loss_weight: 'float'=1.0, balance_weight: 'float'=1.0, activation: 'bool'=False) ->None: super(BinaryDiceLoss, sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
hehaoming/RSI-ChangeDetection
BinaryDiceLoss
false
6,792
[ "MIT" ]
1
f24a1d79c03fb9fefc49bc91bc94b3c120992496
https://github.com/hehaoming/RSI-ChangeDetection/tree/f24a1d79c03fb9fefc49bc91bc94b3c120992496
EqualizedLinear
import torch from torch import nn import torch.nn.functional as F class EqualizedLinear(nn.Module): def __init__(self, input_size, output_size, gain=2 ** 0.5, lrmul=0.01): super().__init__() he_std = gain * input_size ** -0.5 init_std = 1.0 / lrmul self.w_mul = he_std * lrmul ...
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...
hejj16/Landscape-StyleGAN
EqualizedLinear
false
6,793
[ "MIT" ]
1
a93cd32b588ab21da9d7589e705ca6f09db18408
https://github.com/hejj16/Landscape-StyleGAN/tree/a93cd32b588ab21da9d7589e705ca6f09db18408
Classifier
import torch import torch.nn as nn import torch.nn.functional as F class Classifier(nn.Module): def __init__(self): super(Classifier, self).__init__() self.fc1 = nn.Linear(900, 3) def forward(self, x): x = F.avg_pool2d(x, 8) x = x.view(-1, 900) x = self.fc1(x) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
helinwang/pytorch-semseg
Classifier
false
6,794
[ "MIT" ]
1
117e5fb8afbad87d6968de1683867854ddec5885
https://github.com/helinwang/pytorch-semseg/tree/117e5fb8afbad87d6968de1683867854ddec5885
ClassificationLogSoftmax
import torch import torch.nn as nn class ClassificationLogSoftmax(nn.Module): """ Classifier on top of the hidden representation of the first token, which is usually [CLS] token in BERT-like architectures. """ def __init__(self, hidden_size, num_classes): super().__init__() self.d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
harisankarh/NeMo
ClassificationLogSoftmax
false
6,795
[ "Apache-2.0" ]
1
27bfb1aed24a786626e1c27c37417ebcd226ca8a
https://github.com/harisankarh/NeMo/tree/27bfb1aed24a786626e1c27c37417ebcd226ca8a
BalancedBinaryCrossEntropy
import torch import torch.nn as nn from typing import Any import torch.nn.functional as F class BalancedBinaryCrossEntropy(nn.Module): """二分类加权交叉熵""" def __init__(self, reduction: 'str'='mean', class_weight: 'Any'=None, loss_weight: 'float'=1.0, activation: 'bool'=False) ->None: super(Balance...
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...
hehaoming/RSI-ChangeDetection
BalancedBinaryCrossEntropy
false
6,796
[ "MIT" ]
1
f24a1d79c03fb9fefc49bc91bc94b3c120992496
https://github.com/hehaoming/RSI-ChangeDetection/tree/f24a1d79c03fb9fefc49bc91bc94b3c120992496
SeperableConv
import torch import torch.nn as nn import torch.nn.functional as F def _get_padding(kernel_size, stride, dilation): padding = (stride - 1 + dilation * (kernel_size - 1)) // 2 return padding class SeperableConv(nn.Module): def __init__(self, inp, outp, k=3, stride=1, dilation=1): super(Seperable...
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_...
henningpohl/body-based-ar
SeperableConv
false
6,797
[ "MIT" ]
1
dc7d5d6eaf8dd4427de0f2b1cfdcc415cbfffdfb
https://github.com/henningpohl/body-based-ar/tree/dc7d5d6eaf8dd4427de0f2b1cfdcc415cbfffdfb
HybridLoss
import torch import torch.nn as nn from typing import Any import torch.nn.functional as F class BalancedBinaryCrossEntropy(nn.Module): """二分类加权交叉熵""" def __init__(self, reduction: 'str'='mean', class_weight: 'Any'=None, loss_weight: 'float'=1.0, activation: 'bool'=False) ->None: super(Balance...
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...
hehaoming/RSI-ChangeDetection
HybridLoss
false
6,798
[ "MIT" ]
1
f24a1d79c03fb9fefc49bc91bc94b3c120992496
https://github.com/hehaoming/RSI-ChangeDetection/tree/f24a1d79c03fb9fefc49bc91bc94b3c120992496
BalancedBinaryCrossEntropyWithLogits
import torch import torch.nn as nn from typing import Any class BalancedBinaryCrossEntropyWithLogits(nn.Module): """二分类加权交叉熵""" def __init__(self, reduction: 'str'='mean', class_weight: 'Any'=None, loss_weight: 'float'=1.0, activation: 'bool'=False, eposion: 'float'=1e-10) ->None: sup...
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...
hehaoming/RSI-ChangeDetection
BalancedBinaryCrossEntropyWithLogits
false
6,799
[ "MIT" ]
1
f24a1d79c03fb9fefc49bc91bc94b3c120992496
https://github.com/hehaoming/RSI-ChangeDetection/tree/f24a1d79c03fb9fefc49bc91bc94b3c120992496
InputConv
import torch import torch.nn as nn import torch.nn.functional as F def _get_padding(kernel_size, stride, dilation): padding = (stride - 1 + dilation * (kernel_size - 1)) // 2 return padding class InputConv(nn.Module): def __init__(self, inp, outp, k=3, stride=1, dilation=1): super(InputConv, se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
henningpohl/body-based-ar
InputConv
false
6,800
[ "MIT" ]
1
dc7d5d6eaf8dd4427de0f2b1cfdcc415cbfffdfb
https://github.com/henningpohl/body-based-ar/tree/dc7d5d6eaf8dd4427de0f2b1cfdcc415cbfffdfb
ActQuant_PACT
import torch import torch.nn as nn def uniform_quantize(k): class qfn(torch.autograd.Function): @staticmethod def forward(ctx, input): if k == 32: out = input elif k == 1: out = torch.sign(input) else: n = float...
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...
heymesut/SJTU_microe
ActQuant_PACT
false
6,801
[ "BSD-3-Clause" ]
1
7a862d03b4d8fe4c8608173a16082f44001f3f13
https://github.com/heymesut/SJTU_microe/tree/7a862d03b4d8fe4c8608173a16082f44001f3f13
Mish
import torch import torch.nn as nn import torch.nn.functional as F class Mish(nn.Module): def forward(self, x): return x.mul_(F.softplus(x).tanh()) 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, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
heymesut/SJTU_microe
Mish
false
6,802
[ "BSD-3-Clause" ]
1
7a862d03b4d8fe4c8608173a16082f44001f3f13
https://github.com/heymesut/SJTU_microe/tree/7a862d03b4d8fe4c8608173a16082f44001f3f13
activation_quantize_fn
import torch import torch.nn as nn def uniform_quantize(k): class qfn(torch.autograd.Function): @staticmethod def forward(ctx, input): if k == 32: out = input elif k == 1: out = torch.sign(input) else: n = float...
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_...
heymesut/SJTU_microe
activation_quantize_fn
false
6,803
[ "BSD-3-Clause" ]
1
7a862d03b4d8fe4c8608173a16082f44001f3f13
https://github.com/heymesut/SJTU_microe/tree/7a862d03b4d8fe4c8608173a16082f44001f3f13
weightedFeatureFusion
import torch import torch.nn as nn class weightedFeatureFusion(nn.Module): def __init__(self, layers, weight=False): super(weightedFeatureFusion, self).__init__() self.layers = layers self.weight = weight self.n = len(layers) + 1 if weight: self.w = torch.nn.Pa...
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...
heymesut/SJTU_microe
weightedFeatureFusion
false
6,804
[ "BSD-3-Clause" ]
1
7a862d03b4d8fe4c8608173a16082f44001f3f13
https://github.com/heymesut/SJTU_microe/tree/7a862d03b4d8fe4c8608173a16082f44001f3f13
ClipGlobalAvgPool2d
import torch from torch import nn class FastGlobalAvgPool2d(nn.Module): def __init__(self, flatten=False): super(FastGlobalAvgPool2d, self).__init__() self.flatten = flatten def forward(self, x): if self.flatten: in_size = x.size() return x.view((in_size[0], 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 from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
hfyer/NAIC2020_ReID_R1
ClipGlobalAvgPool2d
false
6,805
[ "Apache-2.0" ]
1
240f0c9f65e482e6b0090f01d9f9e3373a337033
https://github.com/hfyer/NAIC2020_ReID_R1/tree/240f0c9f65e482e6b0090f01d9f9e3373a337033
GeneralizedMeanPooling
import torch from torch import nn class GeneralizedMeanPooling(nn.Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At p = infinity, one gets Max Pooling - At p = 1,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
hfyer/NAIC2020_ReID_R1
GeneralizedMeanPooling
false
6,806
[ "Apache-2.0" ]
1
240f0c9f65e482e6b0090f01d9f9e3373a337033
https://github.com/hfyer/NAIC2020_ReID_R1/tree/240f0c9f65e482e6b0090f01d9f9e3373a337033
weight_quantize_fn
import torch import torch.nn as nn def uniform_quantize(k): class qfn(torch.autograd.Function): @staticmethod def forward(ctx, input): if k == 32: out = input elif k == 1: out = torch.sign(input) else: n = float...
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...
heymesut/SJTU_microe
weight_quantize_fn
false
6,807
[ "BSD-3-Clause" ]
1
7a862d03b4d8fe4c8608173a16082f44001f3f13
https://github.com/heymesut/SJTU_microe/tree/7a862d03b4d8fe4c8608173a16082f44001f3f13
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...
hfyer/NAIC2020_ReID_R1
TLU
false
6,808
[ "Apache-2.0" ]
1
240f0c9f65e482e6b0090f01d9f9e3373a337033
https://github.com/hfyer/NAIC2020_ReID_R1/tree/240f0c9f65e482e6b0090f01d9f9e3373a337033
YOLOLayer
import torch import numpy as np import torch.nn as nn class YOLOLayer(nn.Module): """ Detection Layer """ def __init__(self, in_ch, n_anchors, n_classes): super(YOLOLayer, self).__init__() self.n_anchors = n_anchors self.n_classes = n_classes self.conv = nn.Conv2d(in_c...
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...
hiroki-kawauchi/SHAPObjectDetection
YOLOLayer
false
6,809
[ "MIT" ]
1
3667d026949137cf710fc627672809c8564f5c6f
https://github.com/hiroki-kawauchi/SHAPObjectDetection/tree/3667d026949137cf710fc627672809c8564f5c6f
AdaptiveAvgMaxPool2d
import torch from torch import nn class FastGlobalAvgPool2d(nn.Module): def __init__(self, flatten=False): super(FastGlobalAvgPool2d, self).__init__() self.flatten = flatten def forward(self, x): if self.flatten: in_size = x.size() return x.view((in_size[0], 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 from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
hfyer/NAIC2020_ReID_R1
AdaptiveAvgMaxPool2d
false
6,810
[ "Apache-2.0" ]
1
240f0c9f65e482e6b0090f01d9f9e3373a337033
https://github.com/hfyer/NAIC2020_ReID_R1/tree/240f0c9f65e482e6b0090f01d9f9e3373a337033
KeyValueAttention
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import torch.nn.init class KeyValueAttention(nn.Module): def __init__(self, query_size, key_size, value_size, hid_size, init_range): super(KeyValueAttention, self).__init__() self.key2hid = nn.L...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
haojiepan1/CrossWOZ
KeyValueAttention
false
6,811
[ "Apache-2.0" ]
1
6d7b4c4cfb73a528b76074764687906abecc90b6
https://github.com/haojiepan1/CrossWOZ/tree/6d7b4c4cfb73a528b76074764687906abecc90b6
LandmarksLoss
import torch import numpy as np import torch.nn as nn import torch.utils.data class WingLoss(nn.Module): def __init__(self, w=10, e=2): super(WingLoss, self).__init__() self.w = w self.e = e self.C = self.w - self.w * np.log(1 + self.w / self.e) def forward(self, x, t, sigma=...
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 numpy as np import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
homomorfism/wise-programming
LandmarksLoss
false
6,812
[ "MIT" ]
1
e0589e8900237ddc9c3abf54c85be532cacf2d33
https://github.com/homomorfism/wise-programming/tree/e0589e8900237ddc9c3abf54c85be532cacf2d33
Decoder1
import torch import torch.nn as nn class Decoder1(nn.Module): def __init__(self): super(Decoder1, self).__init__() self.reflecPad2 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv3 = nn.Conv2d(64, 3, 3, 1, 0) def forward(self, x): out = self.reflecPad2(x) out = self.conv3...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
hologerry/wct_experiment
Decoder1
false
6,814
[ "MIT" ]
1
890d885561dc8df8c4ae732aebd902aa838257e6
https://github.com/hologerry/wct_experiment/tree/890d885561dc8df8c4ae732aebd902aa838257e6
QuantMeasure
import torch from torch import nn from torch.autograd.function import InplaceFunction def quantize(x, num_bits=8, min_value=None, max_value=None, num_chunks=None, stochastic=False, inplace=False, quantize=False, layer_num=-1, multi= False, index=[], is_act=False): return UniformQuantize().apply(x, num_bit...
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 from to...
hoseung2/DNAS-Compression
QuantMeasure
false
6,815
[ "MIT" ]
1
645407fc572045f33278c935091a07e0ccfce87f
https://github.com/hoseung2/DNAS-Compression/tree/645407fc572045f33278c935091a07e0ccfce87f
SmooothLabelCELoss
import torch import torch.nn as nn class SmooothLabelCELoss(nn.Module): def __init__(self, smooth=0.1, use_uniform=False, reduction='mean'): super(SmooothLabelCELoss, self).__init__() self.smooth_coef = smooth self.smooth_std = 0.5 self.reduction = reduction self.use_unifo...
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...
hekq/3DFingerPose
SmooothLabelCELoss
false
6,816
[ "MIT" ]
1
385c672408e2fd29ed0373a842727c9fcfd0fc59
https://github.com/hekq/3DFingerPose/tree/385c672408e2fd29ed0373a842727c9fcfd0fc59
DiceLoss
import torch import torch.nn as nn import torch.nn.functional as F class BinaryDiceLoss(nn.Module): """Dice loss of binary class Args: smooth: A float number to smooth loss, and avoid NaN error, default: 1 p: Denominator value: \\sum{x^p} + \\sum{y^p}, default: 2 predict: A tensor of 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 math as tl_math import torch.nn as nn ...
hekq/3DFingerPose
DiceLoss
false
6,817
[ "MIT" ]
1
385c672408e2fd29ed0373a842727c9fcfd0fc59
https://github.com/hekq/3DFingerPose/tree/385c672408e2fd29ed0373a842727c9fcfd0fc59
StdConv2d
import torch import torch.nn as nn import torch.nn.functional as F class StdConv2d(nn.Conv2d): def forward(self, x): w = self.weight v = torch.var(w, dim=[1, 2, 3], keepdim=True, unbiased=False) m = torch.mean(w, dim=[1, 2, 3], keepdim=True) w = (w - m) / torch.sqrt(v + 1e-10) ...
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 ...
hrlblab/Glo-In-One
StdConv2d
false
6,818
[ "Apache-2.0" ]
1
7daef49c557bccd6f5c956b88603357346dc78a2
https://github.com/hrlblab/Glo-In-One/tree/7daef49c557bccd6f5c956b88603357346dc78a2
ScaledDotProductAttention
import torch from torch.autograd import Variable import torch.nn as nn import torch.optim class Bottle(nn.Module): """ Perform the reshape routine before and after an operation """ def forward(self, input): if len(input.size()) <= 2: return super(Bottle, self).forward(input) 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....
howardchenhd/Transformer-pytorch
ScaledDotProductAttention
false
6,819
[ "MIT" ]
1
ae71ed5767272feb7e717be6d5bfce46f80ec57a
https://github.com/howardchenhd/Transformer-pytorch/tree/ae71ed5767272feb7e717be6d5bfce46f80ec57a
LeNet_300_100
import torch import torch.nn as nn import torch.nn.functional as F class LeNet_300_100(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(28 * 28, 300) self.fc2 = nn.Linear(300, 100) self.fc3 = nn.Linear(100, 10) self.relu = nn.ReLU() self.last...
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_...
htt-trangtran/smg
LeNet_300_100
false
6,820
[ "MIT" ]
1
b7a49055e7d48ec456bac67ab473db2183d2f597
https://github.com/htt-trangtran/smg/tree/b7a49055e7d48ec456bac67ab473db2183d2f597
IA_gate
import torch import torch.nn as nn class IA_gate(nn.Module): def __init__(self, in_dim, out_dim): super(IA_gate, self).__init__() self.IA = nn.Linear(in_dim, out_dim) def forward(self, x, IA_head): a = self.IA(IA_head) a = 1.0 + torch.tanh(a) a = a.unsqueeze(-1).unsqu...
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 ...
huanglf714/COMatchNet
IA_gate
false
6,821
[ "Apache-2.0" ]
1
79023f5be65d354eb9bdac026d7e0d73110bc4aa
https://github.com/huanglf714/COMatchNet/tree/79023f5be65d354eb9bdac026d7e0d73110bc4aa
ConvBlock
import torch import torch.nn as nn import torch.nn.functional as F def conv3x3(in_planes, out_planes, strd=1, padding=1, bias=False): """3x3 convolution with padding""" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=strd, padding=padding, bias=bias) class ConvBlock(nn.Module): de...
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....
hhj1897/fan_training
ConvBlock
false
6,822
[ "MIT" ]
1
5882f9edf2f1a07c80a6d1f3341a7cf1d348e217
https://github.com/hhj1897/fan_training/tree/5882f9edf2f1a07c80a6d1f3341a7cf1d348e217
PositionwiseFeedForward
import torch import torch.nn as nn import torch.optim class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(features)) self.eps = eps def forward...
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....
howardchenhd/Transformer-pytorch
PositionwiseFeedForward
false
6,823
[ "MIT" ]
1
ae71ed5767272feb7e717be6d5bfce46f80ec57a
https://github.com/howardchenhd/Transformer-pytorch/tree/ae71ed5767272feb7e717be6d5bfce46f80ec57a
MultiHeadedAttention
import math import torch from torch.autograd import Variable import torch.nn as nn import torch.optim class MultiHeadedAttention(nn.Module): """ Multi-Head Attention module from "Attention is All You Need" :cite:`DBLP:journals/corr/VaswaniSPUJGKP17`. Similar to standard `dot` attention but uses ...
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....
howardchenhd/Transformer-pytorch
MultiHeadedAttention
false
6,824
[ "MIT" ]
1
ae71ed5767272feb7e717be6d5bfce46f80ec57a
https://github.com/howardchenhd/Transformer-pytorch/tree/ae71ed5767272feb7e717be6d5bfce46f80ec57a
Decoder2
import torch import torch.nn as nn class Decoder2(nn.Module): def __init__(self): super(Decoder2, self).__init__() self.reflecPad5 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv5 = nn.Conv2d(128, 64, 3, 1, 0) self.relu5 = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingNear...
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....
hologerry/wct_experiment
Decoder2
false
6,825
[ "MIT" ]
1
890d885561dc8df8c4ae732aebd902aa838257e6
https://github.com/hologerry/wct_experiment/tree/890d885561dc8df8c4ae732aebd902aa838257e6
HirarchicalAttention
from torch.nn import Module import torch from typing import * import torch.utils.data import torch.nn as nn import torch.onnx.operators import torch.optim class HirarchicalAttention(Module): """ ref: Hierarchical Attention Networks for Document Classification """ def __init__(self, hidden_size: 'int')...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
hrshy0629/naturalcc
HirarchicalAttention
false
6,826
[ "MIT" ]
1
9c3329dd8387c8242deb52bf590ebe3ac795f8de
https://github.com/hrshy0629/naturalcc/tree/9c3329dd8387c8242deb52bf590ebe3ac795f8de
GCT
import torch import torch.nn as nn class GCT(nn.Module): def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False ): super(GCT, self).__init__() self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1)) self.gamma = nn.Parameter(torch.zeros(1, num_channels, 1...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
huanglf714/COMatchNet
GCT
false
6,827
[ "Apache-2.0" ]
1
79023f5be65d354eb9bdac026d7e0d73110bc4aa
https://github.com/huanglf714/COMatchNet/tree/79023f5be65d354eb9bdac026d7e0d73110bc4aa
BertAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class BertSelfAttention(nn.Module): def __init__(self, config): super().__init__() if (config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, 'embedding_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....
hongyuntw/Col-KBERT
BertAttention
false
6,828
[ "MIT" ]
1
e77ce2585d228a783bf83cc1de53583aff70f7b4
https://github.com/hongyuntw/Col-KBERT/tree/e77ce2585d228a783bf83cc1de53583aff70f7b4
SimpleGFLLoss
import torch import torch.nn.functional as F def simple_gfl(pred, target, beta): """Simply add a pow of abs difference in front of BCE""" assert pred.size() == target.size( ), 'simple GFL assume pred and target to have the same shape' loss = (pred.sigmoid() - target).abs().pow(beta) loss = F.b...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
huimlight/OpenMMLab-IoUNet
SimpleGFLLoss
false
6,829
[ "Apache-2.0" ]
1
00536bac99f4d3d7ad2682dad44f299f714565b6
https://github.com/huimlight/OpenMMLab-IoUNet/tree/00536bac99f4d3d7ad2682dad44f299f714565b6
Conv2dSamePadding
import torch from torch import nn import torch.nn.functional as F def conv2d_same_padding(input, weight, bias=None, stride=1, dilation=1, groups=1): input_rows = input.size(2) filter_rows = weight.size(2) effective_filter_size_rows = (filter_rows - 1) * dilation[0] + 1 out_rows = (input_rows + str...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.nn.functional as F assert_size_stride = torch....
hulaba/pycrop-yield-prediction
Conv2dSamePadding
false
6,830
[ "MIT" ]
1
b4790dc2f87a73e8a0604e8c22466314090c5abf
https://github.com/hulaba/pycrop-yield-prediction/tree/b4790dc2f87a73e8a0604e8c22466314090c5abf
GCNModelVAE
from torch.nn import Module import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.module import Module from torch.nn.parameter import Parameter import torch.nn.modules.loss class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 ...
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.nn import Module i...
hurraygong/scGNN
GCNModelVAE
false
6,831
[ "MIT" ]
1
bc555895fbd5740ddd82e03187171116889cc10e
https://github.com/hurraygong/scGNN/tree/bc555895fbd5740ddd82e03187171116889cc10e
_ASPPModule
import torch import torch.nn as nn class GCT(nn.Module): def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False ): super(GCT, self).__init__() self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1)) self.gamma = nn.Parameter(torch.zeros(1, num_channels, 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....
huanglf714/COMatchNet
_ASPPModule
false
6,832
[ "Apache-2.0" ]
1
79023f5be65d354eb9bdac026d7e0d73110bc4aa
https://github.com/huanglf714/COMatchNet/tree/79023f5be65d354eb9bdac026d7e0d73110bc4aa
MyMaxPool1dPadSame
import torch import torch.nn as nn import torch.nn.functional as F class MyMaxPool1dPadSame(nn.Module): """ extend nn.MaxPool1d to support SAME padding """ def __init__(self, kernel_size): super(MyMaxPool1dPadSame, self).__init__() self.kernel_size = kernel_size self.stride = ...
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...
huynhnhathao/hum_to_find
MyMaxPool1dPadSame
false
6,833
[ "MIT" ]
1
a0d7ec4bab1a7e2f7175956ff2721e23e2448840
https://github.com/huynhnhathao/hum_to_find/tree/a0d7ec4bab1a7e2f7175956ff2721e23e2448840
AE
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.modules.loss class AE(nn.Module): """ Autoencoder for dimensional reduction""" def __init__(self, dim): super(AE, self).__init__() self.dim = dim self.fc1 = nn.Linear(dim, 512) self.fc2 = nn.Lin...
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 ...
hurraygong/scGNN
AE
false
6,834
[ "MIT" ]
1
bc555895fbd5740ddd82e03187171116889cc10e
https://github.com/hurraygong/scGNN/tree/bc555895fbd5740ddd82e03187171116889cc10e
VAE
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.modules.loss class VAE(nn.Module): """ Variational Autoencoder for dimensional reduction""" def __init__(self, dim): super(VAE, self).__init__() self.dim = dim self.fc1 = nn.Linear(dim, 400) sel...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
hurraygong/scGNN
VAE
false
6,835
[ "MIT" ]
1
bc555895fbd5740ddd82e03187171116889cc10e
https://github.com/hurraygong/scGNN/tree/bc555895fbd5740ddd82e03187171116889cc10e
eca_block
import math import torch import torch.nn as nn class eca_block(nn.Module): def __init__(self, channel, b=1, gamma=2): super(eca_block, self).__init__() kernel_size = int(abs((math.log(channel, 2) + b) / gamma)) kernel_size = kernel_size if kernel_size % 2 else kernel_size + 1 self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
huuthieu/pytorch-yolov4-tiny
eca_block
false
6,836
[ "MIT" ]
1
fac82da75e161221af74b56242272a42cf64c17e
https://github.com/huuthieu/pytorch-yolov4-tiny/tree/fac82da75e161221af74b56242272a42cf64c17e
IrisClassifier
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class IrisClassifier(nn.Module): def __init__(self): super(IrisClassifier, self).__init__() self.fc1 = nn.Linear(4, 10) self.fc2 = nn.Linear(10, 10) self.fc3 = nn.Linear(10, 3) def forward(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
huxuan/mlflow
IrisClassifier
false
6,837
[ "Apache-2.0" ]
1
7b4ab0e4cac5d4c2d2cbfcd3d12aa55b2ee83efe
https://github.com/huxuan/mlflow/tree/7b4ab0e4cac5d4c2d2cbfcd3d12aa55b2ee83efe
DynamicPreHead
import torch import torch.nn as nn class DynamicPreHead(nn.Module): def __init__(self, in_dim=3, embed_dim=100, kernel_size=1): super(DynamicPreHead, self).__init__() self.conv = nn.Conv2d(in_dim, embed_dim, kernel_size=kernel_size, stride=1, padding=int((kernel_size - 1) / 2)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
huanglf714/COMatchNet
DynamicPreHead
false
6,838
[ "Apache-2.0" ]
1
79023f5be65d354eb9bdac026d7e0d73110bc4aa
https://github.com/huanglf714/COMatchNet/tree/79023f5be65d354eb9bdac026d7e0d73110bc4aa
NormalizationLayer
import torch import torch.utils.data class NormalizationLayer(torch.nn.Module): """Class for normalization layer.""" def __init__(self, normalize_scale=1.0, learn_scale=True): super(NormalizationLayer, self).__init__() self.norm_s = float(normalize_scale) if learn_scale: 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.utils.data assert_size_stride = torch._C._dynamo.guards.assert_siz...
huynhtruc0309/tirg
NormalizationLayer
false
6,839
[ "Apache-2.0" ]
1
14ac6dcb41624729a6f4144a7c9e7899074f0eec
https://github.com/huynhtruc0309/tirg/tree/14ac6dcb41624729a6f4144a7c9e7899074f0eec
decoder2
import torch import torch.nn as nn class decoder2(nn.Module): def __init__(self, dropout=0.5, act=torch.sigmoid): super(decoder2, self).__init__() self.dropout = nn.Dropout(dropout) self.act = act def forward(self, z_node, z_hyperedge): z_node_ = self.dropout(z_node) ...
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...
iMoonLab/HHDTI
decoder2
false
6,840
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
node_encoder
import torch import torch.nn as nn import torch.nn.functional as F class node_encoder(nn.Module): def __init__(self, num_in_node, num_hidden, dropout, act=F.tanh): super(node_encoder, self).__init__() self.num_in_node = num_in_node self.num_hidden = num_hidden self.dropout = dropo...
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 ...
iMoonLab/HHDTI
node_encoder
false
6,841
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
hyperedge_encoder
import torch import torch.nn as nn import torch.nn.functional as F class hyperedge_encoder(nn.Module): def __init__(self, num_in_edge, num_hidden, dropout, act=F.tanh): super(hyperedge_encoder, self).__init__() self.num_in_edge = num_in_edge self.num_hidden = num_hidden self.dropo...
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 ...
iMoonLab/HHDTI
hyperedge_encoder
false
6,842
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
kl_loss
from torch.nn import Module import torch from torch.nn.modules.module import Module class kl_loss(Module): def __init__(self, num_nodes, num_edges): super(kl_loss, self).__init__() self.num_nodes = num_nodes self.num_edges = num_edges def forward(self, z_node_log_std, z_node_mean, z_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import Module from torch.nn.modules.module import Module as...
iMoonLab/HHDTI
kl_loss
false
6,843
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
HGNN_conv
import math import torch import torch.nn as nn from torch.nn.parameter import Parameter class HGNN_conv(nn.Module): def __init__(self, in_ft, out_ft, bias=True): super(HGNN_conv, self).__init__() self.weight = Parameter(torch.Tensor(in_ft, out_ft)) if bias: self.bias = Paramet...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn from torch.nn.parameter import Parameter asser...
iMoonLab/HHDTI
HGNN_conv
false
6,844
[ "MIT" ]
1
b2dd0e78818888e676afc91af1425dada5b3258a
https://github.com/iMoonLab/HHDTI/tree/b2dd0e78818888e676afc91af1425dada5b3258a
ArcFace
import math import torch from itertools import product as product import torch.nn as nn import torch.utils.data.distributed class ArcFace(nn.Module): def __init__(self, s=64.0, m=0.5): """ArcFace formula: cos(m + theta) = cos(m)cos(theta) - sin(m)sin(theta) Note that: 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 libdevice import math from itertools i...
iChenning/face_project
ArcFace
false
6,845
[ "MIT" ]
1
8d70858817da4d15c7b513ae492034784f57f35f
https://github.com/iChenning/face_project/tree/8d70858817da4d15c7b513ae492034784f57f35f
Model
import torch from torch import nn class Model(nn.Module): def forward(self, img: 'torch.Tensor', scale: 'torch.Tensor', mean: 'torch.Tensor'): return torch.div(torch.sub(img, mean), scale) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand( [4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
ibaiGorordo/depthai-experiments
Model
false
6,846
[ "MIT" ]
1
cde67e277120ddac815cbad6360695759cca900f
https://github.com/ibaiGorordo/depthai-experiments/tree/cde67e277120ddac815cbad6360695759cca900f
Actor
import torch import torch.nn.functional as F import torch.nn as nn class Actor(nn.Module): def __init__(self, hidden_size, num_inputs, action_space): super(Actor, self).__init__() self.action_space = action_space num_outputs = action_space.shape[0] self.linear1 = nn.Linear(num_inp...
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 ...
icml2019-anonymous-author/Action-Robust-Reinforcement-Learning
Actor
false
6,847
[ "MIT" ]
1
03f0a1dd5f4a0fc5230c0ad0b41f63161bae862b
https://github.com/icml2019-anonymous-author/Action-Robust-Reinforcement-Learning/tree/03f0a1dd5f4a0fc5230c0ad0b41f63161bae862b
Block
import torch import torch._C import torch.serialization from torch import nn import torch.nn.functional as F class DropPath(nn.Module): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). """ def __init__(self, drop_prob=None): super(DropPath, self).__init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
huazai-1994/24th-resolution-for-STAC-Overflow
Block
false
6,848
[ "Apache-2.0" ]
1
80bb3b367a126264823ffc597dc01586c262f9d9
https://github.com/huazai-1994/24th-resolution-for-STAC-Overflow/tree/80bb3b367a126264823ffc597dc01586c262f9d9
EncoderBlock
import math import torch from torch.autograd import Variable import torch.nn as nn import torch.optim class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
howardchenhd/Transformer-pytorch
EncoderBlock
false
6,849
[ "MIT" ]
1
ae71ed5767272feb7e717be6d5bfce46f80ec57a
https://github.com/howardchenhd/Transformer-pytorch/tree/ae71ed5767272feb7e717be6d5bfce46f80ec57a
DecoderBlock
import math import torch from torch.autograd import Variable import torch.nn as nn import torch.optim class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.a_2 = nn.Parameter(torch.ones(features)) self.b_2 = nn.Parameter(torch.zeros(fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
howardchenhd/Transformer-pytorch
DecoderBlock
false
6,850
[ "MIT" ]
1
ae71ed5767272feb7e717be6d5bfce46f80ec57a
https://github.com/howardchenhd/Transformer-pytorch/tree/ae71ed5767272feb7e717be6d5bfce46f80ec57a
Biaffine
import torch import torch.nn as nn class Biaffine(nn.Module): def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True): super(Biaffine, self).__init__() self.n_in = n_in self.n_out = n_out self.bias_x = bias_x self.bias_y = bias_y self.weight = nn.Parameter(torc...
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...
icewing1996/biaffine-parser
Biaffine
false
6,851
[ "MIT" ]
1
f5a4ece7ba9a087d81b76dd6a8ea6aa7d90c6c82
https://github.com/icewing1996/biaffine-parser/tree/f5a4ece7ba9a087d81b76dd6a8ea6aa7d90c6c82
Critic
import torch import torch.nn.functional as F import torch.nn as nn class Critic(nn.Module): def __init__(self, hidden_size, num_inputs, action_space): super(Critic, self).__init__() self.action_space = action_space num_outputs = action_space.shape[0] self.linear1 = nn.Linear(num_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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
icml2019-anonymous-author/Action-Robust-Reinforcement-Learning
Critic
false
6,852
[ "MIT" ]
1
03f0a1dd5f4a0fc5230c0ad0b41f63161bae862b
https://github.com/icml2019-anonymous-author/Action-Robust-Reinforcement-Learning/tree/03f0a1dd5f4a0fc5230c0ad0b41f63161bae862b
ScaledDotProductAttention
import torch import numpy as np import torch.utils.data class ScaledDotProductAttention(torch.nn.Module): """ Scaled, softmax attention module for Transformer as defined by Attention(Q, K, V) on pg 4. Returns the final attention vectors as well as the attention matrices (pairwise scores). """ def...
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....
icemansina/protein-transformer
ScaledDotProductAttention
false
6,853
[ "BSD-3-Clause" ]
1
4e73b17f2a4b89ba1a9f6703976d1a31b7a8a5eb
https://github.com/icemansina/protein-transformer/tree/4e73b17f2a4b89ba1a9f6703976d1a31b7a8a5eb
Actor
import torch import torch as t import torch.nn as nn class Actor(nn.Module): def __init__(self, state_dim, action_dim, action_range): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_dim) self.action_range ...
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....
ikamensh/machin
Actor
false
6,854
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
MultiHeadedAttention
import math import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadedAttention(nn.Module): def __init__(self, num_head, d_model, dropout=0.1): super(MultiHeadedAttention, self).__init__() assert d_model % num_head == 0 self.d_k = d_model // num_head 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....
iamxpy/pointer_summarizer
MultiHeadedAttention
false
6,855
[ "Apache-2.0" ]
1
ebeb2ad32a45162c0da14dac0b6241b0b0d00fa0
https://github.com/iamxpy/pointer_summarizer/tree/ebeb2ad32a45162c0da14dac0b6241b0b0d00fa0
A2CCritic
import torch import torch as t import torch.nn as nn class A2CCritic(nn.Module): def __init__(self, state_dim): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, 1) def forward(self, state): v = t.relu(self.fc...
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_...
ikamensh/machin
A2CCritic
false
6,856
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
DDPGCritic
import torch import torch as t import torch.nn as nn class DDPGCritic(nn.Module): def __init__(self, state_dim, action_dim): super().__init__() self.fc1 = nn.Linear(state_dim + action_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, 1) def forward(self, state, 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 import torch.nn as nn assert_...
ikamensh/machin
DDPGCritic
false
6,857
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
CO_Attention
import torch import torch.nn as nn import torch.nn.functional as F class CO_Attention(nn.Module): def __init__(self, in_dim, co_attention_dim): super(CO_Attention, self).__init__() self.leak_relu = nn.LeakyReLU() self.relu = nn.ReLU() self.conv1 = nn.Conv2d(in_dim, 64, kernel_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
huanglf714/COMatchNet
CO_Attention
false
6,858
[ "Apache-2.0" ]
1
79023f5be65d354eb9bdac026d7e0d73110bc4aa
https://github.com/huanglf714/COMatchNet/tree/79023f5be65d354eb9bdac026d7e0d73110bc4aa
ActorDiscrete
import torch import torch as t import torch.nn as nn class ActorDiscrete(nn.Module): def __init__(self, state_dim, action_dim): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_dim) def forward(self, state): ...
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....
ikamensh/machin
ActorDiscrete
false
6,859
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
A2CActorDisc
import torch from torch.distributions import Categorical import torch as t import torch.nn as nn class A2CActorDisc(nn.Module): def __init__(self, state_dim, action_num): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, 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 torch._inductor.runtime....
ikamensh/machin
A2CActorDisc
false
6,860
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
MultiHeadedAttention
import torch import numpy as np import torch.utils.data class ScaledDotProductAttention(torch.nn.Module): """ Scaled, softmax attention module for Transformer as defined by Attention(Q, K, V) on pg 4. Returns the final attention vectors as well as the attention matrices (pairwise scores). """ def...
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....
icemansina/protein-transformer
MultiHeadedAttention
false
6,861
[ "BSD-3-Clause" ]
1
4e73b17f2a4b89ba1a9f6703976d1a31b7a8a5eb
https://github.com/icemansina/protein-transformer/tree/4e73b17f2a4b89ba1a9f6703976d1a31b7a8a5eb
QNet
import torch import torch as t import torch.nn as nn class QNet(nn.Module): def __init__(self, state_dim, action_num, atom_num=10): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(16, 16) self.fc3 = nn.Linear(16, action_num * atom_num) self.acti...
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....
ikamensh/machin
QNet
false
6,862
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
CosineBasisLinear
import torch import numpy as np import torch.nn as nn def cosine_basis_functions(x, n_basis_functions=64): """Cosine basis functions used to embed quantile thresholds. Args: x (torch.Tensor): Input. n_basis_functions (int): Number of cosine basis functions. Returns: ndarray: Embe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy ...
imatge-upc/pixelcoordEDL
CosineBasisLinear
false
6,863
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
GatedActivation
import torch import torch.nn as nn import torch.nn.functional as F class GatedActivation(nn.Module): def __init__(self): super().__init__() def forward(self, x): x, y = x.chunk(2, dim=1) return F.tanh(x) * F.sigmoid(y) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
imatge-upc/pixelcoordEDL
GatedActivation
false
6,864
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
A2CActorCont
import torch import torch as t import torch.nn as nn from torch.distributions import Normal import torch.nn.functional as F class A2CActorCont(nn.Module): def __init__(self, state_dim, action_dim, action_range): super().__init__() self.fc1 = nn.Linear(state_dim, 16) self.fc2 = nn.Linear(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....
ikamensh/machin
A2CActorCont
false
6,865
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
Attention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self): super().__init__() self.softmax = nn.Softmax(dim=-1) def forward(self, Q, K, V, mask=None, dk=64): w = torch.bmm(Q, K.transpose(1, 2)) if mask is not None: assert w.size() == mask.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....
iml1111/machine-translation
Attention
false
6,866
[ "MIT" ]
1
a7dd673efbe8a172c1df49e0d50482dc84008c37
https://github.com/iml1111/machine-translation/tree/a7dd673efbe8a172c1df49e0d50482dc84008c37
HSwishV2
import torch import torch.nn as nn import torch.nn.functional as F class HSwishFunctionV2(torch.autograd.Function): @staticmethod def forward(ctx, feat): act = F.relu6(feat + 3).mul_(feat).div_(6) ctx.variables = feat return act @staticmethod def backward(ctx, grad_output): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dyna...
imvladikon/pytorch-loss
HSwishV2
false
6,867
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b