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
BinaryReg
import torch import torch.nn as nn import torch.utils.data class BinaryReg(nn.Module): """Regularization for encouraging the outputs to be binary. """ def __init__(self, alpha=1.0): super().__init__() self.alpha = alpha def forward(self, input): diff = input - 0.5 dif...
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 ...
pragyasingh7/pytorch_connectomics
BinaryReg
false
4,134
[ "MIT" ]
0
fdc8e1900b0a38d19ea50f78f8c81da2a4f015a9
https://github.com/pragyasingh7/pytorch_connectomics/tree/fdc8e1900b0a38d19ea50f78f8c81da2a4f015a9
DepthWiseSeparableConvBlock
import torch import torch.nn as nn class DepthWiseSeparableConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, bias=True, padding_mode='zeros', inner_kernel_size=1, inner_stride=1, inner_padding=0): """Depthwise separable 2D Co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
pppyykknen/LFDisplay-PyTorch
DepthWiseSeparableConvBlock
false
4,135
[ "MIT" ]
0
d19261dac1717a799bb5ba5f96563be1d2383340
https://github.com/pppyykknen/LFDisplay-PyTorch/tree/d19261dac1717a799bb5ba5f96563be1d2383340
MDN
from torch.nn import Module import torch from torch.nn.modules import Module from torch.nn.modules import Linear class MDN(Module): def __init__(self, input_size, num_mixtures): super(MDN, self).__init__() self.input_size = input_size self.num_mixtures = num_mixtures self.paramete...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
poctaviano/Handwriting-Model
MDN
false
4,136
[ "MIT" ]
0
30311ea0f4cb6e7bc0114cf0b2a96dc915dd9795
https://github.com/poctaviano/Handwriting-Model/tree/30311ea0f4cb6e7bc0114cf0b2a96dc915dd9795
KARAttention
from _paritybench_helpers import _mock_config import math import torch from torch import nn class KARMultiHeadAttention(nn.Module): def __init__(self, config, hidden_size): super(KARMultiHeadAttention, self).__init__() if hidden_size % config.num_attention_heads != 0: raise ValueError...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ohadrozen/inferbert
KARAttention
false
4,137
[ "Apache-2.0" ]
0
2e450aba894937e5769dcf028e4a8a597991fe43
https://github.com/ohadrozen/inferbert/tree/2e450aba894937e5769dcf028e4a8a597991fe43
AttentiveTrans2d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class AttentiveTrans2d(nn.Module): def __init__(self, num_features, hidden_channels=32): super(AttentiveTrans2d, self).__init__() self.avgpool = nn.AdaptiveAvgPool2d(1) self.smooth_gamma = 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.triton_helpers import libdevice import torch.nn as ...
ppomelo/Attentive-Transformation-Based-Normalization
AttentiveTrans2d
false
4,138
[ "Apache-2.0" ]
0
62ad02eb025613e90f4fe0e0a9f0f85839e53092
https://github.com/ppomelo/Attentive-Transformation-Based-Normalization/tree/62ad02eb025613e90f4fe0e0a9f0f85839e53092
DepthLogLoss
import torch import torch.nn as nn class DepthLogLoss(nn.Module): def __init__(self, balance_factor): super(DepthLogLoss, self).__init__() self.balance_factor = balance_factor def forward(self, inputs, targets): n, _, h, w = inputs.shape n_pixel = n * h * w inputs = t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
pystokes/depth_estimation
DepthLogLoss
false
4,140
[ "MIT" ]
0
b5b1955bcb5b3f1a1f1c8ddde45431cf38514f90
https://github.com/pystokes/depth_estimation/tree/b5b1955bcb5b3f1a1f1c8ddde45431cf38514f90
ConditionalBottleNeck
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class FiLM(nn.Module): """ Feature-wise Linear Modulation (FiLM) layer""" def __init__(self, input_size, output_size, num_film_layers=1, layer_norm=False): """ :param input_size: feature size of x_cond ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Daupler/CA-MTL
ConditionalBottleNeck
false
4,141
[ "MIT" ]
0
d417b039dee973e32f42ba5c1c346738cd29ab3c
https://github.com/Daupler/CA-MTL/tree/d417b039dee973e32f42ba5c1c346738cd29ab3c
TextureFinder
import torch import torch.nn as nn import torch.nn.functional as F class TextureFinder(nn.Module): def __init__(self): super(TextureFinder, self).__init__() self.encoder_conv1 = nn.Conv2d(in_channels=1, out_channels=4, kernel_size=4, stride=2, padding=1, dilation=1, groups=1, bias=Tru...
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...
paucarre/staal
TextureFinder
false
4,142
[ "MIT" ]
0
1635e514f0ed978a08c078afd258980bcb6f0cec
https://github.com/paucarre/staal/tree/1635e514f0ed978a08c078afd258980bcb6f0cec
C3D
import torch import torch.nn as nn import torch.nn class C3D(nn.Module): """ The C3D network as described in [1]. """ def __init__(self): super(C3D, self).__init__() self.conv1 = nn.Conv3d(3, 64, kernel_size=(3, 3, 3), padding=(1, 1, 1)) self.pool1 = nn.MaxPool3d(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 from torch._inductor.runtime....
kar98kbang/c3d-pytorch
C3D
false
4,143
[ "MIT" ]
0
22b3564798cb9249ad6fdb6c9d929bff3fdfa567
https://github.com/kar98kbang/c3d-pytorch/tree/22b3564798cb9249ad6fdb6c9d929bff3fdfa567
Model
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """conv. autoencoder""" def __init__(self): """constructor""" super().__init__() self.conv1 = nn.Conv2d(3, 32, 5, padding=2) self.conv2 = nn.Conv2d(32, 64, 3, padding=1) self.con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
positivevaib/semi-supervised-imagenet-classification
Model
false
4,144
[ "MIT" ]
0
4fb6427f5a72951c1b866a1ddbc2599811bb5770
https://github.com/positivevaib/semi-supervised-imagenet-classification/tree/4fb6427f5a72951c1b866a1ddbc2599811bb5770
ActorCritic
import torch import torch.nn.functional as F import torch.nn as nn def swish(x): return x * F.sigmoid(x) class ActorCritic(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64): """Initialize parameters and build model. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
postBG/deep-reinforcement-learning
ActorCritic
false
4,145
[ "MIT" ]
0
5df5662b091c4c3f00beba1aa6f9ce8a52001c93
https://github.com/postBG/deep-reinforcement-learning/tree/5df5662b091c4c3f00beba1aa6f9ce8a52001c93
ODEfunc
import torch import torch.nn as nn def norm(dim): """ Group normalization to improve model accuracy and training speed. """ return nn.GroupNorm(min(1, dim), dim) class ConcatConv1d(nn.Module): """ 1d convolution concatenated with time for usage in ODENet. """ def __init__(self, dim_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
puneat/SS-using-NODE
ODEfunc
false
4,146
[ "MIT" ]
0
29f053769420a2d1cab1ad45f59a912c2ac737da
https://github.com/puneat/SS-using-NODE/tree/29f053769420a2d1cab1ad45f59a912c2ac737da
ConcatConv1d
import torch import torch.nn as nn class ConcatConv1d(nn.Module): """ 1d convolution concatenated with time for usage in ODENet. """ def __init__(self, dim_in, dim_out, kernel_size=3, stride=1, padding=0, bias=True, transpose=False): super(ConcatConv1d, self).__init__() module...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
puneat/SS-using-NODE
ConcatConv1d
false
4,147
[ "MIT" ]
0
29f053769420a2d1cab1ad45f59a912c2ac737da
https://github.com/puneat/SS-using-NODE/tree/29f053769420a2d1cab1ad45f59a912c2ac737da
AdversarialNetwork
import torch import torch.nn as nn class AdversarialNetwork(nn.Module): def __init__(self, in_feature): super(AdversarialNetwork, self).__init__() self.ad_layer1 = nn.Linear(in_feature, 32) self.ad_layer2 = nn.Linear(32, 32) self.ad_layer3 = nn.Linear(32, 1) self.ad_layer1...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
pwjworks/MS-MDA
AdversarialNetwork
false
4,148
[ "MIT" ]
0
21f921a933a318820239541adb26b9fc6feba699
https://github.com/pwjworks/MS-MDA/tree/21f921a933a318820239541adb26b9fc6feba699
CollaborativeAttention
import math import torch import torch.utils.data from enum import Enum import torch.nn as nn class MixingMatrixInit(Enum): CONCATENATE = 1 ALL_ONES = 2 UNIFORM = 3 class CollaborativeAttention(nn.Module): def __init__(self, dim_input: 'int', dim_value_all: 'int', dim_key_query_all: 'int', n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
prattcmp/NonAttentiveTacotron2
CollaborativeAttention
false
4,149
[ "BSD-3-Clause" ]
0
c65722133c392fba233b5003b480ee498fc0a44a
https://github.com/prattcmp/NonAttentiveTacotron2/tree/c65722133c392fba233b5003b480ee498fc0a44a
UpSample
import torch import torch.nn as nn import torch.nn.functional as F class UpSample(nn.Sequential): def __init__(self, skip_input, output_features): super(UpSample, self).__init__() self.convA = nn.Conv2d(skip_input, output_features, kernel_size=3, stride=1, padding=1) self.leak...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
pystokes/depth_estimation
UpSample
false
4,150
[ "MIT" ]
0
b5b1955bcb5b3f1a1f1c8ddde45431cf38514f90
https://github.com/pystokes/depth_estimation/tree/b5b1955bcb5b3f1a1f1c8ddde45431cf38514f90
SelfExpression
import torch import torch.nn as nn class SelfExpression(nn.Module): def __init__(self, n): super(SelfExpression, self).__init__() self.Coefficient = nn.Parameter(0.0001 * torch.ones(n, n, dtype= torch.float32), requires_grad=True) def forward(self, x): y = torch.matmul(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
qilinli/DSC-Net
SelfExpression
false
4,151
[ "MIT" ]
0
c0e7a3cae3e07c34b2989234f568c7007cf0fc55
https://github.com/qilinli/DSC-Net/tree/c0e7a3cae3e07c34b2989234f568c7007cf0fc55
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 16, 3, stride=3) self.conv2 = nn.Conv2d(16, 32, 3, stride=3) self.conv3 = nn.Conv2d(32, 64, 3, stride=3) 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_...
prasad5141/cat_vs_dog_webapp
Net
false
4,152
[ "MIT" ]
0
29c82addbc62104c3b9250af5f465b269cf68039
https://github.com/prasad5141/cat_vs_dog_webapp/tree/29c82addbc62104c3b9250af5f465b269cf68039
LearnedPositionalEmbedding
import torch import torch.nn as nn import torch.nn.functional as F class LearnedPositionalEmbedding(nn.Embedding): """ This module learns positional embeddings up to a fixed maximum size. Padding ids are ignored by either offsetting based on padding_idx or by setting padding_idx to None and ensuring t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
qinwang-ai/Contact-Distil
LearnedPositionalEmbedding
false
4,153
[ "Apache-2.0" ]
0
5e98389de70e0d9c4d16bd91ca1326689dc220a6
https://github.com/qinwang-ai/Contact-Distil/tree/5e98389de70e0d9c4d16bd91ca1326689dc220a6
ConvAE
import math import torch import torch.nn as nn import torch.nn.functional as F class Conv2dSamePad(nn.Module): """ Implement Tensorflow's 'SAME' padding mode in Conv2d. When an odd number, say `m`, of pixels are need to pad, Tensorflow will pad one more column at right or one more row at bottom. But P...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
qilinli/DSC-Net
ConvAE
false
4,154
[ "MIT" ]
0
c0e7a3cae3e07c34b2989234f568c7007cf0fc55
https://github.com/qilinli/DSC-Net/tree/c0e7a3cae3e07c34b2989234f568c7007cf0fc55
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....
qi700/my_point_summarize
MultiHeadedAttention
false
4,155
[ "Apache-2.0" ]
0
e269c2d0411fc61ea34055c3080472bc9111bcaa
https://github.com/qi700/my_point_summarize/tree/e269c2d0411fc61ea34055c3080472bc9111bcaa
Attention
import torch import torch.utils.data from torch import nn import torch.nn.functional as F import torch.hub class Attention(nn.Module): def forward(self, query, key, value, mask=None, dropout=None): scale = query.size(-1) ** -0.5 scores = query.matmul(key.transpose(-2, -1)) / scale if mask...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
opqi/VMZ
Attention
false
4,156
[ "Apache-2.0" ]
0
bc9c3bf5f7d9e7d0ef433f9d9b4a3155ac5ed969
https://github.com/opqi/VMZ/tree/bc9c3bf5f7d9e7d0ef433f9d9b4a3155ac5ed969
MultiHeadAttention
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, hidden_state, num_heads=1): super().__init__() self.q_linear = nn.Linear(hidden_state, hidden_state) self.v_linear = nn.Linear(hidden_state, hidden_state) self.k_linear = nn.Linear(hidden_st...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
qinyiwei/MuTual
MultiHeadAttention
false
4,157
[ "MIT" ]
0
3bdd13c1388d6136b8944666dfd434870760cc93
https://github.com/qinyiwei/MuTual/tree/3bdd13c1388d6136b8944666dfd434870760cc93
_SubPixelBlock
import torch import torch.nn as nn class _SubPixelBlock(nn.Module): def __init__(self, in_channels: 'int'=64, out_channels: 'int'=64, scale_factor: 'int'=2): super(_SubPixelBlock, self).__init__() n_out = out_channels * scale_factor ** 2 self.conv = nn.Conv2d(in_channels, n_out, k...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
pvrancx/torch_isr
_SubPixelBlock
false
4,158
[ "MIT" ]
0
831278ae5c3b939b4147bae1a99bc3f3d4fc415d
https://github.com/pvrancx/torch_isr/tree/831278ae5c3b939b4147bae1a99bc3f3d4fc415d
LocalContextNorm
import math import torch import torch.utils.data from torchvision.transforms import functional as F from torch import nn from torch.nn import functional as F class LocalContextNorm(nn.Module): def __init__(self, num_features, channels_per_group=2, window_size=(227, 227), eps=1e-05): super(LocalCo...
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 from torch import nn assert_size_stride = torch._C._dyn...
pjh4993/FCOS
LocalContextNorm
false
4,159
[ "BSD-2-Clause" ]
0
27f79e3fd3f5043796450b9a2201b42c744fd3df
https://github.com/pjh4993/FCOS/tree/27f79e3fd3f5043796450b9a2201b42c744fd3df
NeuralNet
import torch class NeuralNet(torch.nn.Module): def __init__(self, input_features, hidden_layer_size, output_classes): super(NeuralNet, self).__init__() self.l1 = torch.nn.Linear(input_features, hidden_layer_size) self.l2 = torch.nn.Linear(hidden_layer_size, output_classes) def forwar...
import torch from torch._inductor.select_algorithm import extern_kernels import 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_cu...
rahimftd/digit_recognizer
NeuralNet
false
4,160
[ "MIT" ]
0
a134efa915670308ad7a77c8ace2662e5c775913
https://github.com/rahimftd/digit_recognizer/tree/a134efa915670308ad7a77c8ace2662e5c775913
FCNet
import torch import torch.nn.functional from torch import nn from torch.nn.utils import weight_norm class FCNet(nn.Module): def __init__(self, in_size, out_size, activate=None, drop=0.0): super(FCNet, self).__init__() self.lin = weight_norm(nn.Linear(in_size, out_size), dim=None) self.dro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.fun...
rafiberlin/clp-sose21-pm-vision
FCNet
false
4,161
[ "MIT" ]
0
55c786182ed4568cdeda4bb3676fa02b9580d68d
https://github.com/rafiberlin/clp-sose21-pm-vision/tree/55c786182ed4568cdeda4bb3676fa02b9580d68d
SharpenedCosineSimilarity
import torch import torch.nn as nn import torch.nn.functional as F def unfold2d(x, kernel_size: 'int', stride: 'int', padding: 'int'): x = F.pad(x, [padding] * 4) bs, in_c, h, w = x.size() ks = kernel_size strided_x = x.as_strided((bs, in_c, (h - ks) // stride + 1, (w - ks) // stride + 1, ks, ...
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 import torch.nn.functional as F assert_s...
quickgrid/sharpened_cosine_similarity_torch
SharpenedCosineSimilarity
false
4,162
[ "MIT" ]
0
d652d76a4994a0b3817e248d5899827d35a5ebeb
https://github.com/quickgrid/sharpened_cosine_similarity_torch/tree/d652d76a4994a0b3817e248d5899827d35a5ebeb
EncoderLayer
import math import torch import torch.nn as nn import torch.nn.functional as F class AffineLayer(nn.Module): def __init__(self, dropout, d_model, d_ff): super(AffineLayer, self).__init__() self.w_1 = nn.Linear(d_model, d_ff) self.w_2 = nn.Linear(d_ff, d_model) self.dropout = nn.Dr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
qi700/my_point_summarize
EncoderLayer
false
4,163
[ "Apache-2.0" ]
0
e269c2d0411fc61ea34055c3080472bc9111bcaa
https://github.com/qi700/my_point_summarize/tree/e269c2d0411fc61ea34055c3080472bc9111bcaa
DSCNet
import math import torch import torch.nn as nn import torch.nn.functional as F class Conv2dSamePad(nn.Module): """ Implement Tensorflow's 'SAME' padding mode in Conv2d. When an odd number, say `m`, of pixels are need to pad, Tensorflow will pad one more column at right or one more row at bottom. But P...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
qilinli/DSC-Net
DSCNet
false
4,164
[ "MIT" ]
0
c0e7a3cae3e07c34b2989234f568c7007cf0fc55
https://github.com/qilinli/DSC-Net/tree/c0e7a3cae3e07c34b2989234f568c7007cf0fc55
FuseLayer
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class FuseLayer(nn.Module): def __init__(self, config): super().__init__() self.linear1 = nn.Linear(4 * config.hidden_size, config.hidden_size) self.linear2 = nn.Linear(4 * config.hidden_size, config.hidden_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
qinyiwei/MuTual
FuseLayer
false
4,165
[ "MIT" ]
0
3bdd13c1388d6136b8944666dfd434870760cc93
https://github.com/qinyiwei/MuTual/tree/3bdd13c1388d6136b8944666dfd434870760cc93
AbsModule
import torch class AbsModule(torch.nn.Module): def __init__(self): super(AbsModule, self).__init__() def forward(self, x): return torch.abs(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
mirecta/nncase
AbsModule
false
4,166
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
Tanh
import math import torch class Tanh(torch.nn.Tanh): """ Class that extends ``torch.nn.Tanh`` additionally computing the log diagonal blocks of the Jacobian. """ def forward(self, inputs, grad: 'torch.Tensor'=None): """ Parameters ---------- inputs : ``torch.Tensor`...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_strid...
ralphc1212/BNAF
Tanh
false
4,167
[ "MIT" ]
0
b6e331aa96cdd4496b6eed6c6ce65512a99f4149
https://github.com/ralphc1212/BNAF/tree/b6e331aa96cdd4496b6eed6c6ce65512a99f4149
MHA
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class MHA(nn.Module): def __init__(self, config): super().__init__() self.num_attention_heads = config.num_attention_heads self.hidden_size = config.hidden_size self.attention_head_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....
qinyiwei/MuTual
MHA
false
4,168
[ "MIT" ]
0
3bdd13c1388d6136b8944666dfd434870760cc93
https://github.com/qinyiwei/MuTual/tree/3bdd13c1388d6136b8944666dfd434870760cc93
CosModule
import torch class CosModule(torch.nn.Module): def __init__(self): super(CosModule, self).__init__() def forward(self, x): return torch.cos(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
mirecta/nncase
CosModule
false
4,169
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
PopArt
import torch import numpy as np import torch.nn as nn class PopArt(nn.Module): """Normalize a vector of observations - across the first norm_axes dimensions""" def __init__(self, input_shape, norm_axes=1, beta=0.99999, per_element_update=False, epsilon=1e-05, device=torch.device('cpu')): supe...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import numpy as np import to...
rainwangphy/TRPO-in-MARL
PopArt
false
4,170
[ "MIT" ]
0
22229abba417708922ecf6455c1c5180dbe80391
https://github.com/rainwangphy/TRPO-in-MARL/tree/22229abba417708922ecf6455c1c5180dbe80391
RegressionHead
import abc import torch import torch.nn as nn from torch.nn.functional import * import torch.utils.data.dataset class BaseHead(nn.Module, metaclass=abc.ABCMeta): """Absract class for task heads""" @abc.abstractmethod def __init__(self): super().__init__() class RegressionHead(BaseHead): 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.triton_helpers import libdevice import abc import t...
mfk3138/jiant
RegressionHead
false
4,171
[ "MIT" ]
0
6e67ff1ecb1bb98533c1019a86af4ad2c04c6a64
https://github.com/mfk3138/jiant/tree/6e67ff1ecb1bb98533c1019a86af4ad2c04c6a64
CeilModule
import torch class CeilModule(torch.nn.Module): def __init__(self): super(CeilModule, self).__init__() def forward(self, x): return torch.ceil(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
mirecta/nncase
CeilModule
false
4,172
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
AttFlowLayer
import torch import torch.nn as nn import torch.nn.functional as F class AttFlowLayer(nn.Module): def __init__(self, embed_length): super(AttFlowLayer, self).__init__() self.embed_length = embed_length self.alpha = nn.Linear(3 * embed_length, 1, bias=False) def forward(self, context,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
qtxcm/Joint_NER_with_NTP
AttFlowLayer
false
4,173
[ "Apache-2.0" ]
0
02f26f2cc891d36808b2e28f337cc4846524e5df
https://github.com/qtxcm/Joint_NER_with_NTP/tree/02f26f2cc891d36808b2e28f337cc4846524e5df
SqrtModule
import torch class SqrtModule(torch.nn.Module): def __init__(self): super(SqrtModule, self).__init__() def forward(self, x): return torch.sqrt(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
mirecta/nncase
SqrtModule
false
4,174
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
ReduceMaxModule
import torch class ReduceMaxModule(torch.nn.Module): def __init__(self): super(ReduceMaxModule, self).__init__() def forward(self, x): return torch.max(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
mirecta/nncase
ReduceMaxModule
false
4,175
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
NegModule
import torch class NegModule(torch.nn.Module): def __init__(self): super(NegModule, self).__init__() def forward(self, x): return -x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
mirecta/nncase
NegModule
false
4,176
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
FloorModule
import torch class FloorModule(torch.nn.Module): def __init__(self): super(FloorModule, self).__init__() def forward(self, x): return torch.floor(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
mirecta/nncase
FloorModule
false
4,177
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
ReduceMeanModule
import torch class ReduceMeanModule(torch.nn.Module): def __init__(self): super(ReduceMeanModule, self).__init__() def forward(self, x): return torch.mean(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
mirecta/nncase
ReduceMeanModule
false
4,178
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
ReduceMinModule
import torch class ReduceMinModule(torch.nn.Module): def __init__(self): super(ReduceMinModule, self).__init__() def forward(self, x): return torch.min(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
mirecta/nncase
ReduceMinModule
false
4,179
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
DenseSAGEConv
import math import torch import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class DenseSAGEConv(torch.nn.Module): """See :class:`torch_geometric...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 from torch.nn imp...
rbshi/pytorch_geometric
DenseSAGEConv
false
4,180
[ "MIT" ]
0
fcfbad49219974689eb5c6e32365939ae09ace84
https://github.com/rbshi/pytorch_geometric/tree/fcfbad49219974689eb5c6e32365939ae09ace84
ResizeModule
import torch class ResizeModule(torch.nn.Module): def __init__(self): super(ResizeModule, self).__init__() def forward(self, x): return torch.nn.functional.interpolate(x, size=(3, 4)) 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...
mirecta/nncase
ResizeModule
false
4,181
[ "Apache-2.0" ]
0
d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
https://github.com/mirecta/nncase/tree/d2efa59677a26f4259b3b6a5b6ec05ea16d4e40c
RMSELoss
import torch from torch import nn import torch.cuda class RMSELoss(nn.Module): def __init__(self, eps=1e-06): super().__init__() self.mse = nn.MSELoss() self.eps = eps def forward(self, yhat, y): loss = torch.sqrt(self.mse(yhat, y) + self.eps) return loss def get_in...
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 import ...
rgbayrak/multi-task-physio
RMSELoss
false
4,182
[ "MIT" ]
0
01ea98f26cc9b96ec94105d5213cb1ef93673c2c
https://github.com/rgbayrak/multi-task-physio/tree/01ea98f26cc9b96ec94105d5213cb1ef93673c2c
_ASPPModule
import torch import torch.nn as nn class _ASPPModule(nn.Module): """Atrous Spatial Pyramid Pooling""" def __init__(self, in_channels, out_channels, pyramids): super(_ASPPModule, self).__init__() self.stages = nn.Module() for i, (dilation, padding) in enumerate(zip(pyramids, pyramids))...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
reyuwei/deeplab-pytorch
_ASPPModule
false
4,183
[ "MIT" ]
0
f4e241c83be5f85f0f2e1be5d76160b8c2d7ec9a
https://github.com/reyuwei/deeplab-pytorch/tree/f4e241c83be5f85f0f2e1be5d76160b8c2d7ec9a
Net
import torch import torch.nn as nn class Net(nn.Module): def __init__(self, input_size): super(Net, self).__init__() hlayer1 = int(input_size * 10) hlayer2 = int(input_size * 10 / 2) self.fc1 = nn.Linear(input_size, hlayer1) self.relu1 = nn.ReLU() 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 assert_...
rcaborges/music-cold-start
Net
false
4,184
[ "Apache-2.0" ]
0
a2b321e8b5ef7b894b5e0659c5da2f9ae3df25d8
https://github.com/rcaborges/music-cold-start/tree/a2b321e8b5ef7b894b5e0659c5da2f9ae3df25d8
L2Loss
import torch import torch.nn as nn import torch.utils.data class L2Loss(nn.Module): """ Compute the l2 distance """ def __init__(self): super(L2Loss, self).__init__() def forward(self, h_pred, h_target): return torch.norm(h_target - h_pred, p=2) 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
riokt/video-paragraph
L2Loss
false
4,185
[ "MIT" ]
0
2da3298819e73809af495457db2cf1dfffad712f
https://github.com/riokt/video-paragraph/tree/2da3298819e73809af495457db2cf1dfffad712f
SNNBlock
from torch.nn import Module import math import torch from torch.nn import SELU from torch.nn import AlphaDropout from torch.nn import Identity from torch.nn import Parameter from torch.nn.functional import conv2d class SNNBlock(Module): """Block for a self-normalizing fully-connected layer. This block consis...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn impor...
rharish101/CIL-Project
SNNBlock
false
4,186
[ "MIT" ]
0
fed1be8b22bb4228329b719a301f74459a7bf13b
https://github.com/rharish101/CIL-Project/tree/fed1be8b22bb4228329b719a301f74459a7bf13b
FinalPool
import torch import torch.utils.data class FinalPool(torch.nn.Module): def __init__(self): super(FinalPool, self).__init__() def forward(self, input): """ input : Tensor of shape (batch size, T, Cin) Outputs a Tensor of shape (batch size, Cin). """ re...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride e...
praesc/end-to-end-SLU
FinalPool
false
4,187
[ "Apache-2.0" ]
0
c4e8a5be0ea6a8d93ea7cfd3a5bdab0560c50848
https://github.com/praesc/end-to-end-SLU/tree/c4e8a5be0ea6a8d93ea7cfd3a5bdab0560c50848
CAE_ENC
import torch import torch.nn as nn import torch.nn.functional as F class CAE_ENC(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 32, kernel_size=5, padding=2, stride=2) self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1, stride=2) self.conv3 = 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 import torch.nn as nn assert_...
positivevaib/semi-supervised-imagenet-classification
CAE_ENC
false
4,188
[ "MIT" ]
0
4fb6427f5a72951c1b866a1ddbc2599811bb5770
https://github.com/positivevaib/semi-supervised-imagenet-classification/tree/4fb6427f5a72951c1b866a1ddbc2599811bb5770
PSA_p
import torch import torch.nn as nn import torch._utils import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed def kaiming_init(module, a=0, mode='fan_out', nonlinearity='relu', bias=0, distribution='normal'): assert distribution in ['uniform', 'normal'] if ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
realphongha/human-pose-estimation.pytorch
PSA_p
false
4,189
[ "MIT" ]
0
29b106d3e6c6e12325a7d4bca4abc56ecbc12b1f
https://github.com/realphongha/human-pose-estimation.pytorch/tree/29b106d3e6c6e12325a7d4bca4abc56ecbc12b1f
ContrastiveLoss
from torch.nn import Module import torch from torch.nn import LogSoftmax from torch.nn.functional import cosine_similarity class ContrastiveLoss(Module): """A contrastive loss adapted from SimCLR. Link to SimCLR: https://arxiv.org/abs/2002.05709v3. """ def __init__(self, temperature: 'float'=1.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, math as tl_math from torch....
rharish101/CIL-Project
ContrastiveLoss
false
4,190
[ "MIT" ]
0
fed1be8b22bb4228329b719a301f74459a7bf13b
https://github.com/rharish101/CIL-Project/tree/fed1be8b22bb4228329b719a301f74459a7bf13b
FilterNorm
import torch import torch.nn as nn from torch.nn.init import calculate_gain import torch.nn.parallel class FilterNorm(nn.Module): def __init__(self, in_channels, kernel_size, filter_type, nonlinearity= 'linear', running_std=False, running_mean=False): assert filter_type in ('spatial', 'channel') ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.init import calculate_gain import torch.nn....
rightchose/ddfnet
FilterNorm
false
4,191
[ "MIT" ]
0
44a2f63933c1784a53f26a10c1157a164d044485
https://github.com/rightchose/ddfnet/tree/44a2f63933c1784a53f26a10c1157a164d044485
Actor
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ricklentz/deep-reinforcement-learning
Actor
false
4,192
[ "MIT" ]
0
4a034a955c64a630e0fd72f4380d81e2c25a4c68
https://github.com/ricklentz/deep-reinforcement-learning/tree/4a034a955c64a630e0fd72f4380d81e2c25a4c68
TransformerLayer
import math import torch import uuid from torch import Tensor from typing import Tuple import torch.nn as nn import torch.nn.functional as F from typing import Optional from typing import Dict from torch.nn import Parameter def gelu(x): """Implementation of the gelu activation function. For information: Open...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
qinwang-ai/Contact-Distil
TransformerLayer
false
4,193
[ "Apache-2.0" ]
0
5e98389de70e0d9c4d16bd91ca1326689dc220a6
https://github.com/qinwang-ai/Contact-Distil/tree/5e98389de70e0d9c4d16bd91ca1326689dc220a6
MLP
import torch import torch as th import torch.nn as nn class MLP(nn.Module): def __init__(self, input_size, output_size, hidden=128): super(MLP, self).__init__() self.linear1 = nn.Linear(input_size, hidden, bias=False) self.linear2 = nn.Linear(hidden, output_size, bias=False) def forw...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
ngoby/cherry
MLP
false
4,194
[ "Apache-2.0" ]
0
ec88bac03bf3ac3fae1010c5db8329db595dc5d6
https://github.com/ngoby/cherry/tree/ec88bac03bf3ac3fae1010c5db8329db595dc5d6
EncoderLayer
import math import torch import torch.nn.functional as F import torch.nn as nn def attention(q, k, v, d_k, mask=None, dropout=None): scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) if mask is not None: mask = mask.unsqueeze(1) scores = scores.masked_fill(mask == 0, -1000000000.0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
rcasero/Transformer
EncoderLayer
false
4,195
[ "Apache-2.0" ]
0
82f51e04f80634d56b134e0ac87f67d6ba8c736a
https://github.com/rcasero/Transformer/tree/82f51e04f80634d56b134e0ac87f67d6ba8c736a
ResidualBlock
import torch import torch.nn as nn import torch.nn.functional as F class ResidualBlock(nn.Module): """ Vanilla convolutional residual block from seminal paper by He et al. Use of instance normalization suggested by Ulyanov et al. in https://arxiv.org/pdf/1607.08022.pdf%C2%A0%C2%A0%C2%A0%C2%A0. ""...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
rileypsmith/Fast-Style-Transfer
ResidualBlock
false
4,196
[ "MIT" ]
0
8b2164f8bc6d63530f914610b6c5c5c1b0f4ffd5
https://github.com/rileypsmith/Fast-Style-Transfer/tree/8b2164f8bc6d63530f914610b6c5c5c1b0f4ffd5
RegL1
import torch import torch.nn as nn class RegL1(nn.Module): """ Run Regression with L1 """ def __init__(self, n_input, n_output): super(RegL1, self).__init__() self.linear = nn.Linear(n_input, n_output, bias=True) def forward(self, x, training=True): self.training = traini...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
rmporsch/ML_genetic_risk
RegL1
false
4,197
[ "MIT" ]
0
4e1a0510c94260e69f93639ff4104c5f85080d9f
https://github.com/rmporsch/ML_genetic_risk/tree/4e1a0510c94260e69f93639ff4104c5f85080d9f
DecoderRNN
import torch from torch import nn import torch.nn.functional as F class DecoderRNN(nn.Module): def __init__(self, T, d): super().__init__() self.T = T self.d = d self.W = nn.Linear(d, d) self.U = nn.Linear(d, d) self.V = nn.Linear(d, d) self.b = nn.Paramete...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
rish-16/SHA-RNN
DecoderRNN
false
4,198
[ "MIT" ]
0
08c701396217f0b645de043963ff8ec4bf27e835
https://github.com/rish-16/SHA-RNN/tree/08c701396217f0b645de043963ff8ec4bf27e835
SpatialAttention
import torch import torch.utils.data import torch import torch.nn as nn class SpatialAttention(nn.Module): def __init__(self): super(SpatialAttention, self).__init__() self.conv1 = nn.Conv2d(in_channels=2, out_channels=1, kernel_size=3, padding=1, bias=False) self.sigmoid = 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 import torch.utils.data impor...
robvincen/robot_gradet
SpatialAttention
false
4,199
[ "BSD-3-Clause" ]
0
a39e3c772c72806dfc99e4d24d8787e0d1bdeef5
https://github.com/robvincen/robot_gradet/tree/a39e3c772c72806dfc99e4d24d8787e0d1bdeef5
QNet
import torch import torch.nn as nn class QNet(nn.Module): def __init__(self, in_size: 'int', out_size: 'int'): super(QNet, self).__init__() self.fc1 = nn.Linear(in_size, 16) self.fc_out = nn.Linear(16, out_size) self.act = nn.LeakyReLU() def forward(self, x): o1 = sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
rosebin/gymlab
QNet
false
4,200
[ "BSD-3-Clause" ]
0
de97fc24e0ddf5e328a2aa732cc339b2371d92d1
https://github.com/rosebin/gymlab/tree/de97fc24e0ddf5e328a2aa732cc339b2371d92d1
L0Linear
import torch import numpy as np import torch.nn as nn from torch.nn import functional as F from torch.autograd import Variable import logging as lg def hard_sigmoid(x): """Hard Sigmoid function.""" return torch.min(torch.max(x, torch.zeros_like(x)), torch.ones_like(x)) class _L0Norm(nn.Module): """L0 no...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
rmporsch/ML_genetic_risk
L0Linear
false
4,201
[ "MIT" ]
0
4e1a0510c94260e69f93639ff4104c5f85080d9f
https://github.com/rmporsch/ML_genetic_risk/tree/4e1a0510c94260e69f93639ff4104c5f85080d9f
QNetwork
import torch import torch.nn.functional as F import torch.nn as nn class QNetwork(nn.Module): def __init__(self, state_size, action_size, seed): super(QNetwork, self).__init__() self.seed = torch.manual_seed(seed) self.fc1 = nn.Linear(state_size, 128) self.fc2 = nn.Linear(128, 64)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
royveshovda/deep-reinforcement-learning
QNetwork
false
4,202
[ "MIT" ]
0
64ba7ef5ab44f095b7e8b29f6c4ff1585025981a
https://github.com/royveshovda/deep-reinforcement-learning/tree/64ba7ef5ab44f095b7e8b29f6c4ff1585025981a
Discriminator
import torch import torch.nn as nn class Discriminator(nn.Module): def __init__(self, state_dim, action_dim): super(Discriminator, self).__init__() self.l1 = nn.Linear(state_dim + action_dim, 500) self.l2 = nn.Linear(500, 300) self.l3 = nn.Linear(300, 300) self.l4 = 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.triton_helpers import libdevice import torch.nn as ...
rortiz9/meleeml
Discriminator
false
4,203
[ "MIT" ]
0
9be4bf53a377dfb46dbb3b51f102f1bffc0124d2
https://github.com/rortiz9/meleeml/tree/9be4bf53a377dfb46dbb3b51f102f1bffc0124d2
RelationalTransformerEncoderLayer
import torch import warnings from torch import Tensor from torch.nn import TransformerEncoderLayer from torch.nn.functional import * from torch.nn.modules.activation import MultiheadAttention from torch.nn.modules.activation import xavier_uniform_ from torch.nn.modules.activation import xavier_normal_ from torch.nn.mod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
mfk3138/jiant
RelationalTransformerEncoderLayer
false
4,204
[ "MIT" ]
0
6e67ff1ecb1bb98533c1019a86af4ad2c04c6a64
https://github.com/mfk3138/jiant/tree/6e67ff1ecb1bb98533c1019a86af4ad2c04c6a64
LxmertAttentionOutput
from _paritybench_helpers import _mock_config import torch from torch import nn class LxmertAttentionOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=1e-12...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
rsgit95/med_kg_txt_multimodal
LxmertAttentionOutput
false
4,205
[ "Apache-2.0" ]
0
80355b0cf58e0571531ad6f9728c533110ca996d
https://github.com/rsgit95/med_kg_txt_multimodal/tree/80355b0cf58e0571531ad6f9728c533110ca996d
Block
import torch import torch as th from torch import nn def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is the same as the DropConnect impl I created for EfficientNet, etc networks, however, th...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
q5628077/Transformer-in-RL
Block
false
4,206
[ "MIT" ]
0
14679656779a372d91d9fbd89bd802b5ff34c200
https://github.com/q5628077/Transformer-in-RL/tree/14679656779a372d91d9fbd89bd802b5ff34c200
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, state_dim, action_dim): super(Net, self).__init__() fc1_dim = 32 fc2_dim = 64 fc3_dim = 128 self.fc1 = nn.Linear(state_dim, fc1_dim) self.fc2 = nn.Linear(fc1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ronekko/study_reinforcement_learning
Net
false
4,207
[ "MIT" ]
0
ef5201e3eae69c20f29b7f176b5a6de7ecdb856a
https://github.com/ronekko/study_reinforcement_learning/tree/ef5201e3eae69c20f29b7f176b5a6de7ecdb856a
IReLU
import math import torch class IReLU(torch.nn.Module): __constants__ = ['negative_slope', 'positive_slope'] negative_slope: 'float' positive_slope: 'float' def __init__(self, negative_slope=math.tan(math.pi / 8), positive_slope =math.tan(3 * math.pi / 8)): super(IReLU, self).__init__(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided...
rupumped/DFL
IReLU
false
4,208
[ "BSD-3-Clause" ]
0
a4e4d96b7ce7522cf7fee3c2cfdbb54eb7a473f2
https://github.com/rupumped/DFL/tree/a4e4d96b7ce7522cf7fee3c2cfdbb54eb7a473f2
Affine
import torch from torch import nn class Affine(nn.Module): def __init__(self, channel): super().__init__() self.g = nn.Parameter(torch.ones(1, 1, channel)) self.b = nn.Parameter(torch.zeros(1, 1, channel)) def forward(self, x): return x * self.g + self.b def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
rushirajsherlocked/External-Attention-pytorch
Affine
false
4,209
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
ECAAttention
import torch from torch import nn from torch.nn import init class ECAAttention(nn.Module): def __init__(self, kernel_size=3): super().__init__() self.gap = nn.AdaptiveAvgPool2d(1) self.conv = nn.Conv1d(1, 1, kernel_size=kernel_size, padding=( kernel_size - 1) // 2) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from torch.nn import init assert_size_stride = torch._C._dy...
rushirajsherlocked/External-Attention-pytorch
ECAAttention
false
4,210
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
GTXAttentionOutput
from _paritybench_helpers import _mock_config import torch from torch import nn class GTXAttentionOutput(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=1e-12) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
rsgit95/med_kg_txt_multimodal
GTXAttentionOutput
false
4,211
[ "Apache-2.0" ]
0
80355b0cf58e0571531ad6f9728c533110ca996d
https://github.com/rsgit95/med_kg_txt_multimodal/tree/80355b0cf58e0571531ad6f9728c533110ca996d
Actor
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, state_dim, action_dim): super(Actor, self).__init__() self.l1 = nn.Linear(state_dim, 400) self.l2 = nn.Linear(400, 200) self.l3 = nn.Linear(200, action_dim) def forwa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
rortiz9/meleeml
Actor
false
4,212
[ "MIT" ]
0
9be4bf53a377dfb46dbb3b51f102f1bffc0124d2
https://github.com/rortiz9/meleeml/tree/9be4bf53a377dfb46dbb3b51f102f1bffc0124d2
PolicyNetwork
import torch import torch.nn as nn from torch.nn import functional as F from torch.distributions import Normal class PolicyNetwork(nn.Module): def __init__(self, state_dim, action_dim, hidden_dim, init_w=0.003, log_std_min=-20, log_std_max=2): super(PolicyNetwork, self).__init__() self.lo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 from to...
rtharungowda/Soft-Actor-Critic-Pytorch
PolicyNetwork
false
4,213
[ "MIT" ]
0
0d2c20c6cfd4e578e0b7cff4525ddf0bc956812f
https://github.com/rtharungowda/Soft-Actor-Critic-Pytorch/tree/0d2c20c6cfd4e578e0b7cff4525ddf0bc956812f
Depth_Pointwise_Conv1d
import torch from torch import nn class Depth_Pointwise_Conv1d(nn.Module): def __init__(self, in_ch, out_ch, k): super().__init__() if k == 1: self.depth_conv = nn.Identity() else: self.depth_conv = nn.Conv1d(in_channels=in_ch, out_channels= in_ch, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
rushirajsherlocked/External-Attention-pytorch
Depth_Pointwise_Conv1d
false
4,214
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
ExternalAttention
import torch from torch import nn from torch.nn import init class ExternalAttention(nn.Module): def __init__(self, d_model, S=64): super().__init__() self.mk = nn.Linear(d_model, S, bias=False) self.mv = nn.Linear(S, d_model, bias=False) self.softmax = nn.Softmax(dim=1) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
rushirajsherlocked/External-Attention-pytorch
ExternalAttention
false
4,215
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
SpatialAttention
import torch from torch import nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super().__init__() self.conv = nn.Conv2d(2, 1, kernel_size=kernel_size, padding= kernel_size // 2) self.sigmoid = nn.Sigmoid() def forward(self, x): max_result,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
rushirajsherlocked/External-Attention-pytorch
SpatialAttention
false
4,216
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
GTXSelfAttentionLayer
from _paritybench_helpers import _mock_config import math import torch from torch import nn class GTXAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
rsgit95/med_kg_txt_multimodal
GTXSelfAttentionLayer
false
4,217
[ "Apache-2.0" ]
0
80355b0cf58e0571531ad6f9728c533110ca996d
https://github.com/rsgit95/med_kg_txt_multimodal/tree/80355b0cf58e0571531ad6f9728c533110ca996d
MlpBlock
import torch from torch import nn class MlpBlock(nn.Module): def __init__(self, input_dim, mlp_dim=512): super().__init__() self.fc1 = nn.Linear(input_dim, mlp_dim) self.gelu = nn.GELU() self.fc2 = nn.Linear(mlp_dim, input_dim) def forward(self, x): return self.fc2(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
rushirajsherlocked/External-Attention-pytorch
MlpBlock
false
4,218
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
LxmertCrossAttentionLayer
from _paritybench_helpers import _mock_config import math import torch from torch import nn class LxmertAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
rsgit95/med_kg_txt_multimodal
LxmertCrossAttentionLayer
false
4,219
[ "Apache-2.0" ]
0
80355b0cf58e0571531ad6f9728c533110ca996d
https://github.com/rsgit95/med_kg_txt_multimodal/tree/80355b0cf58e0571531ad6f9728c533110ca996d
GTXCrossAttentionLayer
from _paritybench_helpers import _mock_config import math import torch from torch import nn class GTXAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
rsgit95/med_kg_txt_multimodal
GTXCrossAttentionLayer
false
4,220
[ "Apache-2.0" ]
0
80355b0cf58e0571531ad6f9728c533110ca996d
https://github.com/rsgit95/med_kg_txt_multimodal/tree/80355b0cf58e0571531ad6f9728c533110ca996d
ConvEncoder
import torch from torch import nn class ConvEncoder(nn.Module): """ Simple convolutional encoder network. It consists of 5 convolutional layers, each downsampling the input by a factor of 2, and a final fully-connected layer projecting the output to c_dim dimensions. Args: c_dim (int): o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
planetceres/differentiable_volumetric_rendering
ConvEncoder
false
4,221
[ "MIT" ]
0
f2fe46d139244c7642439ced23656db1e7f5c128
https://github.com/planetceres/differentiable_volumetric_rendering/tree/f2fe46d139244c7642439ced23656db1e7f5c128
DoubleAttention
import torch from torch import nn from torch.nn import functional as F from torch.nn import init class DoubleAttention(nn.Module): def __init__(self, in_channels, c_m, c_n, reconstruct=True): super().__init__() self.in_channels = in_channels self.reconstruct = reconstruct self.c_m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
rushirajsherlocked/External-Attention-pytorch
DoubleAttention
false
4,222
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
LxmertSelfAttentionLayer
from _paritybench_helpers import _mock_config import math import torch from torch import nn class LxmertAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
rsgit95/med_kg_txt_multimodal
LxmertSelfAttentionLayer
false
4,223
[ "Apache-2.0" ]
0
80355b0cf58e0571531ad6f9728c533110ca996d
https://github.com/rsgit95/med_kg_txt_multimodal/tree/80355b0cf58e0571531ad6f9728c533110ca996d
SimplifiedScaledDotProductAttention
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :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....
rushirajsherlocked/External-Attention-pytorch
SimplifiedScaledDotProductAttention
false
4,224
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
SpatialGroupEnhance
import torch from torch import nn from torch.nn import init class SpatialGroupEnhance(nn.Module): def __init__(self, groups): super().__init__() self.groups = groups self.avg_pool = nn.AdaptiveAvgPool2d(1) self.weight = nn.Parameter(torch.zeros(1, groups, 1, 1)) self.bias ...
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 from torch.nn import init assert_size_stride = torch._C._d...
rushirajsherlocked/External-Attention-pytorch
SpatialGroupEnhance
false
4,225
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
ScaledDotProductAttention
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :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....
rushirajsherlocked/External-Attention-pytorch
ScaledDotProductAttention
false
4,226
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
AttentionHead
import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from torch.functional import Tensor def scaled_dot_product_attention(query: 'torch.Tensor', key: 'torch.Tensor', value: 'torch.Tensor') ->Tensor: temp = query.bmm(key.transpose(1, 2)) scale = query.size(-1) ** 0.5 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sabernn/vit-pytorch
AttentionHead
false
4,227
[ "MIT" ]
0
21a2671aa92adb941a56ae629f6089f550949fb2
https://github.com/sabernn/vit-pytorch/tree/21a2671aa92adb941a56ae629f6089f550949fb2
SE_Connect
import torch import torch.nn.functional as F import torch.nn import torch.nn as nn class SE_Connect(nn.Module): def __init__(self, channels, s=4): super().__init__() assert channels % s == 0, '{} % {} != 0'.format(channesl, s) self.linear1 = nn.Linear(channels, channels // s) 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 import torch....
qlindazm/asv-subtools
SE_Connect
false
4,228
[ "Apache-2.0" ]
0
fe1d31db9f3268622016babe944201f6ff81ed56
https://github.com/qlindazm/asv-subtools/tree/fe1d31db9f3268622016babe944201f6ff81ed56
AttentiveStatsPool
import torch import torch.nn import torch.nn as nn class AttentiveStatsPool(nn.Module): def __init__(self, in_dim, bottleneck_dim): super().__init__() self.linear1 = nn.Conv1d(in_dim, bottleneck_dim, kernel_size=1) self.linear2 = nn.Conv1d(bottleneck_dim, in_dim, kernel_size=1) def f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
qlindazm/asv-subtools
AttentiveStatsPool
false
4,229
[ "Apache-2.0" ]
0
fe1d31db9f3268622016babe944201f6ff81ed56
https://github.com/qlindazm/asv-subtools/tree/fe1d31db9f3268622016babe944201f6ff81ed56
OutlookAttention
import math import torch from torch import nn from torch.nn import functional as F class OutlookAttention(nn.Module): def __init__(self, dim, num_heads=1, kernel_size=3, padding=1, stride=1, qkv_bias=False, attn_drop=0.1): super().__init__() self.dim = dim self.num_heads = num_hea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
rushirajsherlocked/External-Attention-pytorch
OutlookAttention
false
4,230
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
Critic
import torch import torch.nn as nn class Critic(nn.Module): def __init__(self, obs_dim: 'int'): super().__init__() self.fc1 = nn.Linear(obs_dim, 64) self.fc2 = nn.Linear(64, 64) self.fc3 = nn.Linear(64, 1) def forward(self, x): x = torch.tanh(self.fc1(x)) 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.triton_helpers import libdevice import torch.nn as ...
raznem/rlex
Critic
false
4,231
[ "MIT" ]
0
d24b964d80067becc81d86f6ce87e5be413b7049
https://github.com/raznem/rlex/tree/d24b964d80067becc81d86f6ce87e5be413b7049
TdnnAffine
import torch import torch.nn.functional as F import torch.nn def to_device(device_object, tensor): """ Select device for non-parameters tensor w.r.t model or tensor which has been specified a device. """ if isinstance(device_object, torch.nn.Module): next(device_object.parameters()).device ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
qlindazm/asv-subtools
TdnnAffine
false
4,232
[ "Apache-2.0" ]
0
fe1d31db9f3268622016babe944201f6ff81ed56
https://github.com/qlindazm/asv-subtools/tree/fe1d31db9f3268622016babe944201f6ff81ed56
ChannelAttentionModule
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :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....
rushirajsherlocked/External-Attention-pytorch
ChannelAttentionModule
false
4,233
[ "MIT" ]
0
7d6814b2d90909adf81c62f3f8a89e30a59d6481
https://github.com/rushirajsherlocked/External-Attention-pytorch/tree/7d6814b2d90909adf81c62f3f8a89e30a59d6481
LDEPooling
import torch import torch.nn class LDEPooling(torch.nn.Module): """A novel learnable dictionary encoding layer. Reference: Weicheng Cai, etc., "A NOVEL LEARNABLE DICTIONARY ENCODING LAYER FOR END-TO-END LANGUAGE IDENTIFICATION", icassp, 2018 """ def __init__(self, input_dim, c_num=64,...
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 assert...
qlindazm/asv-subtools
LDEPooling
false
4,234
[ "Apache-2.0" ]
0
fe1d31db9f3268622016babe944201f6ff81ed56
https://github.com/qlindazm/asv-subtools/tree/fe1d31db9f3268622016babe944201f6ff81ed56