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
ContrastiveLoss
import torch import torch.nn.functional as F class ContrastiveLoss(torch.nn.Module): """ Contrastive loss function. Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf """ def __init__(self, margin=2.0): super(ContrastiveLoss, self).__init__() self.margin =...
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 assert_size_stride = torch._...
Rajat-Mehta/Vehicle-Re-identification-UI
ContrastiveLoss
false
5,756
[ "MIT" ]
1
9769ae9dac8bd43a3b66f705cb2830fa498649d2
https://github.com/Rajat-Mehta/Vehicle-Re-identification-UI/tree/9769ae9dac8bd43a3b66f705cb2830fa498649d2
ConvLayer
import torch import torch.nn as nn from torch.nn.utils import weight_norm class ConvLayer(nn.Module): def __init__(self, input_units, output_units, filter_size, padding_sizes, dropout=0.2): super(ConvLayer, self).__init__() self.conv = weight_norm(nn.Conv1d(in_channels=input_units, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
RandolphVI/HyperNet
ConvLayer
false
5,757
[ "Apache-2.0" ]
1
e9f376f5eb087e57360ca41cca2533c3ca967e47
https://github.com/RandolphVI/HyperNet/tree/e9f376f5eb087e57360ca41cca2533c3ca967e47
UnfoldTemporalWindows
import torch import torch.nn as nn class UnfoldTemporalWindows(nn.Module): def __init__(self, window_size, window_stride, window_dilation=1): super().__init__() self.window_size = window_size self.window_stride = window_stride self.window_dilation = window_dilation self.pa...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Rgtemze/PersonalityRecognition
UnfoldTemporalWindows
false
5,758
[ "MIT" ]
1
90ddd9c02e595d685b8c395ae94d50090288d1f0
https://github.com/Rgtemze/PersonalityRecognition/tree/90ddd9c02e595d685b8c395ae94d50090288d1f0
DeepHeadModule
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed from math import sqrt as sqrt from itertools import product as product import torchvision.transforms.functional as F from torch.nn import functional ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
RedHenLab/RedHenAnonymizer
DeepHeadModule
false
5,759
[ "MIT" ]
1
3560f1ac5cd5b9c6c7ed8bf322b807d57aedc06a
https://github.com/RedHenLab/RedHenAnonymizer/tree/3560f1ac5cd5b9c6c7ed8bf322b807d57aedc06a
MaskedConv1d
import torch import torch.nn as nn class MaskedConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, groups=1, bias=True, causal=True): if causal: padding = (kernel_size - 1) * dilation else: padding = (kernel_size - 1) * dilatio...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Raiselimit/TorchBlocks
MaskedConv1d
false
5,760
[ "MIT" ]
1
a5baecb9a2470ff175087475630f2b7db3f7ef51
https://github.com/Raiselimit/TorchBlocks/tree/a5baecb9a2470ff175087475630f2b7db3f7ef51
KdCeLoss
import torch import torch.nn as nn import torch.nn.functional as F class KdCeLoss(nn.Module): def __init__(self): super().__init__() def forward(self, logits_S, logits_T, temperature=1): """ Calculate the cross entropy between logits_S and logits_T :param logits_S: Tensor of...
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 ...
Raiselimit/TorchBlocks
KdCeLoss
false
5,761
[ "MIT" ]
1
a5baecb9a2470ff175087475630f2b7db3f7ef51
https://github.com/Raiselimit/TorchBlocks/tree/a5baecb9a2470ff175087475630f2b7db3f7ef51
Loss
import torch import torch.nn as nn class Loss(nn.Module): def __init__(self): super(Loss, self).__init__() self.BCELoss = nn.BCELoss(reduce=True, size_average=True) def forward(self, predict_y, input_y): loss = self.BCELoss(predict_y, input_y) return loss 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
RandolphVI/HyperNet
Loss
false
5,762
[ "Apache-2.0" ]
1
e9f376f5eb087e57360ca41cca2533c3ca967e47
https://github.com/RandolphVI/HyperNet/tree/e9f376f5eb087e57360ca41cca2533c3ca967e47
ContentLoss
import torch from torch import nn class ContentLoss(nn.Module): """Module to compute the content loss. Allows arbitrary size style images during initialization and updating the content target. Usage: During loss network definition set compute_loss to False, to allow, after initialization iterate throu...
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...
RicCu/NeuralStyle
ContentLoss
false
5,763
[ "MIT" ]
1
97dc6aec6b2072a9a187276e047aea885566e1be
https://github.com/RicCu/NeuralStyle/tree/97dc6aec6b2072a9a187276e047aea885566e1be
LRN
import torch import torch.nn as nn import torch.utils.data class LRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS=True ): super(LRN, self).__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if ACROSS_CHANNELS: self.average = nn.AvgP...
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...
Richard456/Dann
LRN
false
5,764
[ "MIT" ]
1
1971cf1a7b9ecadc17932a8ecb3f0c34609751a3
https://github.com/Richard456/Dann/tree/1971cf1a7b9ecadc17932a8ecb3f0c34609751a3
Conv2dTime
import torch import torch.nn as nn class Conv2dTime(nn.Conv2d): def __init__(self, in_channels, *args, **kwargs): """ Code adapted from https://github.com/EmilienDupont/augmented-neural-odes Conv2d module where time gets concatenated as a feature map. Makes ODE func aware of the ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Ravimk07/neural-odes-segmentation
Conv2dTime
false
5,765
[ "MIT" ]
1
aebda2df029e447ed6a649778ea2f8ea5a169081
https://github.com/Ravimk07/neural-odes-segmentation/tree/aebda2df029e447ed6a649778ea2f8ea5a169081
ActivationQuantizer
from torch.autograd import Function import torch import torch.nn as nn class Round(Function): @staticmethod def forward(self, input): output = torch.round(input) return output @staticmethod def backward(self, grad_output): grad_input = grad_output.clone() return grad_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.autograd import F...
RiccardoRuggiero/micronet
ActivationQuantizer
false
5,766
[ "MIT" ]
1
bfdac2a50a5f0f8484a253b356c06a166bf7e6a0
https://github.com/RiccardoRuggiero/micronet/tree/bfdac2a50a5f0f8484a253b356c06a166bf7e6a0
ConvTran
import torch from torch import nn from torch.nn import functional as F class ConvTran(nn.Module): def __init__(self, in_channels, out_channels): super(ConvTran, self).__init__() self.conv_t = nn.ConvTranspose2d(in_channels, out_channels, 3, 2, 1, 1) self.batch_norm = nn.InstanceNorm2d(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....
RicCu/NeuralStyle
ConvTran
false
5,767
[ "MIT" ]
1
97dc6aec6b2072a9a187276e047aea885566e1be
https://github.com/RicCu/NeuralStyle/tree/97dc6aec6b2072a9a187276e047aea885566e1be
WeightQuantizer
from torch.autograd import Function import torch import torch.nn as nn class Round(Function): @staticmethod def forward(self, input): output = torch.round(input) return output @staticmethod def backward(self, grad_output): grad_input = grad_output.clone() return grad_...
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....
RiccardoRuggiero/micronet
WeightQuantizer
false
5,768
[ "MIT" ]
1
bfdac2a50a5f0f8484a253b356c06a166bf7e6a0
https://github.com/RiccardoRuggiero/micronet/tree/bfdac2a50a5f0f8484a253b356c06a166bf7e6a0
Attention
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the output features from the decoder. .. math:: \\begin{array}{ll} x = context*output \\\\ attn = exp(x_i) / sum_j exp(x_j) \\\\ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Replie/replie-pythorch
Attention
false
5,769
[ "Apache-2.0" ]
1
b432f88fcd0b3275d18abee7e2909b997570a5dc
https://github.com/Replie/replie-pythorch/tree/b432f88fcd0b3275d18abee7e2909b997570a5dc
Generator_mnist
from _paritybench_helpers import _mock_config import torch import torch.utils.data from torch import nn import torch.nn.parallel from collections import OrderedDict class Generator_mnist(nn.Module): def __init__(self, opt): super(Generator_mnist, self).__init__() self.decoder = nn.Sequential(Orde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
RicoFio/disentangle_mlp
Generator_mnist
false
5,770
[ "MIT" ]
1
1fb3b6070b5846051b8b9e9333e8ee61418f4893
https://github.com/RicoFio/disentangle_mlp/tree/1fb3b6070b5846051b8b9e9333e8ee61418f4893
FocalLoss
import torch class FocalLoss(torch.nn.Module): def __init__(self, gamma=2, alpha=0.5, size_average=True): super(FocalLoss, self).__init__() self.gamma = gamma self.alpha = alpha self.size_average = size_average self.elipson = 1e-06 def forward(self, logits, labels): ...
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 assert_size_stride = t...
RuiBai1999/HiMatch
FocalLoss
false
5,771
[ "MIT" ]
1
199ebc6b06b3cce2b3f2298cb9e20f81c01dc7a6
https://github.com/RuiBai1999/HiMatch/tree/199ebc6b06b3cce2b3f2298cb9e20f81c01dc7a6
GCNdecoder
from torch.nn import Module import math import torch import torch.nn as nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module from torch.nn import functional as F class GCN(Module): """ Graph Convolutional Network """ def __init__(self, in_features, out_features, 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 import triton_helpers from torch.nn import Module i...
Roxbili/topoGAN
GCNdecoder
false
5,772
[ "MIT" ]
1
25cc397bf8925e485d3a39837b8bce552118f5dc
https://github.com/Roxbili/topoGAN/tree/25cc397bf8925e485d3a39837b8bce552118f5dc
MultiHeadAttention
import torch import torch.utils.data from torch import nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """ input: query --- [N, T_q, query_dim] key --- [N, T_k, key_dim] output: out --- [N, T_q, num_units] """ def __init__(self, query_dim, key_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....
Regnac/Emotional_TTS
MultiHeadAttention
false
5,773
[ "BSD-3-Clause" ]
1
38158f622d6a3e14e4b5539f2c2ee34e7cd88885
https://github.com/Regnac/Emotional_TTS/tree/38158f622d6a3e14e4b5539f2c2ee34e7cd88885
Residual
import torch from torch import nn from torch.nn import functional as F class Residual(nn.Module): """Unlinke other blocks, this module receives unpadded inputs.""" def __init__(self, channels, kernel_size=3): super(Residual, self).__init__() padding = int((kernel_size - 1) / 2) self.p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
RicCu/NeuralStyle
Residual
false
5,774
[ "MIT" ]
1
97dc6aec6b2072a9a187276e047aea885566e1be
https://github.com/RicCu/NeuralStyle/tree/97dc6aec6b2072a9a187276e047aea885566e1be
_BoundaryRefineModule
import torch import torch.nn as nn from torch.optim.lr_scheduler import * class _BoundaryRefineModule(nn.Module): def __init__(self, dim): super(_BoundaryRefineModule, self).__init__() self.relu = nn.ReLU(inplace=True) self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
Rocketbase-AI/rockets-mobilepose
_BoundaryRefineModule
false
5,775
[ "MIT" ]
1
be7273dff7fcf7d1023f431f4b63ac8d82978182
https://github.com/Rocketbase-AI/rockets-mobilepose/tree/be7273dff7fcf7d1023f431f4b63ac8d82978182
Discriminator
from torch.nn import Module import math import torch import torch.nn as nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module from torch.nn import functional as F class GCN(Module): """ Graph Convolutional Network """ def __init__(self, in_features, out_features, 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 import triton_helpers from torch._inductor.runtime....
Roxbili/topoGAN
Discriminator
false
5,776
[ "MIT" ]
1
25cc397bf8925e485d3a39837b8bce552118f5dc
https://github.com/Roxbili/topoGAN/tree/25cc397bf8925e485d3a39837b8bce552118f5dc
_TextureConvGroup
import torch from torch import nn from torch.nn import functional as F def reflect_padding(x, f, s, half=False): if half: denom = 2 else: denom = 1 _, _, h, w = x.shape pad_w = w * (s / denom - 1) + f - s pad_h = h * (s / denom - 1) + f - s if pad_w % 2 == 1: pad_l = 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.triton_helpers import libdevice, math as tl_math fr...
RicCu/NeuralStyle
_TextureConvGroup
false
5,777
[ "MIT" ]
1
97dc6aec6b2072a9a187276e047aea885566e1be
https://github.com/RicCu/NeuralStyle/tree/97dc6aec6b2072a9a187276e047aea885566e1be
MLP3_clamp_eval
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class MLP3_clamp_eval(nn.Module): def __init__(self): super(MLP3_clamp_eval, self).__init__() self.fc1 = nn.Linear(32 * 32, 51...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
RuokaiYin/UnarySim
MLP3_clamp_eval
false
5,778
[ "MIT" ]
1
343ff9abf356a63d526b1df8eb946ad528690a27
https://github.com/RuokaiYin/UnarySim/tree/343ff9abf356a63d526b1df8eb946ad528690a27
HUBHardsigmoid
import torch import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class HUBHardsigmoid(torch.nn.Module): """ This is a hub scaled addition (x+1)/2. """ def __init__(self, scale=3): super(HUBHardsigmoid, self).__init__() self.scale = s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.da...
RuokaiYin/UnarySim
HUBHardsigmoid
false
5,779
[ "MIT" ]
1
343ff9abf356a63d526b1df8eb946ad528690a27
https://github.com/RuokaiYin/UnarySim/tree/343ff9abf356a63d526b1df8eb946ad528690a27
MLP3
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class MLP3(nn.Module): def __init__(self, width=512, p=0.5): super(MLP3, self).__init__() self.fc1 = nn.Linear(32 * 32, width)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
RuokaiYin/UnarySim
MLP3
false
5,780
[ "MIT" ]
1
343ff9abf356a63d526b1df8eb946ad528690a27
https://github.com/RuokaiYin/UnarySim/tree/343ff9abf356a63d526b1df8eb946ad528690a27
MLP3_clamp_train
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class MLP3_clamp_train(nn.Module): """ For unary training, activation clamp is better to be after relu. no difference for inference whe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
RuokaiYin/UnarySim
MLP3_clamp_train
false
5,781
[ "MIT" ]
1
343ff9abf356a63d526b1df8eb946ad528690a27
https://github.com/RuokaiYin/UnarySim/tree/343ff9abf356a63d526b1df8eb946ad528690a27
FEM
import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed from math import sqrt as sqrt from itertools import product as product import torchvision.transforms.functional as F from torch.nn import functional ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
RedHenLab/RedHenAnonymizer
FEM
false
5,782
[ "MIT" ]
1
3560f1ac5cd5b9c6c7ed8bf322b807d57aedc06a
https://github.com/RedHenLab/RedHenAnonymizer/tree/3560f1ac5cd5b9c6c7ed8bf322b807d57aedc06a
TVLoss
import torch from torch import nn class TVLoss(nn.Module): """Implements Anisotropic Total Variation regularization""" def __init__(self): super(TVLoss, self).__init__() self.criterion = nn.L1Loss() def forward(self, x): X = x.detach() XX = x _b, _c, h, w = X.shap...
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 import nn assert_size_stride = torch._C._dynamo.guards.assert_...
RicCu/NeuralStyle
TVLoss
false
5,783
[ "MIT" ]
1
97dc6aec6b2072a9a187276e047aea885566e1be
https://github.com/RicCu/NeuralStyle/tree/97dc6aec6b2072a9a187276e047aea885566e1be
MLP3_hardsig
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class MLP3_hardsig(nn.Module): def __init__(self, width=512, p=0.5): super(MLP3_hardsig, self).__init__() self.fc1 = nn.Linear...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
RuokaiYin/UnarySim
MLP3_hardsig
false
5,784
[ "MIT" ]
1
343ff9abf356a63d526b1df8eb946ad528690a27
https://github.com/RuokaiYin/UnarySim/tree/343ff9abf356a63d526b1df8eb946ad528690a27
EntropyLoss
import torch import numpy as np from torch import nn from torch.nn import functional as F class EntropyLoss(nn.Module): """ Module to compute entropy loss """ def __init__(self, normalize): super(EntropyLoss, self).__init__() self.normalize = normalize def forward(self, x): eps =...
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 ...
SAP-samples/emnlp2021-attention-contrastive-learning
EntropyLoss
false
5,785
[ "Apache-2.0" ]
1
dfad1c7c416d963b1b9b018d4182bebbb11ecf1c
https://github.com/SAP-samples/emnlp2021-attention-contrastive-learning/tree/dfad1c7c416d963b1b9b018d4182bebbb11ecf1c
PKT
import torch import torch.nn as nn import torch.optim class PKT(nn.Module): """Probabilistic Knowledge Transfer for deep representation learning Code from author: https://github.com/passalis/probabilistic_kt""" def __init__(self): super(PKT, self).__init__() def forward(self, f_s, f_t): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
RylanSchaeffer/RepDistiller
PKT
false
5,786
[ "BSD-2-Clause" ]
1
3612d9d8f6f913527c7aaec7e5ea557e72ed7c5e
https://github.com/RylanSchaeffer/RepDistiller/tree/3612d9d8f6f913527c7aaec7e5ea557e72ed7c5e
HardMGUCell
import math import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F from typing import Optional import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed def truncated_normal(t, mean=0.0, std=0.01): torch.nn.init.normal_(t, mean=mea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.nn a...
RuokaiYin/UnarySim
HardMGUCell
false
5,787
[ "MIT" ]
1
343ff9abf356a63d526b1df8eb946ad528690a27
https://github.com/RuokaiYin/UnarySim/tree/343ff9abf356a63d526b1df8eb946ad528690a27
FactorTransfer
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class FactorTransfer(nn.Module): """Paraphrasing Complex Network: Network Compression via Factor Transfer, NeurIPS 2018""" def __init__(self, p1=2, p2=1): super(FactorTransfer, self).__init__() self.p1 = p1 ...
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...
RylanSchaeffer/RepDistiller
FactorTransfer
false
5,788
[ "BSD-2-Clause" ]
1
3612d9d8f6f913527c7aaec7e5ea557e72ed7c5e
https://github.com/RylanSchaeffer/RepDistiller/tree/3612d9d8f6f913527c7aaec7e5ea557e72ed7c5e
RKDLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class RKDLoss(nn.Module): """Relational Knowledge Disitllation, CVPR2019""" def __init__(self, w_d=25, w_a=50): super(RKDLoss, self).__init__() self.w_d = w_d self.w_a = w_a def forward(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....
RylanSchaeffer/RepDistiller
RKDLoss
false
5,789
[ "BSD-2-Clause" ]
1
3612d9d8f6f913527c7aaec7e5ea557e72ed7c5e
https://github.com/RylanSchaeffer/RepDistiller/tree/3612d9d8f6f913527c7aaec7e5ea557e72ed7c5e
PA
import torch import torch.nn as nn class PA(nn.Module): def __init__(self, dim): super().__init__() self.pa_conv = nn.Conv3d(dim, dim, kernel_size=3, padding=1, groups=dim ) self.sigmoid = nn.Sigmoid() def forward(self, x): return x * self.sigmoid(self.pa_conv(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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
SLKaMiHi/ResT-UNet-unsupervised-medical-image-registration-network-based-on-Transformer-and-CNN
PA
false
5,790
[ "MIT" ]
1
728624f978f345a1e713046a7dde12d6f84fd3dd
https://github.com/SLKaMiHi/ResT-UNet-unsupervised-medical-image-registration-network-based-on-Transformer-and-CNN/tree/728624f978f345a1e713046a7dde12d6f84fd3dd
MLP
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self, input_size, output_size): super(MLP, self).__init__() self.fc1 = nn.Linear(input_size, 100) self.policy = nn.Linear(100, output_size) self.value = nn.Linear(100, 1) 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 assert_...
SaneBow/AttentionAgentCarRacing
MLP
false
5,791
[ "Apache-2.0" ]
1
944dc18b99b2c51a25c206f722a0bbc43cb7bbb0
https://github.com/SaneBow/AttentionAgentCarRacing/tree/944dc18b99b2c51a25c206f722a0bbc43cb7bbb0
Mlp
import torch import torch.nn as nn import torch.nn.functional import torch.nn.parallel import torch.utils.data import torch.optim import torch.utils.data.distributed class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
SCIIX/CV-Backbones
Mlp
false
5,792
[ "Apache-2.0" ]
1
c76acf0742d8c0b7be9bd061ae2a7b247fa618ef
https://github.com/SCIIX/CV-Backbones/tree/c76acf0742d8c0b7be9bd061ae2a7b247fa618ef
SPoC_pooling
import torch import torch.nn as nn class SPoC_pooling(nn.Module): def __init__(self): super(SPoC_pooling, self).__init__() def forward(self, x): dim = x.size() pool = nn.AvgPool2d(dim[-1]) x = pool(x) return x.view(dim[0], dim[1]) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
SIJIEJI/2020-ai-meets-beauty_ntubeauty
SPoC_pooling
false
5,793
[ "MIT" ]
1
fede564fb3e3029f3fadfe107484c5c7e39c29c5
https://github.com/SIJIEJI/2020-ai-meets-beauty_ntubeauty/tree/fede564fb3e3029f3fadfe107484c5c7e39c29c5
ConcatAvgMaxPooling
import torch import torch.nn as nn class ConcatAvgMaxPooling(nn.Module): def __init__(self, kernel_size=12, stride=1): super(ConcatAvgMaxPooling, self).__init__() self.avgpool = nn.AvgPool2d(kernel_size, stride=1) self.maxpool = nn.MaxPool2d(kernel_size, stride=1) def forward(self, x...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
SamitHuang/CELNet
ConcatAvgMaxPooling
false
5,794
[ "MIT" ]
1
51e067fdb16e723a45a0a60399d568b58cdc011d
https://github.com/SamitHuang/CELNet/tree/51e067fdb16e723a45a0a60399d568b58cdc011d
SelfAttention
import torch import torch.nn as nn class SelfAttention(nn.Module): """A simple self-attention solution.""" def __init__(self, data_dim, dim_q): super(SelfAttention, self).__init__() self._layers = [] self._fc_q = nn.Linear(data_dim, dim_q) self._layers.append(self._fc_q) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
SaneBow/AttentionAgentCarRacing
SelfAttention
false
5,795
[ "Apache-2.0" ]
1
944dc18b99b2c51a25c206f722a0bbc43cb7bbb0
https://github.com/SaneBow/AttentionAgentCarRacing/tree/944dc18b99b2c51a25c206f722a0bbc43cb7bbb0
fullyCon
import torch import torch.nn as nn import torch.nn.functional as F class fullyCon(nn.Module): def __init__(self): super(fullyCon, self).__init__() self.fc1 = nn.Linear(448 * 3 * 448, 500) self.fc2 = nn.Linear(500, 100) self.fc3 = nn.Linear(100, 5) 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 import torch.nn as nn assert_...
Lightingooo/-
fullyCon
false
5,796
[ "MIT" ]
1
7b48c2689b693617e46992ac081065cf08f14bf8
https://github.com/Lightingooo/-/tree/7b48c2689b693617e46992ac081065cf08f14bf8
DQN
import torch import torch.nn as nn import torch.nn.functional as F class DQN(nn.Module): def __init__(self, inputs, outputs): super(DQN, self).__init__() val = int((inputs + outputs) / 2) self.fc1 = nn.Linear(inputs, val) self.fc2 = nn.Linear(val, val) self.fc3 = nn.Linear...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Sai-56/Multi-Agent-DQN-Routing
DQN
false
5,797
[ "MIT" ]
1
c8e7038bd0dfb69b3bdbdeb60ff9b98bb081e95e
https://github.com/Sai-56/Multi-Agent-DQN-Routing/tree/c8e7038bd0dfb69b3bdbdeb60ff9b98bb081e95e
SpatialAttention
import torch import torch.nn as nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=3, multi_branch=False): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' self.conv1 = nn.Conv2d(2, 1, 3, padding=1, bias=False) 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_...
SamitHuang/CELNet
SpatialAttention
false
5,798
[ "MIT" ]
1
51e067fdb16e723a45a0a60399d568b58cdc011d
https://github.com/SamitHuang/CELNet/tree/51e067fdb16e723a45a0a60399d568b58cdc011d
RegWeightedL1Loss
import torch import torch.nn as nn import torch.nn.functional as F def _gather_feat(feat, ind, mask=None): dim = feat.size(2) ind = ind.unsqueeze(2).expand(ind.size(0), ind.size(1), dim) feat = feat.gather(1, ind) if mask is not None: mask = mask.unsqueeze(2).expand_as(feat) feat = fea...
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 ...
SaqibMamoon/GSDT
RegWeightedL1Loss
false
5,799
[ "MIT" ]
1
e11c52a67291e973016ed34c3c95659e0af32d48
https://github.com/SaqibMamoon/GSDT/tree/e11c52a67291e973016ed34c3c95659e0af32d48
RawScale
import torch import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class RawScale(torch.nn.Module): """ Scale raw data to [-1, 1] in a symmetric manner, which meets bipolar/unipolar bitstream requirements. The remaining data count for 'quantile' quantile o...
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...
RuokaiYin/UnarySim
RawScale
false
5,800
[ "MIT" ]
1
343ff9abf356a63d526b1df8eb946ad528690a27
https://github.com/RuokaiYin/UnarySim/tree/343ff9abf356a63d526b1df8eb946ad528690a27
Base
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class Base(nn.Module): """docstring for Base""" def __init__(self, view_space, feature_space, num_actions, hidden_size): super(Base, self).__init__() self.view_space = view_space self.feature_space =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
SJTUwbl/mfrl_pytorch
Base
false
5,801
[ "MIT" ]
1
2b385121cc9a8aa16ed6d554d1dc10f02f2fc5d9
https://github.com/SJTUwbl/mfrl_pytorch/tree/2b385121cc9a8aa16ed6d554d1dc10f02f2fc5d9
CrossLayer
import torch import torch.nn as nn import torch.optim class CrossLayer(nn.Module): def __init__(self, d, dropout): super().__init__() self.linear = nn.Linear(d, d) self.dropout = nn.Dropout(dropout) def forward(self, x0, x): return self.dropout(x0 * self.linear(x)) + x 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 import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo.g...
SauravMaheshkar/rtdl
CrossLayer
false
5,802
[ "Apache-2.0" ]
1
c3f8051210d1cd7fdffc5a63221e3c4e84415ed8
https://github.com/SauravMaheshkar/rtdl/tree/c3f8051210d1cd7fdffc5a63221e3c4e84415ed8
RegLoss
import torch import torch.nn as nn def _reg_loss(regr, gt_regr, mask): """ L1 regression loss Arguments: regr (batch x max_objects x dim) gt_regr (batch x max_objects x dim) mask (batch x max_objects) """ num = mask.float().sum() mask = mask.unsqueeze(2).expand_as(gt_regr).float() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
SaqibMamoon/GSDT
RegLoss
false
5,803
[ "MIT" ]
1
e11c52a67291e973016ed34c3c95659e0af32d48
https://github.com/SaqibMamoon/GSDT/tree/e11c52a67291e973016ed34c3c95659e0af32d48
SpRes
import torch import torch.nn as nn class SpRes(nn.Module): def __init__(self, in_channels=31): super(SpRes, self).__init__() self.conv1 = nn.Conv2d(in_channels=31, out_channels=3, bias=False, kernel_size=1, stride=1) def forward(self, x): x = self.conv1(x) x = 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.triton_helpers import libdevice import torch.nn as ...
SeVEnMY/hyper-reconstruction
SpRes
false
5,804
[ "MIT" ]
1
018c34aaf6884650c36a73bd7f4635f927a79da3
https://github.com/SeVEnMY/hyper-reconstruction/tree/018c34aaf6884650c36a73bd7f4635f927a79da3
L2N
import torch import torch.nn as nn class L2N(nn.Module): def __init__(self, eps=1e-06): super(L2N, self).__init__() self.eps = eps def forward(self, x): return x / (torch.norm(x, p=2, dim=1, keepdim=True) + self.eps ).expand_as(x) def __repr__(self): return 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_...
SIJIEJI/2020-ai-meets-beauty_ntubeauty
L2N
false
5,805
[ "MIT" ]
1
fede564fb3e3029f3fadfe107484c5c7e39c29c5
https://github.com/SIJIEJI/2020-ai-meets-beauty_ntubeauty/tree/fede564fb3e3029f3fadfe107484c5c7e39c29c5
Correlation
import torch import torch.nn as nn import torch.optim class Correlation(nn.Module): """Correlation Congruence for Knowledge Distillation, ICCV 2019. The authors nicely shared the code with me. I restructured their code to be compatible with my running framework. Credits go to the original author""" ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.optim assert_size_stride = torch._C._d...
RylanSchaeffer/RepDistiller
Correlation
false
5,806
[ "BSD-2-Clause" ]
1
3612d9d8f6f913527c7aaec7e5ea557e72ed7c5e
https://github.com/RylanSchaeffer/RepDistiller/tree/3612d9d8f6f913527c7aaec7e5ea557e72ed7c5e
SobelConv
import torch import torch.nn as nn class SobelConv(nn.Module): def __init__(self, in_channel=31, batch_num=16): super(SobelConv, self).__init__() self.bz = batch_num self.in_channel = in_channel self.convx = nn.Conv2d(in_channels=31, out_channels=31, kernel_size =3, st...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
SeVEnMY/hyper-reconstruction
SobelConv
false
5,807
[ "MIT" ]
1
018c34aaf6884650c36a73bd7f4635f927a79da3
https://github.com/SeVEnMY/hyper-reconstruction/tree/018c34aaf6884650c36a73bd7f4635f927a79da3
CustomizedLayer
import torch import torch.nn as nn import torch.utils.data class CustomizedLayer(nn.Module): def __init__(self, in_dim): super().__init__() self.in_dim = in_dim self.scale = nn.Parameter(torch.Tensor(self.in_dim)) self.bias = nn.Parameter(torch.Tensor(self.in_dim)) def forwar...
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...
Serjio42/Torch-Pruning
CustomizedLayer
false
5,808
[ "MIT" ]
1
8a096df38ddd95a2db39eca5f87b8a26c8d134ef
https://github.com/Serjio42/Torch-Pruning/tree/8a096df38ddd95a2db39eca5f87b8a26c8d134ef
FastStyle
import torch from torch import nn from torch.nn import functional as F def reflect_padding(x, f, s, half=False): if half: denom = 2 else: denom = 1 _, _, h, w = x.shape pad_w = w * (s / denom - 1) + f - s pad_h = h * (s / denom - 1) + f - s if pad_w % 2 == 1: pad_l = 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....
RicCu/NeuralStyle
FastStyle
false
5,809
[ "MIT" ]
1
97dc6aec6b2072a9a187276e047aea885566e1be
https://github.com/RicCu/NeuralStyle/tree/97dc6aec6b2072a9a187276e047aea885566e1be
ConvNet
import torch import torch.nn as nn class ConvNet(nn.Module): def __init__(self): super(ConvNet, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size= 5, padding=2) self.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size =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 import triton_helpers import torch.nn as nn assert_...
SGeetansh/dffml
ConvNet
false
5,810
[ "MIT" ]
1
04647bdcadef2f7e7b59cdd8ac1e89f17ef1095b
https://github.com/SGeetansh/dffml/tree/04647bdcadef2f7e7b59cdd8ac1e89f17ef1095b
SoftCrossEntropyLoss
import torch from torch import Tensor from typing import List import torch.nn as nn import torch.nn.functional as F class SoftCrossEntropyLoss(nn.Module): """ Calculate the CrossEntropyLoss with soft targets :param weight: Weight to assign to each of the classes. Default: None :type weight: list of f...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from typing import Lis...
SenWu/fonduer
SoftCrossEntropyLoss
false
5,811
[ "MIT" ]
1
c4f8d95cec97552b34412c6787eb7370ae17424f
https://github.com/SenWu/fonduer/tree/c4f8d95cec97552b34412c6787eb7370ae17424f
LocalizationNet
import torch import torch.utils.data import torch.nn as nn class LocalizationNet(nn.Module): def __init__(self, inplanes, inputsize, nheads=1, use_bn=False): super(LocalizationNet, self).__init__() inputH, inputW = inputsize self.use_bn = use_bn if self.use_bn: None ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
Sanny26/indic-htr
LocalizationNet
false
5,812
[ "MIT" ]
1
c473573b05c251f6e266cbd69acaa7ab18837f37
https://github.com/Sanny26/indic-htr/tree/c473573b05c251f6e266cbd69acaa7ab18837f37
Mac_Pooling
import torch import torch.nn as nn class Mac_Pooling(nn.Module): def __init__(self): super(Mac_Pooling, self).__init__() def forward(self, x): dim = x.size() pool = nn.MaxPool2d(dim[-1]) x = pool(x) return x.view(dim[0], dim[1]) def get_inputs(): return [torch.r...
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...
SIJIEJI/2020-ai-meets-beauty_ntubeauty
Mac_Pooling
false
5,813
[ "MIT" ]
1
fede564fb3e3029f3fadfe107484c5c7e39c29c5
https://github.com/SIJIEJI/2020-ai-meets-beauty_ntubeauty/tree/fede564fb3e3029f3fadfe107484c5c7e39c29c5
TARNetPhi
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class TARNetPhi(nn.Module): def __init__(self, input_nodes, shared_nodes=200): super(TARNetPhi, self).__init__() self.shared1 = nn.Linear(in_features=input_nodes, out_features= shared_nodes) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Shantanu48114860/PSSAM-GAN
TARNetPhi
false
5,814
[ "MIT" ]
1
c883431c1d0ebbb42691483f8ac8efaab65410b6
https://github.com/Shantanu48114860/PSSAM-GAN/tree/c883431c1d0ebbb42691483f8ac8efaab65410b6
Mix
import torch import torch.nn as nn class Mix(nn.Module): def __init__(self, m=-0.8): super(Mix, self).__init__() w = torch.nn.Parameter(torch.FloatTensor([m]), requires_grad=True) w = torch.nn.Parameter(w, requires_grad=True) self.w = w self.mix_block = nn.Sigmoid() d...
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...
ShenZheng2000/Syn2Real-Pytorch
Mix
false
5,815
[ "MIT" ]
1
214c800914e2bcd57d4ca74a4c8476a11e1b5905
https://github.com/ShenZheng2000/Syn2Real-Pytorch/tree/214c800914e2bcd57d4ca74a4c8476a11e1b5905
Attention
import torch import torch.nn.functional as F import torch.nn as nn class Attention(nn.Module): """ Computing the attention over the words """ def __init__(self, input_dim, proj_dim): super(Attention, self).__init__() self.input_dim = input_dim self.proj_dim = proj_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....
Sein-Jang/R2A
Attention
false
5,816
[ "MIT" ]
1
f70b69cedb4de3dd60a36963c4b6a881d9d090ee
https://github.com/Sein-Jang/R2A/tree/f70b69cedb4de3dd60a36963c4b6a881d9d090ee
StochasticGate
import torch import torchvision.transforms.functional as F import torch.nn as nn import torch.nn.functional as F class StochasticGate(nn.Module): """Stochastically merges features from two levels with varying size of the receptive field """ def __init__(self): super(StochasticGate, self).__i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
SharhadBashar/1-stage-wseg
StochasticGate
false
5,817
[ "Apache-2.0" ]
1
83bf13444f5039ffed2de1605f09b3f90b525586
https://github.com/SharhadBashar/1-stage-wseg/tree/83bf13444f5039ffed2de1605f09b3f90b525586
Network
import torch import torch.nn as nn import torch.nn.functional as F class Network(nn.Module): def __init__(self, n_feature, n_hidden, n_output): super(Network, self).__init__() self.fc = torch.nn.Linear(n_feature, n_hidden) self.out = torch.nn.Linear(n_hidden, n_output) def forward(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ShiZhuming/ChallengeCup
Network
false
5,818
[ "MIT" ]
1
c422d1e9864e2bc663a3ddb5e3487a04a0525fcc
https://github.com/ShiZhuming/ChallengeCup/tree/c422d1e9864e2bc663a3ddb5e3487a04a0525fcc
SpatialPyramidPooling
import torch import torch.nn as nn class SpatialPyramidPooling(nn.Module): def __init__(self, pool_sizes=[5, 9, 13]): super(SpatialPyramidPooling, self).__init__() self.maxpools = nn.ModuleList([nn.MaxPool2d(pool_size, 1, pool_size // 2) for pool_size in pool_sizes]) 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...
SekiroRong/YOLOP
SpatialPyramidPooling
false
5,819
[ "MIT" ]
1
e59628925dfaadfa549790cd0cf1c8a7e1139a2c
https://github.com/SekiroRong/YOLOP/tree/e59628925dfaadfa549790cd0cf1c8a7e1139a2c
M
import torch import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed class M(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x, y): y = torch.cat([x, y]) return y def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed as...
ShuaihuaLu/examples
M
false
5,820
[ "BSD-3-Clause" ]
1
2639cf050493df9d3cbf065d45e6025733add0f4
https://github.com/ShuaihuaLu/examples/tree/2639cf050493df9d3cbf065d45e6025733add0f4
SoftDiceLossSquared
import torch import numpy as np from torch import nn import torch.jit import torch.nn.functional def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=Tr...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np from torch import nn import torch.jit import torch.nn.functional assert_size_stride = torch._C._dynamo.guards.assert_size...
ShishuaiHu/DCAC
SoftDiceLossSquared
false
5,821
[ "MIT" ]
1
de04d00edde1b38385a8e5aade7541e2c22807e7
https://github.com/ShishuaiHu/DCAC/tree/de04d00edde1b38385a8e5aade7541e2c22807e7
Foo
import torch import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed def add_lowp(a: 'torch.Tensor', b: 'torch.Tensor'): a, b = a.float(), b.float() c = a + b return c.half() def sigmoid_lowp(x: 'torch.Tensor'): x = 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.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed as...
ShuaihuaLu/examples
Foo
false
5,822
[ "BSD-3-Clause" ]
1
2639cf050493df9d3cbf065d45e6025733add0f4
https://github.com/ShuaihuaLu/examples/tree/2639cf050493df9d3cbf065d45e6025733add0f4
TripletLoss
import torch from torch import nn class TripletLoss(nn.Module): def __init__(self, margin): super(TripletLoss, self).__init__() self.margin = margin self.relu = nn.ReLU() def forward(self, anchor, positive, negative, size_average=True): cosine_positive = nn.CosineSimilarity(d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
SeungHeonDoh/music_zeroshot_models
TripletLoss
false
5,823
[ "MIT" ]
1
38f80df868da357f3cb30522ad2e2031f0bc184e
https://github.com/SeungHeonDoh/music_zeroshot_models/tree/38f80df868da357f3cb30522ad2e2031f0bc184e
_Enc
import torch class _NestedEnc(torch.nn.Module): def __init__(self, f): super().__init__() self.f = f def forward(self, x): return self.f(x) class _Enc(torch.nn.Module): def __init__(self): super().__init__() self.e1 = _NestedEnc(torch.nn.Linear(4, 2)) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cu...
SimonNick/metakbc
_Enc
false
5,825
[ "MIT" ]
1
b502104e00afcb274c673ecd3aaa0415933e745e
https://github.com/SimonNick/metakbc/tree/b502104e00afcb274c673ecd3aaa0415933e745e
FocalLossBinary
import torch import torch.nn.functional as F import torch.jit import torch.nn.functional from functools import partial from torch.nn.modules.loss import _Loss def reduced_focal_loss(outputs: 'torch.Tensor', targets: 'torch.Tensor', threshold: 'float'=0.5, gamma: 'float'=2.0, reduction='mean'): """ Compute...
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...
ShishuaiHu/DCAC
FocalLossBinary
false
5,826
[ "MIT" ]
1
de04d00edde1b38385a8e5aade7541e2c22807e7
https://github.com/ShishuaiHu/DCAC/tree/de04d00edde1b38385a8e5aade7541e2c22807e7
GDL
import torch import numpy as np from torch import nn import torch.jit import torch.nn.functional def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=Tr...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np from torch import nn import torch.jit import torch.nn.functional assert_size_stride = torch._C._dynamo.guards.assert_size...
ShishuaiHu/DCAC
GDL
false
5,827
[ "MIT" ]
1
de04d00edde1b38385a8e5aade7541e2c22807e7
https://github.com/ShishuaiHu/DCAC/tree/de04d00edde1b38385a8e5aade7541e2c22807e7
TernaryTanh
import torch from torch import nn class TernaryTanh(nn.Module): def __init__(self, beta=2.0, varying_beta=True): super(TernaryTanh, self).__init__() self.beta = beta self.varying_beta = varying_beta def forward(self, x): m = torch.nn.Tanh() if self.beta >= 1.0: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
SohamMazumder/Federated_Segmentation
TernaryTanh
false
5,828
[ "MIT" ]
1
d4eb681441003ba20f8b251a42a811c8c436f04e
https://github.com/SohamMazumder/Federated_Segmentation/tree/d4eb681441003ba20f8b251a42a811c8c436f04e
DiceLoss
import torch from torch import nn from torch.autograd import Variable def expand_as_one_hot(input, C, ignore_index=None): """ Converts NxDxHxW label image to NxCxDxHxW, where each label is stored in a separate channel :param input: 4D input image (NxDxHxW) :param C: number of channels/labels :para...
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...
SohamMazumder/Federated_Segmentation
DiceLoss
false
5,829
[ "MIT" ]
1
d4eb681441003ba20f8b251a42a811c8c436f04e
https://github.com/SohamMazumder/Federated_Segmentation/tree/d4eb681441003ba20f8b251a42a811c8c436f04e
ShallowNet
import torch import torch.nn as nn class ShallowNet(nn.Module): def __init__(self, n_features): super(ShallowNet, self).__init__() self.a1 = nn.Linear(n_features, 2) def forward(self, x): return torch.sigmoid(self.a1(x)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
SkBlaz/KBNR
ShallowNet
false
5,830
[ "MIT" ]
1
4c37fe3fdfa7719572affd617e2dab43a54ba1d5
https://github.com/SkBlaz/KBNR/tree/4c37fe3fdfa7719572affd617e2dab43a54ba1d5
MyElementwiseModule
import torch import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed class MyElementwiseModule(torch.nn.Module): def forward(self, x, y): return x * y + y def get_inputs(): return [torch.rand([4, 4, 4, 4]), 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 import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed as...
ShuaihuaLu/examples
MyElementwiseModule
false
5,831
[ "BSD-3-Clause" ]
1
2639cf050493df9d3cbf065d45e6025733add0f4
https://github.com/ShuaihuaLu/examples/tree/2639cf050493df9d3cbf065d45e6025733add0f4
SE
import torch from itertools import chain as chain import torch.utils.data import torch.nn as nn class SwishEfficient(torch.autograd.Function): """Swish activation function: x * sigmoid(x).""" @staticmethod def forward(ctx, x): result = x * torch.sigmoid(x) ctx.save_for_backward(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 itertools import chain a...
SheldongChen/SlowFast
SE
false
5,832
[ "Apache-2.0" ]
1
298cd1648bcaaafa7d436bf286a2c7f243f36416
https://github.com/SheldongChen/SlowFast/tree/298cd1648bcaaafa7d436bf286a2c7f243f36416
GeneralizedDiceLoss
import torch from torch import nn from torch.autograd import Variable def expand_as_one_hot(input, C, ignore_index=None): """ Converts NxDxHxW label image to NxCxDxHxW, where each label is stored in a separate channel :param input: 4D input image (NxDxHxW) :param C: number of channels/labels :para...
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...
SohamMazumder/Federated_Segmentation
GeneralizedDiceLoss
false
5,833
[ "MIT" ]
1
d4eb681441003ba20f8b251a42a811c8c436f04e
https://github.com/SohamMazumder/Federated_Segmentation/tree/d4eb681441003ba20f8b251a42a811c8c436f04e
TwoNet
import torch import torch.nn as nn class TwoNet(nn.Module): def __init__(self, n_features, embedding_dim=256): super(TwoNet, self).__init__() self.a1 = nn.Linear(n_features, embedding_dim) self.a2 = nn.Linear(embedding_dim, 2) def forward(self, x): x = torch.relu(self.a1(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 import torch.nn as nn assert_...
SkBlaz/KBNR
TwoNet
false
5,834
[ "MIT" ]
1
4c37fe3fdfa7719572affd617e2dab43a54ba1d5
https://github.com/SkBlaz/KBNR/tree/4c37fe3fdfa7719572affd617e2dab43a54ba1d5
ConvBnRelu
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class ConvBnRelu(nn.Module): """ A block of convolution, relu, batchnorm """ def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SkywalkerAtlas/HRGAN
ConvBnRelu
false
5,835
[ "MIT" ]
1
bf6d58c1f3c6e042c7ea70319a25e3420531d552
https://github.com/SkywalkerAtlas/HRGAN/tree/bf6d58c1f3c6e042c7ea70319a25e3420531d552
GenerativeLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class GenerativeLoss(nn.Module): def __init__(self): super(GenerativeLoss, self).__init__() self.criterion = nn.BCELoss(reduction='mean') def forward(sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
SkywalkerAtlas/HRGAN
GenerativeLoss
false
5,836
[ "MIT" ]
1
bf6d58c1f3c6e042c7ea70319a25e3420531d552
https://github.com/SkywalkerAtlas/HRGAN/tree/bf6d58c1f3c6e042c7ea70319a25e3420531d552
Encoder
import torch import torch.nn as nn import torch.nn.parallel from torch.autograd import Variable class Encoder(nn.Module): def __init__(self, x_dim, h_dim, z_dim): super(Encoder, self).__init__() self.x_dim = x_dim self.h_dim = h_dim self.z_dim = z_dim self.relu = nn.LeakyR...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch.autograd import Variab...
Shimaa1/group_activity_gcn
Encoder
false
5,837
[ "MIT" ]
1
53f86e93eb7a78d537532d48c836ce30cbf7e8d1
https://github.com/Shimaa1/group_activity_gcn/tree/53f86e93eb7a78d537532d48c836ce30cbf7e8d1
ConvTripleBlock
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class ConvBnRelu(nn.Module): """ A block of convolution, relu, batchnorm """ def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SkywalkerAtlas/HRGAN
ConvTripleBlock
false
5,838
[ "MIT" ]
1
bf6d58c1f3c6e042c7ea70319a25e3420531d552
https://github.com/SkywalkerAtlas/HRGAN/tree/bf6d58c1f3c6e042c7ea70319a25e3420531d552
Residual
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class ConvBnRelu(nn.Module): """ A block of convolution, relu, batchnorm """ def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
SkywalkerAtlas/HRGAN
Residual
false
5,839
[ "MIT" ]
1
bf6d58c1f3c6e042c7ea70319a25e3420531d552
https://github.com/SkywalkerAtlas/HRGAN/tree/bf6d58c1f3c6e042c7ea70319a25e3420531d552
ThreeNet
import torch import torch.nn as nn import torch.nn.functional as F class ThreeNet(nn.Module): def __init__(self, n_features, e1=2048, e2=1024, e3=640, e4=512, e5=216, p=0.4): super(ThreeNet, self).__init__() self.a1 = nn.Linear(n_features, e1) self.a2 = nn.Linear(e1, e2) 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.triton_helpers import libdevice import torch.nn as ...
SkBlaz/KBNR
ThreeNet
false
5,840
[ "MIT" ]
1
4c37fe3fdfa7719572affd617e2dab43a54ba1d5
https://github.com/SkBlaz/KBNR/tree/4c37fe3fdfa7719572affd617e2dab43a54ba1d5
AndModule
import torch import torch.nn as nn import torch.nn class AndModule(nn.Module): def forward(self, attn1, attn2): out = torch.min(attn1, attn2) return out def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.guards.assert...
SpyrosMouselinos/DeltaFormers
AndModule
false
5,841
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
FiveNet
import torch import torch.nn as nn import torch.nn.functional as F class FiveNet(nn.Module): def __init__(self, n_features, e1=1024, e2=2048, e3=1024, e4=640, e5= 512, p=0.4): super(FiveNet, self).__init__() self.a1 = nn.Linear(n_features, e2) self.a2 = nn.Linear(e2, e3) 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.triton_helpers import libdevice import torch.nn as ...
SkBlaz/KBNR
FiveNet
false
5,842
[ "MIT" ]
1
4c37fe3fdfa7719572affd617e2dab43a54ba1d5
https://github.com/SkBlaz/KBNR/tree/4c37fe3fdfa7719572affd617e2dab43a54ba1d5
OrModule
import torch import torch.nn as nn import torch.nn class OrModule(nn.Module): def forward(self, attn1, attn2): out = torch.max(attn1, attn2) return out def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.guards.assert...
SpyrosMouselinos/DeltaFormers
OrModule
false
5,843
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
OneLayerFCBodyWithAction
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class OneLayerFCBodyWithAction(nn.Module): def __init__(self, state_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Sohojoe/UdacityDeepRL-Project2
OneLayerFCBodyWithAction
false
5,844
[ "MIT" ]
1
7137eea0b606ea32d00424d23130ff213f03ecf1
https://github.com/Sohojoe/UdacityDeepRL-Project2/tree/7137eea0b606ea32d00424d23130ff213f03ecf1
QREmbeddingBag
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter class QREmbeddingBag(nn.Module): """Computes sums or means over two 'bags' of embeddings, one using the quotient of the indices and the other using the remainder of the indices, witho...
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 numpy as np import torch.nn as nn from torch.nn.parameter import Paramet...
SplitInfinity/dlrm
QREmbeddingBag
false
5,845
[ "MIT" ]
1
726dc9059be94b249d41e9b5a399c991fe687edb
https://github.com/SplitInfinity/dlrm/tree/726dc9059be94b249d41e9b5a399c991fe687edb
PreActBlockNoBN
import torch import torch.nn as nn import torch.nn.functional as F class PreActBlockNoBN(nn.Module): """Pre-activation version of the BasicBlock.""" expansion = 1 def __init__(self, in_planes, planes, stride=1): super(PreActBlockNoBN, self).__init__() self.conv1 = nn.Conv2d(in_planes, pla...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Spijkervet/Greedy_InfoMax
PreActBlockNoBN
false
5,846
[ "MIT" ]
1
d1784da7995e029d07691ee0977fea49383fb0f8
https://github.com/Spijkervet/Greedy_InfoMax/tree/d1784da7995e029d07691ee0977fea49383fb0f8
SimpleNet
import torch import torch.nn as nn import torch.nn.functional as F import torch.distributions as D class SimpleNet(nn.Module): def __init__(self, s_dim, a_dim): super(SimpleNet, self).__init__() self.s_dim = s_dim self.a_dim = a_dim self.a1 = nn.Linear(s_dim, 100) self.mu ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SpencerLo-CMU/pytorch-rl-suite
SimpleNet
false
5,847
[ "MIT" ]
1
52b215f38cbb4c39a0ccfff48ab8262b1c9ef4a0
https://github.com/SpencerLo-CMU/pytorch-rl-suite/tree/52b215f38cbb4c39a0ccfff48ab8262b1c9ef4a0
BertAttention
from _paritybench_helpers import _mock_config import math import torch import torch.utils.data import torch.nn as nn import torch.nn import torch as torch import torch.sparse class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Somefive/cogdl
BertAttention
false
5,848
[ "MIT" ]
1
1c5ab88aafc27529495d0d22f781055619e27cb2
https://github.com/Somefive/cogdl/tree/1c5ab88aafc27529495d0d22f781055619e27cb2
BertIntermediate
from _paritybench_helpers import _mock_config from torch.nn import Module import math import torch import torch.nn as nn def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn impor...
SpyrosMouselinos/NVLR_solver
BertIntermediate
false
5,849
[ "Apache-2.0" ]
1
7fe12f9eab980ee6959f0b8797aef779b3270c25
https://github.com/SpyrosMouselinos/NVLR_solver/tree/7fe12f9eab980ee6959f0b8797aef779b3270c25
QueryModule
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class QueryModule(nn.Module): def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim, kernel_size=(3, 3), padding=1) self.conv2 = nn.Conv2d(dim, dim, kernel_size=(3, 3), padding=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 import torch.nn as nn import ...
SpyrosMouselinos/DeltaFormers
QueryModule
false
5,850
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
AttentionModule
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class AttentionModule(nn.Module): def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim, kernel_size=(3, 3), padding=1) self.conv2 = nn.Conv2d(dim, dim, kernel_size=(3, 3), padding=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 import torch.nn as nn import ...
SpyrosMouselinos/DeltaFormers
AttentionModule
false
5,851
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
ComparisonModule
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn class ComparisonModule(nn.Module): def __init__(self, dim): super().__init__() self.projection = nn.Conv2d(2 * dim, dim, kernel_size=(1, 1), padding=0 ) self.conv1 = nn.Conv2d(dim, dim, 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 ...
SpyrosMouselinos/DeltaFormers
ComparisonModule
false
5,852
[ "Apache-2.0" ]
1
38508fa9b85f2c50aa0031b67e7e8feff1a75b27
https://github.com/SpyrosMouselinos/DeltaFormers/tree/38508fa9b85f2c50aa0031b67e7e8feff1a75b27
ResBlock
import torch import torch.nn.functional as F class ResBlock(torch.nn.Module): def __init__(self, channels): super(ResBlock, self).__init__() self.channels = channels self.conv1 = torch.nn.Conv2d(channels, channels, kernel_size=(3, 3), padding=1) 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 assert_size_stride = torch._C...
StarsStation/DeepLearning
ResBlock
false
5,853
[ "MIT" ]
1
a4c833af93652069f19a8c6f0b1e42cde64bbb79
https://github.com/StarsStation/DeepLearning/tree/a4c833af93652069f19a8c6f0b1e42cde64bbb79
TwoLayerFCBodyWithAction
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class TwoLayerFCBodyWithAction(nn.Module): def __init__(self, state_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Sohojoe/UdacityDeepRL-Project2
TwoLayerFCBodyWithAction
false
5,854
[ "MIT" ]
1
7137eea0b606ea32d00424d23130ff213f03ecf1
https://github.com/Sohojoe/UdacityDeepRL-Project2/tree/7137eea0b606ea32d00424d23130ff213f03ecf1
Encoder
import torch import torch.nn as nn class Encoder(nn.Module): def __init__(self, input_dim, hidden_dim, latent_dim): super(Encoder, self).__init__() self.FC_input = nn.Linear(input_dim, hidden_dim) self.FC_mean = nn.Linear(hidden_dim, latent_dim) self.FC_var = nn.Linear(hidden_dim,...
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...
StefanNa/dtu_mlops
Encoder
false
5,855
[ "Apache-2.0" ]
1
148f3427f8d090d39d127857be8a37832f800279
https://github.com/StefanNa/dtu_mlops/tree/148f3427f8d090d39d127857be8a37832f800279
CosineClassifier
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data class CosineClassifier(nn.Module): def __init__(self, classes, channels=512): super().__init__() self.channels = channels self.cls = nn.Conv2d(channels, classes, 1, bias=False) self.scaler =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
SirRob1997/DomainBed
CosineClassifier
false
5,856
[ "MIT" ]
1
7399a2b0a63df48f4b67755a3f33901223d5c8fb
https://github.com/SirRob1997/DomainBed/tree/7399a2b0a63df48f4b67755a3f33901223d5c8fb