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
InverseSigmoid
import torch import torch.utils.data def inverseSigmoid(y): """ inverse of y=torch.sigmoid(y) :param y: :return: x """ return torch.log(-y / (y - 1)) class InverseSigmoid(torch.nn.Module): def forward(self, y): return inverseSigmoid(y) 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 math as tl_math import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asse...
khoehlein/fV-SRN
InverseSigmoid
false
3,831
[ "MIT" ]
0
601f3e952b090df92e875c233c2c9ca646523948
https://github.com/khoehlein/fV-SRN/tree/601f3e952b090df92e875c233c2c9ca646523948
InverseSoftplus
import torch import torch.utils.data def inverseSoftplus(y, beta=1, threshold=20): """ inverse of y=torch.nn.functional.softplus(x, beta, threshold) :param y: the output of the softplus :param beta: the smoothness of the step :param threshold: the threshold after which a linear function is used :return:...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asse...
khoehlein/fV-SRN
InverseSoftplus
false
3,832
[ "MIT" ]
0
601f3e952b090df92e875c233c2c9ca646523948
https://github.com/khoehlein/fV-SRN/tree/601f3e952b090df92e875c233c2c9ca646523948
MultiHeadAttention
import math import torch from torch import nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): def __init__(self, emb_size, n_heads=8, mask=False): """ Arguments: emb_size: Size of input Embeddings n_heads: Number of heads for MultiHead Attention Laye...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
kcmankar/TransformerFromScratch
MultiHeadAttention
false
3,833
[ "MIT" ]
0
4c68d507f3b0b9713822964e3769283ca0ddc685
https://github.com/kcmankar/TransformerFromScratch/tree/4c68d507f3b0b9713822964e3769283ca0ddc685
decoder3
import torch import torch.nn import torch import torch.nn as nn class decoder3(nn.Module): def __init__(self, W, v2): super(decoder3, self).__init__() self.reflecPad7 = nn.ZeroPad2d((1, 1, 1, 1)) self.conv7 = nn.Conv2d(int(256 * W), int(128 * W), 3, 1, 0) self.relu7 = nn.ReLU(inpl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch ...
kamieen03/style-transfer-server
decoder3
false
3,834
[ "BSD-2-Clause" ]
0
91727ec62080215a0b870ce043faf0657137b84b
https://github.com/kamieen03/style-transfer-server/tree/91727ec62080215a0b870ce043faf0657137b84b
LReluCustom
import torch from torch import nn class LReluCustom(nn.Module): def __init__(self, leak=0.1): super(LReluCustom, self).__init__() self.leak = leak def forward(self, x): return torch.max(x, self.leak * 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 import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
kkulczak/phrases_reconstruction_GAN
LReluCustom
false
3,835
[ "MIT" ]
0
5cf273416eb714f813a8d603942a442f0933cbff
https://github.com/kkulczak/phrases_reconstruction_GAN/tree/5cf273416eb714f813a8d603942a442f0933cbff
TripletLoss
import torch from torch import nn import torch.nn.functional as F class TripletLoss(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a negative sample """ def __init__(self, margin=2.0): super(TripletLoss, self).__init__() self.margin = marg...
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...
kmi-robots/object_reasoner
TripletLoss
false
3,836
[ "Apache-2.0" ]
0
2d45bdb3ee745e0d866a152e8d81cbb375fa2985
https://github.com/kmi-robots/object_reasoner/tree/2d45bdb3ee745e0d866a152e8d81cbb375fa2985
Net
import torch class Net(torch.nn.Module): def __init__(self, n_input, n_hidden, n_output): super(Net, self).__init__() self.layer1 = torch.nn.Linear(n_input, n_hidden) self.layer2 = torch.nn.Linear(n_hidden, n_hidden) self.layer3 = torch.nn.Linear(n_hidden, n_hidden) self.l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 assert_size_stride ...
kimukook/variable_length_oscillating_pendulum
Net
false
3,837
[ "MIT" ]
0
486aa95fe4b9cbaa6cbeb542209259484f48e191
https://github.com/kimukook/variable_length_oscillating_pendulum/tree/486aa95fe4b9cbaa6cbeb542209259484f48e191
Discriminator
import torch import numpy as np import torch.nn as nn from torch.nn import functional as F class Discriminator(nn.Module): def __init__(self, img_shape, hidden_dim=1024): super().__init__() in_dim = int(np.prod(img_shape)) self.fc1 = nn.Linear(in_dim, hidden_dim) self.fc2 = nn.Lin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
jfrancis71/pytorch-lightning-bolts
Discriminator
false
3,838
[ "Apache-2.0" ]
0
8a4cf8f61644c28d6df54ccffe3a52d6f5fce5a6
https://github.com/jfrancis71/pytorch-lightning-bolts/tree/8a4cf8f61644c28d6df54ccffe3a52d6f5fce5a6
ResidualSineLayer
import torch import numpy as np import torch.nn as nn import torch.utils.data class ResidualSineLayer(nn.Module): """ From Lu & Berger 2021, Compressive Neural Representations of Volumetric Scalar Fields https://github.com/matthewberger/neurcomp/blob/main/siren.py """ def __init__(self, features:...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 numpy ...
khoehlein/fV-SRN
ResidualSineLayer
false
3,839
[ "MIT" ]
0
601f3e952b090df92e875c233c2c9ca646523948
https://github.com/khoehlein/fV-SRN/tree/601f3e952b090df92e875c233c2c9ca646523948
BertPredictionHeadTransform
from _paritybench_helpers import _mock_config import math import torch from torch import nn def gelu(x): """Gaussian Error Linear Unitという活性化関数です。 LeLUが0でカクっと不連続なので、そこを連続になるように滑らかにした形のLeLUです。 """ return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) class BertLayerNorm(nn.Module): def __init__(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
kimihitosugiyama/text_analysis
BertPredictionHeadTransform
false
3,840
[ "Apache-2.0" ]
0
8f51022957928c31e52af1e0fd407daca3addb40
https://github.com/kimihitosugiyama/text_analysis/tree/8f51022957928c31e52af1e0fd407daca3addb40
BertPreTrainingHeads
from _paritybench_helpers import _mock_config import math import torch from torch import nn def gelu(x): """Gaussian Error Linear Unitという活性化関数です。 LeLUが0でカクっと不連続なので、そこを連続になるように滑らかにした形のLeLUです。 """ return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) class BertLayerNorm(nn.Module): def __init__(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
kimihitosugiyama/text_analysis
BertPreTrainingHeads
false
3,841
[ "Apache-2.0" ]
0
8f51022957928c31e52af1e0fd407daca3addb40
https://github.com/kimihitosugiyama/text_analysis/tree/8f51022957928c31e52af1e0fd407daca3addb40
MSELoss
import torch import torch.nn as nn def reduction_batch_based(image_loss, M): divisor = torch.sum(M) if divisor == 0: return 0 else: return torch.sum(image_loss) / divisor def mse_loss(prediction, target, mask, reduction=reduction_batch_based): M = torch.sum(mask, (1, 2)) res = pr...
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...
kopetri/MIDAS_pytorch
MSELoss
false
3,842
[ "MIT" ]
0
9e933bd241ee18b487dcd2b65c28a55d8a923292
https://github.com/kopetri/MIDAS_pytorch/tree/9e933bd241ee18b487dcd2b65c28a55d8a923292
QNetwork
import torch import torch.nn as nn import torch.nn.functional as F class QNetwork(nn.Module): def __init__(self, statedim, actiondim, hiddendim, init_w=0.0003): super().__init__() self.linear1 = nn.Linear(statedim + actiondim, hiddendim) self.linear2 = nn.Linear(hiddendim, hiddendim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
kiranprasad/multiagent-particle-envs
QNetwork
false
3,843
[ "MIT" ]
0
e28e3ff6606e80f11ee16bb2c42f21c442ad29a8
https://github.com/kiranprasad/multiagent-particle-envs/tree/e28e3ff6606e80f11ee16bb2c42f21c442ad29a8
FFN
import torch import torch.nn as nn import torch.utils.data class Conv(nn.Module): """ Convolution Module """ def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True, w_init='linear'): """ :param in_channels: dimension of 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 from torch._inductor.runtime....
kidconan/fast_speech_trans
FFN
false
3,844
[ "MIT" ]
0
4d1d8fe0a871e37165e2a6333a11751ce2a017c0
https://github.com/kidconan/fast_speech_trans/tree/4d1d8fe0a871e37165e2a6333a11751ce2a017c0
ContrastiveLoss
import torch import torch.nn.functional as F class ContrastiveLoss(torch.nn.Module): """ Contrastive loss function. Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf """ def __init__(self, margin=2.0): super(ContrastiveLoss, self).__init__() self.margin =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
kornellewy/face_one_shot_learing
ContrastiveLoss
false
3,845
[ "MIT" ]
0
4cd8c8b1807717f921853043858a6f7ad5259917
https://github.com/kornellewy/face_one_shot_learing/tree/4cd8c8b1807717f921853043858a6f7ad5259917
EmbedNet
from _paritybench_helpers import _mock_config import torch from torchvision.transforms import functional as F import torch.utils.data from torch import nn import torch.nn.functional as F class EmbedNet(nn.Module): def __init__(self, cfg): super(EmbedNet, self).__init__() self.embed_conv1 = 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 from torch._inductor.runtime import triton_helpers import torch.utils.data from ...
hwfan/mega.pytorch
EmbedNet
false
3,846
[ "BSD-2-Clause" ]
0
a07b2267daad73c9482233cfe754d59b8ae2f688
https://github.com/hwfan/mega.pytorch/tree/a07b2267daad73c9482233cfe754d59b8ae2f688
CAM_Use
import torch import torch.nn as nn import torch.utils.data class CAM_Use(nn.Module): """ Channel attention module""" def __init__(self, in_dim): super(CAM_Use, self).__init__() self.chanel_in = in_dim self.gamma = nn.Parameter(torch.zeros(1)) def forward(self, x, attention): ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
jbcnrlz/san
CAM_Use
false
3,847
[ "MIT" ]
0
1eab20f83d3c7dba5607e22d1c70768905b62b12
https://github.com/jbcnrlz/san/tree/1eab20f83d3c7dba5607e22d1c70768905b62b12
CAM_Calculate
import torch import torch.nn as nn import torch.utils.data class CAM_Calculate(nn.Module): """ Channel attention module""" def __init__(self, in_dim): super(CAM_Calculate, self).__init__() self.chanel_in = in_dim self.softmax = nn.Softmax(dim=-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 from torch._inductor.runtime....
jbcnrlz/san
CAM_Calculate
false
3,848
[ "MIT" ]
0
1eab20f83d3c7dba5607e22d1c70768905b62b12
https://github.com/jbcnrlz/san/tree/1eab20f83d3c7dba5607e22d1c70768905b62b12
FFN
import torch import torch.nn as nn import torch as t class Conv(nn.Module): """ Convolution Module """ def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True, w_init='linear'): """ :param in_channels: dimension of 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 from torch._inductor.runtime....
kongziyue1234/mooc
FFN
false
3,849
[ "MIT" ]
0
3b0c822dd55c1066cbc829137e6c424dcda5067e
https://github.com/kongziyue1234/mooc/tree/3b0c822dd55c1066cbc829137e6c424dcda5067e
PairwiseRankingLoss
import torch import torch.nn as nn class PairwiseRankingLoss(nn.Module): """ Pairwise ranking loss """ def __init__(self, margin): super(PairwiseRankingLoss, self).__init__() self.margin = margin def forward(self, anchor1, anchor2, img_sentc, sent_imgc): cost_sent = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
ktodorov/uva-semantics-19
PairwiseRankingLoss
false
3,850
[ "MIT" ]
0
c20e4f1d00f6693a8a46dd1d5576cfd3adced896
https://github.com/ktodorov/uva-semantics-19/tree/c20e4f1d00f6693a8a46dd1d5576cfd3adced896
MeanEncoder
import torch import torch.nn as nn class BaseEncoder(nn.Module): def __init__(self): super(BaseEncoder, self).__init__() self._input_dimensions = 0 @property def input_dimensions(self): return self._input_dimensions class MeanEncoder(BaseEncoder): 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ktodorov/uva-semantics-19
MeanEncoder
false
3,851
[ "MIT" ]
0
c20e4f1d00f6693a8a46dd1d5576cfd3adced896
https://github.com/ktodorov/uva-semantics-19/tree/c20e4f1d00f6693a8a46dd1d5576cfd3adced896
OneConv3d
import logging import torch class OneConv3d(torch.nn.Module): """OneConv3d. """ def __init__(self, out_channels=2): super().__init__() self.layer = torch.nn.Conv3d(in_channels=1, out_channels= out_channels, kernel_size=3, padding=1) def forward(self, x): logging.d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit de...
kirchhausenlab/incasem
OneConv3d
false
3,852
[ "BSD-3-Clause" ]
0
ee9e007c5c04571e547e2fb5af5e800bd2d2b435
https://github.com/kirchhausenlab/incasem/tree/ee9e007c5c04571e547e2fb5af5e800bd2d2b435
encoder4
import torch import torch.nn import torch import torch.nn as nn class encoder4(nn.Module): def __init__(self): super(encoder4, self).__init__() self.conv1 = nn.Conv2d(3, 3, 1, 1, 0) self.reflecPad1 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv2 = nn.Conv2d(3, 64, 3, 1, 0) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
kamieen03/style-transfer-server
encoder4
false
3,853
[ "BSD-2-Clause" ]
0
91727ec62080215a0b870ce043faf0657137b84b
https://github.com/kamieen03/style-transfer-server/tree/91727ec62080215a0b870ce043faf0657137b84b
AlexNet
import torch import torch.nn as nn class AlexNet(nn.Module): """ Our first more "succesful" network, slightly modified AlexNet that accepts images in with 1 channel (i.e. grayscale). Attributes ---------- c: torch.nn.modules.conv.Conv2d Applies a 2D convolution over an input signal co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
jamessoni/x-ray-ML-classification
AlexNet
false
3,854
[ "MIT" ]
0
6934f37631d367cdbe813fa6a2cbdc673c64c503
https://github.com/jamessoni/x-ray-ML-classification/tree/6934f37631d367cdbe813fa6a2cbdc673c64c503
Attention
import math import torch import torch.nn as nn import torch as t class Linear(nn.Module): """ Linear Module """ def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): """ :param in_dim: dimension of input :param out_dim: dimension of output :param bias: boole...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
kongziyue1234/mooc
Attention
false
3,855
[ "MIT" ]
0
3b0c822dd55c1066cbc829137e6c424dcda5067e
https://github.com/kongziyue1234/mooc/tree/3b0c822dd55c1066cbc829137e6c424dcda5067e
OrientedIOUloss
import torch import torch.nn as nn import torch.utils.data class OrientedIOUloss(nn.Module): def __init__(self, reduction='none', loss_type='iou'): super(OrientedIOUloss, self).__init__() self.reduction = reduction self.loss_type = loss_type self.loss_mse = nn.MSELoss(reduction=re...
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...
kuazhangxiaoai/YOLOX
OrientedIOUloss
false
3,856
[ "Apache-2.0" ]
0
7aff49b25a8a80c4c33e941da416500eda72b1a2
https://github.com/kuazhangxiaoai/YOLOX/tree/7aff49b25a8a80c4c33e941da416500eda72b1a2
ReduceMax
import torch class ReduceMax(torch.nn.Module): def forward(self, inputs, mask=None): return torch.amax(inputs, dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
jimthompson5802/ludwig
ReduceMax
false
3,857
[ "Apache-2.0" ]
0
8a369328a3f839d9cdb3710be315952c7891d7c0
https://github.com/jimthompson5802/ludwig/tree/8a369328a3f839d9cdb3710be315952c7891d7c0
IOUloss
import torch import torch.nn as nn import torch.utils.data class IOUloss(nn.Module): def __init__(self, reduction='none', loss_type='iou'): super(IOUloss, self).__init__() self.reduction = reduction self.loss_type = loss_type def forward(self, pred, target): assert pred.shape...
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...
kuazhangxiaoai/YOLOX
IOUloss
false
3,858
[ "Apache-2.0" ]
0
7aff49b25a8a80c4c33e941da416500eda72b1a2
https://github.com/kuazhangxiaoai/YOLOX/tree/7aff49b25a8a80c4c33e941da416500eda72b1a2
BWCEWLoss
import torch from torch import Tensor from typing import Optional from torch import nn class LogitsInputsMixin: @classmethod def get_loss_inputs(cls): """Maps loss to the desired predicted input type.""" return LOGITS class BWCEWLoss(nn.Module, LogitsInputsMixin): """Binary weighted cro...
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 ...
jimthompson5802/ludwig
BWCEWLoss
false
3,859
[ "Apache-2.0" ]
0
8a369328a3f839d9cdb3710be315952c7891d7c0
https://github.com/jimthompson5802/ludwig/tree/8a369328a3f839d9cdb3710be315952c7891d7c0
Scaler
import torch from abc import ABC class BaseOperator(ABC): """ Abstract class defining the basic structure for operator implementations in Hummingbird. """ def __init__(self, regression=False, classification=False, transformer= False, anomaly_detection=False, **kwargs): """ Arg...
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 abc import ABC assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stri...
kvenkman/hummingbird
Scaler
false
3,860
[ "MIT" ]
0
dac08f4ff4a4103df4a8e83329a02f2d804bf34d
https://github.com/kvenkman/hummingbird/tree/dac08f4ff4a4103df4a8e83329a02f2d804bf34d
CausalConv1d
import torch from torch import nn as nn class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, dilation=1, **kwargs): super().__init__() self.pad = (kernel_size - 1) * dilation self.conv = nn.Conv1d(in_channels, out_channels, kernel_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn as nn assert_size_stride = torch._C._dynamo.guards.assert_s...
kschamplin/astro-classifier-neo
CausalConv1d
false
3,861
[ "MIT" ]
0
44fcb8ba41ef549c16360df7fd470f56c42da9b3
https://github.com/kschamplin/astro-classifier-neo/tree/44fcb8ba41ef549c16360df7fd470f56c42da9b3
Multiply
import torch from abc import ABC class BaseOperator(ABC): """ Abstract class defining the basic structure for operator implementations in Hummingbird. """ def __init__(self, regression=False, classification=False, transformer= False, anomaly_detection=False, **kwargs): """ Arg...
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 abc import ABC assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stri...
kvenkman/hummingbird
Multiply
false
3,862
[ "MIT" ]
0
dac08f4ff4a4103df4a8e83329a02f2d804bf34d
https://github.com/kvenkman/hummingbird/tree/dac08f4ff4a4103df4a8e83329a02f2d804bf34d
ReduceLast
import torch def sequence_length_3D(sequence: 'torch.Tensor') ->torch.Tensor: used = torch.sign(torch.amax(torch.abs(sequence), dim=2)) length = torch.sum(used, 1) length = length.int() return length class ReduceLast(torch.nn.Module): def forward(self, inputs, mask=None): batch_size = i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
jimthompson5802/ludwig
ReduceLast
false
3,863
[ "Apache-2.0" ]
0
8a369328a3f839d9cdb3710be315952c7891d7c0
https://github.com/jimthompson5802/ludwig/tree/8a369328a3f839d9cdb3710be315952c7891d7c0
ContrastiveLoss
import torch import torch.nn as nn import torch.nn.functional as F class ContrastiveLoss(nn.Module): def __init__(self, margin=1.5): super(ContrastiveLoss, self).__init__() self.margin = margin def forward(self, output1, output2, weight): pairdist = F.pairwise_distance(output1, 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
kvswim/kv_jhu_cv
ContrastiveLoss
false
3,864
[ "MIT" ]
0
2ddf7a9d497aef116a7c043157b8631cea45000d
https://github.com/kvswim/kv_jhu_cv/tree/2ddf7a9d497aef116a7c043157b8631cea45000d
SigmoidCrossEntropyLoss
import torch from torch import Tensor from typing import List from typing import Optional from typing import Union from torch import nn class LogitsInputsMixin: @classmethod def get_loss_inputs(cls): """Maps loss to the desired predicted input type.""" return LOGITS class SigmoidCrossEntrop...
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 ...
jimthompson5802/ludwig
SigmoidCrossEntropyLoss
false
3,865
[ "Apache-2.0" ]
0
8a369328a3f839d9cdb3710be315952c7891d7c0
https://github.com/jimthompson5802/ludwig/tree/8a369328a3f839d9cdb3710be315952c7891d7c0
Layer
import torch import torch.nn.functional as F import torch.nn as nn class Layer(nn.Module): def __init__(self, input_dim, output_dim, p, name=None): super(Layer, self).__init__() self.name = name self.register_parameter(name='w', param=nn.Parameter(torch.empty(1, input_dim, out...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
kw-lee/VIforSDEs
Layer
false
3,866
[ "MIT" ]
0
dcba3832aaad0aebc921a3b0628c43046d651629
https://github.com/kw-lee/VIforSDEs/tree/dcba3832aaad0aebc921a3b0628c43046d651629
Block
import torch import torch.nn as nn class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
kris927b/ViLT
Block
false
3,867
[ "Apache-2.0" ]
0
db96f20ebc656f1995aa573cbcbca0fe31f55c42
https://github.com/kris927b/ViLT/tree/db96f20ebc656f1995aa573cbcbca0fe31f55c42
encoder3
import torch import torch.nn import torch import torch.nn as nn class encoder3(nn.Module): def __init__(self, W, v2): super(encoder3, self).__init__() self.conv1 = nn.Conv2d(3, 3, 1, 1, 0) self.reflecPad1 = nn.ZeroPad2d((1, 1, 1, 1)) self.conv2 = nn.Conv2d(3, 32 if v2 else int(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 import triton_helpers import torch.nn import torch ...
kamieen03/style-transfer-server
encoder3
false
3,868
[ "BSD-2-Clause" ]
0
91727ec62080215a0b870ce043faf0657137b84b
https://github.com/kamieen03/style-transfer-server/tree/91727ec62080215a0b870ce043faf0657137b84b
Actor
import torch import torch.nn as nn from collections import OrderedDict class Actor(nn.Module): def __init__(self, state_size, action_size, actor_fc_sizes=[256, 128, 64]): super(Actor, self).__init__() sequence_dict_actor = OrderedDict() sequence_dict_actor['fc0'] = nn.Linear(state_size, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
kurohi/deepreinforcement-udacity
Actor
false
3,869
[ "MIT" ]
0
ea8bfcce9a36ca41aa0d7595326b915a494ed5f2
https://github.com/kurohi/deepreinforcement-udacity/tree/ea8bfcce9a36ca41aa0d7595326b915a494ed5f2
Critic
import torch import torch.nn as nn from collections import OrderedDict class Critic(nn.Module): def __init__(self, state_size, action_size, critic_fc_sizes=[256, 128, 64] ): super(Critic, self).__init__() sequence_dict_critic = OrderedDict() self.critic_first_layer = nn.Linear(sta...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 collections import OrderedDict assert_size_stride = t...
kurohi/deepreinforcement-udacity
Critic
false
3,870
[ "MIT" ]
0
ea8bfcce9a36ca41aa0d7595326b915a494ed5f2
https://github.com/kurohi/deepreinforcement-udacity/tree/ea8bfcce9a36ca41aa0d7595326b915a494ed5f2
Model
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, act_dim): 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(2704, 520) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
krishanrana/robot_learning_algorithms
Model
false
3,871
[ "MIT" ]
0
3e66c9bf44e81ff281195130c71bcc6ebdf5ccda
https://github.com/krishanrana/robot_learning_algorithms/tree/3e66c9bf44e81ff281195130c71bcc6ebdf5ccda
SPP
import torch import torch.nn as nn import torch.optim import torch.utils.data class SPP(nn.Module): """ Spatial Pyramid Pooling """ def __init__(self): super(SPP, self).__init__() def forward(self, x): x_1 = torch.nn.functional.max_pool2d(x, 5, stride=1, padding=2) x_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.optim import torch.utils.data assert_size_stride = tor...
ldylab/learning_yolo_family_with_pytorch
SPP
false
3,872
[ "MIT" ]
0
63fd8d65e5ccd55c9ec124052bbcb040e0d9c549
https://github.com/ldylab/learning_yolo_family_with_pytorch/tree/63fd8d65e5ccd55c9ec124052bbcb040e0d9c549
_DynamicGates
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class _DynamicGates(nn.Module): """Internal class to wrap the dynamic gate parameters into a dedicated PyTorch Module""" def __init__(self, cfg: 'Config', input_size: 'int'): super(_DynamicGates, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
kyleniemeyer/neuralhydrology
_DynamicGates
false
3,873
[ "BSD-3-Clause" ]
0
440fda715c4f746a2d56b058b9af2f0e03c36aa0
https://github.com/kyleniemeyer/neuralhydrology/tree/440fda715c4f746a2d56b058b9af2f0e03c36aa0
LIN
import torch import torch.nn as nn from torch.nn.parameter import Parameter class LIN(nn.Module): def __init__(self, num_features, eps=1e-05): super(LIN, self).__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) self.gamma = Parameter(torch.Tensor(1...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
ldzhangyu/photo2cartoon
LIN
false
3,874
[ "MIT" ]
0
d5b371e77e61018c28109db67e8306e5e6064800
https://github.com/ldzhangyu/photo2cartoon/tree/d5b371e77e61018c28109db67e8306e5e6064800
GlobalAttention
import torch import torch.nn as nn import torch.cuda def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same value: ' + str(args) def se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
kurianbenoy/QG-Net
GlobalAttention
false
3,875
[ "MIT" ]
0
074c697530aaaa259a3e16467a020846b1085af1
https://github.com/kurianbenoy/QG-Net/tree/074c697530aaaa259a3e16467a020846b1085af1
mnistmodel_C
import torch from torch import nn import torch.nn.functional as F class mnistmodel_C(nn.Module): def __init__(self): super(mnistmodel_C, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=128, kernel_size =3, padding=1) self.conv2 = nn.Conv2d(in_channels=128, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
layel2/layyer-lib
mnistmodel_C
false
3,876
[ "MIT" ]
0
db48b5c38098ee93d2d34693d98e5ef4d319d919
https://github.com/layel2/layyer-lib/tree/db48b5c38098ee93d2d34693d98e5ef4d319d919
mnistmodel_B
import torch from torch import nn import torch.nn.functional as F class mnistmodel_B(nn.Module): def __init__(self): super(mnistmodel_B, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=64, kernel_size= 8, stride=2, padding=3) self.conv2 = nn.Conv2d(in_chann...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
layel2/layyer-lib
mnistmodel_B
false
3,877
[ "MIT" ]
0
db48b5c38098ee93d2d34693d98e5ef4d319d919
https://github.com/layel2/layyer-lib/tree/db48b5c38098ee93d2d34693d98e5ef4d319d919
discriminator
import torch from torch import nn import torch.nn.functional as F class discriminator(nn.Module): def __init__(self): super(discriminator, self).__init__() self.d1 = nn.Conv2d(in_channels=1, out_channels=4, kernel_size=2, stride=2, padding=0) self.d2 = nn.Conv2d(in_channels=4,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
layel2/layyer-lib
discriminator
false
3,878
[ "MIT" ]
0
db48b5c38098ee93d2d34693d98e5ef4d319d919
https://github.com/layel2/layyer-lib/tree/db48b5c38098ee93d2d34693d98e5ef4d319d919
PartialConv
import math import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data def weights_init(init_type='gaussian'): def init_fun(m): classname = m.__class__.__name__ if (classname.find('Conv') == 0 or classname.find('Linear') == 0 ) and hasattr(m, '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 import math import torch.nn as nn import torch.nn.parallel import torch.utils.da...
labcontext/image-inpainting-oldpaper
PartialConv
false
3,879
[ "Apache-2.0" ]
0
da4683a2c58d662e443ea24ab93fd9d8fcb96bda
https://github.com/labcontext/image-inpainting-oldpaper/tree/da4683a2c58d662e443ea24ab93fd9d8fcb96bda
mnistmodel_A
import torch from torch import nn import torch.nn.functional as F class mnistmodel_A(nn.Module): def __init__(self): super(mnistmodel_A, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=64, kernel_size= 5, stride=1, padding=2) self.conv2 = nn.Conv2d(in_chann...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
layel2/layyer-lib
mnistmodel_A
false
3,880
[ "MIT" ]
0
db48b5c38098ee93d2d34693d98e5ef4d319d919
https://github.com/layel2/layyer-lib/tree/db48b5c38098ee93d2d34693d98e5ef4d319d919
discriminator2
import torch from torch import nn import torch.nn.functional as F class discriminator2(nn.Module): def __init__(self): super().__init__() self.d1 = nn.Conv2d(in_channels=1, out_channels=4, kernel_size=3, stride=1, padding=1) self.d2 = nn.Conv2d(in_channels=4, out_channels=8, k...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
layel2/layyer-lib
discriminator2
false
3,881
[ "MIT" ]
0
db48b5c38098ee93d2d34693d98e5ef4d319d919
https://github.com/layel2/layyer-lib/tree/db48b5c38098ee93d2d34693d98e5ef4d319d919
nnNorm
import torch import torch.nn as nn import torch.nn.functional as F class nnNorm(nn.Module): def __init__(self, dim=-1): super().__init__() self.dim = dim def forward(self, x): return F.normalize(x, dim=self.dim) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
learning-group-structure/paper
nnNorm
false
3,882
[ "MIT" ]
0
96abf7e25cb7e95f45d6eb025257c0ba9e22fc55
https://github.com/learning-group-structure/paper/tree/96abf7e25cb7e95f45d6eb025257c0ba9e22fc55
HLoss
import torch from torch import nn import torch.nn.functional as F class HLoss(nn.Module): """ Entropy loss used for entropy maximization. """ def __init__(self, ignore_index=-1): super(HLoss, self).__init__() self.ignore_index = ignore_index def forward(self, x, labels): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lemon234071/oc_parlai
HLoss
false
3,883
[ "MIT" ]
0
33a0e57c48e58903cb1666e367a7bb9ef012de0c
https://github.com/lemon234071/oc_parlai/tree/33a0e57c48e58903cb1666e367a7bb9ef012de0c
gen_ab_cf
import torch from torch import nn import torch.nn.functional as F class gen_ab_cf(nn.Module): def __init__(self): super().__init__() self.d1 = nn.Conv2d(in_channels=3, out_channels=8, kernel_size=3, stride=1, padding=1) self.d2 = nn.Conv2d(in_channels=8, out_channels=16, kerne...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
layel2/layyer-lib
gen_ab_cf
false
3,884
[ "MIT" ]
0
db48b5c38098ee93d2d34693d98e5ef4d319d919
https://github.com/layel2/layyer-lib/tree/db48b5c38098ee93d2d34693d98e5ef4d319d919
MultiLinear
import torch import numpy as np import torch.nn as nn def tensor(x, dtype=torch.float32): if torch.is_tensor(x): return x.type(dtype) x = torch.tensor(x, device=Config.DEVICE, dtype=dtype) return x def batch_linear(input, weight, bias=None): """ input: (N, D), weight: (N, D, H), bias: (N, H)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
lchenat/TSA
MultiLinear
false
3,885
[ "Apache-2.0" ]
0
661266ba16e06f63962b306a7c30d25f37920c2d
https://github.com/lchenat/TSA/tree/661266ba16e06f63962b306a7c30d25f37920c2d
TransformerBlock
import torch import torchvision.transforms.functional as F import torch.nn as nn import torch.nn.functional as F class TransformerBlock(nn.Module): def __init__(self, seq_len: 'int', embed_channels: 'int', mlp_dims: 'int', num_heads: 'int'): super().__init__() self.embed_channels = embed_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ketan0/ddim
TransformerBlock
false
3,886
[ "MIT" ]
0
26f2de1107885a3f332dd8435b73a1eaedbe10a8
https://github.com/ketan0/ddim/tree/26f2de1107885a3f332dd8435b73a1eaedbe10a8
EntMinLoss
import torch import torch.nn as nn import torch.nn.functional as F class EntMinLoss(nn.Module): def __init__(self): super().__init__() def forward(self, f_x): soft_f_x = F.softmax(f_x, dim=-1) log_soft_f_x = F.log_softmax(f_x, dim=-1) ent = -torch.sum(soft_f_x * log_soft_f_x)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
leoandeol/ldir
EntMinLoss
false
3,887
[ "MIT" ]
0
f90408c5fb16a52c6c5a76fff1c46b9062343ad5
https://github.com/leoandeol/ldir/tree/f90408c5fb16a52c6c5a76fff1c46b9062343ad5
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....
johnson7788/mt-dnn
CeCriterion
false
3,888
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
gconv
import torch import torch.nn as nn import torch.utils.model_zoo class gconv(nn.Module): def __init__(self, channel): super(gconv, self).__init__() self.relu = nn.ReLU() self.conv = nn.Conv2d(channel, channel, kernel_size=3, padding=1) def forward(self, x): y = self.conv(x) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
lee-zq/MRDN
gconv
false
3,889
[ "Apache-2.0" ]
0
976c1f8cd0d4b1943378149ef836bb86dd5fc0cd
https://github.com/lee-zq/MRDN/tree/976c1f8cd0d4b1943378149ef836bb86dd5fc0cd
adaLIN
import torch import torch.nn as nn from torch.nn.parameter import Parameter class adaLIN(nn.Module): def __init__(self, num_features, eps=1e-05): super(adaLIN, self).__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) self.rho.data.fill_(0.9) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
ldzhangyu/photo2cartoon
adaLIN
false
3,890
[ "MIT" ]
0
d5b371e77e61018c28109db67e8306e5e6064800
https://github.com/ldzhangyu/photo2cartoon/tree/d5b371e77e61018c28109db67e8306e5e6064800
LinearModel
import torch import torch.nn.functional as F import torch.nn as nn class LinearModel(nn.Module): """Model creation. """ def __init__(self, input_dim, output_dim): super(LinearModel, self).__init__() self.layer1 = nn.Linear(input_dim, 50) self.layer2 = nn.Linear(50, 50) 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 from torch._inductor.runtime....
learniotai/iotai-sensor-classifications
LinearModel
false
3,891
[ "Apache-2.0" ]
0
ba2527cb317afa30a5c495d1cddc16f7dc2936ed
https://github.com/learniotai/iotai-sensor-classifications/tree/ba2527cb317afa30a5c495d1cddc16f7dc2936ed
_MCLSTMCell
from _paritybench_helpers import _mock_config import torch from typing import Tuple import torch.nn as nn class _Gate(nn.Module): """Utility class to implement a standard sigmoid gate""" def __init__(self, in_features: 'int', out_features: 'int'): super(_Gate, self).__init__() self.fc = 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....
kyleniemeyer/neuralhydrology
_MCLSTMCell
false
3,892
[ "BSD-3-Clause" ]
0
440fda715c4f746a2d56b058b9af2f0e03c36aa0
https://github.com/kyleniemeyer/neuralhydrology/tree/440fda715c4f746a2d56b058b9af2f0e03c36aa0
ConvModel
import torch import torch.nn.functional as F import torch.nn as nn class ConvModel(nn.Module): """Convolution 2D model.""" def __init__(self, input_dim, output_dim): super(ConvModel, self).__init__() self._input_dim = input_dim self._output_dim = output_dim self.conv1 = 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
learniotai/iotai-sensor-classifications
ConvModel
false
3,894
[ "Apache-2.0" ]
0
ba2527cb317afa30a5c495d1cddc16f7dc2936ed
https://github.com/learniotai/iotai-sensor-classifications/tree/ba2527cb317afa30a5c495d1cddc16f7dc2936ed
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...
johnson7788/mt-dnn
MseCriterion
false
3,895
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
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...
johnson7788/mt-dnn
BiLinearSim
false
3,896
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
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...
johnson7788/mt-dnn
Cosine
false
3,897
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
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....
johnson7788/mt-dnn
HLCriterion
false
3,898
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
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...
johnson7788/mt-dnn
NsKlCriterion
false
3,899
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
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....
johnson7788/mt-dnn
JSCriterion
false
3,900
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
MinibatchStdDev
import torch class MinibatchStdDev(torch.nn.Module): """ Concatenate a constant statistic calculated across the minibatch to each pixel location (i, j) as a new channel. Here the standard deviation averaged over channels and locations. This is to increase variation of images produced by the generator....
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
leogeier/dl-2020-prog-gan
MinibatchStdDev
false
3,901
[ "MIT" ]
0
12f28353548188af31cc14ee18a5444ad3d95a0c
https://github.com/leogeier/dl-2020-prog-gan/tree/12f28353548188af31cc14ee18a5444ad3d95a0c
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....
johnson7788/mt-dnn
KlCriterion
false
3,902
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
gen_ba_cf
import torch from torch import nn import torch.nn.functional as F class gen_ba_cf(nn.Module): def __init__(self): super().__init__() self.d1 = nn.Conv2d(in_channels=3, out_channels=8, kernel_size=3, stride=1, padding=1) self.d2 = nn.Conv2d(in_channels=8, out_channels=16, kerne...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
layel2/layyer-lib
gen_ba_cf
false
3,903
[ "MIT" ]
0
db48b5c38098ee93d2d34693d98e5ef4d319d919
https://github.com/layel2/layyer-lib/tree/db48b5c38098ee93d2d34693d98e5ef4d319d919
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...
johnson7788/mt-dnn
NsSymKlCriterion
false
3,904
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
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....
johnson7788/mt-dnn
SymKlCriterion
false
3,905
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
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...
johnson7788/mt-dnn
MultiheadAttentionWrapper
false
3,906
[ "MIT" ]
0
26e5c4a5bfdbf1a1dd1c903e606db1c070568237
https://github.com/johnson7788/mt-dnn/tree/26e5c4a5bfdbf1a1dd1c903e606db1c070568237
RNNAgent
from _paritybench_helpers import _mock_config import torch import torch.nn.functional as F import torch.nn as nn class RNNAgent(nn.Module): def __init__(self, input_shape, args): super(RNNAgent, self).__init__() self.args = args self.fc1 = nn.Linear(input_shape, args.rnn_hidden_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 import torch.nn as nn assert_...
johnson7788/pymarl2
RNNAgent
false
3,907
[ "Apache-2.0" ]
0
8ec3e58fc3325ae82165cae0a5ea8a391ce42bd5
https://github.com/johnson7788/pymarl2/tree/8ec3e58fc3325ae82165cae0a5ea8a391ce42bd5
TransformerEncoderLayer
import math import torch from torch import nn import torch.nn.functional as F def _normalize(tensor, norm_layer): """ Broadcast layer norm """ size = tensor.size() return norm_layer(tensor.view(-1, size[-1])).view(size) class MultiHeadAttention(nn.Module): def __init__(self, n_heads, dim, d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lemon234071/oc_parlai
TransformerEncoderLayer
false
3,908
[ "MIT" ]
0
33a0e57c48e58903cb1666e367a7bb9ef012de0c
https://github.com/lemon234071/oc_parlai/tree/33a0e57c48e58903cb1666e367a7bb9ef012de0c
SelfAttention
import torch import torch.nn.functional as F import torch.nn as nn class SelfAttention(nn.Module): def __init__(self, input_size, heads, embed_size): super().__init__() self.input_size = input_size self.heads = heads self.emb_size = embed_size self.tokeys = nn.Linear(self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
johnson7788/pymarl2
SelfAttention
false
3,909
[ "Apache-2.0" ]
0
8ec3e58fc3325ae82165cae0a5ea8a391ce42bd5
https://github.com/johnson7788/pymarl2/tree/8ec3e58fc3325ae82165cae0a5ea8a391ce42bd5
HorizontalMaxPool2d
import torch import torch.nn as nn class HorizontalMaxPool2d(nn.Module): def __init__(self): super(HorizontalMaxPool2d, self).__init__() def forward(self, x): inp_size = x.size() return nn.functional.max_pool2d(input=x, kernel_size=(1, inp_size[3])) def get_inputs(): return [to...
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...
linkserendipity/AlignedReID
HorizontalMaxPool2d
false
3,910
[ "MIT" ]
0
142a9ebdc200ef4da001f91c1f592e4ff02b2f77
https://github.com/linkserendipity/AlignedReID/tree/142a9ebdc200ef4da001f91c1f592e4ff02b2f77
TransformerDecoderLayer
import math import torch from torch import nn import torch.nn.functional as F def _normalize(tensor, norm_layer): """ Broadcast layer norm """ size = tensor.size() return norm_layer(tensor.view(-1, size[-1])).view(size) class MultiHeadAttention(nn.Module): def __init__(self, n_heads, dim, d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lemon234071/oc_parlai
TransformerDecoderLayer
false
3,911
[ "MIT" ]
0
33a0e57c48e58903cb1666e367a7bb9ef012de0c
https://github.com/lemon234071/oc_parlai/tree/33a0e57c48e58903cb1666e367a7bb9ef012de0c
RingLoss
import torch import torch.nn as nn class RingLoss(nn.Module): """Ring loss. Reference: Zheng et al. Ring loss: Convex Feature Normalization for Face Recognition. CVPR 2018. """ def __init__(self, weight_ring=1.0): super(RingLoss, self).__init__() self.radius = nn.Parameter(to...
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_...
linkserendipity/AlignedReID
RingLoss
false
3,912
[ "MIT" ]
0
142a9ebdc200ef4da001f91c1f592e4ff02b2f77
https://github.com/linkserendipity/AlignedReID/tree/142a9ebdc200ef4da001f91c1f592e4ff02b2f77
DetNet2
import torch import torch.nn as nn class DetNet2(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 3, 1, padding=1) def forward(self, x): x = self.conv1(x) return x def get_inputs(): return [torch.rand([4, 3, 64, 64])] def get_init_inputs():...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
liangzhao123/topic_ws
DetNet2
false
3,913
[ "Apache-2.0" ]
0
ef7aba11b975eab5f657101ed696b49ec94b5f86
https://github.com/liangzhao123/topic_ws/tree/ef7aba11b975eab5f657101ed696b49ec94b5f86
MaskedL1Loss
import torch import torch.utils.data import torch.nn as nn class MaskedL1Loss(nn.Module): def __init__(self): super(MaskedL1Loss, self).__init__() self.criterion = nn.L1Loss() def forward(self, input, target, mask): mask = mask.expand(-1, input.size()[1], -1, -1) loss = self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
lichnost/head2head
MaskedL1Loss
false
3,914
[ "MIT" ]
0
b0ec8b6965c9a32f3727dee9c164a7aaff027c5f
https://github.com/lichnost/head2head/tree/b0ec8b6965c9a32f3727dee9c164a7aaff027c5f
dis_cf
import torch from torch import nn import torch.nn.functional as F class dis_cf(nn.Module): def __init__(self): super().__init__() self.d1 = nn.Conv2d(in_channels=3, out_channels=8, kernel_size=3, stride=1, padding=1) self.d2 = nn.Conv2d(in_channels=8, out_channels=16, kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
layel2/layyer-lib
dis_cf
false
3,915
[ "MIT" ]
0
db48b5c38098ee93d2d34693d98e5ef4d319d919
https://github.com/layel2/layyer-lib/tree/db48b5c38098ee93d2d34693d98e5ef4d319d919
KLMutualLoss
import torch import torch.nn as nn class KLMutualLoss(nn.Module): def __init__(self): super(KLMutualLoss, self).__init__() self.kl_loss = nn.KLDivLoss(size_average=False) self.log_softmax = nn.functional.log_softmax self.softmax = nn.functional.softmax def forward(self, pred1...
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...
linkserendipity/AlignedReID
KLMutualLoss
false
3,916
[ "MIT" ]
0
142a9ebdc200ef4da001f91c1f592e4ff02b2f77
https://github.com/linkserendipity/AlignedReID/tree/142a9ebdc200ef4da001f91c1f592e4ff02b2f77
LayerNorm
import torch import torch.nn as nn import torch.optim class LayerNorm(nn.Module): """Construct a layernorm module in the OpenAI style (epsilon inside the square root).""" def __init__(self, n_state, e=1e-05): super(LayerNorm, self).__init__() self.g = nn.Parameter(torch.ones(n_state)) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo....
lidayuls/comet-commonsense-v1
LayerNorm
false
3,917
[ "Apache-2.0" ]
0
d0c8475b8432358c59c0d957c2d928521741c057
https://github.com/lidayuls/comet-commonsense-v1/tree/d0c8475b8432358c59c0d957c2d928521741c057
CrossEntropyLoss
import torch import torch.utils.data import torch.nn as nn class CrossEntropyLoss(nn.Module): def __init__(self, label_nc): super(CrossEntropyLoss, self).__init__() self.softmax = nn.LogSoftmax(dim=1) self.criterion = nn.NLLLoss2d() def forward(self, output, label): label = l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
lichnost/head2head
CrossEntropyLoss
false
3,918
[ "MIT" ]
0
b0ec8b6965c9a32f3727dee9c164a7aaff027c5f
https://github.com/lichnost/head2head/tree/b0ec8b6965c9a32f3727dee9c164a7aaff027c5f
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, state_dim, action_dim): super(Critic, self).__init__() self.l1 = nn.Linear(state_dim + action_dim, 256) self.l2 = nn.Linear(256, 256) self.l3 = nn.Linear(256, 1) def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
linsats/GRAC2.0
Critic
false
3,919
[ "MIT" ]
0
2fde25103b2316a3435ef0ebdbf471ec4e204fbe
https://github.com/linsats/GRAC2.0/tree/2fde25103b2316a3435ef0ebdbf471ec4e204fbe
Policy
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.distributions import Categorical class Policy(nn.Module): def __init__(self, n_features=4, n_actions=2, device=torch.device('cpu')): super(Policy, self).__init__() self.fc1 = nn.Linear(n_features, 128...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
linklab/minimal_rl
Policy
false
3,920
[ "MIT" ]
0
382d99ca355ea405414c4ed1077fb4e8ed3532a9
https://github.com/linklab/minimal_rl/tree/382d99ca355ea405414c4ed1077fb4e8ed3532a9
MLP
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): """ Simple MLP to demonstrate Jacobian regularization. """ def __init__(self, in_channel=1, im_size=28, num_classes=10, fc_channel1=200, fc_channel2=200): super(MLP, self).__init__() compr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
linzzzzzz/jacobian_regularizer
MLP
false
3,921
[ "MIT" ]
0
c74d5b13e670f3ad1fd5a7cec225bca3853b3565
https://github.com/linzzzzzz/jacobian_regularizer/tree/c74d5b13e670f3ad1fd5a7cec225bca3853b3565
RFDB
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.model_zoo def activation(act_type, inplace=True, neg_slope=0.05, n_prelu=1): act_type = act_type.lower() if act_type == 'relu': layer = nn.ReLU(inplace) elif act_type == 'lrelu': layer = nn.LeakyReLU(neg_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
lee-zq/MRDN
RFDB
false
3,922
[ "Apache-2.0" ]
0
976c1f8cd0d4b1943378149ef836bb86dd5fc0cd
https://github.com/lee-zq/MRDN/tree/976c1f8cd0d4b1943378149ef836bb86dd5fc0cd
NTimesTanh
import torch import torch.nn as nn class NTimesTanh(nn.Module): def __init__(self, N): super(NTimesTanh, self).__init__() self.N = N self.tanh = nn.Tanh() def forward(self, x): return self.tanh(x) * self.N def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
liuzeyuMr/ELEGANT_cvte
NTimesTanh
false
3,923
[ "MIT" ]
0
eb8039310023f91e25e37ff8d907844afd50e0a5
https://github.com/liuzeyuMr/ELEGANT_cvte/tree/eb8039310023f91e25e37ff8d907844afd50e0a5
Actor
import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal class Actor(nn.Module): def __init__(self, state_dim, action_dim, max_action): super(Actor, self).__init__() self.l1 = nn.Linear(state_dim, 256) self.l2 = nn.Linear(256, 256) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
linsats/GRAC2.0
Actor
false
3,924
[ "MIT" ]
0
2fde25103b2316a3435ef0ebdbf471ec4e204fbe
https://github.com/linsats/GRAC2.0/tree/2fde25103b2316a3435ef0ebdbf471ec4e204fbe
BCEIoULoss
import torch from typing import Callable from functools import partial from torch import nn import torch.distributed from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.backends def get_activation_fn(activation: 'str'=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 from typing...
litvinich/catalyst
BCEIoULoss
false
3,925
[ "Apache-2.0" ]
0
b039bb69597d3fe48eed8c34342fa9be968b776e
https://github.com/litvinich/catalyst/tree/b039bb69597d3fe48eed8c34342fa9be968b776e
Normalization
import torch import torch.nn as nn from torch.nn.parameter import Parameter from torch.nn import Parameter class Normalization(nn.Module): def __init__(self): super(Normalization, self).__init__() self.alpha = Parameter(torch.ones(1)) self.beta = Parameter(torch.zeros(1)) def forward...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from t...
liuzeyuMr/ELEGANT_cvte
Normalization
false
3,926
[ "MIT" ]
0
eb8039310023f91e25e37ff8d907844afd50e0a5
https://github.com/liuzeyuMr/ELEGANT_cvte/tree/eb8039310023f91e25e37ff8d907844afd50e0a5
NormMLP
import torch import torch.nn as nn import torch.nn.functional as F class NormMLP(nn.Module): def __init__(self, input_size, output_size): super(NormMLP, self).__init__() self.linear = nn.Linear(input_size, output_size) self.layer_norm = nn.LayerNorm(output_size) def forward(self, act...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lizhaoliu-Lec/apl
NormMLP
false
3,927
[ "MIT" ]
0
3c8837f93b21353f9dd3ed7e0dd02982d0caab4c
https://github.com/lizhaoliu-Lec/apl/tree/3c8837f93b21353f9dd3ed7e0dd02982d0caab4c
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_...
kctsiolis/RepDistiller
Correlation
false
3,928
[ "BSD-2-Clause" ]
0
ce88f6e53fcf8ef81c5bac2d20ad31628dd279ac
https://github.com/kctsiolis/RepDistiller/tree/ce88f6e53fcf8ef81c5bac2d20ad31628dd279ac
SimBasedLoss
import torch from torch import nn import torch.nn.functional as F class SimBasedLoss(nn.Module): def __init__(self): super(SimBasedLoss, self).__init__() def forward(self, y_s, y_t): y_s = F.normalize(y_s, p=2, dim=1) y_t = F.normalize(y_t, p=2, dim=1) student_sims = torch.ma...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
kctsiolis/RepDistiller
SimBasedLoss
false
3,929
[ "BSD-2-Clause" ]
0
ce88f6e53fcf8ef81c5bac2d20ad31628dd279ac
https://github.com/kctsiolis/RepDistiller/tree/ce88f6e53fcf8ef81c5bac2d20ad31628dd279ac
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 ...
kctsiolis/RepDistiller
FactorTransfer
false
3,930
[ "BSD-2-Clause" ]
0
ce88f6e53fcf8ef81c5bac2d20ad31628dd279ac
https://github.com/kctsiolis/RepDistiller/tree/ce88f6e53fcf8ef81c5bac2d20ad31628dd279ac
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 ...
kctsiolis/RepDistiller
DistillKL
false
3,931
[ "BSD-2-Clause" ]
0
ce88f6e53fcf8ef81c5bac2d20ad31628dd279ac
https://github.com/kctsiolis/RepDistiller/tree/ce88f6e53fcf8ef81c5bac2d20ad31628dd279ac