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
FocalLoss
import torch from torch import nn class FocalLoss(nn.Module): def __init__(self, alpha=0.5, gamma=1.0): super().__init__() self.alpha = alpha self.gamma = gamma def forward(self, inputs, targets, **kwargs): CEloss = nn.CrossEntropyLoss(reduction='none')(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 a...
gurucharanmk/Fruits-360_Image_Classification
FocalLoss
false
10,129
[ "MIT" ]
0
9d26bba972ed3eca762ff225b33bd70e82edc7f0
https://github.com/gurucharanmk/Fruits-360_Image_Classification/tree/9d26bba972ed3eca762ff225b33bd70e82edc7f0
AdaptiveFeatureNorm
import torch import torch.nn as nn import torch.utils.data class AdaptiveFeatureNorm(nn.Module): """ The `Stepwise Adaptive Feature Norm loss (ICCV 2019) <https://arxiv.org/pdf/1811.07456v2.pdf>`_ Instead of using restrictive scalar R to match the corresponding feature norm, Stepwise Adaptive Feature Nor...
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...
XianyuanLiu/Transfer-Learning-Library
AdaptiveFeatureNorm
false
10,130
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
ConvertTHWCtoTCHW
import torch import torch.utils.data class ConvertTHWCtoTCHW(torch.nn.Module): """ Convert a torch.FloatTensor of shape (TIME x HEIGHT x WIDTH x CHANNEL) to a torch.FloatTensor of shape (TIME x CHANNELS x HEIGHT x WIDTH). """ def forward(self, tensor): return tensor.permute(0, 3, 1, 2).co...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
XianyuanLiu/Transfer-Learning-Library
ConvertTHWCtoTCHW
false
10,131
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
MinusRbfHSIC
import torch import torch.nn as nn import torch.utils.data.distributed class HSIC(nn.Module): """Base class for the finite sample estimator of Hilbert-Schmidt Independence Criterion (HSIC) ..math:: HSIC (X, Y) := || C_{x, y} ||^2_{HS}, where HSIC (X, Y) = 0 iif X and Y are independent. Empirically, we us...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
derwind/mxfont
MinusRbfHSIC
false
10,132
[ "MIT" ]
0
0b6d4554a1e2208906230d3121d792d450ed28dd
https://github.com/derwind/mxfont/tree/0b6d4554a1e2208906230d3121d792d450ed28dd
BasicCNN2
import torch import torch.nn as nn import torch.nn.functional as F class BasicCNN2(nn.Module): def __init__(self): super().__init__() self.layer_names = ['conv11', 'conv12', 'conv21', 'conv22', 'conv31', 'conv32', 'fc1', 'output_layer'] self.conv11 = nn.Conv2d(3, 32, 3, paddin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
fnc11/CosDefence
BasicCNN2
false
10,133
[ "MIT" ]
0
94f451b7d4b36cb3b9fcc85098dae242f311532b
https://github.com/fnc11/CosDefence/tree/94f451b7d4b36cb3b9fcc85098dae242f311532b
SimpleNeuralNet
import torch import torch.nn as nn import torch.nn.functional as F class SimpleNeuralNet(nn.Module): def __init__(self, n_in, n_hidden, n_out): super().__init__() self.linear1 = nn.Linear(n_in, n_hidden) self.linear2 = nn.Linear(n_hidden, n_out) def forward(self, x): x = x.vi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gjwgit/mnist
SimpleNeuralNet
false
10,134
[ "MIT" ]
0
77551a2600a3df06228546cfe6729df4803b6521
https://github.com/gjwgit/mnist/tree/77551a2600a3df06228546cfe6729df4803b6521
EMDLoss
import torch import torch.nn as nn class EMDLoss(nn.Module): """EMDLoss class """ def __init__(self): super(EMDLoss, self).__init__() def forward(self, p_pred: 'torch.Tensor', p_true: 'torch.Tensor'): assert p_true.shape == p_pred.shape, 'Length of the two distribution must be the sa...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
groundzhou/Image-aesthetic-assesment
EMDLoss
false
10,135
[ "MIT" ]
0
0b22f60cdae11650153027c768a6a488b02ff9e4
https://github.com/groundzhou/Image-aesthetic-assesment/tree/0b22f60cdae11650153027c768a6a488b02ff9e4
CorrelationAlignmentLoss
import torch import torch.nn as nn import torch.utils.data class CorrelationAlignmentLoss(nn.Module): """The `Correlation Alignment Loss` in `Deep CORAL: Correlation Alignment for Deep Domain Adaptation (ECCV 2016) <https://arxiv.org/pdf/1607.01719.pdf>`_. Given source features :math:`f_S` and target fea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
XianyuanLiu/Transfer-Learning-Library
CorrelationAlignmentLoss
false
10,136
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
GaussianKernel
import torch import torch.nn as nn from typing import Optional import torch.utils.data class GaussianKernel(nn.Module): """Gaussian Kernel Matrix Gaussian Kernel k is defined by .. math:: k(x_1, x_2) = \\exp \\left( - \\dfrac{\\| x_1 - x_2 \\|^2}{2\\sigma^2} \\right) where :math:`x_1, x_2 \...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
XianyuanLiu/Transfer-Learning-Library
GaussianKernel
false
10,137
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
BatchSpectralShrinkage
import torch import torch.nn as nn import torch.utils.data class BatchSpectralShrinkage(nn.Module): """ The regularization term in `Catastrophic Forgetting Meets Negative Transfer: Batch Spectral Shrinkage for Safe Transfer Learning (NIPS 2019) <https://proceedings.neurips.cc/paper/2019/file/c6bff625bdb03...
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.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
XianyuanLiu/Transfer-Learning-Library
BatchSpectralShrinkage
false
10,138
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
BridgeFeatLoss
import torch import torch.nn as nn import torch.utils.data class BridgeFeatLoss(nn.Module): """Bridge loss on feature space. """ def __init__(self): super(BridgeFeatLoss, self).__init__() def forward(self, f_s, f_t, f_mixed, lam): dist_mixed2s = ((f_mixed - f_s) ** 2).sum(1, keepdim=...
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...
XianyuanLiu/Transfer-Learning-Library
BridgeFeatLoss
false
10,139
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
DivLoss
import torch import torch.nn as nn import torch.utils.data class DivLoss(nn.Module): """Diversity loss, which is defined as negative of standard deviation. """ def __init__(self): super(DivLoss, self).__init__() def forward(self, lam): mu = lam.mean(0) std = ((lam - mu) ** 2)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
XianyuanLiu/Transfer-Learning-Library
DivLoss
false
10,140
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
VanillaGenerativeAdversarialLoss
import torch import torch.nn as nn import torch.utils.data class VanillaGenerativeAdversarialLoss(nn.Module): """ Loss for `Vanilla Generative Adversarial Network <https://arxiv.org/abs/1406.2661>`_ Args: reduction (str, optional): Specifies the reduction to apply to the output: ``'none...
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...
XianyuanLiu/Transfer-Learning-Library
VanillaGenerativeAdversarialLoss
false
10,141
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
Theta
from torch.autograd import Function import torch import torch.nn as nn from typing import Tuple from typing import Optional from typing import Any import torch.utils.data class GradientReverseFunction(Function): @staticmethod def forward(ctx: 'Any', input: 'torch.Tensor', coeff: 'Optional[float]'=1.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.autograd import Function import torch.nn as nn from typing import Tup...
XianyuanLiu/Transfer-Learning-Library
Theta
false
10,142
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
LeastSquaresGenerativeAdversarialLoss
import torch import torch.nn as nn import torch.utils.data class LeastSquaresGenerativeAdversarialLoss(nn.Module): """ Loss for `Least Squares Generative Adversarial Network (LSGAN) <https://arxiv.org/abs/1611.04076>`_ Args: reduction (str, optional): Specifies the reduction to apply to the outpu...
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.utils.data assert_size_stride = torch._C._dynamo.guard...
XianyuanLiu/Transfer-Learning-Library
LeastSquaresGenerativeAdversarialLoss
false
10,143
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
BatchSpectralPenalizationLoss
import torch import torch.nn as nn import torch.utils.data class BatchSpectralPenalizationLoss(nn.Module): """Batch spectral penalization loss from `Transferability vs. Discriminability: Batch Spectral Penalization for Adversarial Domain Adaptation (ICML 2019) <http://ise.thss.tsinghua.edu.cn/~mlong/doc/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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
XianyuanLiu/Transfer-Learning-Library
BatchSpectralPenalizationLoss
false
10,144
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
Vgg16
import torch from torch import nn import torch.nn.functional as F class Vgg16(nn.Module): def __init__(self): super(Vgg16, self).__init__() self.conv1_1 = nn.Conv2d(3, 64, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.Conv2d(64, 64, kernel_size=3, stride=1, padding=1) self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
chaitrasj/GAN-based-Visible-Thermal-Person-ReID
Vgg16
false
10,145
[ "MIT" ]
0
8fd65ce3ab5403056fbe6e3574d1a7d02a315e62
https://github.com/chaitrasj/GAN-based-Visible-Thermal-Person-ReID/tree/8fd65ce3ab5403056fbe6e3574d1a7d02a315e62
SimpleNet
import torch import torch.nn as nn import torch.nn.functional as F class SimpleNet(nn.Module): def __init__(self, ni): super().__init__() self.linear1 = nn.Linear(ni, 128) self.linear2 = nn.Linear(128, 128) self.linear3 = nn.Linear(128, 64) self.linear4 = nn.Linear(64, 64)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
haakonrob/AI-Feynman
SimpleNet
false
10,146
[ "MIT" ]
0
445b68e9a260dcea67a94eed6e0aeb267f25d2ef
https://github.com/haakonrob/AI-Feynman/tree/445b68e9a260dcea67a94eed6e0aeb267f25d2ef
TripletLossXBM
import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms.functional as F import torch.utils.data def hard_examples_mining(dist_mat, identity_mat, return_idxes=False): """Select hard positives and hard negatives according to `In defense of the Triplet Loss for Person Re-...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
XianyuanLiu/Transfer-Learning-Library
TripletLossXBM
false
10,147
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
TripletLoss
import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms.functional as F import torch.utils.data def hard_examples_mining(dist_mat, identity_mat, return_idxes=False): """Select hard positives and hard negatives according to `In defense of the Triplet Loss for Person Re-...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
XianyuanLiu/Transfer-Learning-Library
TripletLoss
false
10,148
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
PytorchMultiClass
import torch import torch.nn as nn import torch.nn.functional as F class PytorchMultiClass(nn.Module): """num_features as input parameter attributes: layer_1: fully-connected layer with 32 neurons layer_out: fully-connected layer with 4 neurons softmax: softmax function methods: forward() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
freescania/advdsi_at2
PytorchMultiClass
false
10,149
[ "MIT" ]
0
13fa0b8beaeccc28975aea40ee5a1db3dd3e33be
https://github.com/freescania/advdsi_at2/tree/13fa0b8beaeccc28975aea40ee5a1db3dd3e33be
PytorchBinary
import torch import torch.nn as nn import torch.nn.functional as F class PytorchBinary(nn.Module): def __init__(self, num_features): super(PytorchBinary, self).__init__() self.layer_1 = nn.Linear(num_features, 256) self.layer_out = nn.Linear(256, 1) self.sigmoid = nn.Sigmoid() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
freescania/advdsi_at2
PytorchBinary
false
10,150
[ "MIT" ]
0
13fa0b8beaeccc28975aea40ee5a1db3dd3e33be
https://github.com/freescania/advdsi_at2/tree/13fa0b8beaeccc28975aea40ee5a1db3dd3e33be
PytorchRegression
import torch import torch.nn as nn import torch.nn.functional as F class PytorchRegression(nn.Module): def __init__(self, num_features): super(PytorchRegression, self).__init__() self.layer_1 = nn.Linear(num_features, 128) self.layer_out = nn.Linear(128, 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 import torch.nn as nn assert_...
freescania/advdsi_at2
PytorchRegression
false
10,151
[ "MIT" ]
0
13fa0b8beaeccc28975aea40ee5a1db3dd3e33be
https://github.com/freescania/advdsi_at2/tree/13fa0b8beaeccc28975aea40ee5a1db3dd3e33be
AvgPoolHead
import torch import torch.nn as nn import torch.optim class AvgPoolHead(nn.Module): def __init__(self, in_channels, out_channels, fea_map_size): super(AvgPoolHead, self).__init__() self.avgpool = nn.AvgPool2d(fea_map_size, stride=1) self.fc = nn.Linear(in_channels, out_channels) 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...
harshitbansal05/integral-human-pose
AvgPoolHead
false
10,152
[ "MIT" ]
0
50c32b59d765afe3ab2c3873068d3adfb8fd9b13
https://github.com/harshitbansal05/integral-human-pose/tree/50c32b59d765afe3ab2c3873068d3adfb8fd9b13
KarankEtAl
import torch import torch.nn as nn import torch.nn.functional as F class KarankEtAl(nn.Module): def __init__(self, input_channels, n_classes, patch_size=5): super(KarankEtAl, self).__init__() self.patch_size = patch_size self.input_channels = input_channels self.n_classes = n_clas...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
giorgosouz/HSI-classification-makantasis-cnn
KarankEtAl
false
10,153
[ "MIT" ]
0
95f18274d7cb67babb971db71f358a73dee2affc
https://github.com/giorgosouz/HSI-classification-makantasis-cnn/tree/95f18274d7cb67babb971db71f358a73dee2affc
FactorTransfer
import torch from torch import nn import torch.nn.functional as F 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 self.p2 = p2...
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 ...
bobo0810/RepDistiller
FactorTransfer
false
10,154
[ "BSD-2-Clause" ]
0
0a4cea2142221b9b31c8e995920273f5619b37f8
https://github.com/bobo0810/RepDistiller/tree/0a4cea2142221b9b31c8e995920273f5619b37f8
RepresentationSubspaceDistance
import torch import torch.nn as nn import torch.utils.data class RepresentationSubspaceDistance(nn.Module): """ `Representation Subspace Distance (ICML 2021) <http://ise.thss.tsinghua.edu.cn/~mlong/doc/Representation-Subspace-Distance-for-Domain-Adaptation-Regression-icml21.pdf>`_ Args: trade_off...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
XianyuanLiu/Transfer-Learning-Library
RepresentationSubspaceDistance
false
10,155
[ "MIT" ]
0
25f83f32437032df88ca6101ecd1f63ec7a0aa2c
https://github.com/XianyuanLiu/Transfer-Learning-Library/tree/25f83f32437032df88ca6101ecd1f63ec7a0aa2c
Correlation
import torch from torch import nn 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""" 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.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
bobo0810/RepDistiller
Correlation
false
10,156
[ "BSD-2-Clause" ]
0
0a4cea2142221b9b31c8e995920273f5619b37f8
https://github.com/bobo0810/RepDistiller/tree/0a4cea2142221b9b31c8e995920273f5619b37f8
GATMutiHeadAttLayer
import torch import torch.nn as nn from torch.nn import functional as F class GATMutiHeadAttLayer(nn.Module): def __init__(self, in_features, out_features, heads, dropout=0.4, alpha =0.2, concat=True): super(GATMutiHeadAttLayer, self).__init__() self.dropout = dropout self.in_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gitubee/pyGAT
GATMutiHeadAttLayer
false
10,157
[ "MIT" ]
0
bc4cc2b6565b7f2ad99daf88013207f64991c273
https://github.com/gitubee/pyGAT/tree/bc4cc2b6565b7f2ad99daf88013207f64991c273
FocalLoss
import torch from torch import nn class FocalLoss(nn.Module): def __init__(self, gamma=0, eps=1e-07): super(FocalLoss, self).__init__() self.gamma = gamma self.eps = eps self.ce = torch.nn.CrossEntropyLoss(reduction='none') def forward(self, input, target): logp = 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 math as tl_math from torch import nn a...
h8c2/kaggle-landmark-recognition-2020-1st-place
FocalLoss
false
10,158
[ "MIT" ]
0
3285b6c9548d100b14800ea3927f5974b25facd9
https://github.com/h8c2/kaggle-landmark-recognition-2020-1st-place/tree/3285b6c9548d100b14800ea3927f5974b25facd9
BasicNN
import torch import numpy as np from torch import nn from torch.autograd import Variable import torch.nn.functional as F class BasicNN(nn.Module): def __init__(self): super(BasicNN, self).__init__() self.net = nn.Linear(28 * 28, 2) def forward(self, x): if type(x) == np.ndarray: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gtfierro/clipper
BasicNN
false
10,159
[ "Apache-2.0" ]
0
88d7c238d51d5cf66d118bffca0c17edee84755e
https://github.com/gtfierro/clipper/tree/88d7c238d51d5cf66d118bffca0c17edee84755e
PositionalEncoding
import torch from torch import nn class PositionalEncoding(nn.Module): """Implement the PE function.""" def __init__(self, d_model, dropout, max_len=5000): super(PositionalEncoding, self).__init__() self.dropout = nn.Dropout(p=dropout) pe = nn.Parameter(torch.randn(1, max_len, d_model...
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...
hedinang/ocr2
PositionalEncoding
false
10,160
[ "MIT" ]
0
09cc4c71190e900c6ad5aba9485a804139281fec
https://github.com/hedinang/ocr2/tree/09cc4c71190e900c6ad5aba9485a804139281fec
NormalizationLayer
import torch import torch.utils.data class NormalizationLayer(torch.nn.Module): """Class for normalization layer.""" def __init__(self, normalize_scale=1.0, learn_scale=True): super(NormalizationLayer, self).__init__() self.norm_s = float(normalize_scale) if learn_scale: s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_siz...
hmtrii/tirg
NormalizationLayer
false
10,161
[ "Apache-2.0" ]
0
e404020795bb46fb01b6bd82a2618f9370174012
https://github.com/hmtrii/tirg/tree/e404020795bb46fb01b6bd82a2618f9370174012
LabelSmoothCrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F class LabelSmoothCrossEntropyLoss(nn.modules.loss._WeightedLoss): def __init__(self, weight=None, reduction='mean', smoothing=0.0): super().__init__(weight=weight, reduction=reduction) self.smoothing = smoothing self.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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
gosiqueira/dog-breed-recognition
LabelSmoothCrossEntropyLoss
false
10,162
[ "MIT" ]
0
27d3499f4922e6e36219f47af08c34e30c929e12
https://github.com/gosiqueira/dog-breed-recognition/tree/27d3499f4922e6e36219f47af08c34e30c929e12
SoftArgmax2D
import torch import torch.nn as nn from typing import Optional def create_meshgrid(x: 'torch.Tensor', normalized_coordinates: 'Optional[bool]' ) ->torch.Tensor: assert len(x.shape) == 4, x.shape _, _, height, width = x.shape _device, _dtype = x.device, x.dtype if normalized_coordinates: xs...
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 ...
godspeed5/Human-Path-Prediction
SoftArgmax2D
false
10,163
[ "MIT" ]
0
1f451f3750fbd4e37a567f1574cfea1456608be8
https://github.com/godspeed5/Human-Path-Prediction/tree/1f451f3750fbd4e37a567f1574cfea1456608be8
GAT
import torch import torch.nn as nn from torch.nn import functional as F class GATMutiHeadAttLayer(nn.Module): def __init__(self, in_features, out_features, heads, dropout=0.4, alpha =0.2, concat=True): super(GATMutiHeadAttLayer, self).__init__() self.dropout = dropout self.in_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
gitubee/pyGAT
GAT
false
10,164
[ "MIT" ]
0
bc4cc2b6565b7f2ad99daf88013207f64991c273
https://github.com/gitubee/pyGAT/tree/bc4cc2b6565b7f2ad99daf88013207f64991c273
DistillKL
import torch from torch import nn import torch.nn.functional as F class DistillKL(nn.Module): """Distilling the Knowledge in a Neural Network""" 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=...
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 ...
bobo0810/RepDistiller
DistillKL
false
10,165
[ "BSD-2-Clause" ]
0
0a4cea2142221b9b31c8e995920273f5619b37f8
https://github.com/bobo0810/RepDistiller/tree/0a4cea2142221b9b31c8e995920273f5619b37f8
PKT
import torch from torch import nn 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): return self.cosi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
bobo0810/RepDistiller
PKT
false
10,166
[ "BSD-2-Clause" ]
0
0a4cea2142221b9b31c8e995920273f5619b37f8
https://github.com/bobo0810/RepDistiller/tree/0a4cea2142221b9b31c8e995920273f5619b37f8
GeM
import torch from torch import nn from torch.nn import functional as F from torch.nn.parameter import Parameter def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class GeM(nn.Module): def __init__(self, p=3, eps=1e-06, p_trainable=True)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn from to...
h8c2/kaggle-landmark-recognition-2020-1st-place
GeM
false
10,167
[ "MIT" ]
0
3285b6c9548d100b14800ea3927f5974b25facd9
https://github.com/h8c2/kaggle-landmark-recognition-2020-1st-place/tree/3285b6c9548d100b14800ea3927f5974b25facd9
Attention
import torch from torch import nn import torch.nn.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the output features from the decoder. """ def __init__(self, dim): super(Attention, self).__init__() self.dim = dim self.linear1 = nn.Linear(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....
gluver/video-caption.pytorch
Attention
false
10,168
[ "MIT" ]
0
15000246980e43f71a254ab3deeb91f0957309bb
https://github.com/gluver/video-caption.pytorch/tree/15000246980e43f71a254ab3deeb91f0957309bb
EnDown
import torch import torch.nn as nn import torch.optim class EnDown(nn.Module): def __init__(self, in_channels, out_channels): super(EnDown, self).__init__() self.conv = nn.Conv3d(in_channels, out_channels, kernel_size=3, stride=2, padding=1) def forward(self, x): y = self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo.g...
felixquinton1/TransBTS
EnDown
false
10,169
[ "Apache-2.0" ]
0
6992c902413ba15f40ebfe9f6d5d0e3594051033
https://github.com/felixquinton1/TransBTS/tree/6992c902413ba15f40ebfe9f6d5d0e3594051033
ContrastiveLoss
import torch import torch.nn as nn import torch.nn.functional as F class ContrastiveLoss(nn.Module): """ Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise """ def __init__(self, margin): super(ContrastiveLo...
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...
htn274/siamese-triplet
ContrastiveLoss
false
10,170
[ "BSD-3-Clause" ]
0
d468fb939a7ab072a0e1cf1c507a87df1a901852
https://github.com/htn274/siamese-triplet/tree/d468fb939a7ab072a0e1cf1c507a87df1a901852
HuberLoss
import torch import torch.nn as nn class HuberLoss(nn.Module): def __init__(self): super().__init__() self.loss = nn.SmoothL1Loss() def forward(self, logits, labels): loss = self.loss(logits, labels) return loss def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
hslrock/Reinforcement-Learning-Implementation
HuberLoss
false
10,171
[ "MIT" ]
0
31db7e31c92f8e01609bf51d3f8f22211ec0fd5d
https://github.com/hslrock/Reinforcement-Learning-Implementation/tree/31db7e31c92f8e01609bf51d3f8f22211ec0fd5d
CoorsNorm
import torch from torch import nn class CoorsNorm(nn.Module): def __init__(self, eps=1e-08, scale_init=1.0): super().__init__() self.eps = eps scale = torch.zeros(1).fill_(scale_init) self.scale = nn.Parameter(scale) def forward(self, coors): norm = coors.norm(dim=-1,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
hypnopump/En-transformer
CoorsNorm
false
10,172
[ "MIT" ]
0
b52f0e5d79a886512f9d438de345fc8a9eae6420
https://github.com/hypnopump/En-transformer/tree/b52f0e5d79a886512f9d438de345fc8a9eae6420
InitConv
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class InitConv(nn.Module): def __init__(self, in_channels=4, out_channels=16, dropout=0.2): super(InitConv, self).__init__() self.conv = nn.Conv3d(in_channels, out_channels, kernel_size=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 import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo.g...
felixquinton1/TransBTS
InitConv
false
10,173
[ "Apache-2.0" ]
0
6992c902413ba15f40ebfe9f6d5d0e3594051033
https://github.com/felixquinton1/TransBTS/tree/6992c902413ba15f40ebfe9f6d5d0e3594051033
DQN_Simple
import math import torch from torch.autograd import Variable import torch.nn.functional as F import torch.nn as nn class NoisyLinear(nn.Module): def __init__(self, in_features, out_features, std_init=0.4): super(NoisyLinear, self).__init__() self.in_features = in_features self.out_feature...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch.autograd import Variable import torch.nn.functional as F ...
exe1023/GA-final
DQN_Simple
false
10,174
[ "MIT" ]
0
dad84cda665ef24e9568a79a2e7ff0a00edf5851
https://github.com/exe1023/GA-final/tree/dad84cda665ef24e9568a79a2e7ff0a00edf5851
ContrastiveLoss
import torch import torch.nn.functional as F class ContrastiveLoss(torch.nn.Module): """Contrastive loss function""" def __init__(self, margin=1.0): super(ContrastiveLoss, self).__init__() self.margin = margin def forward(self, output1, output2, label): euclidean_distance = F.pai...
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._...
hz512/Smart-Parking-Enforcement-System
ContrastiveLoss
false
10,175
[ "MIT" ]
0
e990903de545693ad6e2536bf167c69ab672d16a
https://github.com/hz512/Smart-Parking-Enforcement-System/tree/e990903de545693ad6e2536bf167c69ab672d16a
REINFORCE
import torch import torch.nn.functional as F import torch.nn as nn class REINFORCE(nn.Module): def __init__(self, input_size, num_actions): super(REINFORCE, self).__init__() self.fc = nn.Linear(input_size, 256) self.head = nn.Linear(256, num_actions) self.relu = nn.ReLU() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
exe1023/GA-final
REINFORCE
false
10,176
[ "MIT" ]
0
dad84cda665ef24e9568a79a2e7ff0a00edf5851
https://github.com/exe1023/GA-final/tree/dad84cda665ef24e9568a79a2e7ff0a00edf5851
LanguageModelCriterion
import torch import torch.nn as nn from torch.autograd import * class LanguageModelCriterion(nn.Module): def __init__(self): super(LanguageModelCriterion, self).__init__() def forward(self, input, target, mask): if target.ndim == 3: target = target.reshape(-1, target.shape[2]) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
helloMickey/self-critical.pytorch
LanguageModelCriterion
false
10,177
[ "MIT" ]
0
3a26111012099e13daeb688136fea45186127935
https://github.com/helloMickey/self-critical.pytorch/tree/3a26111012099e13daeb688136fea45186127935
RewardCriterion
import torch import torch.nn as nn from torch.autograd import * class RewardCriterion(nn.Module): def __init__(self): super(RewardCriterion, self).__init__() def forward(self, input, seq, reward): input = input.gather(2, seq.unsqueeze(2)).squeeze(2) input = input.reshape(-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 import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
helloMickey/self-critical.pytorch
RewardCriterion
false
10,178
[ "MIT" ]
0
3a26111012099e13daeb688136fea45186127935
https://github.com/helloMickey/self-critical.pytorch/tree/3a26111012099e13daeb688136fea45186127935
Upsample
import torch import torch.nn as nn import torch._utils import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F import torch.nn.parallel import torch.optim class Upsample(nn.Module): """ nn.Upsample is deprecated """ def __init__(self, scale_factor, mode='linear'): ...
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._utils import torch.utils.data import torch.utils.data...
fsImageries/video-to-pose3D
Upsample
false
10,179
[ "MIT" ]
0
098c87ce19dc3331da03e6eac0b9744684eb66f6
https://github.com/fsImageries/video-to-pose3D/tree/098c87ce19dc3331da03e6eac0b9744684eb66f6
EPELoss
import torch import torch.nn as nn class EPELoss(nn.Module): def __init__(self): super(EPELoss, self).__init__() def forward(self, output, target): lossvalue = torch.norm(output - target + 1e-16, p=2, dim=1).mean() return lossvalue def get_inputs(): return [torch.rand([4, 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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
haochen23/GeoProj
EPELoss
false
10,180
[ "MIT" ]
0
4b31f51789f9cc41ea7dc977cee057b8bc8a83cc
https://github.com/haochen23/GeoProj/tree/4b31f51789f9cc41ea7dc977cee057b8bc8a83cc
TripletLoss
import torch import torch.nn as nn import torch._utils import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F import torch.nn.parallel import torch.optim class TripletLoss(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a 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 import torch.nn as nn import torch._utils import torch.utils.data import torch.utils.data...
fsImageries/video-to-pose3D
TripletLoss
false
10,181
[ "MIT" ]
0
098c87ce19dc3331da03e6eac0b9744684eb66f6
https://github.com/fsImageries/video-to-pose3D/tree/098c87ce19dc3331da03e6eac0b9744684eb66f6
JointsMSELoss
import torch import torch.nn as nn import torch._utils import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel import torch.optim class JointsMSELoss(nn.Module): def __init__(self, use_target_weight): super(JointsMSELoss, self).__init__() self.criterion = nn.MSELoss()...
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._utils import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel import torch....
fsImageries/video-to-pose3D
JointsMSELoss
false
10,182
[ "MIT" ]
0
098c87ce19dc3331da03e6eac0b9744684eb66f6
https://github.com/fsImageries/video-to-pose3D/tree/098c87ce19dc3331da03e6eac0b9744684eb66f6
SpeakerIntegrator
import torch import torch.nn as nn import torch.utils.data class SpeakerIntegrator(nn.Module): def __init__(self): super(SpeakerIntegrator, self).__init__() def forward(self, x, spembs): """ x shape : (batch, 39, 256) spembs shape : (batch, 256) """ spemb...
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.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
hwRG/FastSpeech2-Pytorch-old-man_city
SpeakerIntegrator
false
10,183
[ "MIT" ]
0
c32ee3a09bf2a53fcd17a2d0b74e8d1c93586573
https://github.com/hwRG/FastSpeech2-Pytorch-old-man_city/tree/c32ee3a09bf2a53fcd17a2d0b74e8d1c93586573
SceneParserHead
import torch import torch.utils.data from torch import nn class SceneParserHead(nn.Module): def __init__(self, in_channels, num_classes): super(SceneParserHead, self).__init__() self.conv1x1 = nn.Conv2d(in_channels, 2048, 1, 1) self.avgpool = nn.AdaptiveAvgPool2d((1, 1)) 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 import torch.utils.data from torch import nn assert_size_stride = torch._C._dyna...
hangwudy/pytorch_tutorial
SceneParserHead
false
10,184
[ "MIT" ]
0
857b128253bd1e2bd30cb85e995c757e5acbb3a2
https://github.com/hangwudy/pytorch_tutorial/tree/857b128253bd1e2bd30cb85e995c757e5acbb3a2
ConvTemporalGraphical
import torch import torch.nn as nn import torch._utils import torch.utils.data import torch.utils.data.distributed import torch.nn.parallel import torch.optim class ConvTemporalGraphical(nn.Module): """The basic module for applying a graph convolution. Args: in_channels (int): Number of channels in 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 import torch.nn as nn import torch._utils import torch.utils.data import torch.u...
fsImageries/video-to-pose3D
ConvTemporalGraphical
false
10,185
[ "MIT" ]
0
098c87ce19dc3331da03e6eac0b9744684eb66f6
https://github.com/fsImageries/video-to-pose3D/tree/098c87ce19dc3331da03e6eac0b9744684eb66f6
Maxout
import torch import torch.nn as nn class Maxout(nn.Module): def __init__(self, pool_size): super().__init__() self._pool_size = pool_size def forward(self, x): assert x.shape[-1 ] % self._pool_size == 0, 'Wrong input last dim size ({}) for Maxout({})'.format( ...
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...
hekaplex/FocusSeq2Seq
Maxout
false
10,186
[ "MIT" ]
0
9bab5d3aa020b4d587add9d7a070335cf0feb2d6
https://github.com/hekaplex/FocusSeq2Seq/tree/9bab5d3aa020b4d587add9d7a070335cf0feb2d6
RNN
import torch import torch.nn as nn from torch.autograd import Variable class RNN(nn.Module): def __init__(self, category_size, input_size, hidden_size, output_size): super(RNN, self).__init__() self.category_size = category_size self.input_size = input_size self.hidden_size = hidd...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = t...
iclementine/practical-pytorch
RNN
false
10,187
[ "MIT" ]
0
88e2e53e47328cdb3ec23573aec3ff0421f1a2b7
https://github.com/iclementine/practical-pytorch/tree/88e2e53e47328cdb3ec23573aec3ff0421f1a2b7
TVLoss
import torch from typing import Tuple from torch.nn.modules.loss import _Loss from typing import List from typing import Optional def _reduce(x: 'torch.Tensor', reduction: 'str'='mean') ->torch.Tensor: """Reduce input in batch dimension if needed. Args: x: Tensor with shape (N, *). reduction:...
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 typing import Tuple from torch.nn.modules.loss import _Loss from typing im...
hecoding/piq
TVLoss
false
10,188
[ "Apache-2.0" ]
0
c72143ce9deb30fefaca434a39e4dfc557673e97
https://github.com/hecoding/piq/tree/c72143ce9deb30fefaca434a39e4dfc557673e97
BCEDiceLoss
import torch from torch import nn import torch.utils.data import torch.nn.functional as F class BCEDiceLoss(nn.Module): def __init__(self): super().__init__() def forward(self, input, target): bce = F.binary_cross_entropy_with_logits(input, target) smooth = 1e-05 input = torc...
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 ...
ha55anali/pytorch-nested-unet
BCEDiceLoss
false
10,189
[ "MIT" ]
0
444dbd0ff7764478de662723b211c23bd65d99f9
https://github.com/ha55anali/pytorch-nested-unet/tree/444dbd0ff7764478de662723b211c23bd65d99f9
ProtoLoss
import torch class ProtoLoss(torch.nn.Module): def __init__(self, num_classes, num_support, num_queries, ndim): super(ProtoLoss, self).__init__() self.num_classes = num_classes self.num_support = num_support self.num_queries = num_queries self.ndim = ndim def euclidea...
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...
gradjitta/Prototypical-Networks
ProtoLoss
false
10,191
[ "MIT" ]
0
9ec344f7299353889e2087224b80a74519ca1a3c
https://github.com/gradjitta/Prototypical-Networks/tree/9ec344f7299353889e2087224b80a74519ca1a3c
LayerNorm
import torch import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter import Parameter from torch.nn.modules.normalization import LayerNorm from torch.optim.lr_scheduler import * class LayerNorm(nn.Module): def __init__(self, hidden_size, eps=0.0001): super(LayerNorm, 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.triton_helpers import libdevice import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter im...
chunhuililili/mt_dnn
LayerNorm
false
10,192
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
GCN
import math import torch import torch.nn as nn from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): def __init__(self, in_features, out_features): super(GraphConvolution, self).__init__() self.in_features = in_features self.out_features = out_features self.w...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn from torch.nn.parameter import Parameter asser...
iDMG-dynamicGCN/DatasetCollection
GCN
false
10,193
[ "MIT" ]
0
ad761b38bc86af1dd3aee6c72e819d6f00252164
https://github.com/iDMG-dynamicGCN/DatasetCollection/tree/ad761b38bc86af1dd3aee6c72e819d6f00252164
TorchLogCosh
import torch import torch as _torch class TorchLogCosh(_torch.nn.Module): """ Log(cosh) activation function for PyTorch modules """ def __init__(self): """ Init method. """ super().__init__() def forward(self, input): """ Forward pass of the functi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch as _torch assert_size_stride = torch._C._dynamo.g...
inailuig/netket
TorchLogCosh
false
10,194
[ "Apache-2.0" ]
0
ab57a6fb019edb9ac298969950724781f2ae2b22
https://github.com/inailuig/netket/tree/ab57a6fb019edb9ac298969950724781f2ae2b22
AutoEncoder
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim class AutoEncoder(nn.Module): def __init__(self): super(AutoEncoder, self).__init__() self.encoder1 = nn.Conv2d(3, 16, 3, padding=1) self.encoder2 = nn.Conv2d(16, 8, 3, padding=1) self.encoder3 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
gjustin40/Pytorch-Cookbook
AutoEncoder
false
10,195
[ "MIT" ]
0
069514d05b00d07521e1a1a028d0746b65099586
https://github.com/gjustin40/Pytorch-Cookbook/tree/069514d05b00d07521e1a1a028d0746b65099586
DQN
import torch import torch.nn.functional as F from torch import nn class DQN(nn.Module): """DQN network, three full connection layers """ def __init__(self): super(DQN, self).__init__() self.fc1 = nn.Linear(4, 16) self.fc1.weight.data.normal_(0, 0.1) self.fc2 = nn.Linear(16...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
ivanwhaf/RL
DQN
false
10,196
[ "MIT" ]
0
1610b3684269b1d60543c60460e9ee65309594ee
https://github.com/ivanwhaf/RL/tree/1610b3684269b1d60543c60460e9ee65309594ee
GeLU
import torch import torch.nn as nn import torch.nn.functional as F class GeLU(nn.Module): def __init__(self): super().__init__() def forward(self, x): return 0.5 * x * (1 + F.tanh(0.7978845608 * (x + 0.044715 * x * x * x)) ) def get_inputs(): return [torch.rand([4, 4, 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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
irustandi/sentiment-discovery
GeLU
false
10,197
[ "BSD-3-Clause" ]
0
a2e074f33bbac94ec9dba111a91da026633dad67
https://github.com/irustandi/sentiment-discovery/tree/a2e074f33bbac94ec9dba111a91da026633dad67
Generator
import torch from torch import nn import torch.utils.data class Generator(nn.Module): def __init__(self): super(Generator, self).__init__() self.relu = nn.ReLU(inplace=True) self.e_conv1 = nn.Conv2d(3, 3, 1, 1, 0, bias=True) self.e_conv2 = nn.Conv2d(3, 3, 3, 1, 1, bias=True) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
goldenbili/SRGAN_Test
Generator
false
10,198
[ "MIT" ]
0
06705c92abd5b7084ae878a4746060760bcff5c3
https://github.com/goldenbili/SRGAN_Test/tree/06705c92abd5b7084ae878a4746060760bcff5c3
HLCriterion
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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....
chunhuililili/mt_dnn
HLCriterion
false
10,199
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
Cosine
from _paritybench_helpers import _mock_config import torch from torch.optim.lr_scheduler import * class Cosine(torch.nn.Module): def __init__(self, config): super().__init__() def forward(self, src, tgt): src = src.float() tgt = tgt.float() return (torch.matmul(src, tgt.trans...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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.optim.lr...
chunhuililili/mt_dnn
Cosine
false
10,200
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
BiLinearSim
from _paritybench_helpers import _mock_config import torch from torch.optim.lr_scheduler import * class BiLinearSim(torch.nn.Module): def __init__(self, config): super().__init__() self.linear = torch.nn.Linear(config.hidden_size, config. hidden_size, bias=False) def forward(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.optim.lr_scheduler import * assert_size_stride = torch._C._dynamo.gua...
chunhuililili/mt_dnn
BiLinearSim
false
10,201
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
JSCriterion
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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....
chunhuililili/mt_dnn
JSCriterion
false
10,202
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
KlCriterion
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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....
chunhuililili/mt_dnn
KlCriterion
false
10,203
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
Mnist_CNN
import torch import torch.nn as nn import torch.nn.functional as F import torch.quantization import torch.onnx import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class Mnist_CNN(nn.Module): def __init__(self): super().__init__() self.conv1 = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
hongsam123/PyTorch-tutorials-kr
Mnist_CNN
false
10,204
[ "BSD-3-Clause" ]
0
e48bbbc7088bf6b9da66abb8862b8d0539662bd5
https://github.com/hongsam123/PyTorch-tutorials-kr/tree/e48bbbc7088bf6b9da66abb8862b8d0539662bd5
Pooler
import torch import torch.nn.functional as F import torch.nn as nn from torch.optim.lr_scheduler import * def linear(x): return x def activation(func_a): """Activation function wrapper """ try: f = eval(func_a) except: f = linear return f class DropoutWrapper(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.functional as F import torch.nn as nn from torch.optim.lr_schedu...
chunhuililili/mt_dnn
Pooler
false
10,205
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
NsKlCriterion
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * def stable_kl(logit, target, epsilon=1e-06, reduce=True): logit = logit.view(-1, logit.size(-1)).float() target = target.view(-1, target.size(-1)).float() bs = logit.size(0) p = ...
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.functi...
chunhuililili/mt_dnn
NsKlCriterion
false
10,206
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
CeCriterion
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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.nn.modules....
chunhuililili/mt_dnn
CeCriterion
false
10,207
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
MseCriterion
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * assert_siz...
chunhuililili/mt_dnn
MseCriterion
false
10,208
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
MultiheadAttentionWrapper
import torch import torch.nn.functional as F import torch.nn as nn from torch.nn.utils import weight_norm from torch.optim.lr_scheduler import * def linear(x): return x def activation(func_a): """Activation function wrapper """ try: f = eval(func_a) except: f = linear 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 import torch.nn.functional as F import torch.nn as nn from torch.nn.utils import weight_norm from torch.optim.lr_scheduler import * assert_s...
chunhuililili/mt_dnn
MultiheadAttentionWrapper
false
10,209
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
Network
import torch import torch.nn as nn import torch.nn.functional as F class Network(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 10 * 10, 120) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ibrahimalmakky/py4ai
Network
false
10,210
[ "MIT" ]
0
224f54086523314ff9c7133680f119c62f6ea249
https://github.com/ibrahimalmakky/py4ai/tree/224f54086523314ff9c7133680f119c62f6ea249
ComplexConv
import torch import torch.nn as nn class ComplexConv(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(ComplexConv, self).__init__() self.device = torch.device('cuda' if torch.cuda.is_available() else ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
iseeklin/Electromagnetic-Signal-Recognition-Using-Deep-Learning
ComplexConv
false
10,211
[ "Apache-2.0" ]
0
be78a2d966f33fd90567b21295cda1c1d472e14a
https://github.com/iseeklin/Electromagnetic-Signal-Recognition-Using-Deep-Learning/tree/be78a2d966f33fd90567b21295cda1c1d472e14a
NsSymKlCriterion
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * def stable_kl(logit, target, epsilon=1e-06, reduce=True): logit = logit.view(-1, logit.size(-1)).float() target = target.view(-1, target.size(-1)).float() bs = logit.size(0) p = ...
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.functi...
chunhuililili/mt_dnn
NsSymKlCriterion
false
10,212
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
Pooling
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 Pooling(nn.Module): def __init__(self, pooling_type=['GAP']): super(Pooling, self).__init__() self.pooling = [] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils...
heebinYoo/proxy-synthesis-confidence-control-new
Pooling
false
10,213
[ "Apache-2.0" ]
0
c591cdffc30cf933bd242ba5646d2436a42a3181
https://github.com/heebinYoo/proxy-synthesis-confidence-control-new/tree/c591cdffc30cf933bd242ba5646d2436a42a3181
SymKlCriterion
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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....
chunhuililili/mt_dnn
SymKlCriterion
false
10,214
[ "MIT" ]
0
4c6efaf21724c7b8103a05e46b5b44d7b246225e
https://github.com/chunhuililili/mt_dnn/tree/4c6efaf21724c7b8103a05e46b5b44d7b246225e
Feedforward
import torch class Feedforward(torch.nn.Module): def __init__(self, input_size, hidden_size=100): super(Feedforward, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.fc1 = torch.nn.Linear(self.input_size, self.hidden_size) self.relu = torch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
jacob-parnell-rozetta/longformer_coverage
Feedforward
false
10,215
[ "Apache-2.0" ]
0
59268bc7ae7eeb962c43080e524eaf1e62100b6c
https://github.com/jacob-parnell-rozetta/longformer_coverage/tree/59268bc7ae7eeb962c43080e524eaf1e62100b6c
ToMono
import torch import torch.nn as nn class ToMono(nn.Module): def forward(self, waveform: 'torch.Tensor') ->torch.Tensor: return torch.mean(waveform, dim=0, keepdim=True) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
icyda17/very-deep-CNNs
ToMono
false
10,216
[ "Apache-2.0" ]
0
c275ef222d50dae90e508345ec3be5adfa5e33ce
https://github.com/icyda17/very-deep-CNNs/tree/c275ef222d50dae90e508345ec3be5adfa5e33ce
VAE_genes
import torch import torch.utils.data from torch import nn from torch.nn import functional as F class VAE_genes(nn.Module): def __init__(self): super(VAE_genes, self).__init__() self.input_linear = nn.Linear(907, 500) self.enc_middle = nn.Linear(500, 100) self.enc_1 = nn.Linear(100...
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...
helenaandres/adversarial-generation-of-gene-expression-data
VAE_genes
false
10,217
[ "MIT" ]
0
9a10f0c364b7daa789ae75ab5b51ed5c7cbcbeb1
https://github.com/helenaandres/adversarial-generation-of-gene-expression-data/tree/9a10f0c364b7daa789ae75ab5b51ed5c7cbcbeb1
Normalize
import torch import torch.nn as nn class Normalize(nn.Module): def forward(self, waveform: 'torch.Tensor') ->torch.Tensor: return (waveform - waveform.mean()) / waveform.std() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
icyda17/very-deep-CNNs
Normalize
false
10,218
[ "Apache-2.0" ]
0
c275ef222d50dae90e508345ec3be5adfa5e33ce
https://github.com/icyda17/very-deep-CNNs/tree/c275ef222d50dae90e508345ec3be5adfa5e33ce
Pad
import torch import torch.nn as nn import torch.nn.functional as F class Pad(nn.Module): def __init__(self, value: 'float', size: 'int'): super().__init__() self.value = value self.size = size def forward(self, waveform: 'torch.Tensor') ->torch.Tensor: return F.pad(waveform, ...
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...
icyda17/very-deep-CNNs
Pad
false
10,219
[ "Apache-2.0" ]
0
c275ef222d50dae90e508345ec3be5adfa5e33ce
https://github.com/icyda17/very-deep-CNNs/tree/c275ef222d50dae90e508345ec3be5adfa5e33ce
SeeInDark
import torch import torch.nn as nn class SeeInDark(nn.Module): def __init__(self, num_classes=10): super(SeeInDark, self).__init__() self.conv1_1 = nn.Conv2d(4, 32, kernel_size=3, stride=1, padding=1) self.conv1_2 = nn.Conv2d(32, 32, kernel_size=3, stride=1, padding=1) self.pool1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
hyeokjae-choi/pytorch-Learning-to-See-in-the-Dark
SeeInDark
false
10,220
[ "MIT" ]
0
b32bf991072decb3aea348d8cd59acbf34d5da2c
https://github.com/hyeokjae-choi/pytorch-Learning-to-See-in-the-Dark/tree/b32bf991072decb3aea348d8cd59acbf34d5da2c
HardtanhBoundToPOTNet
import torch from torch.nn import Conv2d from torch.nn import Hardtanh from torch.nn.functional import relu from torch.nn.functional import hardtanh import torch.nn.functional class HardtanhBoundToPOTNet(torch.nn.Module): def __init__(self): super(HardtanhBoundToPOTNet, self).__init__() self.conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 Conv2d f...
isabella232/model_optimization
HardtanhBoundToPOTNet
false
10,221
[ "Apache-2.0" ]
0
074d1dfd8b4d18e57c6186c0ec5e49eb17a0fc7a
https://github.com/isabella232/model_optimization/tree/074d1dfd8b4d18e57c6186c0ec5e49eb17a0fc7a
Unet
import torch import torch.nn as nn def crop(image, new_shape): plus_h, plus_w = 0, 0 if new_shape[2] % 2 != 0: plus_h = 1 if new_shape[3] % 2 != 0: plus_w = 1 middle_height = image.shape[2] // 2 middle_weight = image.shape[3] // 2 go_height = new_shape[2] // 2 go_weight = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
furkannturkmen/pytorch-CNN-architecture
Unet
false
10,222
[ "MIT" ]
0
6a864811f51409c1526224c288fe608010e0c888
https://github.com/furkannturkmen/pytorch-CNN-architecture/tree/6a864811f51409c1526224c288fe608010e0c888
Fusion
import torch import torch.nn as nn class Fusion(nn.Module): def __init__(self, input_dim, hidden_dim): super(Fusion, self).__init__() self.linear = nn.Linear(input_dim * 4, hidden_dim, bias=True) self.tanh = nn.Tanh() def forward(self, x, y): z = torch.cat([x, y, x * y, x - y...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
hgrhgy/NumSeq2SQL
Fusion
false
10,223
[ "MIT" ]
0
6f22fdf108736f979afa2dbd3af14aa9ad4718aa
https://github.com/hgrhgy/NumSeq2SQL/tree/6f22fdf108736f979afa2dbd3af14aa9ad4718aa
CRF
import torch import torch.nn as nn class CRF(nn.Module): """ Implements Conditional Random Fields that can be trained via backpropagation. """ def __init__(self, num_tags): super(CRF, self).__init__() self.num_tags = num_tags self.transitions = nn.Parameter(torch.Tensor(n...
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...
jbogensperger/DRUG_CROSSNER
CRF
false
10,224
[ "MIT" ]
0
c82fc4ce6fd6229b48d28bafffe38f5ea3dcd6aa
https://github.com/jbogensperger/DRUG_CROSSNER/tree/c82fc4ce6fd6229b48d28bafffe38f5ea3dcd6aa
BertLastCLSModule
import torch from torch import nn class BertLastCLSModule(nn.Module): def __init__(self, dropout_prob=0.0): super().__init__() self.dropout = nn.Dropout(dropout_prob) def forward(self, input): last_hidden = input[-1][:, 0, :] out = self.dropout(last_hidden) return out...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
jdunnmon/emmental-tutorials
BertLastCLSModule
false
10,225
[ "MIT" ]
0
2aa6c86e2e74943fbf75f4df1e70c5b8614c6c49
https://github.com/jdunnmon/emmental-tutorials/tree/2aa6c86e2e74943fbf75f4df1e70c5b8614c6c49
SelfGating
import torch import torch as th import torch.nn as nn class SelfGating(nn.Module): def __init__(self, input_dim): super(SelfGating, self).__init__() self.fc = nn.Linear(input_dim, input_dim) def forward(self, input_tensor): """Feature gating as used in S3D-G. """ spatio...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
inbalcroitoru/Information-retrieval-Audio-retrieval-with-text-queries
SelfGating
false
10,226
[ "Apache-2.0" ]
0
d98ee159c61a8a9a1c433f0bfed14e7005215d5f
https://github.com/inbalcroitoru/Information-retrieval-Audio-retrieval-with-text-queries/tree/d98ee159c61a8a9a1c433f0bfed14e7005215d5f
QLinear
import torch from torch import Tensor import torch.nn as nn import torch.nn.functional as F import torch.autograd as A from torch.autograd.function import once_differentiable from torch.nn.parameter import Parameter import torch.nn.parallel import torch.optim import torch.utils.data class WeightQuantization(A.Functio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 Tensor import torch.nn as nn import torch.autograd as A from t...
i207M/pytorch-cifar
QLinear
false
10,227
[ "MIT" ]
0
df4417b6d0a25515ac82b5aa6151ae2135b2cd5c
https://github.com/i207M/pytorch-cifar/tree/df4417b6d0a25515ac82b5aa6151ae2135b2cd5c
FusionLayer
import torch import torch.nn as nn class FusionLayer(nn.Module): """ vector based fusion m(x, y) = W([x, y, x * y, x - y]) + b g(x, y) = w([x, y, x * y, x - y]) + b :returns g(x, y) * m(x, y) + (1 - g(x, y)) * x """ def __init__(self, input_dim): super(FusionLayer, 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.triton_helpers import libdevice import torch.nn as ...
hgrhgy/NumSeq2SQL
FusionLayer
false
10,228
[ "MIT" ]
0
6f22fdf108736f979afa2dbd3af14aa9ad4718aa
https://github.com/hgrhgy/NumSeq2SQL/tree/6f22fdf108736f979afa2dbd3af14aa9ad4718aa
QConv2d
import torch from torch import Tensor import torch.nn as nn import torch.autograd as A from torch.autograd.function import once_differentiable from torch.nn.parameter import Parameter import torch.nn.parallel import torch.optim import torch.utils.data class WeightQuantization(A.Function): @staticmethod def f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import Tensor import torch.nn as nn import torch.autograd as A from t...
i207M/pytorch-cifar
QConv2d
false
10,229
[ "MIT" ]
0
df4417b6d0a25515ac82b5aa6151ae2135b2cd5c
https://github.com/i207M/pytorch-cifar/tree/df4417b6d0a25515ac82b5aa6151ae2135b2cd5c