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
HighLightLayer
import torch import torch.nn.parallel import torch.nn as nn import torch.utils.data import torch.backends.cudnn def mask_logits(inputs, mask, mask_value=-1e+30): mask = mask.type(torch.float32) return inputs + (1.0 - mask) * mask_value class Conv1D(nn.Module): def __init__(self, in_dim, out_dim, kernel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.parallel import torch.nn as nn import torch.utils.data import to...
EGO4D/episodic-memory
HighLightLayer
false
8,084
[ "MIT" ]
27
2a3464882cd4f665c358c1b05a6397339e33c2e1
https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1
coff
import torch import torch.nn as nn from torch.nn.parameter import Parameter class coff(nn.Module): def __init__(self, input_dims, fill_val=1, nl=None): super(coff, self).__init__() self.k = Parameter(torch.Tensor(1, input_dims)) self.k.data.fill_(fill_val) self.nl = nn.Identity() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided...
Extreme-classification/ECLARE
coff
false
8,085
[ "MIT" ]
24
ca9f52842f2b5f45278eac50cd48c8b67bdfb4c5
https://github.com/Extreme-classification/ECLARE/tree/ca9f52842f2b5f45278eac50cd48c8b67bdfb4c5
UpsampleConvLayer
import torch from torch.optim import * import torch.nn as nn import torch.nn.functional as f class UpsampleConvLayer(nn.Module): """ Upsampling layer (bilinear interpolation + Conv2d) to increase spatial resolution (x2) in a decoder. Default: bias, ReLU, no downsampling, no batch norm. """ 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.optim import * imp...
EvilPerfectionist/ssl_e2vid
UpsampleConvLayer
false
8,086
[ "MIT" ]
24
84f7c7e59875f134e97c14ec423f396725e04be7
https://github.com/EvilPerfectionist/ssl_e2vid/tree/84f7c7e59875f134e97c14ec423f396725e04be7
EmbedComp
import torch import torch.nn as nn import torch.optim import torch.utils.data import torch.backends.cudnn class EmbedComp(nn.Module): def __init__(self, insize, outsize, md): super().__init__() self.fc1 = nn.Linear(insize, outsize) self.outsize = outsize self.md = md 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 import torch.nn as nn import torch.optim import torch.utils.data import torch.ba...
Divyanshu23/model-zoo
EmbedComp
false
8,087
[ "MIT" ]
43
2eea6df691d302e182bb1ff8ec5af3542de562ba
https://github.com/Divyanshu23/model-zoo/tree/2eea6df691d302e182bb1ff8ec5af3542de562ba
Hsigmoid
import torch from torch import nn import torch.nn.functional as F class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): return F.relu6(x + 3.0, inplace=self.inplace) / 6.0 def get_inputs(): ret...
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...
EricFH/SOR
Hsigmoid
false
8,088
[ "Apache-2.0" ]
14
d644469da16169dd269c6ecaac51b1762649e17a
https://github.com/EricFH/SOR/tree/d644469da16169dd269c6ecaac51b1762649e17a
custom_loss
import torch import torch.nn as nn import torch.optim import torch.utils.data import torch.backends.cudnn class custom_loss(nn.Module): def __init__(self): super(custom_loss, self).__init__() def forward(self, x): nc = x.size(1) assert nc % 2 == 0, 'channels do not divide 2!' ...
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 import torch.optim import torch.utils.data import torch.backends.cudnn assert_size_stride = torch._C._dynamo.guards.as...
Divyanshu23/model-zoo
custom_loss
false
8,089
[ "MIT" ]
43
2eea6df691d302e182bb1ff8ec5af3542de562ba
https://github.com/Divyanshu23/model-zoo/tree/2eea6df691d302e182bb1ff8ec5af3542de562ba
LayerNorm
import torch import torch.nn as nn import torch.utils.data class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(features)) self.beta = nn.Parameter(torch.zeros(features)) self.eps = eps 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dy...
FadedCosine/Dependency-Guided-Neural-Text-Generation
LayerNorm
false
8,090
[ "Apache-2.0" ]
19
600ad563ce240c7807f839f7eee5251616b9325b
https://github.com/FadedCosine/Dependency-Guided-Neural-Text-Generation/tree/600ad563ce240c7807f839f7eee5251616b9325b
feedforward
import math import torch import torch.nn as nn import torch.optim import torch.utils.data import torch.backends.cudnn def gelu(x): """Implementation of the gelu activation function by Hugging Face""" return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) class feedforward(nn.Module): def __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.triton_helpers import libdevice import math import ...
Divyanshu23/model-zoo
feedforward
false
8,091
[ "MIT" ]
43
2eea6df691d302e182bb1ff8ec5af3542de562ba
https://github.com/Divyanshu23/model-zoo/tree/2eea6df691d302e182bb1ff8ec5af3542de562ba
Message_Passing_Unit_v1
import torch import torch.nn as nn import torch.nn.functional as F class Message_Passing_Unit_v1(nn.Module): def __init__(self, fea_size, filter_size=128): super(Message_Passing_Unit_v1, self).__init__() self.w = nn.Linear(fea_size * 2, filter_size, bias=True) self.fea_size = fea_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_...
EricssonResearch/scott-eu
Message_Passing_Unit_v1
false
8,092
[ "Apache-2.0" ]
19
aad7fd2f767a3c5e7d89223a593fd979ad596db3
https://github.com/EricssonResearch/scott-eu/tree/aad7fd2f767a3c5e7d89223a593fd979ad596db3
SpaceToDepth
import torch from torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class SpaceToDepth(nn.Module): def __init__(self, block_size=4): super().__init__() assert block_size == 4 self.bs = block_size ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torchvision import datasets as datasets import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distr...
Alibaba-MIIL/ZS_SDL
SpaceToDepth
false
8,093
[ "MIT" ]
20
769fe4f57d2d458a7c4b5468a6395c9b296b1dad
https://github.com/Alibaba-MIIL/ZS_SDL/tree/769fe4f57d2d458a7c4b5468a6395c9b296b1dad
NaiveGroupNorm
from torch.nn import Module import torch from torch.nn import Parameter from torch.nn import init import torch.nn.parallel class NaiveGroupNorm(Module): """NaiveGroupNorm implements Group Normalization with the high-level matrix operations in PyTorch. It is a temporary solution to export GN by ONNX before the...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module from torch.nn import Parameter from torch.nn import...
Eurus-Holmes/CHABCNet
NaiveGroupNorm
false
8,094
[ "BSD-2-Clause" ]
11
8d3985c7680981e58751d043880b5b5a818cc1d3
https://github.com/Eurus-Holmes/CHABCNet/tree/8d3985c7680981e58751d043880b5b5a818cc1d3
CQAttention
import torch import torch.nn.parallel import torch.nn as nn import torch.utils.data import torch.backends.cudnn def mask_logits(inputs, mask, mask_value=-1e+30): mask = mask.type(torch.float32) return inputs + (1.0 - mask) * mask_value class Conv1D(nn.Module): def __init__(self, in_dim, out_dim, kernel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
EGO4D/episodic-memory
CQAttention
false
8,095
[ "MIT" ]
27
2a3464882cd4f665c358c1b05a6397339e33c2e1
https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1
ChannelNorm
import torch import torch.nn as nn class ChannelNorm(nn.Module): def __init__(self): super(ChannelNorm, self).__init__() def forward(self, x): divider = torch.max(torch.max(torch.abs(x), dim=0)[0], dim=1)[0 ] + 1e-05 divider = divider.unsqueeze(0).unsqueeze(2) div...
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 ...
Finspire13/RL-Surgical-Gesture-Segmentation
ChannelNorm
false
8,096
[ "MIT" ]
40
0cb166208f463cd36726f91d1ccaa25093736b47
https://github.com/Finspire13/RL-Surgical-Gesture-Segmentation/tree/0cb166208f463cd36726f91d1ccaa25093736b47
NSELoss
import torch class NSELoss(torch.nn.Module): """Calculate (batch-wise) NSE Loss. Each sample i is weighted by 1 / (std_i + eps)^2, where std_i is the standard deviation of the discharge from the basin, to which the sample belongs. Parameters: ----------- eps : float Constant, added ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
Flash-Of-Thunder/testing
NSELoss
false
8,097
[ "Apache-2.0" ]
18
36366e2cd32756fb07abc533ecbb7672a4738bc6
https://github.com/Flash-Of-Thunder/testing/tree/36366e2cd32756fb07abc533ecbb7672a4738bc6
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(LayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
FacePerceiver/FaRL
LayerNorm
false
8,098
[ "MIT" ]
23
38f1d32f4e63940fae524e9f501b88a947ec09cd
https://github.com/FacePerceiver/FaRL/tree/38f1d32f4e63940fae524e9f501b88a947ec09cd
Conv2dSWU
import torch import torch.utils.data import torch.nn as nn import torch class Conv2dSWU(nn.Module): def __init__(self, in_channels, out_channels, kernel_radius=2, bias=True): super(Conv2dSWU, self).__init__() kernel_size_h = 2 * kernel_radius - 1 self.padding = kernel_radius - 1 s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch assert_size_stride = ...
FVL2020/MSWSR
Conv2dSWU
false
8,099
[ "MIT" ]
27
0844e78ee68fb0465efd5c4a2215ce815980526b
https://github.com/FVL2020/MSWSR/tree/0844e78ee68fb0465efd5c4a2215ce815980526b
NAC
import torch from torch import nn class NAC(nn.Module): def __init__(self, in_dim, out_dim, init_fun=nn.init.xavier_uniform_): super().__init__() self._W_hat = nn.Parameter(torch.empty(in_dim, out_dim)) self._M_hat = nn.Parameter(torch.empty(in_dim, out_dim)) self.register_paramet...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
FlorianWilhelm/snalu.pytorch
NAC
false
8,100
[ "MIT" ]
24
6ce4b4b635e03f534117e3804b545fcaa4e4d56b
https://github.com/FlorianWilhelm/snalu.pytorch/tree/6ce4b4b635e03f534117e3804b545fcaa4e4d56b
GlobalAvgPool
import torch import torch as th from torch import nn class GlobalAvgPool(nn.Module): def __init__(self): super(GlobalAvgPool, self).__init__() def forward(self, x): return th.mean(x, dim=[-2, -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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Fork-for-Modify/VideoFeatureExtractor
GlobalAvgPool
false
8,101
[ "Apache-2.0" ]
15
a73bb5a575a318c2d71bc8dd2432c8941c35a77f
https://github.com/Fork-for-Modify/VideoFeatureExtractor/tree/a73bb5a575a318c2d71bc8dd2432c8941c35a77f
AttentionHead
import torch from torch import nn import torch.nn.functional as F class AttentionGRUCell(nn.Module): def __init__(self, input_size, hidden_size, num_embeddings, use_gru=False): super(AttentionGRUCell, self).__init__() self.i2h = nn.Linear(input_size, hidden_size, bias=False) self.h2h = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
DocYard-ai/UCR
AttentionHead
false
8,102
[ "Apache-2.0" ]
10
7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
https://github.com/DocYard-ai/UCR/tree/7618aa336f56e71d9fd8cdc2d591e3d138e3dc68
DWT
import torch import torch.nn as nn import torch.nn def dwt_init(x): x01 = x[:, :, 0::2, :] / 2 x02 = x[:, :, 1::2, :] / 2 x1 = x01[:, :, :, 0::2] x2 = x02[:, :, :, 0::2] x3 = x01[:, :, :, 1::2] x4 = x02[:, :, :, 1::2] x_LL = x1 + x2 + x3 + x4 x_HL = -x1 - x2 + x3 + x4 x_LH = -x1 + ...
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 import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo....
FanChiMao/HWMNet
DWT
false
8,103
[ "Apache-2.0" ]
13
3375f062a7304b06b545fc7eb430555d43cc4075
https://github.com/FanChiMao/HWMNet/tree/3375f062a7304b06b545fc7eb430555d43cc4075
Attention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, input_dim, feature_dim): super(Attention, self).__init__() self.feature_dim = feature_dim self.input_dim = input_dim weight = torch.zeros(self.feature_dim, self.feature_dim) nn.init.kaiming_u...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
ForoughA/CORGI
Attention
false
8,104
[ "MIT" ]
22
c28ecd0e0375569f9f05e94e6ae5b7a994caacf5
https://github.com/ForoughA/CORGI/tree/c28ecd0e0375569f9f05e94e6ae5b7a994caacf5
Downsample
import torch import torch.nn as nn class Downsample(nn.Module): def __init__(self, n_channels, with_conv=True): super(Downsample, self).__init__() self.with_conv = with_conv self.n_channels = n_channels self.conv = nn.Conv2d(self.n_channels, self.n_channels, 3, stride=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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
FengNiMa/pytorch_diffusion_model_celebahq
Downsample
false
8,105
[ "MIT" ]
17
b81e57453066e05d71feb8451bbff766df401386
https://github.com/FengNiMa/pytorch_diffusion_model_celebahq/tree/b81e57453066e05d71feb8451bbff766df401386
DQN
import torch import torch.nn.functional as F import torch.nn as nn class DQN(nn.Module): """Agent Model.""" def __init__(self, state_size, action_size, seed, layer1_units=64, layer2_units=64): """Initialize parameters and build model. Params ====== state_size (int): Dimension of ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
FranckNdame/drlkit
DQN
false
8,106
[ "MIT" ]
33
698f3c182036cc5eed68f2a05b53a3e3670146bf
https://github.com/FranckNdame/drlkit/tree/698f3c182036cc5eed68f2a05b53a3e3670146bf
Upsample
import torch import torch.nn as nn class Upsample(nn.Module): def __init__(self, n_channels, with_conv=True): super(Upsample, self).__init__() self.with_conv = with_conv self.n_channels = n_channels self.conv = nn.Conv2d(self.n_channels, self.n_channels, 3, stride=1, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
FengNiMa/pytorch_diffusion_model_celebahq
Upsample
false
8,107
[ "MIT" ]
17
b81e57453066e05d71feb8451bbff766df401386
https://github.com/FengNiMa/pytorch_diffusion_model_celebahq/tree/b81e57453066e05d71feb8451bbff766df401386
Conv2dSWL
import torch import torch.utils.data import torch.nn as nn import torch class Conv2dSWL(nn.Module): def __init__(self, in_channels, out_channels, kernel_radius=2, bias=True): super(Conv2dSWL, self).__init__() kernel_size_h = 2 * kernel_radius - 1 self.padding = kernel_radius - 1 s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch assert_size_stride = ...
FVL2020/MSWSR
Conv2dSWL
false
8,108
[ "MIT" ]
27
0844e78ee68fb0465efd5c4a2215ce815980526b
https://github.com/FVL2020/MSWSR/tree/0844e78ee68fb0465efd5c4a2215ce815980526b
Attention
import math import torch import torch.nn as nn import torch.optim import torch.utils.data import torch.backends.cudnn class Attention(nn.Module): def __init__(self, dim, heads, max_len): super().__init__() self.q_mat = nn.Linear(dim, dim) self.k_mat = nn.Linear(dim, dim) self.v_ma...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Divyanshu23/model-zoo
Attention
false
8,109
[ "MIT" ]
43
2eea6df691d302e182bb1ff8ec5af3542de562ba
https://github.com/Divyanshu23/model-zoo/tree/2eea6df691d302e182bb1ff8ec5af3542de562ba
SelfGating
import torch import torch as th from torch import nn class SelfGating(nn.Module): def __init__(self, input_dim): super(SelfGating, self).__init__() self.fc = nn.Linear(input_dim, input_dim) def forward(self, input_tensor): """Feature gating as used in S3D-G. """ spatiot...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
Fork-for-Modify/VideoFeatureExtractor
SelfGating
false
8,110
[ "Apache-2.0" ]
15
a73bb5a575a318c2d71bc8dd2432c8941c35a77f
https://github.com/Fork-for-Modify/VideoFeatureExtractor/tree/a73bb5a575a318c2d71bc8dd2432c8941c35a77f
FullyConnected2
import torch import torch.nn as nn class FullyConnected2(nn.Module): def __init__(self, hidden_size, output_size): super(FullyConnected2, self).__init__() self.lrelu = nn.LeakyReLU(0.1) self.linear_layer = nn.Linear(hidden_size, hidden_size, bias=True) self.linear_layer_1 = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Felix2048/SSM-VLN
FullyConnected2
false
8,111
[ "MIT" ]
27
25b9f98566d6e29d30e09aa8f96257f5935642d6
https://github.com/Felix2048/SSM-VLN/tree/25b9f98566d6e29d30e09aa8f96257f5935642d6
Conv2dSWD
import torch import torch.utils.data import torch.nn as nn import torch class Conv2dSWD(nn.Module): def __init__(self, in_channels, out_channels, kernel_radius=2, bias=True): super(Conv2dSWD, self).__init__() kernel_size_h = 2 * kernel_radius - 1 self.padding = kernel_radius - 1 s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch assert_size_stride = ...
FVL2020/MSWSR
Conv2dSWD
false
8,112
[ "MIT" ]
27
0844e78ee68fb0465efd5c4a2215ce815980526b
https://github.com/FVL2020/MSWSR/tree/0844e78ee68fb0465efd5c4a2215ce815980526b
Conv2dSWR
import torch import torch.utils.data import torch.nn as nn import torch class Conv2dSWR(nn.Module): def __init__(self, in_channels, out_channels, kernel_radius=2, bias=True): super(Conv2dSWR, self).__init__() kernel_size_h = 2 * kernel_radius - 1 self.padding = kernel_radius - 1 s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch assert_size_stride = ...
FVL2020/MSWSR
Conv2dSWR
false
8,113
[ "MIT" ]
27
0844e78ee68fb0465efd5c4a2215ce815980526b
https://github.com/FVL2020/MSWSR/tree/0844e78ee68fb0465efd5c4a2215ce815980526b
UpsampleBlock
import torch import torch.nn as nn import torch.optim import torch.utils.data import torch.backends.cudnn class UpsampleBlock(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(64, 256, 3, 1, 1) self.shuffle = nn.PixelShuffle(2) self.relu = nn.ReLU() 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 import torch.nn as nn import ...
Divyanshu23/model-zoo
UpsampleBlock
false
8,114
[ "MIT" ]
43
2eea6df691d302e182bb1ff8ec5af3542de562ba
https://github.com/Divyanshu23/model-zoo/tree/2eea6df691d302e182bb1ff8ec5af3542de562ba
EmbeddingModule
import torch import torch.nn as nn class EmbeddingModule(nn.Module): def __init__(self, input_dim, output_dim, dropout_rate): super(EmbeddingModule, self).__init__() self.dropout = nn.Dropout2d(p=dropout_rate) self.conv_1 = nn.Conv1d(input_dim, output_dim, 1) self.relu = nn.ReLU()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Finspire13/Towards-Unified-Surgical-Skill-Assessment
EmbeddingModule
false
8,115
[ "MIT" ]
13
2c398d4e93889135762e4a91fc4676bfb7706fb0
https://github.com/Finspire13/Towards-Unified-Surgical-Skill-Assessment/tree/2c398d4e93889135762e4a91fc4676bfb7706fb0
GCNLayer
import torch import torch.nn as nn class GCNLayer(nn.Module): def __init__(self, in_ft, out_ft, act='prelu', bias=True): super(GCNLayer, self).__init__() self.fc = nn.Linear(in_ft, out_ft, bias=False) self.act = nn.PReLU() if act == 'prelu' else nn.ReLU() if bias: 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 torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
GRAND-Lab/MERIT
GCNLayer
false
8,116
[ "MIT" ]
18
c1cc62056254b1ea2931eef47ccde1e717ff5afe
https://github.com/GRAND-Lab/MERIT/tree/c1cc62056254b1ea2931eef47ccde1e717ff5afe
MultiheadAttention
import math import torch import torch.nn as nn import torch.utils.data class MultiheadAttention(nn.Module): """ Multihead attention mechanism (dot attention) """ def __init__(self, num_hidden_k, dropout_p=0.1): """ :param num_hidden_k: dimension of hidden """ super(MultiheadAtten...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Francois-Aubet/AHGP
MultiheadAttention
false
8,117
[ "MIT" ]
19
3ecdd01d138f013ae8da196fbf3a71632aa2cd88
https://github.com/Francois-Aubet/AHGP/tree/3ecdd01d138f013ae8da196fbf3a71632aa2cd88
Critic
import torch import torch.nn.functional as F import torch.nn as nn class Critic(nn.Module): """ Neural Network for the Critic Model """ def __init__(self, state_size, action_size, seed=0, first_layer_units= 400, second_layer_units=300): """Initialize parameters and build model. Params ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn.functional as...
FranckNdame/drlkit
Critic
false
8,118
[ "MIT" ]
33
698f3c182036cc5eed68f2a05b53a3e3670146bf
https://github.com/FranckNdame/drlkit/tree/698f3c182036cc5eed68f2a05b53a3e3670146bf
Gaussian_Kernel_Function
import torch from torch import nn class Gaussian_Kernel_Function(nn.Module): def __init__(self, std): super(Gaussian_Kernel_Function, self).__init__() self.sigma = std ** 2 def forward(self, fa, fb): asize = fa.size() bsize = fb.size() fa1 = fa.view(-1, 1, asize[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, math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.gua...
FupingWu90/VarDA
Gaussian_Kernel_Function
false
8,119
[ "MIT" ]
14
cfea269a4f608128bb5b13a778619b17d7123bfa
https://github.com/FupingWu90/VarDA/tree/cfea269a4f608128bb5b13a778619b17d7123bfa
FullyConnected
import torch import torch.nn as nn class FullyConnected(nn.Module): def __init__(self, hidden_size, output_size, bias=False): super(FullyConnected, self).__init__() self.lrelu = nn.LeakyReLU(0.1) self.linear_layer = nn.Linear(hidden_size, output_size, bias=bias) def forward(self, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Felix2048/SSM-VLN
FullyConnected
false
8,120
[ "MIT" ]
27
25b9f98566d6e29d30e09aa8f96257f5935642d6
https://github.com/Felix2048/SSM-VLN/tree/25b9f98566d6e29d30e09aa8f96257f5935642d6
MultiHeadAttentionBlock
import math import torch import torch.nn.parallel import torch.nn as nn import torch.utils.data import torch.backends.cudnn def mask_logits(inputs, mask, mask_value=-1e+30): mask = mask.type(torch.float32) return inputs + (1.0 - mask) * mask_value class Conv1D(nn.Module): def __init__(self, in_dim, out...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
EGO4D/episodic-memory
MultiHeadAttentionBlock
false
8,121
[ "MIT" ]
27
2a3464882cd4f665c358c1b05a6397339e33c2e1
https://github.com/EGO4D/episodic-memory/tree/2a3464882cd4f665c358c1b05a6397339e33c2e1
DilatedResidualLayer
import torch import torch.nn as nn import torch.nn.functional as F class DilatedResidualLayer(nn.Module): def __init__(self, dilation, input_dim, output_dim): super(DilatedResidualLayer, self).__init__() self.conv_dilated = nn.Conv1d(input_dim, output_dim, 3, padding= dilation, dilati...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Finspire13/Towards-Unified-Surgical-Skill-Assessment
DilatedResidualLayer
false
8,122
[ "MIT" ]
13
2c398d4e93889135762e4a91fc4676bfb7706fb0
https://github.com/Finspire13/Towards-Unified-Surgical-Skill-Assessment/tree/2c398d4e93889135762e4a91fc4676bfb7706fb0
Attention
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Linear(nn.Module): """ Linear Module """ def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): """ :param in_dim: dimension of input :param out_dim: dimension of output ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Francois-Aubet/AHGP
Attention
false
8,123
[ "MIT" ]
19
3ecdd01d138f013ae8da196fbf3a71632aa2cd88
https://github.com/Francois-Aubet/AHGP/tree/3ecdd01d138f013ae8da196fbf3a71632aa2cd88
Decoder3
import torch import torch.nn as nn class Decoder3(nn.Module): def __init__(self, model=None, fixed=False): super(Decoder3, self).__init__() self.fixed = fixed self.conv31 = nn.Conv2d(256, 128, 3, 1, 0) self.conv22 = nn.Conv2d(128, 128, 3, 1, 0) self.conv21 = nn.Conv2d(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....
EndyWon/Texture-Reformer
Decoder3
false
8,124
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
GCN
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel class Conv2D(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', stride=1, dilation=1, groups=1): super(Conv2D, self).__init__() assert type(kernel_size) in [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 import nn import torch.nn.functional as F import torch.nn.parallel as...
Eurus-Holmes/CHABCNet
GCN
false
8,125
[ "BSD-2-Clause" ]
11
8d3985c7680981e58751d043880b5b5a818cc1d3
https://github.com/Eurus-Holmes/CHABCNet/tree/8d3985c7680981e58751d043880b5b5a818cc1d3
LandmarkHead
import torch import torch.nn as nn from itertools import product as product class LandmarkHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(LandmarkHead, self).__init__() self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 10, kernel_size= (1, 1), stride=1, padd...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from itertools import product as product assert_size_strid...
FacePerceiver/facer
LandmarkHead
false
8,126
[ "MIT" ]
12
cbb01dc457f3713050e89af7b2c9c0d98663842c
https://github.com/FacePerceiver/facer/tree/cbb01dc457f3713050e89af7b2c9c0d98663842c
LastLevelMaxPool
import torch import torch.utils.data from torchvision.transforms import functional as F from torch import nn import torch.nn.functional as F class LastLevelMaxPool(nn.Module): def forward(self, x): return [F.max_pool2d(x, 1, 2, 0)] def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_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 import torch.utils.data from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
Bhaskers-Blu-Org2/arcticseals
LastLevelMaxPool
false
8,127
[ "MIT" ]
16
9e2629ca0ce7aadbe63118f39ff2da757d5dbc33
https://github.com/Bhaskers-Blu-Org2/arcticseals/tree/9e2629ca0ce7aadbe63118f39ff2da757d5dbc33
ResidualBlockNoBN
import torch import torch.utils.data from torch.utils import data as data import torch.nn as nn from torch.nn import init as init from torch.nn.modules.batchnorm import _BatchNorm from torchvision.models import vgg as vgg from torch import autograd as autograd @torch.no_grad() def default_init_weights(module_list, sc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 from ...
BCV-Uniandes/RSR
ResidualBlockNoBN
false
8,128
[ "zlib-acknowledgement" ]
14
dad60eedd3560f2655e3d1ed444153ed2616af2e
https://github.com/BCV-Uniandes/RSR/tree/dad60eedd3560f2655e3d1ed444153ed2616af2e
ResidualDenseBlock
import torch import torch.utils.data from torch.utils import data as data import torch.nn as nn from torch.nn import init as init from torch.nn.modules.batchnorm import _BatchNorm from torchvision.models import vgg as vgg from torch import autograd as autograd @torch.no_grad() def default_init_weights(module_list, sc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torch.utils import data as data import torch.nn as ...
BCV-Uniandes/RSR
ResidualDenseBlock
false
8,129
[ "zlib-acknowledgement" ]
14
dad60eedd3560f2655e3d1ed444153ed2616af2e
https://github.com/BCV-Uniandes/RSR/tree/dad60eedd3560f2655e3d1ed444153ed2616af2e
AttentionPool2d
import torch import torch.nn as nn import torch.nn.functional as F class AttentionPool2d(nn.Module): def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads: 'int', output_dim: 'int'=None): super().__init__() self.positional_embedding = nn.Parameter(torch.randn(spacial_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....
FacePerceiver/FaRL
AttentionPool2d
false
8,130
[ "MIT" ]
23
38f1d32f4e63940fae524e9f501b88a947ec09cd
https://github.com/FacePerceiver/FaRL/tree/38f1d32f4e63940fae524e9f501b88a947ec09cd
BboxHead
import torch import torch.nn as nn from itertools import product as product class BboxHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(BboxHead, self).__init__() self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=( 1, 1), stride=1, padding=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 import torch.nn as nn from itertools import product as product assert_size_strid...
FacePerceiver/facer
BboxHead
false
8,131
[ "MIT" ]
12
cbb01dc457f3713050e89af7b2c9c0d98663842c
https://github.com/FacePerceiver/facer/tree/cbb01dc457f3713050e89af7b2c9c0d98663842c
AttentionLayer
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Linear(nn.Module): """ Linear Module """ def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): """ :param in_dim: dimension of input :param out_dim: dimension of output ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Francois-Aubet/AHGP
AttentionLayer
false
8,132
[ "MIT" ]
19
3ecdd01d138f013ae8da196fbf3a71632aa2cd88
https://github.com/Francois-Aubet/AHGP/tree/3ecdd01d138f013ae8da196fbf3a71632aa2cd88
Decoder2
import torch import torch.nn as nn class Decoder2(nn.Module): def __init__(self, model=None, fixed=False): super(Decoder2, self).__init__() self.fixed = fixed self.conv21 = nn.Conv2d(128, 64, 3, 1, 0) self.conv12 = nn.Conv2d(64, 64, 3, 1, 0, dilation=1) self.conv11 = nn.Co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
EndyWon/Texture-Reformer
Decoder2
false
8,133
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
SelfAttAggregate
import math import torch import torch.nn as nn class SelfAttAggregate(torch.nn.Module): def __init__(self, agg_dim): super(SelfAttAggregate, self).__init__() self.agg_dim = agg_dim self.weight = nn.Parameter(torch.Tensor(agg_dim, 1)) self.softmax = nn.Softmax(dim=-1) torch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
GIST-railab/UString
SelfAttAggregate
false
8,134
[ "MIT" ]
30
490a6b0b29fbf434e094717fe272f78bc5d34956
https://github.com/GIST-railab/UString/tree/490a6b0b29fbf434e094717fe272f78bc5d34956
GRU2D
import math import torch from torch import nn class GRU2D(nn.Module): """2D GRU Cell""" def __init__(self, in_dim, hidden_dim, bias=True): super(GRU2D, self).__init__() self.x_to_intermediate = nn.Linear(in_dim, 3 * hidden_dim, bias=bias) self.h_to_intermediate = nn.Linear(in_dim, 3 *...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
GSK-AI/meta-learning-qsar
GRU2D
false
8,135
[ "MIT" ]
20
e0fcad57a5616b4828d9b14d18cfb2dc4c8eba89
https://github.com/GSK-AI/meta-learning-qsar/tree/e0fcad57a5616b4828d9b14d18cfb2dc4c8eba89
AccidentPredictor
import torch import torch.nn as nn import torch.nn.functional as F class AccidentPredictor(nn.Module): def __init__(self, input_dim, output_dim=2, act=torch.relu, dropout=[0, 0] ): super(AccidentPredictor, self).__init__() self.act = act self.dropout = dropout self.dense1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
GIST-railab/UString
AccidentPredictor
false
8,136
[ "MIT" ]
30
490a6b0b29fbf434e094717fe272f78bc5d34956
https://github.com/GIST-railab/UString/tree/490a6b0b29fbf434e094717fe272f78bc5d34956
Actor
import torch import torch.nn.functional as F import torch.nn as nn class Actor(nn.Module): """ Neural Network for the Actor Model """ def __init__(self, state_size, action_size, max_action, seed=0, layer1_units=400, layer2_units=300): """Initialize parameters and build model. Params =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
FranckNdame/drlkit
Actor
false
8,137
[ "MIT" ]
33
698f3c182036cc5eed68f2a05b53a3e3670146bf
https://github.com/FranckNdame/drlkit/tree/698f3c182036cc5eed68f2a05b53a3e3670146bf
PairwiseBCELoss
import torch import torch.nn as nn import torch.nn.functional as F from abc import abstractmethod import torch.utils.data.dataloader import torch.nn class SimilarityLoss(nn.Module): def __init__(self): super(SimilarityLoss, self).__init__() @abstractmethod def forward(self, inputs, targets): ...
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...
GT-SALT/LADA
PairwiseBCELoss
false
8,138
[ "MIT" ]
31
2838a4c90694bf1054c6bab7f3b60ab5e04a5d4d
https://github.com/GT-SALT/LADA/tree/2838a4c90694bf1054c6bab7f3b60ab5e04a5d4d
RankingLoss
import torch import torch.nn as nn import torch.nn.functional as F from abc import abstractmethod import torch.utils.data.dataloader import torch.nn class SimilarityLoss(nn.Module): def __init__(self): super(SimilarityLoss, self).__init__() @abstractmethod def forward(self, inputs, targets): ...
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 from abc import abstractmethod import torch.utils.data.dataloader i...
GT-SALT/LADA
RankingLoss
false
8,139
[ "MIT" ]
31
2838a4c90694bf1054c6bab7f3b60ab5e04a5d4d
https://github.com/GT-SALT/LADA/tree/2838a4c90694bf1054c6bab7f3b60ab5e04a5d4d
SmallDecoder1_16x
import torch import torch.nn as nn class SmallDecoder1_16x(nn.Module): def __init__(self, model=None, fixed=False): super(SmallDecoder1_16x, self).__init__() self.fixed = fixed self.conv11 = nn.Conv2d(24, 3, 3, 1, 0, dilation=1) self.relu = nn.ReLU(inplace=True) self.pad =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EndyWon/Texture-Reformer
SmallDecoder1_16x
false
8,140
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
Encoder2
import torch import torch.nn as nn class Encoder2(nn.Module): def __init__(self, model=None, fixed=False): super(Encoder2, self).__init__() self.fixed = fixed self.conv0 = nn.Conv2d(3, 3, 1, 1, 0) self.conv11 = nn.Conv2d(3, 64, 3, 1, 0, dilation=1) self.conv12 = nn.Conv2d(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
EndyWon/Texture-Reformer
Encoder2
false
8,141
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
NonpositiveLinear
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class NonpositiveLinear(nn.Linear): def reset_parameters(self): nn.init.xavier_uniform_(self.weight) self.weight.data.abs_() self.weight.data.mul_(-1.0) if self.bias is not None: fan_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
GlenHGHUANG/STRODE
NonpositiveLinear
false
8,142
[ "MIT" ]
11
91565275dffd4f08738c8a0e5b6c9ad89344623e
https://github.com/GlenHGHUANG/STRODE/tree/91565275dffd4f08738c8a0e5b6c9ad89344623e
ClassHead
import torch import torch.nn as nn from itertools import product as product class ClassHead(nn.Module): def __init__(self, inchannels=512, num_anchors=3): super(ClassHead, self).__init__() self.num_anchors = num_anchors self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 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 import torch.nn as nn from itertools import product as product assert_size_strid...
FacePerceiver/facer
ClassHead
false
8,143
[ "MIT" ]
12
cbb01dc457f3713050e89af7b2c9c0d98663842c
https://github.com/FacePerceiver/facer/tree/cbb01dc457f3713050e89af7b2c9c0d98663842c
Encoder1
import torch import torch.nn as nn class Encoder1(nn.Module): def __init__(self, model=None, fixed=False): super(Encoder1, self).__init__() self.fixed = fixed self.conv0 = nn.Conv2d(3, 3, 1, 1, 0) self.conv11 = nn.Conv2d(3, 64, 3, 1, 0, dilation=1) self.relu = nn.ReLU(inpl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EndyWon/Texture-Reformer
Encoder1
false
8,144
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
SmallDecoder2_16x
import torch import torch.nn as nn class SmallDecoder2_16x(nn.Module): def __init__(self, model=None, fixed=False): super(SmallDecoder2_16x, self).__init__() self.fixed = fixed self.conv21 = nn.Conv2d(32, 16, 3, 1, 0) self.conv12 = nn.Conv2d(16, 16, 3, 1, 0, dilation=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....
EndyWon/Texture-Reformer
SmallDecoder2_16x
false
8,145
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
CRF
import torch import torch.nn as nn class CRF(nn.Module): """ Implements Conditional Random Fields that can be trained via backpropagation. """ def __init__(self, num_tags): super(CRF, self).__init__() self.num_tags = num_tags self.transitions = nn.Parameter(torch.Tensor(nu...
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...
Franck-Dernoncourt/meta_cross_nlu_qa
CRF
false
8,146
[ "MIT" ]
14
98f0af07988f24d9c7827030765246c6f67a0f4d
https://github.com/Franck-Dernoncourt/meta_cross_nlu_qa/tree/98f0af07988f24d9c7827030765246c6f67a0f4d
Model
import torch from typing import Tuple import torch.nn as nn class LSTM(nn.Module): """Implementation of the standard LSTM. TODO: Include ref and LaTeX equations Parameters ---------- input_size : int Number of input features hidden_size : int Number of hidden/memory cells. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from typing import ...
Flash-Of-Thunder/testing
Model
false
8,147
[ "Apache-2.0" ]
18
36366e2cd32756fb07abc533ecbb7672a4738bc6
https://github.com/Flash-Of-Thunder/testing/tree/36366e2cd32756fb07abc533ecbb7672a4738bc6
SmallDecoder3_16x
import torch import torch.nn as nn class SmallDecoder3_16x(nn.Module): def __init__(self, model=None, fixed=False): super(SmallDecoder3_16x, self).__init__() self.fixed = fixed self.conv31 = nn.Conv2d(64, 32, 3, 1, 0) self.conv22 = nn.Conv2d(32, 32, 3, 1, 0) self.conv21 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EndyWon/Texture-Reformer
SmallDecoder3_16x
false
8,148
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): """ Layer Normalization (https://arxiv.org/abs/1607.06450) """ def __init__(self, normalized_shape, eps=1e-05): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(normalized_shape)) self.bet...
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_...
GMDennis/claf
LayerNorm
false
8,149
[ "MIT" ]
10
d1e064e593127e5d654f000f5506c5ae1caab5ce
https://github.com/GMDennis/claf/tree/d1e064e593127e5d654f000f5506c5ae1caab5ce
GeLU
import torch from torch import nn import torch.jit import torch.nn.functional import torch.nn from torch.nn.functional import gelu class GeLU(nn.Module): def forward(self, x): return gelu(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 from torch import nn import torch.jit import torch.nn.functional import torch.n...
Gitsamshi/nnUNet-1
GeLU
false
8,150
[ "Apache-2.0" ]
28
5341684211e6d91dab6ad76a7595a95addff23be
https://github.com/Gitsamshi/nnUNet-1/tree/5341684211e6d91dab6ad76a7595a95addff23be
PositionwiseFeedForward
import torch import torch.nn as nn import torch.nn.functional as F class PointwiseConv(nn.Module): """ Pointwise Convolution (1x1 Conv) Convolution 1 Dimension (Faster version) (cf. https://github.com/huggingface/pytorch-openai-transformer-lm/blob/ eafc28abdfadfa0732f03a0fc65805c5bfb2ffe7/mode...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
GMDennis/claf
PositionwiseFeedForward
false
8,151
[ "MIT" ]
10
d1e064e593127e5d654f000f5506c5ae1caab5ce
https://github.com/GMDennis/claf/tree/d1e064e593127e5d654f000f5506c5ae1caab5ce
Decoder1
import torch import torch.nn as nn class Decoder1(nn.Module): def __init__(self, model=None, fixed=False): super(Decoder1, self).__init__() self.fixed = fixed self.conv11 = nn.Conv2d(64, 3, 3, 1, 0, dilation=1) self.relu = nn.ReLU(inplace=True) self.unpool = nn.UpsamplingN...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EndyWon/Texture-Reformer
Decoder1
false
8,152
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
SeqAttnMatch
import torch import torch.nn as nn import torch.nn.functional as F class SeqAttnMatch(nn.Module): """ Given sequences X and Y, match sequence Y to each element in X. * o_i = sum(alpha_j * y_j) for i in X * alpha_j = softmax(y_j * x_i) """ def __init__(self, embed_dim, identity=False): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
GMDennis/claf
SeqAttnMatch
false
8,153
[ "MIT" ]
10
d1e064e593127e5d654f000f5506c5ae1caab5ce
https://github.com/GMDennis/claf/tree/d1e064e593127e5d654f000f5506c5ae1caab5ce
NonnegativeLinear
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class NonnegativeLinear(nn.Linear): def reset_parameters(self): nn.init.xavier_uniform_(self.weight) self.weight.data.abs_() if self.bias is not None: fan_in, _ = nn.init._calculate_fan_in_an...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
GlenHGHUANG/STRODE
NonnegativeLinear
false
8,155
[ "MIT" ]
11
91565275dffd4f08738c8a0e5b6c9ad89344623e
https://github.com/GlenHGHUANG/STRODE/tree/91565275dffd4f08738c8a0e5b6c9ad89344623e
TimeEncoding
import torch from torch import nn class TimeEncoding(nn.Module): def __init__(self, d_model, dropout=0.1, max_len=5000): super(TimeEncoding, self).__init__() self.dropout = nn.Dropout(p=dropout) def forward(self, x, mask, lengths): time = mask * 1 / (lengths[..., None] - 1) t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GuyTevet/MotionCLIP
TimeEncoding
false
8,156
[ "MIT" ]
45
c2b9f40b0e721e42981f3e8b58133a1c51fde715
https://github.com/GuyTevet/MotionCLIP/tree/c2b9f40b0e721e42981f3e8b58133a1c51fde715
Encoder3
import torch import torch.nn as nn class Encoder3(nn.Module): def __init__(self, model=None, fixed=False): super(Encoder3, self).__init__() self.fixed = fixed self.conv0 = nn.Conv2d(3, 3, 1, 1, 0) self.conv11 = nn.Conv2d(3, 64, 3, 1, 0) self.conv12 = nn.Conv2d(64, 64, 3, 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....
EndyWon/Texture-Reformer
Encoder3
false
8,158
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
LSTM
import torch from typing import Tuple import torch.nn as nn class LSTM(nn.Module): """Implementation of the standard LSTM. TODO: Include ref and LaTeX equations Parameters ---------- input_size : int Number of input features hidden_size : int Number of hidden/memory cells. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Flash-Of-Thunder/testing
LSTM
false
8,159
[ "Apache-2.0" ]
18
36366e2cd32756fb07abc533ecbb7672a4738bc6
https://github.com/Flash-Of-Thunder/testing/tree/36366e2cd32756fb07abc533ecbb7672a4738bc6
TVLoss
import torch import torch.utils.data import torch.nn as nn class TVLoss(nn.Module): def __init__(self): super(TVLoss, self).__init__() def forward(self, x): x.size()[0] h_x = x.size()[2] w_x = x.size()[3] self._tensor_size(x[:, :, 1:, :]) self._tensor_size(x[:...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
GuoShi28/GCP-Net
TVLoss
false
8,160
[ "Apache-2.0" ]
24
cef7513fa242343055af64e612429e4384d3c1d7
https://github.com/GuoShi28/GCP-Net/tree/cef7513fa242343055af64e612429e4384d3c1d7
SmallDecoder4_16x
import torch import torch.nn as nn class SmallDecoder4_16x(nn.Module): def __init__(self, model=None, fixed=False): super(SmallDecoder4_16x, self).__init__() self.fixed = fixed self.conv41 = nn.Conv2d(128, 64, 3, 1, 0) self.conv34 = nn.Conv2d(64, 64, 3, 1, 0) self.conv33 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EndyWon/Texture-Reformer
SmallDecoder4_16x
false
8,161
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
CharbonnierLoss
import torch import torch.utils.data import torch.nn as nn class CharbonnierLoss(nn.Module): """Charbonnier Loss (L1)""" def __init__(self, eps=1e-06): super(CharbonnierLoss, self).__init__() self.eps = eps def forward(self, x, y): diff = x - y loss = torch.sum(torch.sqrt...
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...
GuoShi28/GCP-Net
CharbonnierLoss
false
8,162
[ "Apache-2.0" ]
24
cef7513fa242343055af64e612429e4384d3c1d7
https://github.com/GuoShi28/GCP-Net/tree/cef7513fa242343055af64e612429e4384d3c1d7
SmallDecoder5_16x
import torch import torch.nn as nn class SmallDecoder5_16x(nn.Module): def __init__(self, model=None, fixed=False): super(SmallDecoder5_16x, self).__init__() self.fixed = fixed self.conv51 = nn.Conv2d(128, 128, 3, 1, 0) self.conv44 = nn.Conv2d(128, 128, 3, 1, 0) self.conv4...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EndyWon/Texture-Reformer
SmallDecoder5_16x
false
8,163
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
SageLayer
import torch import torch.nn as nn import torch.nn.functional as F class SageLayer(nn.Module): """ Encodes a node's using 'convolutional' GraphSage approach """ def __init__(self, input_size, out_size): super(SageLayer, self).__init__() self.input_size = input_size self.out_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
HKUST-KnowComp/CSKB-Population
SageLayer
false
8,164
[ "MIT" ]
13
7b1b2d25fbd0095b0cf009b933cfd5a62feadd58
https://github.com/HKUST-KnowComp/CSKB-Population/tree/7b1b2d25fbd0095b0cf009b933cfd5a62feadd58
Decoder4
import torch import torch.nn as nn class Decoder4(nn.Module): def __init__(self, model=None, fixed=False): super(Decoder4, self).__init__() self.fixed = fixed self.conv41 = nn.Conv2d(512, 256, 3, 1, 0) self.conv34 = nn.Conv2d(256, 256, 3, 1, 0) self.conv33 = nn.Conv2d(256,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EndyWon/Texture-Reformer
Decoder4
false
8,165
[ "MIT" ]
11
f84f95accb3574c7b759a7f03c0b0b4e150314b5
https://github.com/EndyWon/Texture-Reformer/tree/f84f95accb3574c7b759a7f03c0b0b4e150314b5
GlobalAttention
import torch import torch.nn as nn import torch.nn.functional as F def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same value: ' + str(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
GT-SALT/Disfluency-Generation-and-Detection
GlobalAttention
false
8,166
[ "MIT" ]
11
72126172b466aa74277f3cf0f73b915e5dbeefbb
https://github.com/GT-SALT/Disfluency-Generation-and-Detection/tree/72126172b466aa74277f3cf0f73b915e5dbeefbb
MultiHeadedAttention
import math import torch from torch import Tensor from torch import nn class MultiHeadedAttention(nn.Module): """ Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py """ def __init__(self, num_heads: '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....
GuyTevet/MotionCLIP
MultiHeadedAttention
false
8,167
[ "MIT" ]
45
c2b9f40b0e721e42981f3e8b58133a1c51fde715
https://github.com/GuyTevet/MotionCLIP/tree/c2b9f40b0e721e42981f3e8b58133a1c51fde715
AttenHead
import math import torch from torch.nn import functional as F from torch import nn class AttenHead(nn.Module): def __init__(self, fdim, num_heads=1): super().__init__() self.num_heads = num_heads self.fatt = fdim // num_heads for i in range(num_heads): setattr(self, 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....
GT-RIPL/FeatMatch
AttenHead
false
8,168
[ "MIT" ]
41
03e16af82d8c94f7bbbbf5eab1334dc1fc9b93cb
https://github.com/GT-RIPL/FeatMatch/tree/03e16af82d8c94f7bbbbf5eab1334dc1fc9b93cb
PartialBCELoss
import torch class PartialBCELoss(torch.nn.Module): def __init__(self): super(PartialBCELoss, self).__init__() self.log_sigmoid = torch.nn.LogSigmoid() def forward(self, logits, targets, targets_mask, weights=None): pos_vals = -targets * self.log_sigmoid(logits) neg_vals = -s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math assert_size...
HKUST-KnowComp/MLMET
PartialBCELoss
false
8,169
[ "MIT" ]
10
ae1188a929a5ca6a8e087bb091853b328ea2c7e7
https://github.com/HKUST-KnowComp/MLMET/tree/ae1188a929a5ca6a8e087bb091853b328ea2c7e7
Gaussian_Distance
import torch from torch import nn class Gaussian_Distance(nn.Module): def __init__(self, kern=1): super(Gaussian_Distance, self).__init__() self.kern = kern self.avgpool = nn.AvgPool2d(kernel_size=kern, stride=kern) def forward(self, mu_a, logvar_a, mu_b, logvar_b): mu_a = se...
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 ...
FupingWu90/VarDA
Gaussian_Distance
false
8,170
[ "MIT" ]
14
cfea269a4f608128bb5b13a778619b17d7123bfa
https://github.com/FupingWu90/VarDA/tree/cfea269a4f608128bb5b13a778619b17d7123bfa
EstimationLoss
import torch import torch.nn as nn class EstimationLoss(nn.Module): def __init__(self): super(EstimationLoss, self).__init__() self.gamma = 0 self.alpha = 0 def forward(self, pred, target): temp1 = -torch.mul(pred ** self.gamma, torch.mul(1 - target, torch. log(1 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
Gorilla-Lab-SCUT/AffordanceNet
EstimationLoss
false
8,171
[ "MIT" ]
37
47c0c55a12f7e1429fd3e4a4bb781c4eec12803d
https://github.com/Gorilla-Lab-SCUT/AffordanceNet/tree/47c0c55a12f7e1429fd3e4a4bb781c4eec12803d
RRDB
import torch import torch.utils.data from torch.utils import data as data import torch.nn as nn from torch.nn import init as init from torch.nn.modules.batchnorm import _BatchNorm from torchvision.models import vgg as vgg from torch import autograd as autograd @torch.no_grad() def default_init_weights(module_list, sc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torch.utils import data as data import torch.nn as ...
BCV-Uniandes/RSR
RRDB
false
8,172
[ "zlib-acknowledgement" ]
14
dad60eedd3560f2655e3d1ed444153ed2616af2e
https://github.com/BCV-Uniandes/RSR/tree/dad60eedd3560f2655e3d1ed444153ed2616af2e
SimpleLSTM
import torch import torch.utils.data import torch.nn as nn class SimpleLSTM(nn.Module): def __init__(self, input_dim, hidden_dim): super(SimpleLSTM, self).__init__() self.nf = input_dim self.hf = hidden_dim self.conv = nn.Conv2d(self.nf + self.hf, 4 * self.hf, 3, 1, 1, bias ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils....
GuoShi28/GCP-Net
SimpleLSTM
false
8,173
[ "Apache-2.0" ]
24
cef7513fa242343055af64e612429e4384d3c1d7
https://github.com/GuoShi28/GCP-Net/tree/cef7513fa242343055af64e612429e4384d3c1d7
ShuffleConv
import torch from torch import nn class ShuffleConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', upscale_factor=2, padding_mode='zeros'): super(ShuffleConv, self).__init__() self.upscale_factor = upscale_factor self.conv = nn.Conv2d(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...
GerbenBeintema/deepSI
ShuffleConv
false
8,174
[ "BSD-3-Clause" ]
12
580711210398064bb7f01e41d08b7a248a88b35b
https://github.com/GerbenBeintema/deepSI/tree/580711210398064bb7f01e41d08b7a248a88b35b
h_sigmoid
import torch import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
GewelsJI/VPS
h_sigmoid
false
8,175
[ "Apache-2.0" ]
22
8cb7f584be3c5fc0941126860f2198cb1d88fc4e
https://github.com/GewelsJI/VPS/tree/8cb7f584be3c5fc0941126860f2198cb1d88fc4e
Upscale_Conv_block
import torch from torch import nn class ConvShuffle(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', upscale_factor=2, padding_mode='zeros'): super(ConvShuffle, self).__init__() self.upscale_factor = upscale_factor self.conv = nn.Conv2d(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._inductor.runtime import triton_helpers from torch import nn assert_s...
GerbenBeintema/deepSI
Upscale_Conv_block
false
8,176
[ "BSD-3-Clause" ]
12
580711210398064bb7f01e41d08b7a248a88b35b
https://github.com/GerbenBeintema/deepSI/tree/580711210398064bb7f01e41d08b7a248a88b35b
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: self.gamma = nn.Param...
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_...
HAXRD/PIC
LayerNorm
false
8,177
[ "MIT" ]
28
658b4dd6b01e64413d5f8f0107d9167f1bd78546
https://github.com/HAXRD/PIC/tree/658b4dd6b01e64413d5f8f0107d9167f1bd78546
Conv
import torch import torch.nn as nn import torch.utils.data class Conv(nn.Module): """ Convenience class that does padding and convolution for inputs in the format [batch_size, sequence length, hidden size] """ def __init__(self, input_size, output_size, kernel_size, pad_type): """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
HLTCHKUST/emotion-dialogue
Conv
false
8,178
[ "MIT" ]
40
0d58b339134dd9a2f386948ae474b270a77370f9
https://github.com/HLTCHKUST/emotion-dialogue/tree/0d58b339134dd9a2f386948ae474b270a77370f9
ClassicUpConv
import torch from torch import nn class ClassicUpConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', upscale_factor=2, padding_mode='zeros'): super(ClassicUpConv, self).__init__() self.upscale_factor = upscale_factor self.conv = nn.Conv2d(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 import triton_helpers from torch._inductor.runtime....
GerbenBeintema/deepSI
ClassicUpConv
false
8,179
[ "BSD-3-Clause" ]
12
580711210398064bb7f01e41d08b7a248a88b35b
https://github.com/GerbenBeintema/deepSI/tree/580711210398064bb7f01e41d08b7a248a88b35b
ScalarFilter
import torch import torch as th import torch.nn as nn class ScalarFilter(nn.Module): def __init__(self): super(ScalarFilter, self).__init__() def forward(self, p_x, g_x): """ input should be scalar: bsz x l1, bsz x l2 return bsz x l2 """ matrix = g_x.unsqueeze...
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...
HKUST-KnowComp/DualMessagePassing
ScalarFilter
false
8,180
[ "MIT" ]
12
d29d627be2a8c8f24b52e3db2c383e33a059aaa7
https://github.com/HKUST-KnowComp/DualMessagePassing/tree/d29d627be2a8c8f24b52e3db2c383e33a059aaa7
WeightedBCELoss
import torch class WeightedBCELoss(torch.nn.Module): def __init__(self, neg_scale=-1, bce_sum=False): super(WeightedBCELoss, self).__init__() self.log_sigmoid = torch.nn.LogSigmoid() self.neg_scale = neg_scale self.bce_sum = bce_sum def forward(self, logits, targets, target_w...
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 assert_size...
HKUST-KnowComp/MLMET
WeightedBCELoss
false
8,181
[ "MIT" ]
10
ae1188a929a5ca6a8e087bb091853b328ea2c7e7
https://github.com/HKUST-KnowComp/MLMET/tree/ae1188a929a5ca6a8e087bb091853b328ea2c7e7
Actor
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, hidden_size, num_inputs, num_outputs): super(Actor, self).__init__() self.linear1 = nn.Linear(num_inputs, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
HAXRD/PIC
Actor
false
8,182
[ "MIT" ]
28
658b4dd6b01e64413d5f8f0107d9167f1bd78546
https://github.com/HAXRD/PIC/tree/658b4dd6b01e64413d5f8f0107d9167f1bd78546
Sparsemax
import torch import torch as th import torch.nn as nn class Sparsemax(nn.Module): """Sparsemax function.""" def __init__(self, dim=-1): """Initialize sparsemax activation Args: dim (int, optional): The dimension over which to apply the sparsemax function. """ 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 import torch as th import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.ass...
HKUST-KnowComp/DualMessagePassing
Sparsemax
false
8,183
[ "MIT" ]
12
d29d627be2a8c8f24b52e3db2c383e33a059aaa7
https://github.com/HKUST-KnowComp/DualMessagePassing/tree/d29d627be2a8c8f24b52e3db2c383e33a059aaa7
Minimum
import torch import torch as th import torch.nn as nn def minimum(x, dim=-1, scale_up=False, inplace=False): if inplace: x_ = x.clone() min_x = th.min(x_, dim=dim, keepdim=True)[0] min_mask = x_ == min_x x.masked_fill_(min_mask == 0, 0.0) if scale_up: x_sum = th...
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 as th import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.ass...
HKUST-KnowComp/DualMessagePassing
Minimum
false
8,184
[ "MIT" ]
12
d29d627be2a8c8f24b52e3db2c383e33a059aaa7
https://github.com/HKUST-KnowComp/DualMessagePassing/tree/d29d627be2a8c8f24b52e3db2c383e33a059aaa7
MeanPooling
import torch from torch import nn class MeanPooling(nn.Module): def __init__(self): super(MeanPooling, self).__init__() def forward(self, doc_state, entity_mapping, entity_lens): entity_states = entity_mapping.unsqueeze(3) * doc_state.unsqueeze(1) mean_pooled = torch.sum(entity_state...
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...
HLTCHKUST/MulQG
MeanPooling
false
8,185
[ "MIT" ]
19
8e257f2d6c0f03c07ea8a0bf0e8f55b0cde60605
https://github.com/HLTCHKUST/MulQG/tree/8e257f2d6c0f03c07ea8a0bf0e8f55b0cde60605