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 import torch.nn.functional as F class FocalLoss(torch.nn.Module): def __init__(self, gamma=2): super().__init__() self.gamma = gamma def forward(self, input, target): if not target.size() == input.size(): raise ValueError( 'Target size ({}) mu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math assert_size...
rskmoi/kaggle-imet
FocalLoss
false
7,582
[ "MIT" ]
1
483e9e6dbae5b1d8e023e0812c4b990afca874bc
https://github.com/rskmoi/kaggle-imet/tree/483e9e6dbae5b1d8e023e0812c4b990afca874bc
ECToCA3
import torch import torch.nn as nn import torch.nn.functional as F class ECToCA3(nn.Module): def __init__(self, D_in, D_out): super(ECToCA3, self).__init__() self.fc1 = nn.Linear(D_in, 800) self.fc2 = nn.Linear(800, D_out) def forward(self, x): x = F.leaky_relu(self.fc1(x), 0...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
sachio222/aha4
ECToCA3
false
7,583
[ "MIT" ]
1
ec378fe1bace85e325ad7cb8686b8ba321dc97d0
https://github.com/sachio222/aha4/tree/ec378fe1bace85e325ad7cb8686b8ba321dc97d0
n_to_one
import torch from torch import nn class n_to_one(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 3, 1, 1, bias=False) self.conv2 = nn.Conv2d(3, 3, 1, 1, bias=False) def forward(self, x1, x2): y1 = self.conv1(x1) y2 = self.conv2(x2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
sailfish009/torch-toolbox
n_to_one
false
7,584
[ "BSD-3-Clause" ]
1
80dfc22c697b9f323e097de72af04f0e5435d7b4
https://github.com/sailfish009/torch-toolbox/tree/80dfc22c697b9f323e097de72af04f0e5435d7b4
ActorDDPGNonConvNetwork
import torch import numpy as np import torch.nn as nn from numpy import * def fanin_init(size, fanin=None): fanin = fanin or size[0] v = 1.0 / np.sqrt(fanin) return torch.Tensor(size).uniform_(-v, v) class ActorDDPGNonConvNetwork(nn.Module): def __init__(self, num_hidden_layers, output_action, inpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ruyueshuo/MaskTrackRCNN
ActorDDPGNonConvNetwork
false
7,585
[ "Apache-2.0" ]
1
3c6ada36be3c2b2df32176349ec5c0ee5b24e724
https://github.com/ruyueshuo/MaskTrackRCNN/tree/3c6ada36be3c2b2df32176349ec5c0ee5b24e724
CA1
import torch import torch.nn as nn import torch.nn.functional as F class CA1(nn.Module): """Reconstructs the inputs that originated from EC network. Consists of 2 fully connected layers, recieving inputs from CA3 and outputs to EC. """ def __init__(self, N, D_in, D_out, resize_dim): sup...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
sachio222/aha4
CA1
false
7,586
[ "MIT" ]
1
ec378fe1bace85e325ad7cb8686b8ba321dc97d0
https://github.com/sachio222/aha4/tree/ec378fe1bace85e325ad7cb8686b8ba321dc97d0
Sparsemax
from torch.autograd import Function import torch import torch.nn as nn def _make_ix_like(X, dim): d = X.size(dim) rho = torch.arange(1, d + 1, device=X.device, dtype=X.dtype) view = [1] * X.dim() view[0] = -1 return rho.view(view).transpose(0, dim) def _roll_last(X, dim): if 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.autograd import Function import torch.nn as nn assert_size_stride = torch._C._...
roholazandie/entmax
Sparsemax
false
7,587
[ "MIT" ]
1
657374e6a792ec6840b6f78bc759cc1f51570aad
https://github.com/roholazandie/entmax/tree/657374e6a792ec6840b6f78bc759cc1f51570aad
L0Loss
import torch from torch import nn class L0Loss(nn.Module): """L0loss from "Noise2Noise: Learning Image Restoration without Clean Data" <https://arxiv.org/pdf/1803.04189>`_ paper. """ def __init__(self, gamma=2, eps=1e-08): super(L0Loss, self).__init__() self.gamma = gamma ...
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...
sailfish009/torch-toolbox
L0Loss
false
7,588
[ "BSD-3-Clause" ]
1
80dfc22c697b9f323e097de72af04f0e5435d7b4
https://github.com/sailfish009/torch-toolbox/tree/80dfc22c697b9f323e097de72af04f0e5435d7b4
BertSelfOutput
from _paritybench_helpers import _mock_config import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, config, variance_epsilon=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, 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 from torch import n...
BLimmie/pytorch-pretrained-BERT
BertSelfOutput
false
7,589
[ "Apache-2.0" ]
1
2ac4b29641e569020ed2acc28016f481f617052b
https://github.com/BLimmie/pytorch-pretrained-BERT/tree/2ac4b29641e569020ed2acc28016f481f617052b
LossPredictionLoss
import torch import torch.nn as nn class LossPredictionLoss(nn.Module): def __init__(self, margin=1.0): super(LossPredictionLoss, self).__init__() self.margin = margin def forward(self, input, target): input = (input - input.flip(0))[:len(input) // 2] target = (target - targe...
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...
saksman/deepfish_adaptation
LossPredictionLoss
false
7,590
[ "MIT" ]
1
0413def87ec1d3cb67fa043a2fb60ef7e0d73539
https://github.com/saksman/deepfish_adaptation/tree/0413def87ec1d3cb67fa043a2fb60ef7e0d73539
SmallMaskNet
import torch import torch.nn as nn import torch.nn.functional as F class SmallMaskNet(nn.Module): """A three-layer network for predicting mask""" def __init__(self, input, output): super(SmallMaskNet, self).__init__() self.conv1 = nn.Conv2d(input, 32, 5, padding=2) self.conv2 = nn.Con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
saikatdutta/NME-VFI
SmallMaskNet
false
7,591
[ "Apache-2.0" ]
1
5915e2336ea3ed7113a9c6a91bbc7f6b5deaac17
https://github.com/saikatdutta/NME-VFI/tree/5915e2336ea3ed7113a9c6a91bbc7f6b5deaac17
ContinuousEmbeddings
import math import torch from torch import Tensor from torch import nn import torch.nn.functional as F def _get_activation_fn(activation): if activation == 'relu': return nn.ReLU(inplace=True) if activation == 'leaky_relu': return nn.LeakyReLU(inplace=True) elif activation == 'gelu': ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
sallypannn/pytorch-widedeep
ContinuousEmbeddings
false
7,592
[ "MIT" ]
1
ab4a209a2a3bff539f543a66ac51306042ed6693
https://github.com/sallypannn/pytorch-widedeep/tree/ab4a209a2a3bff539f543a66ac51306042ed6693
Net
import torch import torch.nn as nn import torch.nn.functional class Net(nn.Module): def __init__(self, num_inputs=784, num_outputs=10, num_hiddens=256, is_training=True): super(Net, self).__init__() self.num_inputs = num_inputs self.num_outputs = num_outputs self.num_hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
samjz06/d2l-pytorch
Net
false
7,593
[ "Apache-2.0" ]
1
80eca3f7d217eefb4f6ae08aae24c6a3c2714898
https://github.com/samjz06/d2l-pytorch/tree/80eca3f7d217eefb4f6ae08aae24c6a3c2714898
L2Softmax
import math import torch from torch.nn import functional as F from torch.nn.modules.loss import _WeightedLoss class L2Softmax(_WeightedLoss): """L2Softmax from `"L2-constrained Softmax Loss for Discriminative Face Verification" <https://arxiv.org/abs/1703.09507>`_ paper. Parameters ---------- ...
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 math...
sailfish009/torch-toolbox
L2Softmax
false
7,594
[ "BSD-3-Clause" ]
1
80dfc22c697b9f323e097de72af04f0e5435d7b4
https://github.com/sailfish009/torch-toolbox/tree/80dfc22c697b9f323e097de72af04f0e5435d7b4
Conv
import torch from torch import nn from torch.nn.functional import interpolate from typing import cast class Interpolate(nn.Module): def __init__(self, scale_factor: 'float'=1.0, mode: 'str'='nearest' ) ->None: super().__init__() self.scale_factor = scale_factor self.mode = mode ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sakshi-06/pystiche
Conv
false
7,595
[ "BSD-3-Clause" ]
1
21a67364b332a34a2308a929f200900c76be5b73
https://github.com/sakshi-06/pystiche/tree/21a67364b332a34a2308a929f200900c76be5b73
Wide
import math import torch from torch import Tensor from torch import nn class Wide(nn.Module): """wide (linear) component Linear model implemented via an Embedding layer connected to the output neuron(s). Parameters ----------- wide_dim: int size of the Embedding layer. `wide_dim` is ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guard...
sallypannn/pytorch-widedeep
Wide
false
7,596
[ "MIT" ]
1
ab4a209a2a3bff539f543a66ac51306042ed6693
https://github.com/sallypannn/pytorch-widedeep/tree/ab4a209a2a3bff539f543a66ac51306042ed6693
ConvMeanPool
import torch import torch.nn as nn class ConvMeanPool(nn.Module): def __init__(self, input_dim, output_dim, kernel_size=3, biases=True, adjust_padding=False): super().__init__() if not adjust_padding: conv = nn.Conv2d(input_dim, output_dim, kernel_size, stride=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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
samsartor/score_sde
ConvMeanPool
false
7,597
[ "Apache-2.0" ]
1
d25c8d092a68d643c796d771c55f80075aa041d1
https://github.com/samsartor/score_sde/tree/d25c8d092a68d643c796d771c55f80075aa041d1
UpsampleConv
import torch import torch.nn as nn class UpsampleConv(nn.Module): def __init__(self, input_dim, output_dim, kernel_size=3, biases=True): super().__init__() self.conv = nn.Conv2d(input_dim, output_dim, kernel_size, stride=1, padding=kernel_size // 2, bias=biases) self.pixelshuf...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
samsartor/score_sde
UpsampleConv
false
7,598
[ "Apache-2.0" ]
1
d25c8d092a68d643c796d771c55f80075aa041d1
https://github.com/samsartor/score_sde/tree/d25c8d092a68d643c796d771c55f80075aa041d1
MeanPoolConv
import torch import torch.nn as nn class MeanPoolConv(nn.Module): def __init__(self, input_dim, output_dim, kernel_size=3, biases=True): super().__init__() self.conv = nn.Conv2d(input_dim, output_dim, kernel_size, stride=1, padding=kernel_size // 2, bias=biases) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
samsartor/score_sde
MeanPoolConv
false
7,599
[ "Apache-2.0" ]
1
d25c8d092a68d643c796d771c55f80075aa041d1
https://github.com/samsartor/score_sde/tree/d25c8d092a68d643c796d771c55f80075aa041d1
MultiHeadAttentionLayer
import math import torch import torch.nn as nn class MultiHeadAttentionLayer(nn.Module): def __init__(self, d_model, n_heads, dropout): super().__init__() assert d_model % n_heads == 0 self.d_model = d_model self.n_heads = n_heads self.head_dim = d_model // n_heads ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
salvacarrion/nmt-continual-learning
MultiHeadAttentionLayer
false
7,600
[ "MIT" ]
1
302147ac9c270f3341a68a72c803c457f05ff37b
https://github.com/salvacarrion/nmt-continual-learning/tree/302147ac9c270f3341a68a72c803c457f05ff37b
VarianceNorm2d
import torch import torch.nn as nn class VarianceNorm2d(nn.Module): def __init__(self, num_features, bias=False): super().__init__() self.num_features = num_features self.bias = bias self.alpha = nn.Parameter(torch.zeros(num_features)) self.alpha.data.normal_(1, 0.02) ...
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_...
samsartor/score_sde
VarianceNorm2d
false
7,601
[ "Apache-2.0" ]
1
d25c8d092a68d643c796d771c55f80075aa041d1
https://github.com/samsartor/score_sde/tree/d25c8d092a68d643c796d771c55f80075aa041d1
INDeConv
import torch import torch.nn as nn class INDeConv(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, out_padding=0, dilation=1, groups=1, relu=True, ins_n= True, bias=False): super(INDeConv, self).__init__() self.out_channels = out_planes ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
samsgood0310/Unsupervised-Defect-Segmentation
INDeConv
false
7,602
[ "Apache-2.0" ]
1
66af32506cd6e60c356890616e28d679622fd8e6
https://github.com/samsgood0310/Unsupervised-Defect-Segmentation/tree/66af32506cd6e60c356890616e28d679622fd8e6
PlainRefiner
import torch import torch.nn as nn class PlainRefiner(nn.Module): """Simple refiner from Deep Image Matting. Args: conv_channels (int): Number of channels produced by the three main convolutional layer. loss_refine (dict): Config of the loss of the refiner. Default: 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.nn as nn assert_...
rivergold/mmediting
PlainRefiner
false
7,603
[ "Apache-2.0" ]
1
fd972635c48bb065db29d1b5090592a87c7263d2
https://github.com/rivergold/mmediting/tree/fd972635c48bb065db29d1b5090592a87c7263d2
InstanceNorm2dPlus
import torch import torch.nn as nn class InstanceNorm2dPlus(nn.Module): def __init__(self, num_features, bias=True): super().__init__() self.num_features = num_features self.bias = bias self.instance_norm = nn.InstanceNorm2d(num_features, affine=False, track_running_st...
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_...
samsartor/score_sde
InstanceNorm2dPlus
false
7,604
[ "Apache-2.0" ]
1
d25c8d092a68d643c796d771c55f80075aa041d1
https://github.com/samsartor/score_sde/tree/d25c8d092a68d643c796d771c55f80075aa041d1
BiaffineAttention
import torch import torch.utils.checkpoint import torch.utils.data class BiaffineAttention(torch.nn.Module): """Implements a biaffine attention operator for binary relation classification. PyTorch implementation of the biaffine attention operator from "End-to-end neural relation extraction using deep bia...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.checkpoint import torch.utils.data assert_size_stride = torch...
rushabh-v/unilm
BiaffineAttention
false
7,605
[ "MIT" ]
1
a62a023bd5d3500c23ac454be0a8b0107e18a6ce
https://github.com/rushabh-v/unilm/tree/a62a023bd5d3500c23ac454be0a8b0107e18a6ce
SSD300
import torch import torchvision from torch import nn import torch.nn.functional as F from math import sqrt from itertools import product as product import torch.optim import torch.utils.data def decimate(tensor, m): """ Decimate a tensor by a factor 'm', i.e. downsample by keeping every 'm'th value. This...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
dee-walia20/SSD-Implementation-using-Pytorch
SSD300
false
7,606
[ "MIT" ]
1
2a7dcdcea2787f4bffd45f335819f08af2b525dd
https://github.com/dee-walia20/SSD-Implementation-using-Pytorch/tree/2a7dcdcea2787f4bffd45f335819f08af2b525dd
ResidualBlock
import torch import torch.nn as nn from functools import partial def ncsn_conv3x3(in_planes, out_planes, stride=1, bias=True, dilation=1, init_scale=1.0, padding=1): """3x3 convolution with PyTorch initialization. Same as NCSNv1/NCSNv2.""" init_scale = 1e-10 if init_scale == 0 else init_scale conv = 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.triton_helpers import libdevice import torch.nn as ...
samsartor/score_sde
ResidualBlock
false
7,607
[ "Apache-2.0" ]
1
d25c8d092a68d643c796d771c55f80075aa041d1
https://github.com/samsartor/score_sde/tree/d25c8d092a68d643c796d771c55f80075aa041d1
LinActorCritic
import torch class LinActorCritic(torch.nn.Module): def __init__(self, actor_lr, epsilon, in_dim, h_dim, out_dim): super(LinActorCritic, self).__init__() self.in_dim = in_dim self.out_dim = out_dim self.h_dim = h_dim self.epsilon = epsilon self.define_network() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Gregory-Eales/mban
LinActorCritic
false
7,608
[ "Apache-2.0" ]
1
d8b35db51c7e601b1db777d9a80343600374250b
https://github.com/Gregory-Eales/mban/tree/d8b35db51c7e601b1db777d9a80343600374250b
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 32, 5) self.pool1 = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(32, 64, 5) self.pool2 = nn.MaxPool2d(2, 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
piyushpathak03/Facial-key-point-detection
Net
false
7,609
[ "Apache-2.0" ]
1
863eeeac50c46befb17ecf7610cd341ea0e65291
https://github.com/piyushpathak03/Facial-key-point-detection/tree/863eeeac50c46befb17ecf7610cd341ea0e65291
BertImagePooler
from _paritybench_helpers import _mock_config import torch import torch.optim import torch.utils.data from torch import nn import torch class BertImagePooler(nn.Module): def __init__(self, config): super(BertImagePooler, self).__init__() self.dense = nn.Linear(config.v_hidden_size, config.bi_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 from torch._inductor.runtime import triton_helpers import torch.optim import tor...
ChoiIseungil/vilbert-multi-task
BertImagePooler
false
7,610
[ "MIT" ]
1
37d14b9aed9c48117a820e05157c7ccd3dd20d5b
https://github.com/ChoiIseungil/vilbert-multi-task/tree/37d14b9aed9c48117a820e05157c7ccd3dd20d5b
Net2
import torch import torch.nn as nn from torch.testing._internal.common_utils import * class MyRelu2(torch.autograd.Function): @staticmethod def forward(ctx, input): ctx.save_for_backward(input) return input.clamp(min=0) class Net2(nn.Module): def __init__(self): super().__init_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from torch.testing._internal.common_utils import * assert_size_stri...
LexcaliburR/notebook
Net2
false
7,611
[ "MIT" ]
1
84a8f3801dff20d07caa0ed2584e722656fb5726
https://github.com/LexcaliburR/notebook/tree/84a8f3801dff20d07caa0ed2584e722656fb5726
Conv2d
from torch.autograd import Function import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def _setup_kernel(k): k = np.asarray(k, dtype=np.float32) if k.ndim == 1: k = np.outer(k, k) k /= np.sum(k) assert k.ndim == 2 assert k.shape[0] == k.shape[1] retur...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 numpy as np import torch.nn as nn imp...
samsartor/score_sde
Conv2d
false
7,612
[ "Apache-2.0" ]
1
d25c8d092a68d643c796d771c55f80075aa041d1
https://github.com/samsartor/score_sde/tree/d25c8d092a68d643c796d771c55f80075aa041d1
BertOutput
from _paritybench_helpers import _mock_config import torch import torch.nn import torch.nn as nn class BertOutput(nn.Module): """BERT output layer. Based on: BERT (pytorch-transformer) https://github.com/huggingface/transformers """ def __init__(self, config) ->None: super(BertOutput, 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.triton_helpers import libdevice import torch.nn imp...
Erotemic/MONAI
BertOutput
false
7,613
[ "Apache-2.0" ]
1
a9cd2d88168107281a2abcc2f63efaed80580e79
https://github.com/Erotemic/MONAI/tree/a9cd2d88168107281a2abcc2f63efaed80580e79
BERTLowRank
from _paritybench_helpers import _mock_config 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 + torch.tanh(math.sqrt(2 / math...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
DAQuestionAnswering/Bert-n-Pals
BERTLowRank
false
7,614
[ "MIT" ]
1
d5a288b9ac62259e70c249635108ba3906e19f00
https://github.com/DAQuestionAnswering/Bert-n-Pals/tree/d5a288b9ac62259e70c249635108ba3906e19f00
Decoder
import torch import torch.nn as nn class INConv(nn.Module): def __init__(self, in_planes, out_planes, kernel_size, stride=1, padding=0, dilation=1, groups=1, relu=True, ins_n=True, bias=False): super(INConv, self).__init__() self.out_channels = out_planes self.conv = nn.Conv2d(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....
samsgood0310/Unsupervised-Defect-Segmentation
Decoder
false
7,615
[ "Apache-2.0" ]
1
66af32506cd6e60c356890616e28d679622fd8e6
https://github.com/samsgood0310/Unsupervised-Defect-Segmentation/tree/66af32506cd6e60c356890616e28d679622fd8e6
FrameAvgPool
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class FrameAvgPool(nn.Module): def __init__(self, cfg): super(FrameAvgPool, self).__init__() input_size = cfg.INPUT_SIZE hidden_size = cfg.HIDDEN_SIZE kernel_size = cfg.KERNEL_SIZE stride = cf...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
CFM-MSG/Code_LEORN
FrameAvgPool
false
7,616
[ "MIT" ]
1
fabea1e1ded973a4db692e51e2df442bde55f626
https://github.com/CFM-MSG/Code_LEORN/tree/fabea1e1ded973a4db692e51e2df442bde55f626
BertOutput
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.utils.checkpoint class BertLayerNorm(nn.Module): """LayerNorm层, 见Transformer(一), 讲编码器(encoder)的第3部分""" def __init__(self, hidden_size, eps=1e-12, conditional=False): """Construct a layernorm module in the TF...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Elvisambition/bert_seq2seq
BertOutput
false
7,617
[ "Apache-2.0" ]
1
643ac537c16872f0d13200de06001d8201a54fbb
https://github.com/Elvisambition/bert_seq2seq/tree/643ac537c16872f0d13200de06001d8201a54fbb
EncoderLayer
import math import torch import torch.nn as nn class MultiHeadAttentionLayer(nn.Module): def __init__(self, d_model, n_heads, dropout): super().__init__() assert d_model % n_heads == 0 self.d_model = d_model self.n_heads = n_heads self.head_dim = d_model // n_heads ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
salvacarrion/nmt-continual-learning
EncoderLayer
false
7,618
[ "MIT" ]
1
302147ac9c270f3341a68a72c803c457f05ff37b
https://github.com/salvacarrion/nmt-continual-learning/tree/302147ac9c270f3341a68a72c803c457f05ff37b
T5DenseReluDense
from _paritybench_helpers import _mock_config import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.checkpoint class T5DenseReluDense(nn.Module): def __init__(self, config): super().__init__() self.wi = nn.Linear(config.d_model, config.d_ff, bias=False) 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 import ...
Elvisambition/bert_seq2seq
T5DenseReluDense
false
7,619
[ "Apache-2.0" ]
1
643ac537c16872f0d13200de06001d8201a54fbb
https://github.com/Elvisambition/bert_seq2seq/tree/643ac537c16872f0d13200de06001d8201a54fbb
AdapterLayer
from _paritybench_helpers import _mock_config 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 + torch.tanh(math.sqrt(2 / math...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
DAQuestionAnswering/Bert-n-Pals
AdapterLayer
false
7,620
[ "MIT" ]
1
d5a288b9ac62259e70c249635108ba3906e19f00
https://github.com/DAQuestionAnswering/Bert-n-Pals/tree/d5a288b9ac62259e70c249635108ba3906e19f00
BertSelfAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AlanFokCo/bert-chinese-horovod-elastic
BertSelfAttention
false
7,621
[ "Apache-2.0" ]
1
02317d0857e0e8e313dd63ead61ca9996b25548e
https://github.com/AlanFokCo/bert-chinese-horovod-elastic/tree/02317d0857e0e8e313dd63ead61ca9996b25548e
RobertaClassificationHead
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.utils.data import torch.nn class RobertaClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, config): super(RobertaClassificationHead, 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 ...
GavinGuan95/Generative-VQA
RobertaClassificationHead
false
7,622
[ "MIT" ]
1
0912e3a2426809ef4d4eb40bae667b31c2269161
https://github.com/GavinGuan95/Generative-VQA/tree/0912e3a2426809ef4d4eb40bae667b31c2269161
Actor
import torch class Actor(torch.nn.Module): def __init__(self, actor_lr, epsilon): super(Actor, self).__init__() self.epsilon = epsilon self.define_network() self.optimizer = torch.optim.Adam(params=self.parameters(), lr=actor_lr ) self.device = torch.device('cu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Gregory-Eales/Proximal-Policy-Optimization
Actor
false
7,623
[ "Apache-2.0" ]
1
134f930bd1436c34e79af9344fe70f75e11c8a30
https://github.com/Gregory-Eales/Proximal-Policy-Optimization/tree/134f930bd1436c34e79af9344fe70f75e11c8a30
Normalization
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class Normalization(nn.Module): def __init__(self, cfg): super(Normalization, self).__init__() self.normalizer = nn.LayerNorm(cfg.embedding_dim, elementwise_affine=True) def forward(self, input): ...
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_...
JustinLiam/DAN
Normalization
false
7,624
[ "MIT" ]
1
eb29cddad6c93e591854b115ef524643b1cd471c
https://github.com/JustinLiam/DAN/tree/eb29cddad6c93e591854b115ef524643b1cd471c
SingleHeadAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class SingleHeadAttention(nn.Module): def __init__(self, cfg): super(SingleHeadAttention, self).__init__() self.input_dim = cfg.embedding_dim self.embedding_dim = cfg.embedding_dim self.va...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JustinLiam/DAN
SingleHeadAttention
false
7,625
[ "MIT" ]
1
eb29cddad6c93e591854b115ef524643b1cd471c
https://github.com/JustinLiam/DAN/tree/eb29cddad6c93e591854b115ef524643b1cd471c
SparsemaxBisect
from torch.autograd import Function import torch import torch.nn as nn def sparsemax_bisect(X, dim=-1, n_iter=50, ensure_sum_one=True): """sparsemax: normalizing sparse transform (a la softmax), via bisection. Solves the projection: min_p ||x - p||_2 s.t. p >= 0, sum(p) == 1. Parameters ...
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.autograd import Function import torch.nn as nn assert_size_stride = torch._C._...
roholazandie/entmax
SparsemaxBisect
false
7,626
[ "MIT" ]
1
657374e6a792ec6840b6f78bc759cc1f51570aad
https://github.com/roholazandie/entmax/tree/657374e6a792ec6840b6f78bc759cc1f51570aad
GPT2Layer
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadSelfAttention(nn.Module): def __init__(self, d_ipt: 'int', n_head: 'int', dropout_p: 'float'=0.1): super(MultiHeadSelfAttention, self).__init__() self.qkv_linear = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
DunZhang/GPT2SourceCode
GPT2Layer
false
7,627
[ "MIT" ]
1
d598dbae278c93f88469d45ec025da4cfa7d69ee
https://github.com/DunZhang/GPT2SourceCode/tree/d598dbae278c93f88469d45ec025da4cfa7d69ee
Gaussian
import torch from torch import Tensor import torch.utils.tensorboard import torch.utils.data class Gaussian(torch.nn.Module): """Gaussian activation""" def forward(self, x: 'Tensor') ->Tensor: return torch.exp(-x * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.tensorboard import torch.utils.data assert_size_stride...
raimis/torchani
Gaussian
false
7,628
[ "MIT" ]
1
19882c6e18174e08423706a536366f89029a740a
https://github.com/raimis/torchani/tree/19882c6e18174e08423706a536366f89029a740a
EntmaxBisect
from torch.autograd import Function import torch import torch.nn as nn def entmax_bisect(X, alpha=1.5, dim=-1, n_iter=50, ensure_sum_one=True): """alpha-entmax: normalizing sparse transform (a la softmax). Solves the optimization problem: max_p <x, p> - H_a(p) s.t. p >= 0, sum(p) == 1. wh...
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...
roholazandie/entmax
EntmaxBisect
false
7,629
[ "MIT" ]
1
657374e6a792ec6840b6f78bc759cc1f51570aad
https://github.com/roholazandie/entmax/tree/657374e6a792ec6840b6f78bc759cc1f51570aad
ResNetV2
import torch import torch.nn as nn import torch.nn.functional as F from collections import OrderedDict import torch.utils.data def conv1x1(cin, cout, stride=1, bias=False): return StdConv2d(cin, cout, kernel_size=1, stride=stride, padding=0, bias=bias) def conv3x3(in_planes, out_planes, stride=1): r...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
matsuolab/DomainBed
ResNetV2
false
7,630
[ "MIT" ]
1
00e0e3d183b36fd4d0c50442012149794a6504c2
https://github.com/matsuolab/DomainBed/tree/00e0e3d183b36fd4d0c50442012149794a6504c2
HSwish
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed class HSwish(nn.Module): def __init__(self, inplace=True): super(HSwish, self).__init__() self.inplace = inplace def forward(self, x): out = x * F.relu6(x + 3, inplace=self.inplace)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data.distributed assert_size_stride = torch._C._...
AberHu/ImageNet-training
HSwish
false
7,631
[ "MIT" ]
12
7201eb140176f4d7ec1ed0ff5c27deba2dfb60c2
https://github.com/AberHu/ImageNet-training/tree/7201eb140176f4d7ec1ed0ff5c27deba2dfb60c2
Normalize
import torch import torch.utils.data class Normalize(torch.nn.Module): def __init__(self): super(Normalize, self).__init__() self.normalize = torch.nn.functional.normalize def forward(self, x): x = self.normalize(x, dim=-1) return x def get_inputs(): return [torch.rand(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data asse...
Alescontrela/AMP_for_hardware
Normalize
false
7,632
[ "BSD-3-Clause" ]
11
bfb0dbdcf32bdf83a916790bddf193fffc7e79b8
https://github.com/Alescontrela/AMP_for_hardware/tree/bfb0dbdcf32bdf83a916790bddf193fffc7e79b8
ResizeTransform
import torch import torch.nn as nn import torch.nn.functional as nnf import torch.utils class ResizeTransform(nn.Module): """ Resize a transform, which involves resizing the vector field *and* rescaling it. """ def __init__(self, vel_resize, ndims): super().__init__() self.factor = 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 import torch.utils assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
Alison-brie/MultiPropReg
ResizeTransform
false
7,633
[ "MIT" ]
14
526d843b161c0e2e53ec5c7c47de6964c6a44c60
https://github.com/Alison-brie/MultiPropReg/tree/526d843b161c0e2e53ec5c7c47de6964c6a44c60
LinearBlock
import torch from torch import nn class LinearBlock(nn.Module): def __init__(self, in_dim, out_dim, norm='none', activation='relu'): super(LinearBlock, self).__init__() use_bias = True self.fc = nn.Linear(in_dim, out_dim, bias=use_bias) norm_dim = out_dim if norm == 'bn': ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Alikfp/research-GANwriting
LinearBlock
false
7,634
[ "MIT" ]
41
2190954218a733deac52c929f51bb85bca5d7216
https://github.com/Alikfp/research-GANwriting/tree/2190954218a733deac52c929f51bb85bca5d7216
ResizeConv2d
import torch import torch.nn.functional as F import torch.nn as nn import torch.cuda import torch.optim import torch.utils.data class ResizeConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, scale_factor, mode='nearest'): super().__init__() self.scale_factor = s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.cuda import torch.optim import torch.utils.da...
AhmadQasim/MedAL
ResizeConv2d
false
7,635
[ "MIT" ]
13
0ad6064d0d07f23722034b866ba86d93b62517f4
https://github.com/AhmadQasim/MedAL/tree/0ad6064d0d07f23722034b866ba86d93b62517f4
BalancedL1Loss
import functools import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
AllenPeng0209/SaccadeNet
BalancedL1Loss
false
7,636
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
Conv2dBlock
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps self.momentum = mome...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn.functional as...
Alikfp/research-GANwriting
Conv2dBlock
false
7,637
[ "MIT" ]
41
2190954218a733deac52c929f51bb85bca5d7216
https://github.com/Alikfp/research-GANwriting/tree/2190954218a733deac52c929f51bb85bca5d7216
WeightedCrossEntropyLoss
import torch import torch.nn as nn import torch.nn.functional as F class WeightedCrossEntropyLoss(nn.Module): """ Transform input to fit the fomation of PyTorch offical cross entropy loss with anchor-wise weighting. """ def __init__(self): super(WeightedCrossEntropyLoss, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
AbangLZU/OpenPCDet
WeightedCrossEntropyLoss
false
7,638
[ "Apache-2.0" ]
29
eeea3f24d392f692228c1ad4e28c0dc9d0e25665
https://github.com/AbangLZU/OpenPCDet/tree/eeea3f24d392f692228c1ad4e28c0dc9d0e25665
GlobalAvgPool2d
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data class GlobalAvgPool2d(nn.Module): def __init__(self): super(GlobalAvgPool2d, self).__init__() def forward(self, x): N = x.data.size(0) C = x.data.siz...
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.parallel import torch.optim import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asser...
Alin1102/Yolov3_Dartnet2Caffe
GlobalAvgPool2d
false
7,639
[ "MIT" ]
21
b4284b080f53c1ac73c1930b1b1c4e07dcd97559
https://github.com/Alin1102/Yolov3_Dartnet2Caffe/tree/b4284b080f53c1ac73c1930b1b1c4e07dcd97559
Eltwise
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class Eltwise(nn.Module): def __init__(self, operation='+'): super(Eltwise, self).__init__() self.operation = operation def forward(self, x1, x2): if self.operation == '+' or self.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 import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asser...
Alin1102/Yolov3_Dartnet2Caffe
Eltwise
false
7,640
[ "MIT" ]
21
b4284b080f53c1ac73c1930b1b1c4e07dcd97559
https://github.com/Alin1102/Yolov3_Dartnet2Caffe/tree/b4284b080f53c1ac73c1930b1b1c4e07dcd97559
MaxPoolStride1
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data class MaxPoolStride1(nn.Module): def __init__(self): super(MaxPoolStride1, self).__init__() def forward(self, x): x = F.max_pool2d(F.pad(x, (0, 1, 0, 1), mod...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data...
Alin1102/Yolov3_Dartnet2Caffe
MaxPoolStride1
false
7,641
[ "MIT" ]
21
b4284b080f53c1ac73c1930b1b1c4e07dcd97559
https://github.com/Alin1102/Yolov3_Dartnet2Caffe/tree/b4284b080f53c1ac73c1930b1b1c4e07dcd97559
SigmoidFocalClassificationLoss
import torch import torch.nn as nn class SigmoidFocalClassificationLoss(nn.Module): """ Sigmoid focal cross entropy loss. """ def __init__(self, gamma: 'float'=2.0, alpha: 'float'=0.25): """ Args: gamma: Weighting parameter to balance loss for hard and easy examples. ...
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...
AbangLZU/OpenPCDet
SigmoidFocalClassificationLoss
false
7,642
[ "Apache-2.0" ]
29
eeea3f24d392f692228c1ad4e28c0dc9d0e25665
https://github.com/AbangLZU/OpenPCDet/tree/eeea3f24d392f692228c1ad4e28c0dc9d0e25665
L2Norm
import torch import torch.nn as nn class L2Norm(nn.Module): def __init__(self, n_dims, scale=20.0, eps=1e-10): super(L2Norm, self).__init__() self.n_dims = n_dims self.weight = nn.Parameter(torch.Tensor(self.n_dims)) self.eps = eps self.scale = scale def forward(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 libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
AllenPeng0209/SaccadeNet
L2Norm
false
7,643
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
Policy
import torch import torch.nn as nn class Policy(nn.Module): def __init__(self, num_inputs, num_outputs): super(Policy, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.action_mean = nn.Linear(64, num_outputs) self.action_mean....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Akella17/Deep-Bayesian-Quadrature-Policy-Optimization
Policy
false
7,644
[ "MIT" ]
16
e98fd68046486c002c33cf019db2ce66da18615b
https://github.com/Akella17/Deep-Bayesian-Quadrature-Policy-Optimization/tree/e98fd68046486c002c33cf019db2ce66da18615b
HSigmoid
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed class HSigmoid(nn.Module): def __init__(self, inplace=True): super(HSigmoid, self).__init__() self.inplace = inplace def forward(self, x): out = F.relu6(x + 3, inplace=self.inplace)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data.distributed assert_size_stride = torch._C._...
AberHu/ImageNet-training
HSigmoid
false
7,645
[ "MIT" ]
12
7201eb140176f4d7ec1ed0ff5c27deba2dfb60c2
https://github.com/AberHu/ImageNet-training/tree/7201eb140176f4d7ec1ed0ff5c27deba2dfb60c2
Scale
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, scale=1.0): super(Scale, self).__init__() self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float)) def forward(self, x): return x * self.scale 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
AllenPeng0209/SaccadeNet
Scale
false
7,646
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
Abs
import torch import torch.nn as nn class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super(ModuleWrapper, self).__init__() def set_flag(self, flag_name, value): setattr(self, flag_name, value) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
AlliedToasters/elko_den
Abs
false
7,647
[ "Apache-2.0" ]
38
4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
https://github.com/AlliedToasters/elko_den/tree/4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
GHMC
import torch import torch.nn as nn import torch.nn.functional as F def _expand_binary_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero(labels >= 1).squeeze() if inds.numel() > 0: bin_labels[inds, labels[inds] - 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 math as tl_math import torch.nn as nn ...
AllenPeng0209/SaccadeNet
GHMC
false
7,648
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
ConvWS2d
import torch import torch.nn as nn import torch.nn.functional as F def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-05): c_in = weight.size(0) weight_flat = weight.view(c_in, -1) mean = weight_flat.mean(dim=1, keepdim=True).view(c_in, 1, 1, 1) std = weight...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AllenPeng0209/SaccadeNet
ConvWS2d
false
7,649
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
Attention
import math import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, n_head=1, score_function ='scaled_dot_product'): super(Attention, self).__init__() if hidden_dim is None: hidden_dim = embe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
AlbertoPaz/ABSA-PyTorch
Attention
false
7,650
[ "MIT" ]
20
070a4b6f20cde0e2021c72b84c534659d749f36e
https://github.com/AlbertoPaz/ABSA-PyTorch/tree/070a4b6f20cde0e2021c72b84c534659d749f36e
SmoothL1Loss
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
AllenPeng0209/SaccadeNet
SmoothL1Loss
false
7,651
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
KL_loss_softmax
import torch import torch.nn as nn import torch.nn.init class KL_loss_softmax(nn.Module): """ Compute KL_divergence between all prediction score (already sum=1, omit softmax function) """ def __init__(self): super(KL_loss_softmax, self).__init__() self.KL_loss = nn.KLDivLoss(reduce=Fa...
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...
AndresPMD/semantic_adaptive_margin
KL_loss_softmax
false
7,652
[ "Apache-2.0" ]
12
1e8bf2f1836498c48df030cb0a967b72b52e8460
https://github.com/AndresPMD/semantic_adaptive_margin/tree/1e8bf2f1836498c48df030cb0a967b72b52e8460
Centered_Grad
import torch import torch.nn as nn class Centered_Grad(nn.Module): def __init__(self): super(Centered_Grad, self).__init__() self.x_ker_init = torch.tensor([[[[-0.5, 0, 0.5]]]], dtype=torch. float, requires_grad=True) self.y_ker_init = torch.tensor([[[[-0.5], [0], [0.5]]]], dt...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
AmazingAng/pytorch-tvnet
Centered_Grad
false
7,653
[ "MIT" ]
12
e880d3ce15f55e5d9a11b423cfd1e0461de4fedb
https://github.com/AmazingAng/pytorch-tvnet/tree/e880d3ce15f55e5d9a11b423cfd1e0461de4fedb
ShuffleBlock
import torch from torch import nn class ShuffleBlock(nn.Module): def __init__(self, groups=2): super(ShuffleBlock, self).__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.size()...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Alibaba-MIIL/HeadSharingKD
ShuffleBlock
false
7,654
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
GLU
import torch import torch.nn as nn class GLU(nn.Module): def __init__(self, input_channel, output_channel): super(GLU, self).__init__() self.linear_left = nn.Linear(input_channel, output_channel) self.linear_right = nn.Linear(input_channel, output_channel) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Abdulmajid-Murad/deep_probabilistic_forecast
GLU
false
7,655
[ "MIT" ]
11
399846381af4bb789021c9f63f121dd69fa0125d
https://github.com/Abdulmajid-Murad/deep_probabilistic_forecast/tree/399846381af4bb789021c9f63f121dd69fa0125d
ActFirstResBlock
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps self.momentum = mome...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
Alikfp/research-GANwriting
ActFirstResBlock
false
7,656
[ "MIT" ]
41
2190954218a733deac52c929f51bb85bca5d7216
https://github.com/Alikfp/research-GANwriting/tree/2190954218a733deac52c929f51bb85bca5d7216
Multi_feature_fusing
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.nn.init def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) return X class Multi_feature_fusing(...
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 import torch.nn.init assert_size_strid...
AndresPMD/semantic_adaptive_margin
Multi_feature_fusing
false
7,657
[ "Apache-2.0" ]
12
1e8bf2f1836498c48df030cb0a967b72b52e8460
https://github.com/AndresPMD/semantic_adaptive_margin/tree/1e8bf2f1836498c48df030cb0a967b72b52e8460
Permute
import torch from torch import nn class Permute(nn.Module): def __init__(self, permutation=[2, 1, 0]): super().__init__() self.permutation = permutation def forward(self, input): return input[:, self.permutation] def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_ini...
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...
Alibaba-AAIG/Beyond-ImageNet-Attack
Permute
false
7,658
[ "MIT" ]
23
c14b4844b64a8035b8fe033a617c0567224a9fa4
https://github.com/Alibaba-AAIG/Beyond-ImageNet-Attack/tree/c14b4844b64a8035b8fe033a617c0567224a9fa4
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 ...
Alibaba-MIIL/HeadSharingKD
FactorTransfer
false
7,659
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
GHMR
import torch import torch.nn as nn class GHMR(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper "Gradient Harmonized Single-stage Detector" https://arxiv.org/abs/1811.05181 Args: mu (float): The parameter for the Authentic Smooth L1 loss. bins ...
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...
AllenPeng0209/SaccadeNet
GHMR
false
7,660
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
Forward_Grad
import torch import torch.nn as nn import torch.nn.functional as F class Forward_Grad(nn.Module): def __init__(self): super(Forward_Grad, self).__init__() self.x_ker_init = torch.tensor([[[[-1, 1]]]], dtype=torch.float, requires_grad=True) self.y_ker_init = torch.tensor([[[[-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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AmazingAng/pytorch-tvnet
Forward_Grad
false
7,661
[ "MIT" ]
12
e880d3ce15f55e5d9a11b423cfd1e0461de4fedb
https://github.com/AmazingAng/pytorch-tvnet/tree/e880d3ce15f55e5d9a11b423cfd1e0461de4fedb
EncoderImagePrecomp
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) return X class EncoderImagePreco...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AndresPMD/semantic_adaptive_margin
EncoderImagePrecomp
false
7,662
[ "Apache-2.0" ]
12
1e8bf2f1836498c48df030cb0a967b72b52e8460
https://github.com/AndresPMD/semantic_adaptive_margin/tree/1e8bf2f1836498c48df030cb0a967b72b52e8460
Normalize
import torch from torch import nn class Normalize(nn.Module): """normalization layer""" def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(...
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...
Alibaba-MIIL/HeadSharingKD
Normalize
false
7,663
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
LinearBlock
import torch import torch.nn as nn import torch.utils.data def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
AllenPu/mbdg
LinearBlock
false
7,664
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
FeatureExtractor
import torch import torch.nn as nn class FeatureExtractor(nn.Module): def __init__(self, num_inputs, num_outputs): super(FeatureExtractor, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 48) self.affine3 = nn.Linear(48, num_outputs) 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.triton_helpers import libdevice import torch.nn as ...
Akella17/Deep-Bayesian-Quadrature-Policy-Optimization
FeatureExtractor
false
7,665
[ "MIT" ]
16
e98fd68046486c002c33cf019db2ce66da18615b
https://github.com/Akella17/Deep-Bayesian-Quadrature-Policy-Optimization/tree/e98fd68046486c002c33cf019db2ce66da18615b
mlp
import torch import torch.nn as nn class mlp(nn.Module): def __init__(self, seq_len): super(mlp, self).__init__() self.lin1 = nn.Linear(seq_len, 2048) self.lin2 = nn.Linear(2048, 2048) self.lin3 = nn.Linear(2048, seq_len) self.relu = nn.ReLU() def forward(self, input_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
AliRoyat/MACS_IQA
mlp
false
7,666
[ "Apache-2.0" ]
16
d37ac72170dc0271065a7c54273b70ed52aee4b8
https://github.com/AliRoyat/MACS_IQA/tree/d37ac72170dc0271065a7c54273b70ed52aee4b8
Normalize_one
import torch from torch import nn class Normalize_one(nn.Module): def __init__(self, mean, std): super(Normalize_one, self).__init__() self.mean = mean self.std = std def forward(self, input): x = input.clone() x = (x - self.mean) / self.std return x def get...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Alibaba-AAIG/Beyond-ImageNet-Attack
Normalize_one
false
7,667
[ "MIT" ]
23
c14b4844b64a8035b8fe033a617c0567224a9fa4
https://github.com/Alibaba-AAIG/Beyond-ImageNet-Attack/tree/c14b4844b64a8035b8fe033a617c0567224a9fa4
FPNHead
import torch import torch.nn as nn class FPNHead(nn.Module): """"this is the FPNHead class common to all backbones""" def __init__(self, num_in, num_mid, num_out): super(FPNHead, self).__init__() self.block0 = nn.Conv2d(num_in, num_mid, kernel_size=3, padding=1, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
AmaldevHari/Ghost-DeblurGAN
FPNHead
false
7,668
[ "MIT" ]
16
e725e5dad6a5fa5865d317e6644d96d0e800eae6
https://github.com/AmaldevHari/Ghost-DeblurGAN/tree/e725e5dad6a5fa5865d317e6644d96d0e800eae6
LayerNorm
import torch import torch.nn as nn import torch.utils.data class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: ...
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...
AllenPu/mbdg
LayerNorm
false
7,669
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
HintLoss
import torch from torch import nn class HintLoss(nn.Module): """Fitnets: hints for thin deep nets, ICLR 2015""" def __init__(self): super(HintLoss, self).__init__() self.crit = nn.MSELoss() def forward(self, f_s, f_t): loss = self.crit(f_s, f_t) return loss def get_inpu...
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...
Alibaba-MIIL/HeadSharingKD
HintLoss
false
7,670
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
DeContraster
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class DeContraster(AdversarialNoiseGenerator): def __init__(self, e...
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.distributions import torch.utils.data assert_size_stride = torch._C._dynamo....
AlexMeinke/Provable-OOD-Detection
DeContraster
false
7,671
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
BinaryLoss
import torch import torch.nn as nn import torch.distributions import torch.utils.data class BinaryLoss(nn.Module): def __init__(self): super().__init__() def forward(self, output): return torch.logaddexp(torch.tensor([1.0], device=output.device), - output) def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.distributions import torch....
AlexMeinke/Provable-OOD-Detection
BinaryLoss
false
7,672
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
EncoderImageWeightNormPrecomp
import torch from collections import OrderedDict import torch.nn as nn import torch.nn.init from torch.nn.utils.weight_norm import weight_norm def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) 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.triton_helpers import libdevice from collections im...
AndresPMD/semantic_adaptive_margin
EncoderImageWeightNormPrecomp
false
7,673
[ "Apache-2.0" ]
12
1e8bf2f1836498c48df030cb0a967b72b52e8460
https://github.com/AndresPMD/semantic_adaptive_margin/tree/1e8bf2f1836498c48df030cb0a967b72b52e8460
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...
Alibaba-MIIL/HeadSharingKD
PKT
false
7,674
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
LinearVarianceUnif
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn import Parameter class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super(ModuleW...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import Parameter assert_size_str...
AlliedToasters/elko_den
LinearVarianceUnif
false
7,675
[ "Apache-2.0" ]
38
4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
https://github.com/AlliedToasters/elko_den/tree/4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
KDE
import torch from torch import nn import torch.nn.functional as F class KDE(nn.Module): """KD on embeddings - KDE""" def __init__(self): super(KDE, self).__init__() def forward(self, embedding_s, embedding_t): inputs_embed = F.normalize(embedding_s, p=2.0, dim=1) targets_embed = ...
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_...
Alibaba-MIIL/HeadSharingKD
KDE
false
7,676
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
MNIST_CNN
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class MNIST_CNN(nn.Module): """ Hand-tuned architecture for MNIST. Weirdness I've noticed so far with this architecture: - adding a linear layer after the mean-pool in features hurts RotatedMNIST-100 gen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
AllenPu/mbdg
MNIST_CNN
false
7,677
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
LinearVariance
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn import Parameter class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super(ModuleW...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
AlliedToasters/elko_den
LinearVariance
false
7,678
[ "Apache-2.0" ]
38
4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
https://github.com/AlliedToasters/elko_den/tree/4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
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 ...
Alibaba-MIIL/HeadSharingKD
DistillKL
false
7,679
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
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_...
Alibaba-MIIL/HeadSharingKD
Correlation
false
7,680
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
HINet
import torch import torch.nn as nn class HINet(nn.Module): def __init__(self, in_ch): super(HINet, self).__init__() self.instance_norm = nn.InstanceNorm2d(in_ch - in_ch // 2, affine=True) def forward(self, x): channels = x.shape[1] channels_i = channels - channels // 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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
AmaldevHari/Ghost-DeblurGAN
HINet
false
7,681
[ "MIT" ]
16
e725e5dad6a5fa5865d317e6644d96d0e800eae6
https://github.com/AmaldevHari/Ghost-DeblurGAN/tree/e725e5dad6a5fa5865d317e6644d96d0e800eae6