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
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, max_action, phi=0.05): super(Actor, self).__init__() self.l1 = nn.Linear(state_dim + action_dim, 400) self.l2 = nn.Linear(400, 300) self.l3 = 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 from torch._inductor.runtime....
DanielTakeshi/DCUR
Actor
false
355
[ "MIT" ]
0
1cdb00e7e68060ad3bba9a497106c327f6b5a663
https://github.com/DanielTakeshi/DCUR/tree/1cdb00e7e68060ad3bba9a497106c327f6b5a663
SelfAttention
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_head...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DartingMelody/perceiver-io
SelfAttention
false
356
[ "Apache-2.0" ]
0
fb818b1763f61e259b23b8b014df2ac01c303a54
https://github.com/DartingMelody/perceiver-io/tree/fb818b1763f61e259b23b8b014df2ac01c303a54
SpaceToDepth
import torch from torch import nn class SpaceToDepth(nn.Module): def __init__(self, block_size): super().__init__() self.bs = block_size def forward(self, x): N, C, H, W = x.size() x = x.view(N, C, H // self.bs, self.bs, W // self.bs, self.bs) x = x.permute(0, 3, 5, 1...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Dauriel/weather4cast2021
SpaceToDepth
false
357
[ "Apache-2.0" ]
0
29e818c4bcd488ec84b51558bf5392e4a887db70
https://github.com/Dauriel/weather4cast2021/tree/29e818c4bcd488ec84b51558bf5392e4a887db70
CrossAttention
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_head...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DartingMelody/perceiver-io
CrossAttention
false
358
[ "Apache-2.0" ]
0
fb818b1763f61e259b23b8b014df2ac01c303a54
https://github.com/DartingMelody/perceiver-io/tree/fb818b1763f61e259b23b8b014df2ac01c303a54
Scale
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
CuongNguyen218/ObjectDetection-OneStageDet
Scale
false
359
[ "MIT" ]
0
60efe8b0ee6782b2aea20a32264b2ce1fc21901f
https://github.com/CuongNguyen218/ObjectDetection-OneStageDet/tree/60efe8b0ee6782b2aea20a32264b2ce1fc21901f
Upsample_
import torch from torch import nn class Upsample_(nn.Module): def __init__(self, scale=2): super(Upsample_, self).__init__() self.upsample = nn.Upsample(mode='bilinear', scale_factor=scale) def forward(self, x): return self.upsample(x) def get_inputs(): return [torch.rand([4, 4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Dauriel/weather4cast2021
Upsample_
false
360
[ "Apache-2.0" ]
0
29e818c4bcd488ec84b51558bf5392e4a887db70
https://github.com/Dauriel/weather4cast2021/tree/29e818c4bcd488ec84b51558bf5392e4a887db70
SubPixelConvolutionalBlock
import torch from torch import nn class SubPixelConvolutionalBlock(nn.Module): """ A subpixel convolutional block, comprising convolutional, pixel-shuffle, and PReLU activation layers. """ def __init__(self, kernel_size=3, n_channels=64, scaling_factor=2): """ :param kernel_size: kern...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
DanielLiang1/a-PyTorch-Tutorial-to-Super-Resolution
SubPixelConvolutionalBlock
false
361
[ "MIT" ]
0
cf7b519029687fe9726bb194fe3765934afa18b3
https://github.com/DanielLiang1/a-PyTorch-Tutorial-to-Super-Resolution/tree/cf7b519029687fe9726bb194fe3765934afa18b3
DoubleDense
import torch from torch import nn from torch.nn import functional as F class DoubleDense(nn.Module): def __init__(self, in_channels, hidden_neurons, output_channels): super(DoubleDense, self).__init__() self.dense1 = nn.Linear(in_channels, out_features=hidden_neurons) self.dense2 = 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 from torch import nn assert_s...
Dauriel/weather4cast2021
DoubleDense
false
362
[ "Apache-2.0" ]
0
29e818c4bcd488ec84b51558bf5392e4a887db70
https://github.com/Dauriel/weather4cast2021/tree/29e818c4bcd488ec84b51558bf5392e4a887db70
BasicDeconv
import torch import torch.nn as nn import torch.nn.functional as F class BasicDeconv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, use_bn=False): super(BasicDeconv, self).__init__() self.use_bn = use_bn self.tconv = nn.ConvTranspose2d(in_channels...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
DecAngel/C-3-Framework
BasicDeconv
false
363
[ "MIT" ]
0
00b792b4481a0ec9d7e30e290c66e7020235e79b
https://github.com/DecAngel/C-3-Framework/tree/00b792b4481a0ec9d7e30e290c66e7020235e79b
LinearNet
import torch import torch.nn import torch.optim class LinearNet(torch.nn.Module): def __init__(self, D_in, H, D_out): super().__init__() self.linear1 = torch.nn.Linear(D_in, H) self.nonlinear = torch.nn.ReLU() self.linear2 = torch.nn.Linear(H, D_out) def forward(self, x: 'tor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
DavidV17/ReAgent
LinearNet
false
364
[ "BSD-3-Clause" ]
0
9b55696849cf133bc8494a5bce57df420ffe7517
https://github.com/DavidV17/ReAgent/tree/9b55696849cf133bc8494a5bce57df420ffe7517
AngleLoss
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed from typing import * class AngleLoss(nn.Module): def __init__(self): super(AngleLoss, self).__init__() def forward(self, angle, an...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn i...
DeVriesMatt/pointMLP-pytorch
AngleLoss
false
365
[ "Apache-2.0" ]
0
e9c09a2038551e83b072353f3fd7e3294463e892
https://github.com/DeVriesMatt/pointMLP-pytorch/tree/e9c09a2038551e83b072353f3fd7e3294463e892
VAE
import torch import torch.nn as nn import torch.nn.functional as F class VAE(nn.Module): def __init__(self, state_dim, action_dim, latent_dim, max_action): super(VAE, self).__init__() self.e1 = nn.Linear(state_dim + action_dim, 750) self.e2 = nn.Linear(750, 750) self.mean = nn.Lin...
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...
DanielTakeshi/DCUR
VAE
false
366
[ "MIT" ]
0
1cdb00e7e68060ad3bba9a497106c327f6b5a663
https://github.com/DanielTakeshi/DCUR/tree/1cdb00e7e68060ad3bba9a497106c327f6b5a663
Upsample
import torch from torch import nn class Upsample(nn.Module): def __init__(self, input_dim, output_dim, kernel, stride): super(Upsample, self).__init__() self.upsample = nn.ConvTranspose2d(input_dim, output_dim, kernel_size=kernel, stride=stride) def forward(self, x): retu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
Dauriel/weather4cast2021
Upsample
false
367
[ "Apache-2.0" ]
0
29e818c4bcd488ec84b51558bf5392e4a887db70
https://github.com/Dauriel/weather4cast2021/tree/29e818c4bcd488ec84b51558bf5392e4a887db70
DECLoss
import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class DECLoss(nn.Module): def __init__(self): super(DECLoss, self).__init__() def target_distribution(self, q): weigh...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import Variable import torch.nn.parallel import torch.optim import torch.utils.data import torch.u...
Crazy-Jack/SpatialExpGeneCluster
DECLoss
false
368
[ "MIT" ]
0
9e57c308d1c577a936a2358d0641c65b8130034f
https://github.com/Crazy-Jack/SpatialExpGeneCluster/tree/9e57c308d1c577a936a2358d0641c65b8130034f
SAModule_Head
import torch import torch.nn as nn import torch.nn.functional as F class BasicConv(nn.Module): def __init__(self, in_channels, out_channels, use_bn=False, **kwargs): super(BasicConv, self).__init__() self.use_bn = use_bn self.conv = nn.Conv2d(in_channels, out_channels, bias=not 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....
DecAngel/C-3-Framework
SAModule_Head
false
369
[ "MIT" ]
0
00b792b4481a0ec9d7e30e290c66e7020235e79b
https://github.com/DecAngel/C-3-Framework/tree/00b792b4481a0ec9d7e30e290c66e7020235e79b
TripletLoss
import torch from torch import nn import torch.nn.functional as F from torch.nn import * from torch.optim.lr_scheduler import * def _batch_hard(mat_distance, mat_similarity, indice=False): sorted_mat_distance, positive_indices = torch.sort(mat_distance + - 9999999.0 * (1 - mat_similarity), dim=1, descendi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Dingyuan-Zheng/ctf-UDA
TripletLoss
false
370
[ "MIT" ]
0
3e3c67f68d7eb0b52a16a259e5a77e153062c4fd
https://github.com/Dingyuan-Zheng/ctf-UDA/tree/3e3c67f68d7eb0b52a16a259e5a77e153062c4fd
MultiHeadAttention
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, num_q_channels: 'int', num_kv_channels: 'int', num_heads: 'int', dropout: 'float'): super().__init__() self.attention = nn.MultiheadAttention(embed_dim=num_q_channels, num_heads=num_head...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DartingMelody/perceiver-io
MultiHeadAttention
false
371
[ "Apache-2.0" ]
0
fb818b1763f61e259b23b8b014df2ac01c303a54
https://github.com/DartingMelody/perceiver-io/tree/fb818b1763f61e259b23b8b014df2ac01c303a54
AUGLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class AUGLoss(nn.Module): def __init__(self): super(AUGLoss, self).__init__() def forward(self, x1, x2): b = x1 - x2 b = b * b b = b.sum(1) b = torch.sqrt(b) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel import torch.optim import torch....
DonghyunAhn/sadvirus
AUGLoss
false
372
[ "MIT" ]
0
cdcc98812d613962a7003ff0c6013d0805bde024
https://github.com/DonghyunAhn/sadvirus/tree/cdcc98812d613962a7003ff0c6013d0805bde024
Conv2d_fw
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class Conv2d_fw(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, bias=True): super(Conv2d_fw, self).__init__(in_channels, out_channels, kernel_size, stride=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo.g...
DingYuan0118/Meta-Fine-Tuning
Conv2d_fw
false
373
[ "MIT" ]
0
531b7418420c072844216ec5217f1f03f6419a79
https://github.com/DingYuan0118/Meta-Fine-Tuning/tree/531b7418420c072844216ec5217f1f03f6419a79
ContrastiveDistanceLoss
import torch import torch.nn as nn from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed import torch.multiprocessing import torch.backends class ContrastiveDistanceLoss(nn.Module): """The Contrastive distance l...
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 torch.nn.modules.loss import * from torch.nn.modules import * ...
Dokholyan/catalyst
ContrastiveDistanceLoss
false
374
[ "Apache-2.0" ]
0
de8e681676d76741fdb722d4cd77274ba616915d
https://github.com/Dokholyan/catalyst/tree/de8e681676d76741fdb722d4cd77274ba616915d
ContrastiveLoss
import torch class ContrastiveLoss(torch.nn.Module): def __init__(self, margin=1.0): super(ContrastiveLoss, self).__init__() self.margin = margin def forward(self, anchor, positive, negative): distance_anchor_positive = (anchor - positive).pow(2).sum(1) distance_anchor_negati...
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...
DongChengdongHangZhou/Siamese-Network-tiff
ContrastiveLoss
false
375
[ "MIT" ]
0
aaf923ad59301af1b3237e605964341a90dc414b
https://github.com/DongChengdongHangZhou/Siamese-Network-tiff/tree/aaf923ad59301af1b3237e605964341a90dc414b
ContrastiveEmbeddingLoss
import torch import torch.nn as nn from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed import torch.multiprocessing import torch.backends class ContrastiveEmbeddingLoss(nn.Module): """The Contrastive embedding...
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 from t...
Dokholyan/catalyst
ContrastiveEmbeddingLoss
false
376
[ "Apache-2.0" ]
0
de8e681676d76741fdb722d4cd77274ba616915d
https://github.com/Dokholyan/catalyst/tree/de8e681676d76741fdb722d4cd77274ba616915d
SoftEntropy
import torch from torch import nn import torch.nn.functional as F from torch.nn import * from torch.optim.lr_scheduler import * class SoftEntropy(nn.Module): def __init__(self): super(SoftEntropy, self).__init__() self.logsoftmax = nn.LogSoftmax(dim=1) 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 math as tl_math from torch import nn f...
Dingyuan-Zheng/ctf-UDA
SoftEntropy
false
377
[ "MIT" ]
0
3e3c67f68d7eb0b52a16a259e5a77e153062c4fd
https://github.com/Dingyuan-Zheng/ctf-UDA/tree/3e3c67f68d7eb0b52a16a259e5a77e153062c4fd
ContrastivePairwiseEmbeddingLoss
import torch import torch.nn as nn from torch.nn import functional as F from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed import torch.multiprocessing import torch.backends class ContrastivePairwiseEmbeddingLoss...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Dokholyan/catalyst
ContrastivePairwiseEmbeddingLoss
false
378
[ "Apache-2.0" ]
0
de8e681676d76741fdb722d4cd77274ba616915d
https://github.com/Dokholyan/catalyst/tree/de8e681676d76741fdb722d4cd77274ba616915d
PairwiseDistanceMatrix
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class PairwiseDistanceMatrix(nn.Module): def __init__(self): super(PairwiseDistanceMatrix, self).__init__() def forward(self, X, Y): X2 = (X ** 2).sum(1).view(-1, 1) Y2 = (Y ** 2).sum(1).view(1, -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 import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_si...
DreamBlack/APCNet
PairwiseDistanceMatrix
false
379
[ "MIT" ]
0
d76bc9e46c3b631035c5c67e2367b6fb80621333
https://github.com/DreamBlack/APCNet/tree/d76bc9e46c3b631035c5c67e2367b6fb80621333
GenerateMask
import torch import torch.nn as nn import torch.nn.functional as F class VectorAttention(nn.Module): """vector attention""" def __init__(self, input_dim, hidden_dim): super(VectorAttention, self).__init__() self.theta = nn.Linear(input_dim, hidden_dim) self.phi = nn.Linear(input_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....
Crazy-Jack/BigGAN-PyTorch
GenerateMask
false
380
[ "MIT" ]
0
1a5644e9c87cc399580c96cfeb180052076888da
https://github.com/Crazy-Jack/BigGAN-PyTorch/tree/1a5644e9c87cc399580c96cfeb180052076888da
MLP
import torch from torch import nn from torch.nn import functional as F class MLP(nn.Module): """ fc1, fc2 two fully connected layers fc3 output layer relu activation function for hidden layers sigmoid activation function for output layer """ def __init__(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 import nn assert_s...
EE559DeepLearningEPFL/Project1
MLP
false
381
[ "MIT" ]
0
cbafdfee26771ae0ba3cd36375e68d92e9f108b2
https://github.com/EE559DeepLearningEPFL/Project1/tree/cbafdfee26771ae0ba3cd36375e68d92e9f108b2
SEModule
from torch.nn import Module import torch import torch.nn as nn from torch.nn import Conv2d from torch.nn import ReLU from torch.nn import Sigmoid from torch.nn import AdaptiveAvgPool2d class SEModule(Module): def __init__(self, channels, reduction): super(SEModule, self).__init__() self.avg_pool ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
Dou-Yu-xuan/pykinship
SEModule
false
382
[ "MIT" ]
0
f81f6667fa08a08fe726736d05476168b2a3e2f0
https://github.com/Dou-Yu-xuan/pykinship/tree/f81f6667fa08a08fe726736d05476168b2a3e2f0
TVLoss
import torch import torch.nn as nn import torch.optim import torch.utils.data from torch.nn.init import * class TVLoss(nn.Module): def __init__(self, tv_loss_weight=1): super(TVLoss, self).__init__() self.tv_loss_weight = tv_loss_weight def forward(self, x): batch_size = x.size()[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 import torch.nn as nn import torch.optim import torch.utils.data from torch.nn.init import * assert_size_stride = torch._C._dynamo.guards.as...
EVA4-RS-Group/Phase2
TVLoss
false
383
[ "Apache-2.0" ]
0
7c551e3894979cc425dd51baeddbfa5a51b7878d
https://github.com/EVA4-RS-Group/Phase2/tree/7c551e3894979cc425dd51baeddbfa5a51b7878d
FullAttention
from torch.nn import Module import torch from torch.nn import Dropout class FullAttention(Module): def __init__(self, use_dropout=False, attention_dropout=0.1): super().__init__() self.use_dropout = use_dropout self.dropout = Dropout(attention_dropout) def forward(self, queries, keys...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EStorm21/kornia
FullAttention
false
384
[ "ECL-2.0", "Apache-2.0" ]
0
b2bba7950d748ba0b8ce0cc68035a248799a1044
https://github.com/EStorm21/kornia/tree/b2bba7950d748ba0b8ce0cc68035a248799a1044
PointLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data def array2samples_distance(array1, array2): """ arguments: array1: the array, size: (num_point, num_feature) array2: the samples, size: (num_point, num_feature) returns: distances: each entry is 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.nn as nn import torch.nn.parallel import torch.utils.data assert_size_stride...
DreamBlack/APCNet
PointLoss
false
385
[ "MIT" ]
0
d76bc9e46c3b631035c5c67e2367b6fb80621333
https://github.com/DreamBlack/APCNet/tree/d76bc9e46c3b631035c5c67e2367b6fb80621333
Hflip
import torch import torch.nn as nn def hflip(input: 'torch.Tensor') ->torch.Tensor: """Horizontally flip a tensor image or a batch of tensor images. .. image:: _static/img/hflip.png Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: input: input tens...
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...
EStorm21/kornia
Hflip
false
386
[ "ECL-2.0", "Apache-2.0" ]
0
b2bba7950d748ba0b8ce0cc68035a248799a1044
https://github.com/EStorm21/kornia/tree/b2bba7950d748ba0b8ce0cc68035a248799a1044
normalize
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.utils.data from torch.nn.init import * class normalize(nn.Module): def __init__(self): super(normalize, self).__init__() def forward(self, x): x = F.normalize(x, p=2, dim=1) return x ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
EVA4-RS-Group/Phase2
normalize
false
387
[ "Apache-2.0" ]
0
7c551e3894979cc425dd51baeddbfa5a51b7878d
https://github.com/EVA4-RS-Group/Phase2/tree/7c551e3894979cc425dd51baeddbfa5a51b7878d
AuxsiameseMLP
import torch from torch import nn from torch.nn import functional as F class AuxsiameseMLP(nn.Module): """ basic structure similar to the MLP input is splited into two 1*14*14 images for separating training, share the same parameters softmax for the auxiliary output layers """ def __init__(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 import nn assert_s...
EE559DeepLearningEPFL/Project1
AuxsiameseMLP
false
388
[ "MIT" ]
0
cbafdfee26771ae0ba3cd36375e68d92e9f108b2
https://github.com/EE559DeepLearningEPFL/Project1/tree/cbafdfee26771ae0ba3cd36375e68d92e9f108b2
SevenLayerFC_Net
import torch import torch.nn as nn import torch.nn.functional as F class SevenLayerFC_Net(nn.Module): def __init__(self, D_in, H, D_out): """ In the constructor we instantiate three nn.Linear modules and assign them as member variables. """ super(SevenLayerFC_Net, 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....
Darkhunter9/10-605_cifar100
SevenLayerFC_Net
false
389
[ "MIT" ]
0
97c171c7b3ad74bcb0376c2ec23083f1a0b9417d
https://github.com/Darkhunter9/10-605_cifar100/tree/97c171c7b3ad74bcb0376c2ec23083f1a0b9417d
JointsMSELoss
import torch import torch.nn as nn import torch.optim import torch.utils.data from torch.nn.init import * class JointsMSELoss(nn.Module): def __init__(self, use_target_weight): super(JointsMSELoss, self).__init__() self.criterion = nn.MSELoss(size_average=True) self.use_target_weight = us...
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 from torch.nn.init import * assert_size_stride = torch._C._dynamo.guards.as...
EVA4-RS-Group/Phase2
JointsMSELoss
false
390
[ "Apache-2.0" ]
0
7c551e3894979cc425dd51baeddbfa5a51b7878d
https://github.com/EVA4-RS-Group/Phase2/tree/7c551e3894979cc425dd51baeddbfa5a51b7878d
SiameseMLP
import torch from torch import nn from torch.nn import functional as F class SiameseMLP(nn.Module): """ basic structure similar to the MLP input is splited into two 1*14*14 images for separating training, share the same parameters """ def __init__(self): super(SiameseMLP, self).__init__()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
EE559DeepLearningEPFL/Project1
SiameseMLP
false
391
[ "MIT" ]
0
cbafdfee26771ae0ba3cd36375e68d92e9f108b2
https://github.com/EE559DeepLearningEPFL/Project1/tree/cbafdfee26771ae0ba3cd36375e68d92e9f108b2
SingleKaistAutoEncoder
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def kaiming_init(module, mode='fan_out', nonlinearity='relu', bias=0, distribution='normal'): assert distribution in ['uniform', 'normal'] if distribution == 'uniform': nn.init.kaiming_uniform_(module.weight, 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....
DouCir/mmdetection
SingleKaistAutoEncoder
false
392
[ "Apache-2.0" ]
0
44613202c379d85315ed47ca670fd9853f90c3a5
https://github.com/DouCir/mmdetection/tree/44613202c379d85315ed47ca670fd9853f90c3a5
EPE
import torch import torch.nn as nn class EPE(nn.Module): def __init__(self): super(EPE, self).__init__() def forward(self, flow, gt, loss_mask): loss_map = (flow - gt.detach()) ** 2 loss_map = (loss_map.sum(1, True) + 1e-06) ** 0.5 return loss_map * loss_mask def get_inputs...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
Egazaga/arXiv2020-RIFE
EPE
false
393
[ "MIT" ]
0
84b050e168a682905a9dde8aa15437a4994f2abf
https://github.com/Egazaga/arXiv2020-RIFE/tree/84b050e168a682905a9dde8aa15437a4994f2abf
BiencoderLoss
import torch import torch.nn as nn from torch import Tensor as T import torch.nn.functional as F class BiencoderLoss(nn.Module): def __init__(self): super(BiencoderLoss, self).__init__() def forward(self, q_vectors: 'T', p_vectors: 'T'): score_matrix = torch.mm(q_vectors, torch.transpose(p_v...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Eric-Yang-yz/dense_passage_retrieval
BiencoderLoss
false
394
[ "MIT" ]
0
5d6e210d5ff3304b4891c94edd2bd2aee5b34655
https://github.com/Eric-Yang-yz/dense_passage_retrieval/tree/5d6e210d5ff3304b4891c94edd2bd2aee5b34655
Attention
import math import torch import torch.nn as nn class Attention(nn.Module): """ Attention mechanism (Luong) """ def __init__(self, hidden_size, hidden_size1): super(Attention, self).__init__() self.W_h = nn.Linear(hidden_size + hidden_size1, hidden_size, bias= 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....
DeepInEvil/kgirnet
Attention
false
395
[ "MIT" ]
0
81210907daba7671d3f3fd5814656d1557b7a2b1
https://github.com/DeepInEvil/kgirnet/tree/81210907daba7671d3f3fd5814656d1557b7a2b1
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, alpha=0.25, gamma=2, logits=False, reduce=True): super(FocalLoss, self).__init__() self.alpha = alpha self.gamma = gamma self.bce = (logits and F.binary_cross_entropy_...
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...
EdwardTyantov/siim-isic-melanoma-2020
FocalLoss
false
396
[ "MIT" ]
0
ce0ba286244dcf7b5ccb8250505c80350efb0301
https://github.com/EdwardTyantov/siim-isic-melanoma-2020/tree/ce0ba286244dcf7b5ccb8250505c80350efb0301
AuxMLP
import torch from torch import nn from torch.nn import functional as F class AuxMLP(nn.Module): """ basic structure similar to the MLP input is splited into two 1*14*14 images for separating training, use different parameters softmax for the auxiliary output layers """ 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 import triton_helpers from torch import nn assert_s...
EE559DeepLearningEPFL/Project1
AuxMLP
false
397
[ "MIT" ]
0
cbafdfee26771ae0ba3cd36375e68d92e9f108b2
https://github.com/EE559DeepLearningEPFL/Project1/tree/cbafdfee26771ae0ba3cd36375e68d92e9f108b2
Homography
import torch import torch.nn as nn class Homography(nn.Module): """Homography geometric model to be used together with ImageRegistrator module for the optimization-based image registration.""" def __init__(self) ->None: super().__init__() self.model = nn.Parameter(torch.eye(3)) ...
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...
EStorm21/kornia
Homography
false
398
[ "ECL-2.0", "Apache-2.0" ]
0
b2bba7950d748ba0b8ce0cc68035a248799a1044
https://github.com/EStorm21/kornia/tree/b2bba7950d748ba0b8ce0cc68035a248799a1044
AuxCNN
import torch from torch import nn from torch.nn import functional as F class AuxCNN(nn.Module): """ basic structure similar to the CNN input is splited into two 1*14*14 images for separating training, use different parameters softmax for the auxiliary output layers """ 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 import triton_helpers from torch import nn from tor...
EE559DeepLearningEPFL/Project1
AuxCNN
false
399
[ "MIT" ]
0
cbafdfee26771ae0ba3cd36375e68d92e9f108b2
https://github.com/EE559DeepLearningEPFL/Project1/tree/cbafdfee26771ae0ba3cd36375e68d92e9f108b2
AuxsiameseCNN
import torch from torch import nn from torch.nn import functional as F class AuxsiameseCNN(nn.Module): """ basic structure similar to the CNN input is splited into two 1*14*14 images for separating training, share the same parameters softmax for the auxiliary output layers """ def __init__(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 import nn from tor...
EE559DeepLearningEPFL/Project1
AuxsiameseCNN
false
400
[ "MIT" ]
0
cbafdfee26771ae0ba3cd36375e68d92e9f108b2
https://github.com/EE559DeepLearningEPFL/Project1/tree/cbafdfee26771ae0ba3cd36375e68d92e9f108b2
AddBias
import torch import torch.nn as nn class AddBias(nn.Module): def __init__(self, bias): super(AddBias, self).__init__() self.bias = bias def forward(self, x): return x + self.bias def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {'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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ErikML/convex_adversarial
AddBias
false
401
[ "MIT" ]
0
52652943cfdb54199b579dbe70d3be20d2a13f23
https://github.com/ErikML/convex_adversarial/tree/52652943cfdb54199b579dbe70d3be20d2a13f23
Discriminator
import torch import torch.nn as nn class Discriminator(nn.Module): def __init__(self, n_h): super(Discriminator, self).__init__() self.f_k = nn.Bilinear(n_h, n_h, 1) for m in self.modules(): self.weights_init(m) def weights_init(self, m): if isinstance(m, nn.Bilin...
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...
EchooooAi/gsrl
Discriminator
false
402
[ "MIT" ]
0
1cfc73fe052c09fe05df09c92c5232e7341e9ad0
https://github.com/EchooooAi/gsrl/tree/1cfc73fe052c09fe05df09c92c5232e7341e9ad0
Hsigmoid
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel 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 ...
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 import torch.nn.parallel assert_size_stride = torch._C._dynamo.guard...
EllisHui/outOfRailWay
Hsigmoid
false
403
[ "BSD-2-Clause" ]
0
e3bf9aaa18879bee5536740d55006c872f06278f
https://github.com/EllisHui/outOfRailWay/tree/e3bf9aaa18879bee5536740d55006c872f06278f
DistillKL
import torch from torch import nn import torch.nn.functional as F class DistillKL(nn.Module): """KL divergence for distillation""" def __init__(self, T): super(DistillKL, self).__init__() self.T = T def forward(self, y_s, y_t): p_s = F.log_softmax(y_s / self.T, dim=1) p_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 libdevice, math as tl_math from torch ...
Electronicshelf/Few-shot-regularization
DistillKL
false
404
[ "MIT" ]
0
3fd0fef52684af77a5e574b5d61cfd8dd557b14b
https://github.com/Electronicshelf/Few-shot-regularization/tree/3fd0fef52684af77a5e574b5d61cfd8dd557b14b
Normalize
import torch from torch import nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm) return out 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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Electronicshelf/Few-shot-regularization
Normalize
false
405
[ "MIT" ]
0
3fd0fef52684af77a5e574b5d61cfd8dd557b14b
https://github.com/Electronicshelf/Few-shot-regularization/tree/3fd0fef52684af77a5e574b5d61cfd8dd557b14b
CNN
import torch from torch import nn from torch.nn import functional as F class CNN(nn.Module): """ conv1, conv2 two convolution layers. fc1, fc2 two fully connected layers. fc3 output layer relu activation function for hidden layers sigmoid activation func...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
EE559DeepLearningEPFL/Project1
CNN
false
406
[ "MIT" ]
0
cbafdfee26771ae0ba3cd36375e68d92e9f108b2
https://github.com/EE559DeepLearningEPFL/Project1/tree/cbafdfee26771ae0ba3cd36375e68d92e9f108b2
RegressionModel
import torch import torch.nn as nn class RegressionModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, feature_size=256): super(RegressionModel, self).__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = nn.ReL...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
DvdNss/FaceMaskDetection
RegressionModel
false
407
[ "Apache-2.0" ]
0
3a4efe2bf8fb224d72636c853684a563b4e7a2e4
https://github.com/DvdNss/FaceMaskDetection/tree/3a4efe2bf8fb224d72636c853684a563b4e7a2e4
SiameseCNN
import torch from torch import nn from torch.nn import functional as F class SiameseCNN(nn.Module): """ basic structure similar to the CNN input is splited into two 1*14*14 images for separating training, share the same parameters """ def __init__(self): super(SiameseCNN, self).__init__()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from tor...
EE559DeepLearningEPFL/Project1
SiameseCNN
false
408
[ "MIT" ]
0
cbafdfee26771ae0ba3cd36375e68d92e9f108b2
https://github.com/EE559DeepLearningEPFL/Project1/tree/cbafdfee26771ae0ba3cd36375e68d92e9f108b2
L2Norm
import torch import torch.nn as nn class L2Norm(nn.Module): """ Scale shall be learnable according to original paper scale: initial scale number chan_num: L2Norm channel number (norm over all channels) """ def __init__(self, scale=20, chan_num=512): super(L2Norm, 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
EldritchJS/inference_results_v0.5
L2Norm
false
409
[ "Apache-2.0" ]
0
5552490e184d9fc342d871fcc410ac423ea49053
https://github.com/EldritchJS/inference_results_v0.5/tree/5552490e184d9fc342d871fcc410ac423ea49053
BasicModel3
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel3(nn.Module): """ Example model two from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2)) """ def __init__(self): super().__init__() def forward...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel3
false
410
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
Conv2dWithConstraint
import torch from torch import nn class Conv2dWithConstraint(nn.Conv2d): def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super(Conv2dWithConstraint, self).__init__(*args, **kwargs) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=2, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
ErikBjare/braindecode
Conv2dWithConstraint
false
411
[ "BSD-3-Clause" ]
0
d77788d4813d353b65f0bfc61c6129015b0390b4
https://github.com/ErikBjare/braindecode/tree/d77788d4813d353b65f0bfc61c6129015b0390b4
EdgeCaseModel
import torch import torch.nn as nn class LayerWithRidiculouslyLongNameAndDoesntDoAnything(nn.Module): def forward(self, x): return x class EdgeCaseModel(nn.Module): def __init__(self, throw_error=False, return_str=False): super().__init__() self.throw_error = throw_error 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...
EarthLab-Luxembourg/torch-summary
EdgeCaseModel
false
412
[ "MIT" ]
0
8ef25aea5e9fb075df27e1e0c77bad56a7254397
https://github.com/EarthLab-Luxembourg/torch-summary/tree/8ef25aea5e9fb075df27e1e0c77bad56a7254397
BasicModel6_MultiTensor
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel6_MultiTensor(nn.Module): def __init__(self): super().__init__() def forward(self, input1, input2): input = input1 + input2 return 1 - F.relu(1 - input)[:, 1] def get_inputs(): return [torch.rand...
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...
Europium248/captum
BasicModel6_MultiTensor
false
413
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
Attention
import torch import torch.nn as nn import torch.optim import torch.utils.data from torch.nn.init import * class Attention(nn.Module): """ Attention Network. """ def __init__(self, encoder_dim, decoder_dim, attention_dim): """ :param encoder_dim: feature size of encoded images ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
EVA4-RS-Group/Phase2
Attention
false
414
[ "Apache-2.0" ]
0
7c551e3894979cc425dd51baeddbfa5a51b7878d
https://github.com/EVA4-RS-Group/Phase2/tree/7c551e3894979cc425dd51baeddbfa5a51b7878d
PredictionHead
import torch import torch.nn as nn class PredictionHead(nn.Module): def __init__(self, in_channels, num_classes, num_anchors): super(PredictionHead, self).__init__() self.classification = nn.Conv2d(in_channels, num_classes * num_anchors, kernel_size=1) self.regression = nn.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
EldritchJS/inference_results_v0.5
PredictionHead
false
415
[ "Apache-2.0" ]
0
5552490e184d9fc342d871fcc410ac423ea49053
https://github.com/EldritchJS/inference_results_v0.5/tree/5552490e184d9fc342d871fcc410ac423ea49053
BasicModel2
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel2(nn.Module): """ Example model one from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1) - 1 - ReLU(x2)) """ def __init__(self): super().__init__() def forward...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel2
false
416
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
BasicModel5_MultiArgs
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel5_MultiArgs(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) * x3[0] - ReLU(x2) * x3[1]) """ def __init__(self): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel5_MultiArgs
false
417
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
RecursiveNet
import torch import torch.nn as nn class RecursiveNet(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(64, 64, 3, 1, 1) def forward(self, x, args1=None, args2=None): del args1, args2 for _ in range(3): out = self.conv1(x) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
EarthLab-Luxembourg/torch-summary
RecursiveNet
false
418
[ "MIT" ]
0
8ef25aea5e9fb075df27e1e0c77bad56a7254397
https://github.com/EarthLab-Luxembourg/torch-summary/tree/8ef25aea5e9fb075df27e1e0c77bad56a7254397
BasicModel4_MultiArgs
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel4_MultiArgs(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2) / x3) """ def __init__(self): super()...
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...
Europium248/captum
BasicModel4_MultiArgs
false
419
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
LanguageModelCriterion
import torch import torch.nn as nn class LanguageModelCriterion(nn.Module): def __init__(self): super(LanguageModelCriterion, self).__init__() def forward(self, input, target, mask): input = input.contiguous().view(-1, input.size(2)) target = target.contiguous().view(-1, 1) m...
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...
FYJNEVERFOLLOWS/hw_NLP
LanguageModelCriterion
false
420
[ "MIT" ]
0
c9d72804128dfed3a53e9df40e94b2d53cccacae
https://github.com/FYJNEVERFOLLOWS/hw_NLP/tree/c9d72804128dfed3a53e9df40e94b2d53cccacae
BasicModel
import torch import torch.nn as nn import torch.nn.functional as F class BasicModel(nn.Module): def __init__(self): super().__init__() def forward(self, input): input = 1 - F.relu(1 - input) return input def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel
false
421
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
ClassificationModel
import torch import torch.nn as nn class ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256): super(ClassificationModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
DvdNss/FaceMaskDetection
ClassificationModel
false
422
[ "Apache-2.0" ]
0
3a4efe2bf8fb224d72636c853684a563b4e7a2e4
https://github.com/DvdNss/FaceMaskDetection/tree/3a4efe2bf8fb224d72636c853684a563b4e7a2e4
ReLUDeepLiftModel
import torch import torch.nn as nn class ReLUDeepLiftModel(nn.Module): """ https://www.youtube.com/watch?v=f_iAM0NPwnM """ def __init__(self): super().__init__() self.relu1 = nn.ReLU() self.relu2 = nn.ReLU() def forward(self, x1, x2, x3=2): return 2 * self.rel...
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...
Europium248/captum
ReLUDeepLiftModel
false
423
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
eSEModule
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel 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 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
EllisHui/outOfRailWay
eSEModule
false
424
[ "BSD-2-Clause" ]
0
e3bf9aaa18879bee5536740d55006c872f06278f
https://github.com/EllisHui/outOfRailWay/tree/e3bf9aaa18879bee5536740d55006c872f06278f
TemporalEmbedding
import math import torch import torch.nn as nn class FixedEmbedding(nn.Module): def __init__(self, c_in, d_model): super(FixedEmbedding, self).__init__() w = torch.zeros(c_in, d_model).float() w.require_grad = False position = torch.arange(0, c_in).float().unsqueeze(1) 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 import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guar...
Fanxingye/Informer2020
TemporalEmbedding
false
425
[ "Apache-2.0" ]
0
94fd05f82ff0882681a9716ae3e980a574fdcbed
https://github.com/Fanxingye/Informer2020/tree/94fd05f82ff0882681a9716ae3e980a574fdcbed
TanhDeepLiftModel
import torch import torch.nn as nn class TanhDeepLiftModel(nn.Module): """ Same as the ReLUDeepLiftModel, but with activations that can have negative outputs """ def __init__(self): super().__init__() self.tanh1 = nn.Tanh() self.tanh2 = nn.Tanh() def forward(s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
Europium248/captum
TanhDeepLiftModel
false
426
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
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...
EllisHui/outOfRailWay
NaiveGroupNorm
false
427
[ "BSD-2-Clause" ]
0
e3bf9aaa18879bee5536740d55006c872f06278f
https://github.com/EllisHui/outOfRailWay/tree/e3bf9aaa18879bee5536740d55006c872f06278f
GEGLU
import torch from torch import nn import torch.nn.functional as F import torch.utils.checkpoint class GEGLU(nn.Module): def forward(self, x): x, gate = x.chunk(2, dim=-1) return F.gelu(gate) * 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.utils.checkpoint assert_size_stride = torch._...
ClashLuke/gpt-neox
GEGLU
false
428
[ "MIT" ]
0
3291d0e6c867d9d328b96e8377f5b77c6f66c323
https://github.com/ClashLuke/gpt-neox/tree/3291d0e6c867d9d328b96e8377f5b77c6f66c323
MultiRelu
import torch from torch import Tensor from typing import Tuple import torch.nn as nn from typing import no_type_check class MultiRelu(nn.Module): def __init__(self, inplace: 'bool'=False): super().__init__() self.relu1 = nn.ReLU(inplace=inplace) self.relu2 = nn.ReLU(inplace=inplace) ...
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...
Europium248/captum
MultiRelu
false
429
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
BasicModel_MaxPool_ReLU
import torch import torch.nn as nn class BasicModel_MaxPool_ReLU(nn.Module): def __init__(self, inplace=False): super().__init__() self.maxpool = nn.MaxPool1d(3) self.relu = nn.ReLU(inplace=inplace) def forward(self, x): return self.relu(self.maxpool(x)).sum(dim=1) def get_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel_MaxPool_ReLU
false
430
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
AdaptiveCatAvgMaxPool2d
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def adaptive_catavgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_pool2d(x, output_size) return torch.cat((x_avg, x_max), 1) class AdaptiveCatAvgMaxPool2d(...
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 torch.nn import functional as F import torch.nn.parallel asser...
Fanzhongjie/ARFE
AdaptiveCatAvgMaxPool2d
false
431
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
GCN_Linear
from torch.nn import Module import math import torch import torch.nn.functional as F from torch import nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class sparse_dropout(Module): """ Sparse dropout implementation """ def __init__(self): super(sparse_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.nn import Module i...
Eudialyte/SepGAT
GCN_Linear
false
432
[ "MIT" ]
0
6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
https://github.com/Eudialyte/SepGAT/tree/6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
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...
EllisHui/outOfRailWay
GCN
false
433
[ "BSD-2-Clause" ]
0
e3bf9aaa18879bee5536740d55006c872f06278f
https://github.com/EllisHui/outOfRailWay/tree/e3bf9aaa18879bee5536740d55006c872f06278f
Linear2
import torch import torch.nn.functional as F from torch import nn class Linear2(nn.Module): def __init__(self, nfeat, nhid, nclass, dropout): super(Linear2, self).__init__() self.linear1 = nn.Linear(nfeat, nhid, bias=True) self.linear2 = nn.Linear(nhid, nclass, bias=True) 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 import triton_helpers from torch import nn assert_s...
Eudialyte/SepGAT
Linear2
false
434
[ "MIT" ]
0
6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
https://github.com/Eudialyte/SepGAT/tree/6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
BalancedL1Loss
import functools import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "su...
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 functools impor...
Fanzhongjie/ARFE
BalancedL1Loss
false
435
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
LinearMaxPoolLinearModel
import torch import torch.nn as nn class LinearMaxPoolLinearModel(nn.Module): def __init__(self): super().__init__() self.lin1 = nn.Linear(4, 4, bias=False) self.lin1.weight = nn.Parameter(torch.eye(4, 4)) self.pool1 = nn.MaxPool1d(4) self.lin2 = nn.Linear(1, 1, bias=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 import torch.nn as nn assert_...
Europium248/captum
LinearMaxPoolLinearModel
false
436
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
AdaptiveAvgMaxPool2d
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def adaptive_avgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_pool2d(x, output_size) return 0.5 * (x_avg + x_max) class AdaptiveAvgMaxPool2d(nn.Module): ...
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 torch.nn import functional as F import torch.nn.parallel asser...
Fanzhongjie/ARFE
AdaptiveAvgMaxPool2d
false
437
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
TinyCnn
import torch import torch.nn as nn class TinyCnn(nn.Module): def __init__(self, feature_extraction=False): super().__init__() self.feature_extraction = feature_extraction self.conv1 = nn.Conv2d(3, 3, 5) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2, 2) if not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Europium248/captum
TinyCnn
false
438
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
ConvNorm
import torch import torch.utils.data class ConvNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=None, dilation=1, bias=True, w_init_gain='linear'): super(ConvNorm, self).__init__() if padding is None: assert kernel_size % 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.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size...
FadyKhalaf/tacotron2
ConvNorm
false
439
[ "BSD-3-Clause" ]
0
d9bf28a6d286aab42bce46df9f26a9a3d7c2f01f
https://github.com/FadyKhalaf/tacotron2/tree/d9bf28a6d286aab42bce46df9f26a9a3d7c2f01f
TokenEmbedding
import torch import torch.nn as nn class TokenEmbedding(nn.Module): def __init__(self, c_in, d_model): super(TokenEmbedding, self).__init__() padding = 1 if torch.__version__ >= '1.5.0' else 2 self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model, kernel_size=3, pa...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Fanxingye/Informer2020
TokenEmbedding
false
440
[ "Apache-2.0" ]
0
94fd05f82ff0882681a9716ae3e980a574fdcbed
https://github.com/Fanxingye/Informer2020/tree/94fd05f82ff0882681a9716ae3e980a574fdcbed
BasicModel_ConvNet_MaxPool3d
import torch import torch.nn as nn class BasicModel_ConvNet_MaxPool3d(nn.Module): """Same as above, but with the MaxPool1d replaced with a MaxPool3d. This is useful because the MaxPool modules behave differently to other modules from the perspective of the DeepLift Attributions """ def __init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Europium248/captum
BasicModel_ConvNet_MaxPool3d
false
441
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
CrossEntropyLoss
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Red...
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 ...
Fanzhongjie/ARFE
CrossEntropyLoss
false
442
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
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...
Felicia980317/mytorch
h_sigmoid
false
443
[ "Apache-2.0" ]
0
e463122c0d402878ec5b4c5a823a0feeba8fdbfe
https://github.com/Felicia980317/mytorch/tree/e463122c0d402878ec5b4c5a823a0feeba8fdbfe
MedianPool2d
import torch from torch.nn.modules.utils import _pair import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel from torch.nn.modules.utils import _quadruple class MedianPool2d(nn.Module): """ Median pool (usable as median filter when stride=1) module. Args: kernel_size: si...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules.utils import _pair import torch.nn as nn import tor...
Fanzhongjie/ARFE
MedianPool2d
false
444
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
BasicModel_ConvNet_One_Conv
import torch from torch import Tensor import torch.nn as nn from typing import Optional from typing import no_type_check class BasicModel_ConvNet_One_Conv(nn.Module): def __init__(self, inplace: 'bool'=False): super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = 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 import torch.nn as nn assert_...
Europium248/captum
BasicModel_ConvNet_One_Conv
false
445
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
GCN1
from torch.nn import Module import math import torch import torch.nn.functional as F from torch import nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class sparse_dropout(Module): """ Sparse dropout implementation """ def __init__(self): super(sparse_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.nn import Module import math import torch.nn.functional as F from tor...
Eudialyte/SepGAT
GCN1
false
446
[ "MIT" ]
0
6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
https://github.com/Eudialyte/SepGAT/tree/6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
Tanh
import torch import torch.nn as nn import torch.nn.parallel class Tanh(nn.Module): def __init__(self, inplace: 'bool'=False): super(Tanh, self).__init__() self.inplace = inplace def forward(self, x): return x.tanh_() if self.inplace else x.tanh() def get_inputs(): return [torch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._d...
Fanzhongjie/ARFE
Tanh
false
448
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
SoftmaxDeepLiftModel
import torch import torch.nn as nn class SoftmaxDeepLiftModel(nn.Module): """ Model architecture from: https://adventuresinmachinelearning.com/pytorch-tutorial-deep-learning/ """ def __init__(self, num_in, num_hidden, num_out): super().__init__() self.num_in = num_in ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Europium248/captum
SoftmaxDeepLiftModel
false
449
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
SEModule
import torch import torch.nn as nn import torch.nn.parallel class SEModule(nn.Module): def __init__(self, channels, reduction=16, act_layer=nn.ReLU): super(SEModule, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) reduction_channels = max(channels // reduction, 8) self.fc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Fanzhongjie/ARFE
SEModule
false
450
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
MockModule
import torch import torch.nn as nn import torch.nn import torch.optim class MockModule(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(3, 16, kernel_size=1) def forward(self, x: 'torch.Tensor'): return self.conv(x).mean(3).mean(2) def get_inputs(): retu...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.optim assert_size_stride = to...
FebruaryBreeze/torch-parameter-groups
MockModule
false
451
[ "MIT" ]
0
e90c3d451c1afcfe5267801d5cfcc5413777b1d8
https://github.com/FebruaryBreeze/torch-parameter-groups/tree/e90c3d451c1afcfe5267801d5cfcc5413777b1d8
ShuffleBlock
import torch import torch.nn as nn class ShuffleBlock(nn.Module): def __init__(self, groups=2): super(ShuffleBlock, self).__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Fede112/pytorch-cifar
ShuffleBlock
false
452
[ "MIT" ]
0
2e89028e9aaabb22dd944f0002d29548059c24df
https://github.com/Fede112/pytorch-cifar/tree/2e89028e9aaabb22dd944f0002d29548059c24df
SplitAttnConv2d
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel class RadixSoftmax(nn.Module): def __init__(self, radix, cardinality): super(RadixSoftmax, self).__init__() self.radix = radix self.cardinality = cardinality def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Fanzhongjie/ARFE
SplitAttnConv2d
false
453
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
CNN
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self, input_size=50, hidden_size=256, dropout=0, kernel_size=3, padding=1, activation_function=F.relu): """ Args: input_size: dimention of input embedding kernel_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 import ...
Fatead/NER
CNN
false
454
[ "MIT" ]
0
142fabb2fcb1b730042da7acfde10199c62537d5
https://github.com/Fatead/NER/tree/142fabb2fcb1b730042da7acfde10199c62537d5
BasicModel_ConvNet
import torch from torch import Tensor import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2) self.conv2 = nn.C...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Europium248/captum
BasicModel_ConvNet
false
455
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc