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
InceptionA
import torch import torch.nn as nn import torch.nn.functional as F class BasicConv2d(nn.Module): def __init__(self, in_channels, out_channels, **kwargs): super(BasicConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, bias=True, **kwargs) def forward(self, x): 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 ...
Galaxies99/inception-cuda
InceptionA
false
11,451
[ "MIT" ]
0
ed8fdbe3caef415e60b52e671273be90e9423e44
https://github.com/Galaxies99/inception-cuda/tree/ed8fdbe3caef415e60b52e671273be90e9423e44
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...
HUSTLyn/SentEval
PairwiseRankingLoss
false
11,452
[ "BSD-3-Clause" ]
0
3aaa8c80681e44d641dccbc1267c2dc6b2e2609f
https://github.com/HUSTLyn/SentEval/tree/3aaa8c80681e44d641dccbc1267c2dc6b2e2609f
DQN
import random import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class DQN(nn.Module): def __init__(self, state_dim, out_dim, capacity, bsz, epsilon): super().__init__() self.steps_done = 0 self.position = 0 self.pool = [] ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import random import torch.nn...
Gromy1211/torch-light
DQN
false
11,453
[ "MIT" ]
0
c7d7a9bc5ab1eab03d800a27d9325859516f01e6
https://github.com/Gromy1211/torch-light/tree/c7d7a9bc5ab1eab03d800a27d9325859516f01e6
MemoryDictionary
import torch import torch.nn as nn import torch.nn.functional as F from typing import * class MemoryDictionary(nn.Module): """このクラスでは M_1 -> M_2 という写像を生成します。 この記憶辞書の最もシンプルな場合である、二層の全結合層によって作成されます。 """ def __init__(self, num_memory: 'int', num_dims: 'int', device: 'torch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F from typing import * asser...
Geson-anko/ThinkingSimulation
MemoryDictionary
false
11,454
[ "MIT" ]
0
bd4b33c42042a2d8d14e1a9553f19fb4b4bfe8f8
https://github.com/Geson-anko/ThinkingSimulation/tree/bd4b33c42042a2d8d14e1a9553f19fb4b4bfe8f8
AlphaEntropy
import torch import torch.nn as nn class AlphaEntropy(nn.Module): def __init__(self): super().__init__() self.v_loss = nn.MSELoss() def forward(self, props, v, pi, reward): v_loss = self.v_loss(v, reward) p_loss = -torch.mean(torch.sum(props * pi, 1)) return p_loss + ...
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...
Gromy1211/torch-light
AlphaEntropy
false
11,455
[ "MIT" ]
0
c7d7a9bc5ab1eab03d800a27d9325859516f01e6
https://github.com/Gromy1211/torch-light/tree/c7d7a9bc5ab1eab03d800a27d9325859516f01e6
CMDS_Loss
import torch from torch import nn def Covariance(m, bias=False, rowvar=True, inplace=False): """ Estimate a covariance matrix given data(tensor). Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, `X = [x_1, x_2, ... x_N]^T`, then the covariance m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Gustoaxel/Cells_Cycle
CMDS_Loss
false
11,456
[ "MIT" ]
0
d211dea8c05a8d5535e6e72d95c781d6bc02baeb
https://github.com/Gustoaxel/Cells_Cycle/tree/d211dea8c05a8d5535e6e72d95c781d6bc02baeb
MaxMarginRankingLoss
import torch import numpy as np import torch as th import torch.nn.functional as F class MaxMarginRankingLoss(th.nn.Module): def __init__(self, margin=1.0, negative_weighting=False, batch_size=1, n_pair=1, hard_negative_rate=0.5): super(MaxMarginRankingLoss, 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 import numpy as np import torch as th assert_size_stride = torch._C._dynamo.guards.assert...
HS310164/howto100m
MaxMarginRankingLoss
false
11,457
[ "Apache-2.0" ]
0
e3952a77c268466de2b9174ae8983c528b91397d
https://github.com/HS310164/howto100m/tree/e3952a77c268466de2b9174ae8983c528b91397d
DiceLoss
import functools import torch import numpy as np import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "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 math as tl_math import functools impor...
Geoffrey1500/mmsegmentation
DiceLoss
false
11,458
[ "Apache-2.0" ]
0
0a5544c46e6ea1e07ed47858d5fcb39a5ae974b1
https://github.com/Geoffrey1500/mmsegmentation/tree/0a5544c46e6ea1e07ed47858d5fcb39a5ae974b1
AtteMatchLay
import torch import torch.nn as nn from torch.nn.functional import cosine_similarity def multi_perspective_expand_for_2D(in_tensor, decompose_params): """ Return: [batch_size, decompse_dim, dim] """ in_tensor = in_tensor.unsqueeze(1) decompose_params = decompose_params.unsqueeze(0) return torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
Gromy1211/torch-light
AtteMatchLay
false
11,459
[ "MIT" ]
0
c7d7a9bc5ab1eab03d800a27d9325859516f01e6
https://github.com/Gromy1211/torch-light/tree/c7d7a9bc5ab1eab03d800a27d9325859516f01e6
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...
Gxx-5/MyPhoto2Cartoon
LIN
false
11,460
[ "MIT" ]
0
aa05dfa8b7d6c507c33026a2e8b299d5779357be
https://github.com/Gxx-5/MyPhoto2Cartoon/tree/aa05dfa8b7d6c507c33026a2e8b299d5779357be
MockAccuracy
import torch class _Metric(torch.nn.Module): def __init__(self): super().__init__() def forward(self, input: 'torch.Tensor', target: 'torch.Tensor'): raise NotImplementedError() class Accuracy(_Metric): def __init__(self): super().__init__() def forward(self, input: 'torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
HalleyYoung/MusicTransformer-pytorch
MockAccuracy
false
11,461
[ "MIT" ]
0
bbfb7050f4a81675b089cd826d4476cf29bf19c2
https://github.com/HalleyYoung/MusicTransformer-pytorch/tree/bbfb7050f4a81675b089cd826d4476cf29bf19c2
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...
Gxx-5/MyPhoto2Cartoon
adaLIN
false
11,462
[ "MIT" ]
0
aa05dfa8b7d6c507c33026a2e8b299d5779357be
https://github.com/Gxx-5/MyPhoto2Cartoon/tree/aa05dfa8b7d6c507c33026a2e8b299d5779357be
ActorCritic
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.distributions import Categorical class ActorCritic(nn.Module): def __init__(self): super().__init__() self.affine1 = nn.Linear(4, 128) self.action_head = nn.Linear(128, 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 from torch._inductor.runtime....
Gromy1211/torch-light
ActorCritic
false
11,463
[ "MIT" ]
0
c7d7a9bc5ab1eab03d800a27d9325859516f01e6
https://github.com/Gromy1211/torch-light/tree/c7d7a9bc5ab1eab03d800a27d9325859516f01e6
Sentence_Maxpool
import torch import torch as th import torch.nn.functional as F import torch.nn as nn class Sentence_Maxpool(nn.Module): def __init__(self, word_dimension, output_dim, relu=True): super(Sentence_Maxpool, self).__init__() self.fc = nn.Linear(word_dimension, output_dim) self.out_dim = outpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
HS310164/howto100m
Sentence_Maxpool
false
11,464
[ "Apache-2.0" ]
0
e3952a77c268466de2b9174ae8983c528b91397d
https://github.com/HS310164/howto100m/tree/e3952a77c268466de2b9174ae8983c528b91397d
Fp32LayerNorm
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Fp32LayerNorm(nn.LayerNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) 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 import torch.utils.data import torch.onnx.operators impor...
Ashprakash/roberta
Fp32LayerNorm
false
11,465
[ "MIT" ]
0
5ee7abda64d752a467218c247855ddc20c09a779
https://github.com/Ashprakash/roberta/tree/5ee7abda64d752a467218c247855ddc20c09a779
TransitionUp
import torch from torch import nn import torch.distributions import torch.nn.parallel import torch.optim def center_crop(layer, max_height, max_width): _, _, h, w = layer.size() xy1 = (w - max_width) // 2 xy2 = (h - max_height) // 2 return layer[:, :, xy2:xy2 + max_height, xy1:xy1 + max_width] class...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.distributions import torch.nn.parallel import ...
Haijunlv/swa_gaussian
TransitionUp
false
11,466
[ "BSD-2-Clause" ]
0
412a1f0a18f8607c2493e48275abe5345cd3eb1e
https://github.com/Haijunlv/swa_gaussian/tree/412a1f0a18f8607c2493e48275abe5345cd3eb1e
CategoricalAccuracy
import torch class _Metric(torch.nn.Module): def __init__(self): super().__init__() def forward(self, input: 'torch.Tensor', target: 'torch.Tensor'): raise NotImplementedError() class Accuracy(_Metric): def __init__(self): super().__init__() def forward(self, input: 'torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
HalleyYoung/MusicTransformer-pytorch
CategoricalAccuracy
false
11,467
[ "MIT" ]
0
bbfb7050f4a81675b089cd826d4476cf29bf19c2
https://github.com/HalleyYoung/MusicTransformer-pytorch/tree/bbfb7050f4a81675b089cd826d4476cf29bf19c2
ResidualDenseBlock_5C
import torch import torch.nn as nn class ResidualDenseBlock_5C(nn.Module): def __init__(self, nf=64, gc=32, bias=True): super(ResidualDenseBlock_5C, self).__init__() self.conv1 = nn.Conv2d(nf, gc, 3, 1, 1, bias=bias) self.conv2 = nn.Conv2d(nf + gc, gc, 3, 1, 1, bias=bias) self.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...
Geeta-Landmark/Super-Resolution-Image
ResidualDenseBlock_5C
false
11,468
[ "Apache-2.0" ]
0
fb5d71ec9a4673409ecd28189e97056943ca308b
https://github.com/Geeta-Landmark/Super-Resolution-Image/tree/fb5d71ec9a4673409ecd28189e97056943ca308b
SeperableConv
import torch import torch.nn as nn import torch.nn.functional as F def _get_padding(kernel_size, stride, dilation): padding = (stride - 1 + dilation * (kernel_size - 1)) // 2 return padding class SeperableConv(nn.Module): def __init__(self, inp, outp, k=3, stride=1, dilation=1): super(Seperable...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
HabilBhagat/MiniProject---Sem_6
SeperableConv
false
11,469
[ "Apache-2.0" ]
0
bbc329a4844921cc04be58f704057bb70ad9dfe2
https://github.com/HabilBhagat/MiniProject---Sem_6/tree/bbc329a4844921cc04be58f704057bb70ad9dfe2
ZeroPad1d
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class ZeroPad1d(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left = pad_left self.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 import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler assert_size_str...
Ashprakash/roberta
ZeroPad1d
false
11,470
[ "MIT" ]
0
5ee7abda64d752a467218c247855ddc20c09a779
https://github.com/Ashprakash/roberta/tree/5ee7abda64d752a467218c247855ddc20c09a779
InputConv
import torch import torch.nn as nn import torch.nn.functional as F def _get_padding(kernel_size, stride, dilation): padding = (stride - 1 + dilation * (kernel_size - 1)) // 2 return padding class InputConv(nn.Module): def __init__(self, inp, outp, k=3, stride=1, dilation=1): super(InputConv, se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
HabilBhagat/MiniProject---Sem_6
InputConv
false
11,471
[ "Apache-2.0" ]
0
bbc329a4844921cc04be58f704057bb70ad9dfe2
https://github.com/HabilBhagat/MiniProject---Sem_6/tree/bbc329a4844921cc04be58f704057bb70ad9dfe2
RRDB
import torch import torch.nn as nn class ResidualDenseBlock_5C(nn.Module): def __init__(self, nf=64, gc=32, bias=True): super(ResidualDenseBlock_5C, self).__init__() self.conv1 = nn.Conv2d(nf, gc, 3, 1, 1, bias=bias) self.conv2 = nn.Conv2d(nf + gc, gc, 3, 1, 1, bias=bias) self.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...
Geeta-Landmark/Super-Resolution-Image
RRDB
false
11,472
[ "Apache-2.0" ]
0
fb5d71ec9a4673409ecd28189e97056943ca308b
https://github.com/Geeta-Landmark/Super-Resolution-Image/tree/fb5d71ec9a4673409ecd28189e97056943ca308b
AUXModule
import torch import torch.nn as nn import torch.nn.functional as F class AUXModule(nn.Module): def __init__(self, in_features, out_features): super().__init__() self.linear = nn.Linear(in_features, out_features) def forward(self, x): x = F.adaptive_max_pool2d(x, output_size=(1, 1)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
HamzaFarhan/segmentation_models.pytorch
AUXModule
false
11,473
[ "MIT" ]
0
b7803df1d17027f329e267ba4c55144adfdd4da9
https://github.com/HamzaFarhan/segmentation_models.pytorch/tree/b7803df1d17027f329e267ba4c55144adfdd4da9
MeanStd
import torch import torch.nn as nn class MeanStd(nn.Module): def __init__(self): super(MeanStd, self).__init__() def forward(self, x): x = x.view(x.size(0), x.size(1), -1) mean_x = torch.mean(x, dim=2) var_x = torch.mean(x ** 2, dim=2) - mean_x * mean_x return torch.c...
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...
GiangHLe/pytorch_GAN_zoo
MeanStd
false
11,474
[ "BSD-3-Clause" ]
0
7a3db2a88032f357b3f262abd6204b560caa9f2c
https://github.com/GiangHLe/pytorch_GAN_zoo/tree/7a3db2a88032f357b3f262abd6204b560caa9f2c
ConvReg
import torch import torch.nn as nn class ConvReg(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 64, 3, stride=2, padding=1) self.conv2 = nn.Conv2d(64, 128, 3, stride=2, padding=1) self.relu = nn.ReLU() self.sigmoid = nn.Sigmoid() 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 import torch.nn as nn assert_...
Guru-Uni-siegen/Domain-Shifting-Network
ConvReg
false
11,475
[ "MIT" ]
0
dd9eb7bda07634874497a335151b5e967aaad874
https://github.com/Guru-Uni-siegen/Domain-Shifting-Network/tree/dd9eb7bda07634874497a335151b5e967aaad874
InceptionE
import torch import torch.nn as nn import torch.nn.functional as F class BasicConv2d(nn.Module): def __init__(self, in_channels, out_channels, **kwargs): super(BasicConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, bias=True, **kwargs) def forward(self, x): 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 ...
Galaxies99/inception-cuda
InceptionE
false
11,476
[ "MIT" ]
0
ed8fdbe3caef415e60b52e671273be90e9423e44
https://github.com/Galaxies99/inception-cuda/tree/ed8fdbe3caef415e60b52e671273be90e9423e44
AdaIN
import math import torch import torch.nn as nn from numpy import prod def getLayerNormalizationFactor(x): """ Get He's constant for the given layer https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/He_Delving_Deep_into_ICCV_2015_paper.pdf """ size = x.weight.size() fan_in = pro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
GiangHLe/pytorch_GAN_zoo
AdaIN
false
11,477
[ "BSD-3-Clause" ]
0
7a3db2a88032f357b3f262abd6204b560caa9f2c
https://github.com/GiangHLe/pytorch_GAN_zoo/tree/7a3db2a88032f357b3f262abd6204b560caa9f2c
ZSSRNet
import torch import torch.nn as nn class ZSSRNet(nn.Module): def __init__(self, input_channels=3, kernel_size=3, channels=64): super(ZSSRNet, self).__init__() self.conv0 = nn.Conv2d(input_channels, channels, kernel_size= kernel_size, padding=kernel_size // 2, bias=True) self.c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
HaiTMai/pytorch-zssr
ZSSRNet
false
11,478
[ "Apache-2.0" ]
0
433143ef7bcc036648e2d4294699c6ce15c21a7c
https://github.com/HaiTMai/pytorch-zssr/tree/433143ef7bcc036648e2d4294699c6ce15c21a7c
AsymmetricLoss
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 tensor. """ ...
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...
HexaFarms/MMClassification
AsymmetricLoss
false
11,479
[ "Apache-2.0" ]
0
d61d0448b6bcd2fd4c0a408688f603a53ab16ca2
https://github.com/HexaFarms/MMClassification/tree/d61d0448b6bcd2fd4c0a408688f603a53ab16ca2
FocalLoss
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 tensor. """ ...
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...
HexaFarms/MMClassification
FocalLoss
false
11,480
[ "Apache-2.0" ]
0
d61d0448b6bcd2fd4c0a408688f603a53ab16ca2
https://github.com/HexaFarms/MMClassification/tree/d61d0448b6bcd2fd4c0a408688f603a53ab16ca2
GlobalAveragePooling
import torch import torch.nn as nn class GlobalAveragePooling(nn.Module): """Global Average Pooling neck. Note that we use `view` to remove extra channel after pooling. We do not use `squeeze` as it will also remove the batch dimension when the tensor has a batch dimension of size 1, which can lead t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
HexaFarms/MMClassification
GlobalAveragePooling
false
11,481
[ "Apache-2.0" ]
0
d61d0448b6bcd2fd4c0a408688f603a53ab16ca2
https://github.com/HexaFarms/MMClassification/tree/d61d0448b6bcd2fd4c0a408688f603a53ab16ca2
Fp32GroupNorm
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Fp32GroupNorm(nn.GroupNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) 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 import torch.utils.data import torch.onnx.operators impor...
Ashprakash/roberta
Fp32GroupNorm
false
11,482
[ "MIT" ]
0
5ee7abda64d752a467218c247855ddc20c09a779
https://github.com/Ashprakash/roberta/tree/5ee7abda64d752a467218c247855ddc20c09a779
VarifocalLoss
import torch import torch.nn.functional as F import torch.nn as nn 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 tensor. """ ...
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...
Huuush/deepfashion2-det
VarifocalLoss
false
11,483
[ "Apache-2.0" ]
0
46af0ada8d6f534de2de6a9c069580cd1bf609ec
https://github.com/Huuush/deepfashion2-det/tree/46af0ada8d6f534de2de6a9c069580cd1bf609ec
Reorg
import torch import torch.nn as nn class Reorg(nn.Module): def __init__(self, stride=2): super(Reorg, self).__init__() self.stride = stride def forward(self, x): stride = self.stride assert x.data.dim() == 4 B = x.data.size(0) C = x.data.size(1) H = x....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Hydroxy-OH/deep_sort_pytorch
Reorg
false
11,484
[ "MIT" ]
0
040656566d9f52fefa4ef02ca58f039ff591211b
https://github.com/Hydroxy-OH/deep_sort_pytorch/tree/040656566d9f52fefa4ef02ca58f039ff591211b
ModMSELoss
import torch class ModMSELoss(torch.nn.Module): def __init__(self, shape_r_gt, shape_c_gt): super(ModMSELoss, self).__init__() self.shape_r_gt = shape_r_gt self.shape_c_gt = shape_c_gt def forward(self, output, label, prior): prior_size = prior.shape output_max = torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
HeosSacer/saliency_web_mapper
ModMSELoss
false
11,485
[ "MIT" ]
0
a2fd744b821086dc1a0af0498361207f7bcddee6
https://github.com/HeosSacer/saliency_web_mapper/tree/a2fd744b821086dc1a0af0498361207f7bcddee6
CosNorm_Classifier
import math import torch from torch import nn from torch.nn.parameter import Parameter class CosNorm_Classifier(nn.Module): def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001 ): super(CosNorm_Classifier, self).__init__() self.in_dims = in_dims self.out_dims...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
HoganZhang/OpenLongTailRecognition-OLTR
CosNorm_Classifier
false
11,486
[ "BSD-3-Clause" ]
0
94b7e9fc93e7c96218e801007aa4d09a3f5fc69d
https://github.com/HoganZhang/OpenLongTailRecognition-OLTR/tree/94b7e9fc93e7c96218e801007aa4d09a3f5fc69d
GaussianFocalLoss
import functools import torch import torch.nn.functional as F import torch.nn as nn 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...
Huuush/deepfashion2-det
GaussianFocalLoss
false
11,487
[ "Apache-2.0" ]
0
46af0ada8d6f534de2de6a9c069580cd1bf609ec
https://github.com/Huuush/deepfashion2-det/tree/46af0ada8d6f534de2de6a9c069580cd1bf609ec
BartClassificationHead
import torch from torch import nn import torch.utils.checkpoint class BartClassificationHead(nn.Module): """Head for sentence-level classification tasks.""" def __init__(self, input_dim: 'int', inner_dim: 'int', num_classes: 'int', pooler_dropout: 'float'): super().__init__() self.den...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Clemens123/transformers
BartClassificationHead
false
11,488
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
Upsample
import torch import torch.nn as nn class Upsample(nn.Module): def __init__(self, stride=2): super(Upsample, self).__init__() self.stride = stride def forward(self, x): stride = self.stride assert x.data.dim() == 4 B = x.data.size(0) C = x.data.size(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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Hydroxy-OH/deep_sort_pytorch
Upsample
false
11,489
[ "MIT" ]
0
040656566d9f52fefa4ef02ca58f039ff591211b
https://github.com/Hydroxy-OH/deep_sort_pytorch/tree/040656566d9f52fefa4ef02ca58f039ff591211b
ConvDropoutLayerNorm
import torch from torch import nn import torch.utils.checkpoint class SqueezeBertLayerNorm(nn.LayerNorm): """ This is a nn.LayerNorm subclass that accepts NCW data layout and performs normalization in the C dimension. N = batch C = channels W = sequence length """ def __init__(self, hidden_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._inductor.runtime.triton_helpers import libdevice from torch import n...
Clemens123/transformers
ConvDropoutLayerNorm
false
11,490
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
PositionwiseFeedForward
import math import torch from torch import nn import torch.utils.checkpoint def gelu(x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) class PositionwiseFeedForward(nn.Module): """A two-layer Feed-Forward-Network with residual layer norm. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Clemens123/transformers
PositionwiseFeedForward
false
11,491
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
FastGuidedFilter
import torch from torch import nn from torch.nn import functional as F class BoxFilter(nn.Module): def __init__(self, r): super(BoxFilter, self).__init__() self.r = r def forward(self, x): kernel_size = 2 * self.r + 1 kernel_x = torch.full((x.data.shape[1], 1, 1, 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._inductor.runtime import triton_helpers from torch import nn from tor...
HyeongminMoon/copy-paste-aug
FastGuidedFilter
false
11,492
[ "MIT" ]
0
38fcd770d70b5d4291de0cbb42073b37d7188537
https://github.com/HyeongminMoon/copy-paste-aug/tree/38fcd770d70b5d4291de0cbb42073b37d7188537
exponential
import torch from torch import nn class exponential(nn.Module): def __init__(self): super(exponential, self).__init__() def forward(self, x): return torch.exp(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
Hyunmok-Park/modular-metalearning-master
exponential
false
11,493
[ "MIT" ]
0
a7be61d7c48a62ec8c333b1031521977baed792b
https://github.com/Hyunmok-Park/modular-metalearning-master/tree/a7be61d7c48a62ec8c333b1031521977baed792b
MultiheadAttention
import torch import torch.nn as nn class MultiheadAttention(nn.Module): """A warpper for torch.nn.MultiheadAttention. This module implements MultiheadAttention with residual connection, and positional encoding used in DETR is also passed as input. Args: embed_dims (int): The embedding dimens...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Huuush/deepfashion2-det
MultiheadAttention
false
11,494
[ "Apache-2.0" ]
0
46af0ada8d6f534de2de6a9c069580cd1bf609ec
https://github.com/Huuush/deepfashion2-det/tree/46af0ada8d6f534de2de6a9c069580cd1bf609ec
LINEAR_LOGSOFTMAX_CLASSIFIER
import torch import torch.nn as nn class LINEAR_LOGSOFTMAX_CLASSIFIER(nn.Module): def __init__(self, input_dim, nclass): super(LINEAR_LOGSOFTMAX_CLASSIFIER, self).__init__() self.fc = nn.Linear(input_dim, nclass) self.logic = nn.LogSoftmax(dim=1) def forward(self, x): o = 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....
IacoSimoncini/tfvaegan
LINEAR_LOGSOFTMAX_CLASSIFIER
false
11,495
[ "MIT" ]
0
157b526d65d0b0d5412f4be6fed02fc7d6325827
https://github.com/IacoSimoncini/tfvaegan/tree/157b526d65d0b0d5412f4be6fed02fc7d6325827
ConvUnit
import torch import torch.nn as nn class ConvUnit(nn.Module): def __init__(self): super(ConvUnit, self).__init__() self.conv = nn.Conv2d(in_channels=256, out_channels=32, kernel_size =5, stride=1) def forward(self, x): return self.conv(x) def get_inputs(): return [t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Gromy1211/torch-light
ConvUnit
false
11,496
[ "MIT" ]
0
c7d7a9bc5ab1eab03d800a27d9325859516f01e6
https://github.com/Gromy1211/torch-light/tree/c7d7a9bc5ab1eab03d800a27d9325859516f01e6
SqueezeBertLayerNorm
import torch from torch import nn import torch.utils.checkpoint class SqueezeBertLayerNorm(nn.LayerNorm): """ This is a nn.LayerNorm subclass that accepts NCW data layout and performs normalization in the C dimension. N = batch C = channels W = sequence length """ def __init__(self, hidden_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._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.utils.checkpoint assert_size_stride = torch._...
Clemens123/transformers
SqueezeBertLayerNorm
false
11,497
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
GroupedLinearLayer
import torch from torch import nn import torch.utils.checkpoint class GroupedLinearLayer(nn.Module): def __init__(self, input_size, output_size, num_groups): super().__init__() self.input_size = input_size self.output_size = output_size self.num_groups = num_groups self.gr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.checkpoint assert_size_stride = torch._C...
Clemens123/transformers
GroupedLinearLayer
false
11,498
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
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(3, 16, 3, padding=1) self.conv2 = nn.Conv2d(16, 16, 3, padding=1) self.conv3 = nn.Conv2d(16, 20, 3, padding=1) 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....
Hunkzer/DLplayground
Net
false
11,499
[ "Apache-2.0" ]
0
c85238e00052a80e6a59e5d1c705014c45eeb6aa
https://github.com/Hunkzer/DLplayground/tree/c85238e00052a80e6a59e5d1c705014c45eeb6aa
NoNorm
import torch from torch import nn import torch.utils.checkpoint class NoNorm(nn.Module): def __init__(self, feat_size, eps=None): super().__init__() self.bias = nn.Parameter(torch.zeros(feat_size)) self.weight = nn.Parameter(torch.ones(feat_size)) def forward(self, input_tensor): ...
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 import torch.utils.checkpoint assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
Clemens123/transformers
NoNorm
false
11,500
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
Net
import torch from torch.nn import functional as F class Net(torch.nn.Module): def __init__(self, n_feature, n_hidden, n_output): super(Net, self).__init__() self.hidden = torch.nn.Linear(n_feature, n_hidden) self.hidden_two = torch.nn.Linear(n_hidden, n_hidden) self.hidden_3 = tor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
Hyunmok-Park/modular-metalearning-master
Net
false
11,501
[ "MIT" ]
0
a7be61d7c48a62ec8c333b1031521977baed792b
https://github.com/Hyunmok-Park/modular-metalearning-master/tree/a7be61d7c48a62ec8c333b1031521977baed792b
GeLU
import torch import torch.nn as nn class GeLU(nn.Module): def forward(self, x): return 0.5 * x * (1.0 + torch.tanh(x * 0.7978845608 * (1.0 + 0.044715 * x * x))) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
IamHimon/re2
GeLU
false
11,502
[ "Apache-2.0" ]
0
d16b0ffc385f7b118a6160d035250da8d6320534
https://github.com/IamHimon/re2/tree/d16b0ffc385f7b118a6160d035250da8d6320534
MLP
import torch import torch.nn as nn class MLP(nn.Module): """ MLP """ def __init__(self, hidden_layers, input_size, output_size, seed=1): """ `hidden_layers`: list, the number of neurons for every layer; `input_size`: number of states; `output_size`: number of actions; ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ILABUTK/MLePOMDP_Early_Sepsis_Detection
MLP
false
11,503
[ "MIT" ]
0
7e6fdb1e425ee3cd5aa4142287c1e7dba28a126f
https://github.com/ILABUTK/MLePOMDP_Early_Sepsis_Detection/tree/7e6fdb1e425ee3cd5aa4142287c1e7dba28a126f
BoxFilter
import torch from torch import nn from torch.nn import functional as F class BoxFilter(nn.Module): def __init__(self, r): super(BoxFilter, self).__init__() self.r = r def forward(self, x): kernel_size = 2 * self.r + 1 kernel_x = torch.full((x.data.shape[1], 1, 1, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_st...
HyeongminMoon/copy-paste-aug
BoxFilter
false
11,504
[ "MIT" ]
0
38fcd770d70b5d4291de0cbb42073b37d7188537
https://github.com/HyeongminMoon/copy-paste-aug/tree/38fcd770d70b5d4291de0cbb42073b37d7188537
AconC
import torch import torch.nn as nn class AconC(nn.Module): """ ACON activation (activate or not). AconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is a learnable parameter according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>. """ def __i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
IanVzs/labelImg
AconC
false
11,505
[ "MIT" ]
0
3d3dfbf9cf385f38c60376826fdce1f178f563a6
https://github.com/IanVzs/labelImg/tree/3d3dfbf9cf385f38c60376826fdce1f178f563a6
XOR
import torch import torch.utils.data.distributed import torch.nn as nn import torch.utils.data class XOR(nn.Module): def __init__(self, input_dim, output_dim): super(XOR, self).__init__() self.lin1 = nn.Linear(input_dim, 8) self.lin2 = nn.Linear(8, output_dim) def forward(self, featu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils....
IST-DASLab/horovod
XOR
false
11,506
[ "Apache-2.0" ]
0
d2611353c33b299f04e47fae0de741702de3130e
https://github.com/IST-DASLab/horovod/tree/d2611353c33b299f04e47fae0de741702de3130e
TransformerBlock
import torch import torch.nn as nn class TransformerBlock(nn.Module): def __init__(self, max_len, hidden_size, hidden_dropout, attention_heads, feed_forward_size): super().__init__() self.pre_layer_norm_1 = nn.LayerNorm([max_len, hidden_size]) self.dropout_1 = nn.Dropout(p=hidden_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
HyeyeonKoo/RoBERTa_PLD_pytorch
TransformerBlock
false
11,507
[ "MIT" ]
0
836db92b5570e3671371119aca0f864109b142fb
https://github.com/HyeyeonKoo/RoBERTa_PLD_pytorch/tree/836db92b5570e3671371119aca0f864109b142fb
MultiheadAttentionWrapper
import torch from torch import nn from torch.autograd import Variable import torch.nn.functional as F from torch.nn.utils import weight_norm import torch.nn.utils from torch.optim.lr_scheduler import * def linear(x): return x def activation(func_a): """Activation function wrapper """ try: f ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from torch.autograd import Variable import torch.nn.functional as F from torch.nn.utils import weight_norm import torch...
FalconX777/CharacterBert_Multitasking
MultiheadAttentionWrapper
false
11,508
[ "BSD-3-Clause" ]
0
eab566975871fffd0ec875a05ba478f1bce9b0ab
https://github.com/FalconX777/CharacterBert_Multitasking/tree/eab566975871fffd0ec875a05ba478f1bce9b0ab
LayerNorm
import torch from torch import nn from torch.nn import Parameter from torch.nn.parameter import Parameter import torch.nn.utils from torch.optim.lr_scheduler import * class LayerNorm(nn.Module): def __init__(self, hidden_size, eps=0.0001): super(LayerNorm, self).__init__() self.alpha = Parameter(...
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 from torch.nn import Parameter from torch.nn.parameter imp...
FalconX777/CharacterBert_Multitasking
LayerNorm
false
11,509
[ "BSD-3-Clause" ]
0
eab566975871fffd0ec875a05ba478f1bce9b0ab
https://github.com/FalconX777/CharacterBert_Multitasking/tree/eab566975871fffd0ec875a05ba478f1bce9b0ab
Downsample
import torch import torch.nn as nn import torch.nn.parallel class Downsample(nn.Module): """ Image to Patch Embedding, downsampling between stage1 and stage2 """ def __init__(self, in_embed_dim, out_embed_dim, patch_size): super().__init__() self.proj = nn.Conv2d(in_embed_dim, out_emb...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dy...
Inch-Z/volo
Downsample
false
11,510
[ "Apache-2.0" ]
0
8bbb40838f5cc889ccae26b97438ea73cb1b4e07
https://github.com/Inch-Z/volo/tree/8bbb40838f5cc889ccae26b97438ea73cb1b4e07
Anomaly
import torch import torch.utils.data from torch import nn class Anomaly(nn.Module): def __init__(self, window=1024): self.window = window super(Anomaly, self).__init__() self.layer1 = nn.Conv1d(window, window, kernel_size=1, stride=1, padding=0) self.layer2 = nn.Conv1d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
G-santini/anomalydetector
Anomaly
false
11,511
[ "MIT" ]
0
f41be86d357cba7c164a02947b28d5c70ee3e451
https://github.com/G-santini/anomalydetector/tree/f41be86d357cba7c164a02947b28d5c70ee3e451
BCEDiceLoss
import torch from torch import nn import torch.utils.data import torch.nn.functional as F class BCEDiceLoss(nn.Module): def __init__(self): super().__init__() def forward(self, input, target): bce = F.binary_cross_entropy_with_logits(input, target) smooth = 1e-05 input = torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Information-Fusion-Lab-Umass/pytorch-nested-unet
BCEDiceLoss
false
11,512
[ "MIT" ]
0
29b8704795f9d0ab17952b19bf8b4624e7aa16c0
https://github.com/Information-Fusion-Lab-Umass/pytorch-nested-unet/tree/29b8704795f9d0ab17952b19bf8b4624e7aa16c0
MetaAconC
import torch import torch.nn as nn class MetaAconC(nn.Module): """ ACON activation (activate or not). MetaAconC: (p1*x-p2*x) * sigmoid(beta*(p1*x-p2*x)) + p2*x, beta is generated by a small network according to "Activate or Not: Learning Customized Activation" <https://arxiv.org/pdf/2009.04759.pdf>. "...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
IanVzs/labelImg
MetaAconC
false
11,513
[ "MIT" ]
0
3d3dfbf9cf385f38c60376826fdce1f178f563a6
https://github.com/IanVzs/labelImg/tree/3d3dfbf9cf385f38c60376826fdce1f178f563a6
VAE
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.onnx import torch.optim import torch.utils.data.distributed import torch.nn.functional as F import torch.autograd class VAE(nn.Module): def __init__(self): super(VAE, self).__init__() self.fc1 = nn.Li...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
HolyLow/examples
VAE
false
11,514
[ "BSD-3-Clause" ]
0
23b0cb1022cf7a21428883e95fded01d74a059bf
https://github.com/HolyLow/examples/tree/23b0cb1022cf7a21428883e95fded01d74a059bf
OutlookAttention
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class OutlookAttention(nn.Module): """ Implementation of outlook attention --dim: hidden dim --num_heads: number of heads --kernel_size: kernel size in each window for outlook attention retu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Inch-Z/volo
OutlookAttention
false
11,515
[ "Apache-2.0" ]
0
8bbb40838f5cc889ccae26b97438ea73cb1b4e07
https://github.com/Inch-Z/volo/tree/8bbb40838f5cc889ccae26b97438ea73cb1b4e07
PatchEmbed
import torch import torch.nn as nn import torch.nn.parallel class PatchEmbed(nn.Module): """ Image to Patch Embedding. Different with ViT use 1 conv layer, we use 4 conv layers to do patch embedding """ def __init__(self, img_size=224, stem_conv=False, stem_stride=1, patch_size=8, in_chan...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dy...
Inch-Z/volo
PatchEmbed
false
11,516
[ "Apache-2.0" ]
0
8bbb40838f5cc889ccae26b97438ea73cb1b4e07
https://github.com/Inch-Z/volo/tree/8bbb40838f5cc889ccae26b97438ea73cb1b4e07
PELU
import math import torch import torch as th import torch.nn as nn class PELU(nn.Module): def __init__(self, a=None, b=None): super().__init__() default_val = math.sqrt(0.1) a = default_val if a is None else a b = default_val if b is None else b self.a = nn.Parameter(th.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.triton_helpers import math as tl_math import math import torch as th import torch.nn as nn assert_size_stride =...
InzamamRahaman/PELU
PELU
false
11,517
[ "MIT" ]
0
ee2598c32f3596f18d957417c97c03e8862086bf
https://github.com/InzamamRahaman/PELU/tree/ee2598c32f3596f18d957417c97c03e8862086bf
AdjMSELoss
import torch import torch.nn as nn class AdjMSELoss(nn.Module): def __init__(self): super(AdjMSELoss, self).__init__() def forward(self, outputs, labels): loss = torch.abs(outputs - labels) adj_fact = torch.mean(torch.abs(labels)) ** 2 adj = torch.exp(-outputs * labels / adj_...
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 ...
JDE65/Adjusted-MAE-loss-function
AdjMSELoss
false
11,518
[ "MIT" ]
0
e0b54c41a499f68791b731e29e31b5e0f410ac5c
https://github.com/JDE65/Adjusted-MAE-loss-function/tree/e0b54c41a499f68791b731e29e31b5e0f410ac5c
Transformer
import torch import torch.nn as nn import torch.nn.parallel class Mlp(nn.Module): """Implementation of MLP""" 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 hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Inch-Z/volo
Transformer
false
11,519
[ "Apache-2.0" ]
0
8bbb40838f5cc889ccae26b97438ea73cb1b4e07
https://github.com/Inch-Z/volo/tree/8bbb40838f5cc889ccae26b97438ea73cb1b4e07
ClassBlock
import torch import torch.nn as nn import torch.nn.parallel class Mlp(nn.Module): """Implementation of MLP""" 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 hi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Inch-Z/volo
ClassBlock
false
11,520
[ "Apache-2.0" ]
0
8bbb40838f5cc889ccae26b97438ea73cb1b4e07
https://github.com/Inch-Z/volo/tree/8bbb40838f5cc889ccae26b97438ea73cb1b4e07
DummyModelWithSharedSubmodule
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.quantization import torch.onnx import torch.testing class DummyDenseWithRelu(nn.Module): def __init__(self, input_size, output...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Donfa1con/distiller
DummyModelWithSharedSubmodule
false
11,521
[ "Apache-2.0" ]
0
645ee41bfebc463523b228ff087e41619607d8b2
https://github.com/Donfa1con/distiller/tree/645ee41bfebc463523b228ff087e41619607d8b2
LocalConv2d
import torch import torch.nn as nn import torch.nn.functional as F class LocalConv2d(nn.Module): def __init__(self, num_rows, num_feats_in, num_feats_out, kernel=1, padding=0): super(LocalConv2d, self).__init__() self.num_rows = num_rows self.out_channels = num_feats_out 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
JSharpClone/M3D-RPN-
LocalConv2d
false
11,522
[ "Apache-2.0" ]
0
5192b095e921b5c054a66fd0ce948e67aee957be
https://github.com/JSharpClone/M3D-RPN-/tree/5192b095e921b5c054a66fd0ce948e67aee957be
BahdanauAttention
import math import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.quantization from torch.nn.parameter import Parameter import torch.onnx import torch.testing class EltwiseAdd(nn.Module...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Donfa1con/distiller
BahdanauAttention
false
11,523
[ "Apache-2.0" ]
0
645ee41bfebc463523b228ff087e41619607d8b2
https://github.com/Donfa1con/distiller/tree/645ee41bfebc463523b228ff087e41619607d8b2
Actor
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.quantization import torch.onnx import torch.testing class Actor(nn.Module): def __init__(self, nb_states, nb_actions, hidden1=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Donfa1con/distiller
Actor
false
11,524
[ "Apache-2.0" ]
0
645ee41bfebc463523b228ff087e41619607d8b2
https://github.com/Donfa1con/distiller/tree/645ee41bfebc463523b228ff087e41619607d8b2
ModelWithDuplicates
import torch from collections import OrderedDict import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.quantization import torch.onnx import torch.testing class ModelWithDuplicates(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Donfa1con/distiller
ModelWithDuplicates
false
11,525
[ "Apache-2.0" ]
0
645ee41bfebc463523b228ff087e41619607d8b2
https://github.com/Donfa1con/distiller/tree/645ee41bfebc463523b228ff087e41619607d8b2
Mean
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.quantization import torch.onnx import torch.testing class Mean(nn.Module): def __init__(self, *args, **kwargs): super(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data...
Donfa1con/distiller
Mean
false
11,526
[ "Apache-2.0" ]
0
645ee41bfebc463523b228ff087e41619607d8b2
https://github.com/Donfa1con/distiller/tree/645ee41bfebc463523b228ff087e41619607d8b2
policy1
import torch import torch.nn as nn class policy1(nn.Module): def __init__(self): super(policy1, self).__init__() self.sm = nn.Softmax(dim=-1) self.actor = nn.Parameter(torch.FloatTensor([-0.35, 0.4, 1])) def forward(self): mu = self.sm(self.actor) return mu def get_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
JWongDude/FruitLoops
policy1
false
11,527
[ "MIT" ]
0
f4346d9db16ba619d71ce5bb819f5da08a88a120
https://github.com/JWongDude/FruitLoops/tree/f4346d9db16ba619d71ce5bb819f5da08a88a120
AlexNet
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class AlexNet(nn.Module): def __init__(self): super(AlexNet, self).__init__() self.conv1 = nn.Conv2d(3, 64, (11, 11), stride=(4, 4), padding=(2, 2)) self.conv2 = nn.Conv2d(64, 192, (5, 5), 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 from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Fritingo/AlexNet_on_browser
AlexNet
false
11,528
[ "MIT" ]
0
3e674dd84e25ee74f2efde77882b4faa788907c2
https://github.com/Fritingo/AlexNet_on_browser/tree/3e674dd84e25ee74f2efde77882b4faa788907c2
Norm
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.quantization import torch.onnx import torch.testing class Norm(nn.Module): """ A module wrapper for vector/matrix norm ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
Donfa1con/distiller
Norm
false
11,529
[ "Apache-2.0" ]
0
645ee41bfebc463523b228ff087e41619607d8b2
https://github.com/Donfa1con/distiller/tree/645ee41bfebc463523b228ff087e41619607d8b2
TwoMLPHead
import torch from torch import nn import torch.nn.functional as F class TwoMLPHead(nn.Module): """ Standard heads for FPN-based models Arguments: in_channels (int): number of input channels representation_size (int): size of the intermediate representation """ def __init__(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
GerardWalsh/DeepLabv3FineTuning
TwoMLPHead
false
11,530
[ "MIT" ]
0
149d4b33a7dc94c56361f559ca67cb0fcf9ae9d5
https://github.com/GerardWalsh/DeepLabv3FineTuning/tree/149d4b33a7dc94c56361f559ca67cb0fcf9ae9d5
ClippedLinearQuantization
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from torch.optim.lr_scheduler import * import torch.optim.lr_scheduler import torch.quantization import torch.onnx import torch.testing def linear_dequantize(input, scale, zero_point, inplace=False): if 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
Donfa1con/distiller
ClippedLinearQuantization
false
11,531
[ "Apache-2.0" ]
0
645ee41bfebc463523b228ff087e41619607d8b2
https://github.com/Donfa1con/distiller/tree/645ee41bfebc463523b228ff087e41619607d8b2
Downsample
import torch import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: return nn.Conv3d(*args, **kwargs) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Jack000/improved-diffusion
Downsample
false
11,532
[ "MIT" ]
0
e2abfc8072f9007b558b697b79d2affdae0eca3b
https://github.com/Jack000/improved-diffusion/tree/e2abfc8072f9007b558b697b79d2affdae0eca3b
Classifier
import torch import torch.distributed import torch import torch.nn as nn class Classifier(nn.Module): def __init__(self, hidden_size): super(Classifier, self).__init__() self.linear1 = nn.Linear(hidden_size, 1) self.sigmoid = nn.Sigmoid() def forward(self, x, mask_cls): h = 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.distributed import torch import torch.nn as nn assert_size_stride =...
JackInTaiwan/BertSum
Classifier
false
11,533
[ "Apache-2.0" ]
0
5b6f372b13358473d17c49bfc45f1e15c80f9fce
https://github.com/JackInTaiwan/BertSum/tree/5b6f372b13358473d17c49bfc45f1e15c80f9fce
LayerNorm
import torch import torch.nn as nn 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)) self.b = nn.Parame...
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_...
HamoolNizar/RumorDetectionSystem
LayerNorm
false
11,534
[ "MIT" ]
0
902ae4d705c0a6db470064f0e7f07f3c167d3eac
https://github.com/HamoolNizar/RumorDetectionSystem/tree/902ae4d705c0a6db470064f0e7f07f3c167d3eac
DilatedResidualLayer
import torch from torch import nn import torch.nn.functional as F class DilatedResidualLayer(nn.Module): def __init__(self, dilation, in_channels, out_channels): super(DilatedResidualLayer, self).__init__() self.conv_dilated = nn.Conv1d(in_channels, out_channels, 3, padding =dilation,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Jaakik/hydra-ml
DilatedResidualLayer
false
11,535
[ "MIT" ]
0
eae54fc478163130c94450a2a2ddea4f204c1ea9
https://github.com/Jaakik/hydra-ml/tree/eae54fc478163130c94450a2a2ddea4f204c1ea9
BiDAFAttention
import torch import torch.nn as nn import torch.nn.functional as F def masked_softmax(logits, mask, dim=-1, log_softmax=False): """Take the softmax of `logits` over given dimension, and set entries to 0 wherever `mask` is 0. Args: logits (torch.Tensor): Inputs to the softmax function. mas...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JNXSTJ/squad
BiDAFAttention
false
11,536
[ "MIT" ]
0
ed875a90b212e1fe2f05144edb5595cedb5dd42b
https://github.com/JNXSTJ/squad/tree/ed875a90b212e1fe2f05144edb5595cedb5dd42b
Upsample
import torch import torch.nn as nn import torch.nn.functional as F def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Jack000/improved-diffusion
Upsample
false
11,537
[ "MIT" ]
0
e2abfc8072f9007b558b697b79d2affdae0eca3b
https://github.com/Jack000/improved-diffusion/tree/e2abfc8072f9007b558b697b79d2affdae0eca3b
CNN
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self, input_size=50, hidden_size=256, dropout=0, kernel_size=3, padding=1, activation_function=F.relu): """ Args: input_size: dimention of input embedding kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
JanKalo/OpenNRE
CNN
false
11,538
[ "MIT" ]
0
2842903e5b66c88311820adac50a16ee3dc8ff77
https://github.com/JanKalo/OpenNRE/tree/2842903e5b66c88311820adac50a16ee3dc8ff77
TVLoss
import torch import torch.nn as nn class TVLoss(nn.Module): def __init__(self, strength): super(TVLoss, self).__init__() self.strength = strength def forward(self, input): self.x_diff = input[:, :, 1:, :] - input[:, :, :-1, :] self.y_diff = input[:, :, :, 1:] - 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 math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
JaledMC/neural-style-pt
TVLoss
false
11,539
[ "MIT" ]
0
ce205c867761e251e86c89722df81c74dad7a221
https://github.com/JaledMC/neural-style-pt/tree/ce205c867761e251e86c89722df81c74dad7a221
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, ignore_target=-1): super().__init__() self.ignore_target = ignore_target def forward(self, input, target): """ :param input: (N), logit :param target: (N), {0, 1} :return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
JamesWang007/PointRCNN
DiceLoss
false
11,540
[ "MIT" ]
0
ea0812c52e6767b976fc50fed61e6b72fa6cdf81
https://github.com/JamesWang007/PointRCNN/tree/ea0812c52e6767b976fc50fed61e6b72fa6cdf81
SigmoidFocalClassificationLoss
import torch import torch.nn as nn def _sigmoid_cross_entropy_with_logits(logits, labels): loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits) loss += torch.log1p(torch.exp(-torch.abs(logits))) return loss class SigmoidFocalClassificationLoss(nn.Module): """Sigmoid focal cross entrop...
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...
JamesWang007/PointRCNN
SigmoidFocalClassificationLoss
false
11,541
[ "MIT" ]
0
ea0812c52e6767b976fc50fed61e6b72fa6cdf81
https://github.com/JamesWang007/PointRCNN/tree/ea0812c52e6767b976fc50fed61e6b72fa6cdf81
GlobalAvgPool2d
import torch from torch import nn import torch.nn.functional as F class GlobalAvgPool2d(nn.Module): def __init__(self): super(GlobalAvgPool2d, self).__init__() def forward(self, x): return F.avg_pool2d(x, kernel_size=x.size()[2:]) def get_inputs(): return [torch.rand([4, 4, 4, 4])] 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
JessyLee/Jessy_Dive_into_DL_Pytorch
GlobalAvgPool2d
false
11,542
[ "MIT" ]
0
40b7921637b13507057f41485d928f3b59cc6f6a
https://github.com/JessyLee/Jessy_Dive_into_DL_Pytorch/tree/40b7921637b13507057f41485d928f3b59cc6f6a
PSNRLoss
import torch import torch.nn as nn from torch.nn.functional import mse_loss as mse def psnr(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float' ) ->torch.Tensor: """Creates a function that calculates the PSNR between 2 images. PSNR is Peek Signal to Noise Ratio, which is similar to mean squar...
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...
JoanFM/kornia
PSNRLoss
false
11,543
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
Conv2d
import torch import torch.nn as nn from torch.nn import functional as F class Conv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(Conv2d, self).__init__(in_channels, out_channels, kernel_size, strid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
JassiGhuman/backgroundSubtraction
Conv2d
false
11,544
[ "MIT" ]
0
351a380b34f9d84548bea734a69842227e373e65
https://github.com/JassiGhuman/backgroundSubtraction/tree/351a380b34f9d84548bea734a69842227e373e65
Rot180
import torch import torch.nn as nn def rot180(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-2, -1]) class Rot180(nn.Module): """Rotate a tensor image or a batch of tensor images 180 degrees. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. ...
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...
JoanFM/kornia
Rot180
false
11,545
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
BasicBlock
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data def conv3x3(in_planes, out_planes, stride=1, dilation=1): return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=dilation, dilation=dilation, bias=False) class BasicBlock(nn.Module): expansion ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
JiazeWang/6-PACK
BasicBlock
false
11,546
[ "MIT" ]
0
bce910213cfbf89b4ed7b59ff6c70a59a7c19b99
https://github.com/JiazeWang/6-PACK/tree/bce910213cfbf89b4ed7b59ff6c70a59a7c19b99
LastLevelMaxPool
import torch import torch.utils.data from torchvision.transforms import functional as F from torch import nn import torch.nn.functional as F class LastLevelMaxPool(nn.Module): def forward(self, x): return [F.max_pool2d(x, 1, 2, 0)] 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 import torch.utils.data from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
Amir4g/maskrcnn-benchmark
LastLevelMaxPool
false
11,547
[ "MIT" ]
0
c734fef962c3a2782e0055cfb6f825505a4b0c26
https://github.com/Amir4g/maskrcnn-benchmark/tree/c734fef962c3a2782e0055cfb6f825505a4b0c26
Fire
import torch from torch import nn class Fire(nn.Module): def __init__(self, inplanes, squeeze_planes, expand1x1_planes, expand3x3_planes): super(Fire, self).__init__() self.inplanes = inplanes self.squeeze = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1) self.squeeze_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 import triton_helpers from torch import nn assert_s...
GerardWalsh/DeepLabv3FineTuning
Fire
false
11,548
[ "MIT" ]
0
149d4b33a7dc94c56361f559ca67cb0fcf9ae9d5
https://github.com/GerardWalsh/DeepLabv3FineTuning/tree/149d4b33a7dc94c56361f559ca67cb0fcf9ae9d5
RgbaToRgb
import torch import torch.nn as nn def rgba_to_rgb(image: 'torch.Tensor') ->torch.Tensor: """Convert an image from RGBA to RGB. Args: image: RGBA Image to be converted to RGB of shape :math:`(*,4,H,W)`. Returns: RGB version of the image with shape :math:`(*,3,H,W)`. Example: ...
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...
JoanFM/kornia
RgbaToRgb
false
11,549
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90
ExtractTensorPatches
import torch from typing import Optional from typing import Tuple import torch.nn as nn import torch.nn.functional as F from typing import Union from torch.nn.modules.utils import _pair def _extract_tensor_patchesnd(input: 'torch.Tensor', window_sizes: 'Tuple[int, ...]', strides: 'Tuple[int, ...]') ->torch.Tensor...
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 typing import Optional from typing import Tuple import torch.nn as nn import torch.nn.functional as F from typing import Union from tor...
JoanFM/kornia
ExtractTensorPatches
false
11,550
[ "ECL-2.0", "Apache-2.0" ]
0
808898887cde69074ca3e3df9b24dea9682aad90
https://github.com/JoanFM/kornia/tree/808898887cde69074ca3e3df9b24dea9682aad90