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
Expand
import torch import torch.nn as nn import torch.utils.data class Expand(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, s, s, C // s ** 2, H, W) x = x.permute(0...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
ChaokunChang/SVAS
Expand
false
248
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
Actor
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Actor(nn.Module): def __init__(self, input_size, output_size): super(Actor, self).__init__() self.fc1 = nn.Linear(input_size, 128) self.fc2 = nn.Linear(128, 256) 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....
ChangQingAAS/Deep-Reinforcement-Learning
Actor
false
249
[ "MIT" ]
0
3bc1381c632b1730a48e63e972aea62086c4287c
https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c
L2Norm
import torch import torch.nn as nn class L2Norm(nn.Module): def __init__(self, n_dims, scale=20.0, eps=1e-10): """L2 normalization layer. Args: n_dims (int): Number of dimensions to be normalized scale (float, optional): Defaults to 20.. eps (float, optional):...
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_...
ChengBo5/mask-text-detector
L2Norm
false
250
[ "Apache-2.0" ]
0
ce93e45ed1d982ec0ef6ad977c02e49326bf255a
https://github.com/ChengBo5/mask-text-detector/tree/ce93e45ed1d982ec0ef6ad977c02e49326bf255a
duelingdqnNet
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class duelingdqnNet(nn.Module): def __init__(self, STATE_NUM, ACTION_NUM): super(duelingdqnNet, self).__init__() self.ACTION_NUM = ACTION_NUM self.fc1_a = nn.Linear(in_features=STAT...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
ChangQingAAS/Deep-Reinforcement-Learning
duelingdqnNet
false
251
[ "MIT" ]
0
3bc1381c632b1730a48e63e972aea62086c4287c
https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c
Reorg
import torch from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class Reorg(nn.Module): def __init__(self, stride=2): super(Reorg, self).__init__() self.stride = stride def forward(self, x): stride = se...
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.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo assert_...
ChitienSun/NCTU_DLSR_final_project
Reorg
false
252
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
CausalConv1d
import torch import torch.nn as nn class CausalConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=1, **kwargs): super(CausalConv1d, self).__init__(in_channels, out_channels, kernel_size, padding=dilation * (kernel_size - 1), 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ChesterHuynh/Wavenet-CPC-Music-Translation
CausalConv1d
false
253
[ "MIT" ]
0
60632b0330a61a10bac1a129826c55372f685427
https://github.com/ChesterHuynh/Wavenet-CPC-Music-Translation/tree/60632b0330a61a10bac1a129826c55372f685427
Sum
import torch import torch.nn as nn import torch.utils.data class Sum(nn.Module): def __init__(self, n, weight=False): super(Sum, self).__init__() self.weight = weight self.iter = range(n - 1) if weight: self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=Tru...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
ChaokunChang/SVAS
Sum
false
254
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
BPNet
import torch import torch.nn.functional as F import torch.nn as nn class BPNet(nn.Module): def __init__(self, input_dim, output_dim, level1, level2): super(BPNet, self).__init__() self.fc1 = nn.Linear(input_dim, level1) self.fc2 = nn.Linear(level1, level2) self.fc3 = nn.Linear(lev...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Cheemion/Sitting_Posture_Recognization_Experiments
BPNet
false
255
[ "MIT" ]
0
3a96377fe36b97e9867b5c32fe4d7434ddd370e2
https://github.com/Cheemion/Sitting_Posture_Recognization_Experiments/tree/3a96377fe36b97e9867b5c32fe4d7434ddd370e2
BCEBlurWithLogitsLoss
import torch import torch.nn as nn import torch.utils.data class BCEBlurWithLogitsLoss(nn.Module): def __init__(self, alpha=0.05): super(BCEBlurWithLogitsLoss, self).__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, true): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
ChaokunChang/SVAS
BCEBlurWithLogitsLoss
false
256
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
SELayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class SELayer(nn.Module): def __init__(self, in_channels, reduction): super(SELayer, self).__init__() mid_channels = in_channels // reduction self.fc1 = nn.Linear(in_channels, mid_channels) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
ChengBin1997/pytorch_image_classification
SELayer
false
257
[ "MIT" ]
0
f7c39efceb86d961489514917d11b96f44699094
https://github.com/ChengBin1997/pytorch_image_classification/tree/f7c39efceb86d961489514917d11b96f44699094
GHMC
import torch import torch.nn.functional as F import torch.nn as nn def _expand_onehot_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero((labels >= 0) & (labels < label_channels), as_tuple=False).squeeze() if inds.n...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
ChengBo5/mask-text-detector
GHMC
false
258
[ "Apache-2.0" ]
0
ce93e45ed1d982ec0ef6ad977c02e49326bf255a
https://github.com/ChengBo5/mask-text-detector/tree/ce93e45ed1d982ec0ef6ad977c02e49326bf255a
Classify
import torch import torch.nn as nn import torch.utils.data def autopad(k, p=None): if p is None: p = k // 2 if isinstance(k, int) else [(x // 2) for x in k] return p class Classify(nn.Module): def __init__(self, c1, c2, k=1, s=1, p=None, g=1): super(Classify, self).__init__() 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ChaokunChang/SVAS
Classify
false
259
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
PetarVGAT
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class BaseModel(nn.Module): @staticmethod def add_args(parser): """Add model-specific arguments to the parser.""" pass @classmethod def build_model_from_args(cls, args): """Build a new ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
BruceW91/cogdl
PetarVGAT
false
260
[ "MIT" ]
0
1ad524375f5ba062103698a0432fc857572a6933
https://github.com/BruceW91/cogdl/tree/1ad524375f5ba062103698a0432fc857572a6933
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...
ChanLiang/MAP-BERT
ZeroPad1d
false
261
[ "MIT" ]
0
c3f95a925002061463dbb68608ff7c67ff353b5d
https://github.com/ChanLiang/MAP-BERT/tree/c3f95a925002061463dbb68608ff7c67ff353b5d
Conv2d
import torch import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, relu=True, same_padding=False, bn=False): super(Conv2d, self).__init__() padding = int((kernel_size - 1) / 2) if same_padding else 0 self.conv = nn.Conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ChrisKonishi/multi-stream-crowd-counting-extended
Conv2d
false
262
[ "MIT" ]
0
4b1590499bd93ac09e62c4c7760b88ae92e6b301
https://github.com/ChrisKonishi/multi-stream-crowd-counting-extended/tree/4b1590499bd93ac09e62c4c7760b88ae92e6b301
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...
ChanLiang/MAP-BERT
Fp32GroupNorm
false
263
[ "MIT" ]
0
c3f95a925002061463dbb68608ff7c67ff353b5d
https://github.com/ChanLiang/MAP-BERT/tree/c3f95a925002061463dbb68608ff7c67ff353b5d
MaxPoolStride1
import torch from torch.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class MaxPoolStride1(nn.Module): def __init__(self): super(MaxPoolStride1, self).__init__() def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import to...
ChitienSun/NCTU_DLSR_final_project
MaxPoolStride1
false
264
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
GlobalAvgPool2d
import torch from torch.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class GlobalAvgPool2d(nn.Module): def __init__(self): super(GlobalAvgPool2d, self).__init__() def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo assert_...
ChitienSun/NCTU_DLSR_final_project
GlobalAvgPool2d
false
265
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
DilatedResConv
import torch import torch.nn as nn import torch.nn.functional as F class DilatedResConv(nn.Module): def __init__(self, channels, dilation=1, activation='relu', padding=1, kernel_size=3, left_pad=0): super().__init__() in_channels = channels if activation == 'relu': sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ChesterHuynh/Wavenet-CPC-Music-Translation
DilatedResConv
false
266
[ "MIT" ]
0
60632b0330a61a10bac1a129826c55372f685427
https://github.com/ChesterHuynh/Wavenet-CPC-Music-Translation/tree/60632b0330a61a10bac1a129826c55372f685427
ClippedLinearQuantization
import torch from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo def linear_dequantize(input, scale_factor, inplace=False): if inplace: input.div_(scale_factor) return input return input / scale_factor def linea...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.optim.lr_schedule...
ChitienSun/NCTU_DLSR_final_project
ClippedLinearQuantization
false
267
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
BahdanauAttention
import math import torch from torch import nn import torch.nn.functional as F class BahdanauAttention(nn.Module): def __init__(self, hidden_size): super(BahdanauAttention, self).__init__() self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) 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....
Chiang97912/seq2seq
BahdanauAttention
false
268
[ "MIT" ]
0
4b544016ecc16fa8e48358021cf486e58494aa0f
https://github.com/Chiang97912/seq2seq/tree/4b544016ecc16fa8e48358021cf486e58494aa0f
MaxPool2dStaticSamePadding
import math import torch import torch.nn as nn import torch.nn.functional as F class MaxPool2dStaticSamePadding(nn.Module): def __init__(self, *args, **kwargs): super().__init__() self.pool = nn.MaxPool2d(*args, **kwargs) self.stride = self.pool.stride self.kernel_size = self.pool...
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...
ChrisLiuxp/efficientdet
MaxPool2dStaticSamePadding
false
269
[ "MIT" ]
0
5d52ac491e1dd2a29ee6650bb746f1e840c24fcc
https://github.com/ChrisLiuxp/efficientdet/tree/5d52ac491e1dd2a29ee6650bb746f1e840c24fcc
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...
ChristophReich1996/kornia
PSNRLoss
false
270
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
RgbaToBgr
import torch import torch.nn as nn def bgr_to_rgb(image: 'torch.Tensor') ->torch.Tensor: """Convert a BGR image to RGB. Args: image (torch.Tensor): BGR Image to be converted to BGR of shape :math:`(*,3,H,W)`. Returns: torch.Tensor: RGB version of the image with shape of shape :math:`(*,3...
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...
ChristophReich1996/kornia
RgbaToBgr
false
271
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
GHMR
import torch import torch.nn as nn class GHMR(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper `Gradient Harmonized Single-stage Detector <https://arxiv.org/abs/1811.05181>`_. Args: mu (float): The parameter for the Authentic Smooth L1 loss. b...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
ChengBo5/mask-text-detector
GHMR
false
272
[ "Apache-2.0" ]
0
ce93e45ed1d982ec0ef6ad977c02e49326bf255a
https://github.com/ChengBo5/mask-text-detector/tree/ce93e45ed1d982ec0ef6ad977c02e49326bf255a
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...
ChristophReich1996/kornia
Rot180
false
273
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
SplAtConv2d
import logging import torch from torch import nn import torch.nn.functional as F from torch.nn import ReLU from torch.nn import Conv2d from torch.nn.modules.utils import _pair from torch.optim.lr_scheduler import * from torch.optim import * def get_norm(norm, out_channels, **kwargs): """ Args: norm (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....
Challyfilio/NAIC2021
SplAtConv2d
false
274
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
RobertaMaskLeanerHead
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 RobertaMaskLeanerHead(nn.Module): """ Head for mask leaner. input: (batch, src_lens, embed_dim) output: (batch, src_lens,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 from torch._inductor.runtime....
ChanLiang/MAP-BERT
RobertaMaskLeanerHead
false
275
[ "MIT" ]
0
c3f95a925002061463dbb68608ff7c67ff353b5d
https://github.com/ChanLiang/MAP-BERT/tree/c3f95a925002061463dbb68608ff7c67ff353b5d
ExtractTensorPatches
import torch import torch.nn as nn import torch.nn.functional as F from typing import Tuple from typing import Union from typing import Optional 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 import torch.nn as nn import torch.nn.functional as F from typing import Tuple from typing import Union from typing import Optional from tor...
ChristophReich1996/kornia
ExtractTensorPatches
false
276
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
Hflip
import torch import torch.nn as nn def hflip(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-1]) class Hflip(nn.Module): """Horizontally flip a tensor image or a batch of tensor images. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: ...
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...
ChristophReich1996/kornia
Hflip
false
277
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
InverseDepthSmoothnessLoss
import torch import torch.nn as nn def _gradient_x(img: 'torch.Tensor') ->torch.Tensor: assert len(img.shape) == 4, img.shape return img[:, :, :, :-1] - img[:, :, :, 1:] def _gradient_y(img: 'torch.Tensor') ->torch.Tensor: assert len(img.shape) == 4, img.shape return img[:, :, :-1, :] - img[:, :, 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 math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ChristophReich1996/kornia
InverseDepthSmoothnessLoss
false
278
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
NCutLossOptimized
import torch from torch import Tensor import torch.nn as nn class NCutLossOptimized(nn.Module): """Implementation of the continuous N-Cut loss, as in: 'W-Net: A Deep Model for Fully Unsupervised Image Segmentation', by Xia, Kulis (2017)""" def __init__(self, radius: 'int'=5): """ :param r...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
Christer-L/wnet_pytorch
NCutLossOptimized
false
279
[ "MIT" ]
0
c7a7d3db0c07d5e2d83fe152ce5fdae31472748b
https://github.com/Christer-L/wnet_pytorch/tree/c7a7d3db0c07d5e2d83fe152ce5fdae31472748b
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 (torch.Tensor): RGBA Image to be converted to RGB of shape :math:`(*,4,H,W)`. Returns: torch.Tensor: RGB version of the image with shape :math:`(*,3...
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...
ChristophReich1996/kornia
RgbaToRgb
false
280
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
MomentumNetSide
import torch import torch.utils.data import torch.utils.data.dataloader class MomentumNetSide(torch.nn.Module): def __init__(self, beta: 'float'): super(MomentumNetSide, self).__init__() self.beta = beta def forward(self, inp: 'torch.Tensor'): return inp * self.beta def get_inputs(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.utils.data.dataloader assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
ClashLuke/HomebrewNLP
MomentumNetSide
false
281
[ "BSD-2-Clause" ]
0
18d9a9a32af4e5e5672a9261ef6ac613dc9194c0
https://github.com/ClashLuke/HomebrewNLP/tree/18d9a9a32af4e5e5672a9261ef6ac613dc9194c0
BinaryFocalLossWithLogits
import torch import torch.nn as nn def binary_focal_loss_with_logits(input: 'torch.Tensor', target: 'torch.Tensor', alpha: 'float'=0.25, gamma: 'float'=2.0, reduction: 'str'='none', eps: 'float'=1e-08) ->torch.Tensor: """Function that computes Binary Focal loss. .. math:: \\text{FL}(p_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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ChristophReich1996/kornia
BinaryFocalLossWithLogits
false
282
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
TotalVariation
import torch import torch.nn as nn def total_variation(img: 'torch.Tensor') ->torch.Tensor: """Function that computes Total Variation according to [1]. Args: img (torch.Tensor): the input image with shape :math:`(N, C, H, W)` or :math:`(C, H, W)`. Return: torch.Tensor: a scalar with the ...
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...
ChristophReich1996/kornia
TotalVariation
false
283
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
Vflip
import torch import torch.nn as nn def vflip(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-2]) class Vflip(nn.Module): """Vertically flip a tensor image or a batch of tensor images. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: ...
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...
ChristophReich1996/kornia
Vflip
false
284
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
MSE
import torch import torch.nn as nn class MSE(nn.Module): def __init__(self): super(MSE, self).__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) mse = torch.sum(diffs.pow(2)) / n return mse def get_inputs(): retu...
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...
Clement25/Multimodal-Attack
MSE
false
285
[ "MIT" ]
0
bd04ee099d457e87b6e6ee918c03f65a589bcb9a
https://github.com/Clement25/Multimodal-Attack/tree/bd04ee099d457e87b6e6ee918c03f65a589bcb9a
DiffLoss
import torch import torch.nn as nn class DiffLoss(nn.Module): def __init__(self): super(DiffLoss, self).__init__() def forward(self, input1, input2): batch_size = input1.size(0) input1 = input1.view(batch_size, -1) input2 = input2.view(batch_size, -1) input1_mean = to...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Clement25/Multimodal-Attack
DiffLoss
false
286
[ "MIT" ]
0
bd04ee099d457e87b6e6ee918c03f65a589bcb9a
https://github.com/Clement25/Multimodal-Attack/tree/bd04ee099d457e87b6e6ee918c03f65a589bcb9a
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...
ChanLiang/MAP-BERT
Fp32LayerNorm
false
287
[ "MIT" ]
0
c3f95a925002061463dbb68608ff7c67ff353b5d
https://github.com/ChanLiang/MAP-BERT/tree/c3f95a925002061463dbb68608ff7c67ff353b5d
ConcatenateChannels
import torch import torch.nn class ConcatenateChannels(torch.nn.Module): def __init__(self, split_location): self.split_location = split_location super(ConcatenateChannels, self).__init__() def forward(self, x, y): return torch.cat([x, y], dim=1) def inverse(self, x): 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 import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_...
ClashLuke/memcnn
ConcatenateChannels
false
288
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
SplitChannels
import torch import torch.nn class SplitChannels(torch.nn.Module): def __init__(self, split_location): self.split_location = split_location super(SplitChannels, self).__init__() def forward(self, x): return x[:, :self.split_location, :].clone(), x[:, self. split_location:...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_...
ClashLuke/memcnn
SplitChannels
false
289
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
SpatialAttention
import torch import torch.nn as nn class SpatialAttention(nn.Module): def __init__(self, kernel=3): super(SpatialAttention, self).__init__() self.conv1 = nn.Conv2d(2, 1, kernel_size=kernel, padding=kernel // 2, bias=False) self.sigmoid = nn.Sigmoid() def forward(self, x)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Clayrisee/BanchelorsProject-FAS
SpatialAttention
false
290
[ "MIT" ]
0
3da199fb2e7be04eed7f28374ef753383511dbee
https://github.com/Clayrisee/BanchelorsProject-FAS/tree/3da199fb2e7be04eed7f28374ef753383511dbee
InvDepth
import torch import torch.nn as nn class InvDepth(nn.Module): def __init__(self, height, width, min_depth=0.5, max_depth=25.0): super(InvDepth, self).__init__() self._min_range = 1.0 / max_depth self._max_range = 1.0 / min_depth self.w = nn.Parameter(self._init_weights(height, wid...
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...
ChristophReich1996/kornia
InvDepth
false
291
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
DummyModel
import torch import torch.nn class DummyModel(torch.nn.Module): def __init__(self, block): super(DummyModel, self).__init__() self.block = block self.conv = torch.nn.Conv2d(1, 1, 1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch.rand([4, 1, 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 import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
ClashLuke/memcnn
DummyModel
false
292
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
Simplenet
import torch from torch.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class Simplenet(nn.Module): def __init__(self): super(Simplenet, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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.optim.lr_scheduler...
ChitienSun/NCTU_DLSR_final_project
Simplenet
false
293
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
InvConv
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class InvConv(nn.Module): """Invertible 1x1 Convolution for 2D inputs. Originally described in Glow (https://arxiv.org/abs/1807.03039). Does not support LU-decomposed version. Args: num_channels (int): Number of...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ClaraBing/flow
InvConv
false
294
[ "MIT" ]
0
00290326a97235e7d83303f1efff2e14214d0c36
https://github.com/ClaraBing/flow/tree/00290326a97235e7d83303f1efff2e14214d0c36
PixWiseBCELoss
import torch import torch.nn as nn class PixWiseBCELoss(nn.Module): def __init__(self, beta=0.5): super().__init__() self.criterion = nn.BCELoss() self.beta = beta def forward(self, net_mask, net_label, target_mask, target_label): pixel_loss = self.criterion(net_mask, target_...
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...
Clayrisee/BanchelorsProject-FAS
PixWiseBCELoss
false
295
[ "MIT" ]
0
3da199fb2e7be04eed7f28374ef753383511dbee
https://github.com/Clayrisee/BanchelorsProject-FAS/tree/3da199fb2e7be04eed7f28374ef753383511dbee
SIMSE
import torch import torch.nn as nn class SIMSE(nn.Module): def __init__(self): super(SIMSE, self).__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) simse = torch.sum(diffs).pow(2) / n ** 2 return simse def get_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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Clement25/Multimodal-Attack
SIMSE
false
296
[ "MIT" ]
0
bd04ee099d457e87b6e6ee918c03f65a589bcb9a
https://github.com/Clement25/Multimodal-Attack/tree/bd04ee099d457e87b6e6ee918c03f65a589bcb9a
Attention
import math import torch from torch import nn class Attention(nn.Module): """A generic attention module for a decoder in seq2seq""" def __init__(self, dim, use_tanh=False, C=10): super(Attention, self).__init__() self.use_tanh = use_tanh self.project_query = nn.Linear(dim, 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.triton_helpers import libdevice import math from to...
ChristinaTan0704/transTSP
Attention
false
297
[ "MIT" ]
0
b97cd7ed8ae97e91b687d5007d13a021781f3d1d
https://github.com/ChristinaTan0704/transTSP/tree/b97cd7ed8ae97e91b687d5007d13a021781f3d1d
Gate
import torch import torch.nn as nn class Gate(torch.nn.Module): def __init__(self, out_planes): super(Gate, self).__init__() self.gate = nn.Parameter(torch.ones(1, out_planes, 1, 1), requires_grad=False) def forward(self, x): return self.gate * x def get_inputs(): r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
CityU-AIM-Group/GFBS
Gate
false
298
[ "MIT" ]
0
d71361243f1bcf699e1a20b312b05fe0be4dfd6d
https://github.com/CityU-AIM-Group/GFBS/tree/d71361243f1bcf699e1a20b312b05fe0be4dfd6d
Block
import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is the same as the DropConnect impl I created fo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Challyfilio/NAIC2021
Block
false
299
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
ConvBlock
import torch from torch import nn class ConvBlock(nn.Module): def __init__(self, nb_in, nb_out): super(ConvBlock, self).__init__() self.convolution = nn.Conv2d(in_channels=nb_in, out_channels=nb_out, kernel_size=5, stride=1, padding=2) self.ReLU = nn.ReLU() self.MaxPoo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Clement-W/PT-Activation-Map-Visualiser
ConvBlock
false
300
[ "MIT" ]
0
6c71d5225585e5f18c3e73a4775d7816699faeea
https://github.com/Clement-W/PT-Activation-Map-Visualiser/tree/6c71d5225585e5f18c3e73a4775d7816699faeea
MultiplicationInverse
import torch import torch.nn class MultiplicationInverse(torch.nn.Module): def __init__(self, factor=2): super(MultiplicationInverse, self).__init__() self.factor = torch.nn.Parameter(torch.ones(1) * factor) def forward(self, x): return x * self.factor def inverse(self, y): ...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_...
ClashLuke/memcnn
MultiplicationInverse
false
301
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
CrossEntropyLossTF
from torch.nn import Module import torch import torch.nn as nn import torch.nn from torch.nn.modules.module import Module def _assert_no_grad(variable): msg = ( "nn criterions don't compute the gradient w.r.t. targets - please mark these variables as not requiring gradients" ) assert not varia...
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 import M...
ClashLuke/memcnn
CrossEntropyLossTF
false
302
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
SSE
import torch import torch.nn as nn import torch.utils.data class SSE(nn.Module): def __init__(self, in_ch): super(SSE, self).__init__() self.conv = nn.Conv2d(in_ch, in_ch, kernel_size=1, stride=1) def forward(self, x): input_x = x x = self.conv(x) x = torch.sigmoid(x)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ColinWine/Accurate-and-rapid-pulmonary-tuberculosis-diagnosis-system
SSE
false
303
[ "Apache-2.0" ]
0
7be433b3a495a7c4db2b850a79dc505e413909c4
https://github.com/ColinWine/Accurate-and-rapid-pulmonary-tuberculosis-diagnosis-system/tree/7be433b3a495a7c4db2b850a79dc505e413909c4
ExpNormalBasis
import torch import numpy as np import torch.nn as nn class ExpNormalBasis(nn.Module): def __init__(self, n_rbf, cutoff, learnable_mu, learnable_beta): super().__init__() self.mu = torch.linspace(np.exp(-cutoff), 1, n_rbf) init_beta = (2 / n_rbf * (1 - np.exp(-cutoff))) ** -2 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 import numpy as np import torch.nn as nn assert_size_stride = torch._C._d...
ClintvanHoesel/MXMNet_adapted
ExpNormalBasis
false
304
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
CosineEnvelope
import torch import numpy as np import torch.nn as nn class CosineEnvelope(nn.Module): def __init__(self, cutoff): super().__init__() self.cutoff = cutoff def forward(self, d): output = 0.5 * (torch.cos(np.pi * d / self.cutoff) + 1) exclude = d >= self.cutoff output[e...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ClintvanHoesel/MXMNet_adapted
CosineEnvelope
false
305
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
Conv2d
import torch import torch.nn as nn class Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding='auto', dilation=1, bias=False, norm=nn.Identity(), activation=nn.ReLU()): super(Conv2d, self).__init__() if padding == 'auto': ke...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ClementPla/NNTools
Conv2d
false
306
[ "MIT" ]
0
61562be2d931a7f720ceee1bd91a37a2b9a329af
https://github.com/ClementPla/NNTools/tree/61562be2d931a7f720ceee1bd91a37a2b9a329af
MultiHeadedAttention
import math import torch from torch import Tensor import torch.nn as nn class MultiHeadedAttention(nn.Module): """ Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py """ def __init__(self, num_heads: 'in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ClementNguyen/slt
MultiHeadedAttention
false
307
[ "Apache-2.0" ]
0
20ee90349d1ed0655b99612ffcfae6d079116db6
https://github.com/ClementNguyen/slt/tree/20ee90349d1ed0655b99612ffcfae6d079116db6
PainnRadialBasis
import torch import numpy as np import torch.nn as nn class PainnRadialBasis(nn.Module): def __init__(self, n_rbf, cutoff, learnable_k): super().__init__() self.n = torch.arange(1, n_rbf + 1).float() if learnable_k: self.n = nn.Parameter(self.n) self.cutoff = cutoff ...
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...
ClintvanHoesel/MXMNet_adapted
PainnRadialBasis
false
308
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
Net
import torch from torch import Tensor from logging import info from torch import nn from logging import error from torch.nn import Linear from torch.nn.functional import relu class Net(nn.Module): def __init__(self, size): super(Net, self).__init__() convolutions = [5] info('CONV LAYERS: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 logging import info from...
ChsHub/ai_denoiser
Net
false
309
[ "MIT" ]
0
abb0852765b10a0f05593a850f9922c5737f5f6a
https://github.com/ChsHub/ai_denoiser/tree/abb0852765b10a0f05593a850f9922c5737f5f6a
MultiHeadAttention
import math import torch import numpy as np from torch import nn class MultiHeadAttention(nn.Module): def __init__(self, n_heads, input_dim, embed_dim, val_dim=None, key_dim =None): super(MultiHeadAttention, self).__init__() if val_dim is None: val_dim = embed_dim // n_heads ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ChristinaTan0704/transTSP
MultiHeadAttention
false
311
[ "MIT" ]
0
b97cd7ed8ae97e91b687d5007d13a021781f3d1d
https://github.com/ChristinaTan0704/transTSP/tree/b97cd7ed8ae97e91b687d5007d13a021781f3d1d
Sine
import torch import torch.nn as nn class Sine(nn.Module): """for implicit representation""" def __init__(self, w0=1.0): super().__init__() self.w0 = w0 def forward(self, x): return torch.sin(self.w0 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inp...
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...
Crazy-Jack/BigGAN-PyTorch
Sine
false
312
[ "MIT" ]
0
1a5644e9c87cc399580c96cfeb180052076888da
https://github.com/Crazy-Jack/BigGAN-PyTorch/tree/1a5644e9c87cc399580c96cfeb180052076888da
CatConv
import torch import torch.nn as nn class CatConv(nn.Module): def __init__(self, in_kernels_1, in_kernels_2, kernels): super(CatConv, self).__init__() self.conv = nn.Conv2d(in_kernels_1 + in_kernels_2, kernels, kernel_size=1, bias=True) def forward(self, x1, x2): x1 = torc...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ColinKohler/ActionDyanmicsNetwork
CatConv
false
313
[ "MIT" ]
0
9cb6ffca111bfb1e1efb31cbac9201a98739a6ed
https://github.com/ColinKohler/ActionDyanmicsNetwork/tree/9cb6ffca111bfb1e1efb31cbac9201a98739a6ed
GELU
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class GELU(nn.Module): """Applies the Gaussian Error Linear Units function: .. math:: ext{GELU}(x) = x * \\Phi(x) where :math:`\\Phi...
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.nn.parallel import torch.optim import torch....
Crazy-Jack/SpatialExpGeneCluster
GELU
false
315
[ "MIT" ]
0
9e57c308d1c577a936a2358d0641c65b8130034f
https://github.com/Crazy-Jack/SpatialExpGeneCluster/tree/9e57c308d1c577a936a2358d0641c65b8130034f
Adv
import torch import torch.nn as nn class Adv(nn.Module): def __init__(self, dim_inputs, dropout): super(Adv, self).__init__() self.affine1 = nn.Linear(dim_inputs, 32) self.affine2 = nn.Linear(32, 32) self.adv_head = nn.Linear(32, 1) self.act = nn.LeakyReLU() self.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Cranial-XIX/TRPO-and-its-variant
Adv
false
316
[ "MIT" ]
0
aa74102d013c998a666683667073c22aad8c5bce
https://github.com/Cranial-XIX/TRPO-and-its-variant/tree/aa74102d013c998a666683667073c22aad8c5bce
ScaledDotProduct
import torch from typing import Tuple from typing import Optional class ScaledDotProduct(torch.nn.Module): def __init__(self, dropout=0.0): """Processes a projected query and key-value pair to apply scaled dot product attention. Args: dropout (float): probability of dropping 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._inductor.runtime....
ConnollyLeon/recommenders
ScaledDotProduct
false
319
[ "MIT" ]
0
6ada3b6b71380660fec353c11db752b4637aebf5
https://github.com/ConnollyLeon/recommenders/tree/6ada3b6b71380660fec353c11db752b4637aebf5
Block
import torch import torch.nn as nn import torch.nn.functional as F class LayerNorm(nn.Module): """ LayerNorm that supports two data formats: channels_last (default) or channels_first. The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch_size, height, width,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Clayrisee/BanchelorsProject-FAS
Block
false
320
[ "MIT" ]
0
3da199fb2e7be04eed7f28374ef753383511dbee
https://github.com/Clayrisee/BanchelorsProject-FAS/tree/3da199fb2e7be04eed7f28374ef753383511dbee
Net
import torch import torch.nn.functional as F import torch.nn as nn import torch.onnx class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 24, kernel_size=5, padding=2) self.conv2 = nn.Conv2d(24, 48, kernel_size=5, padding=1) self.conv3 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Charlie839242/MNIST_example
Net
false
321
[ "Apache-2.0" ]
0
e23d5b0314d8fb2bd38323dbb289a2a1591f105b
https://github.com/Charlie839242/MNIST_example/tree/e23d5b0314d8fb2bd38323dbb289a2a1591f105b
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, n_obs, output_dim, hidden_size, init_w=0.003): super().__init__() self.linear1 = nn.Linear(n_obs + output_dim, hidden_size) self.linear2 = nn.Linear(hidden_size, 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 import triton_helpers import torch.nn as nn assert_...
Crazyalltnt/RL-Alogorithms-Implement
Critic
false
322
[ "MIT" ]
0
27905f1c1890b1aff907564230b4ec0c22e60ba0
https://github.com/Crazyalltnt/RL-Alogorithms-Implement/tree/27905f1c1890b1aff907564230b4ec0c22e60ba0
Policy
import torch import torch.nn as nn class Policy(nn.Module): def __init__(self, dim_inputs, dim_outputs): super(Policy, self).__init__() self.affine1 = nn.Linear(dim_inputs, 64) self.affine2 = nn.Linear(64, 64) self.action_mean = nn.Linear(64, dim_outputs) self.action_mean....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
Cranial-XIX/TRPO-and-its-variant
Policy
false
324
[ "MIT" ]
0
aa74102d013c998a666683667073c22aad8c5bce
https://github.com/Cranial-XIX/TRPO-and-its-variant/tree/aa74102d013c998a666683667073c22aad8c5bce
PMA
import math import torch from torch import Tensor from torch.nn import Linear from typing import Type from typing import Optional from typing import Tuple from torch.nn import LayerNorm class MAB(torch.nn.Module): def __init__(self, dim_Q: 'int', dim_K: 'int', dim_V: 'int', num_heads: 'int', Conv: 'Optio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ClintvanHoesel/MXMNet_adapted
PMA
false
325
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
BatchedVectorAttention
import torch import torch.nn as nn import torch.nn.functional as F class BatchedVectorAttention(nn.Module): """vector attention""" def __init__(self, input_dim, hidden_dim): super(BatchedVectorAttention, self).__init__() self.theta = nn.Linear(input_dim, hidden_dim) self.phi = nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Crazy-Jack/BigGAN-PyTorch
BatchedVectorAttention
false
326
[ "MIT" ]
0
1a5644e9c87cc399580c96cfeb180052076888da
https://github.com/Crazy-Jack/BigGAN-PyTorch/tree/1a5644e9c87cc399580c96cfeb180052076888da
CReLU
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
CuongNguyen218/ObjectDetection-OneStageDet
CReLU
false
327
[ "MIT" ]
0
60efe8b0ee6782b2aea20a32264b2ce1fc21901f
https://github.com/CuongNguyen218/ObjectDetection-OneStageDet/tree/60efe8b0ee6782b2aea20a32264b2ce1fc21901f
PaddedMaxPool2d
import torch import torch.nn as nn import torch.nn.functional as F class PaddedMaxPool2d(nn.Module): """ Maxpool layer with a replicating padding. Args: kernel_size (int or tuple): Kernel size for maxpooling stride (int or tuple, optional): The stride of the window; Default ``kernel_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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
CuongNguyen218/ObjectDetection-OneStageDet
PaddedMaxPool2d
false
328
[ "MIT" ]
0
60efe8b0ee6782b2aea20a32264b2ce1fc21901f
https://github.com/CuongNguyen218/ObjectDetection-OneStageDet/tree/60efe8b0ee6782b2aea20a32264b2ce1fc21901f
UnpoolingAsConvolution
import torch import torch.nn.functional as F import torch.nn as nn def getIncomingShape(incoming): size = incoming.size() return [size[0], size[1], size[2], size[3]] def interleave(tensors, axis): old_shape = getIncomingShape(tensors[0])[1:] new_shape = [-1] + old_shape new_shape[axis] *= len(te...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ColinKohler/ActionDyanmicsNetwork
UnpoolingAsConvolution
false
330
[ "MIT" ]
0
9cb6ffca111bfb1e1efb31cbac9201a98739a6ed
https://github.com/ColinKohler/ActionDyanmicsNetwork/tree/9cb6ffca111bfb1e1efb31cbac9201a98739a6ed
PLU
import torch import torch.nn as nn class PLU(nn.Module): """ y = max(alpha*(x+c)−c, min(alpha*(x−c)+c, x)) from PLU: The Piecewise Linear Unit Activation Function """ def __init__(self, alpha=0.1, c=1): super().__init__() self.alpha = alpha self.c = c def forward(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
CuongNguyen218/ObjectDetection-OneStageDet
PLU
false
331
[ "MIT" ]
0
60efe8b0ee6782b2aea20a32264b2ce1fc21901f
https://github.com/CuongNguyen218/ObjectDetection-OneStageDet/tree/60efe8b0ee6782b2aea20a32264b2ce1fc21901f
HLoss
import torch import torch.nn as nn class HLoss(nn.Module): def __init__(self): super(HLoss, self).__init__() def forward(self, x): b = torch.exp(x) * x b = -1.0 * b.sum(dim=1) return b def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retu...
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...
DAIZHENWEI/FastGCN_pytorch
HLoss
false
332
[ "MIT" ]
0
87efe350d5acbe517a0642e9862ac9676b55c053
https://github.com/DAIZHENWEI/FastGCN_pytorch/tree/87efe350d5acbe517a0642e9862ac9676b55c053
TripletLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class TripletLoss(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a negative sample """ def __init__(self, margin): super(TripletLoss, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
DanIulian/minigrid_rl
TripletLoss
false
333
[ "MIT" ]
0
d7b59fd1d1e62fc99d5134c89f59c6ad16246cfa
https://github.com/DanIulian/minigrid_rl/tree/d7b59fd1d1e62fc99d5134c89f59c6ad16246cfa
MAB
import math import torch from torch import Tensor from torch.nn import Linear from typing import Type from typing import Optional from typing import Tuple from torch.nn import LayerNorm class MAB(torch.nn.Module): def __init__(self, dim_Q: 'int', dim_K: 'int', dim_V: 'int', num_heads: 'int', Conv: 'Optio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ClintvanHoesel/MXMNet_adapted
MAB
false
334
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
L2Norm
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
CuongNguyen218/ObjectDetection-OneStageDet
L2Norm
false
335
[ "MIT" ]
0
60efe8b0ee6782b2aea20a32264b2ce1fc21901f
https://github.com/CuongNguyen218/ObjectDetection-OneStageDet/tree/60efe8b0ee6782b2aea20a32264b2ce1fc21901f
GCN
from torch.nn import Module import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
DAIZHENWEI/FastGCN_pytorch
GCN
false
336
[ "MIT" ]
0
87efe350d5acbe517a0642e9862ac9676b55c053
https://github.com/DAIZHENWEI/FastGCN_pytorch/tree/87efe350d5acbe517a0642e9862ac9676b55c053
Reorg
import torch import torch.nn as nn class Reorg(nn.Module): """ This layer reorganizes a tensor according to a stride. The dimensions 2,3 will be sliced by the stride and then stacked in dimension 1. (input must have 4 dimensions) Args: stride (int): stride to divide the 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
CuongNguyen218/ObjectDetection-OneStageDet
Reorg
false
337
[ "MIT" ]
0
60efe8b0ee6782b2aea20a32264b2ce1fc21901f
https://github.com/CuongNguyen218/ObjectDetection-OneStageDet/tree/60efe8b0ee6782b2aea20a32264b2ce1fc21901f
ValueNetwork
import torch import torch.nn.functional as F from torch import nn def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class ValueNetwork(nn.Module): def __init__(self, num_inputs, hidden_dim): super(Va...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
DailinH/pytorch-soft-actor-critic
ValueNetwork
false
338
[ "MIT" ]
0
0669e22cf2ba1ddd7cd373687a7ed8ba2a65fd8b
https://github.com/DailinH/pytorch-soft-actor-critic/tree/0669e22cf2ba1ddd7cd373687a7ed8ba2a65fd8b
ScaleReLU
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
CuongNguyen218/ObjectDetection-OneStageDet
ScaleReLU
false
339
[ "MIT" ]
0
60efe8b0ee6782b2aea20a32264b2ce1fc21901f
https://github.com/CuongNguyen218/ObjectDetection-OneStageDet/tree/60efe8b0ee6782b2aea20a32264b2ce1fc21901f
ContrastiveLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class ContrastiveLoss(nn.Module): """ Contrastive loss Takes embeddings of two samples and a target label == 1 if samples are from the same class and label == 0 otherwise """ def __init__(self, margin): ...
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...
DanIulian/minigrid_rl
ContrastiveLoss
false
340
[ "MIT" ]
0
d7b59fd1d1e62fc99d5134c89f59c6ad16246cfa
https://github.com/DanIulian/minigrid_rl/tree/d7b59fd1d1e62fc99d5134c89f59c6ad16246cfa
HLoss
import torch import torch.nn.functional as F import torch.utils.data class HLoss(torch.nn.Module): def __init__(self): super(HLoss, self).__init__() def forward(self, x): b = F.softmax(x, dim=1) * F.log_softmax(x, dim=1) b = -1.0 * b.sum() return b def get_inputs(): ret...
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...
DanIulian/minigrid_rl
HLoss
false
341
[ "MIT" ]
0
d7b59fd1d1e62fc99d5134c89f59c6ad16246cfa
https://github.com/DanIulian/minigrid_rl/tree/d7b59fd1d1e62fc99d5134c89f59c6ad16246cfa
Entropy_loss
import torch import torch.nn as nn import torch.nn.functional as F class Entropy_loss(nn.Module): def __init__(self): super(Entropy_loss, self).__init__() def forward(self, x): probs = F.softmax(x, dim=1) b = torch.log(probs) * probs b = -1.0 * b.sum(dim=1) return b ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
DAIZHENWEI/FastGCN_pytorch
Entropy_loss
false
342
[ "MIT" ]
0
87efe350d5acbe517a0642e9862ac9676b55c053
https://github.com/DAIZHENWEI/FastGCN_pytorch/tree/87efe350d5acbe517a0642e9862ac9676b55c053
SPU
import torch import torch.nn as nn class SPU(nn.Module): def forward(self, x): return torch.where(x > 0, x ** 2 - 0.5, torch.sigmoid(-x) - 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
DanDoge/course_ethz
SPU
false
343
[ "MIT" ]
0
73e5f77e3694d6134169127c0500898402683c32
https://github.com/DanDoge/course_ethz/tree/73e5f77e3694d6134169127c0500898402683c32
SAB
import math import torch from torch import Tensor from torch.nn import Linear from typing import Type from typing import Optional from typing import Tuple from torch.nn import LayerNorm class MAB(torch.nn.Module): def __init__(self, dim_Q: 'int', dim_K: 'int', dim_V: 'int', num_heads: 'int', Conv: 'Optio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ClintvanHoesel/MXMNet_adapted
SAB
false
344
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
QNetwork
import torch import torch.nn.functional as F from torch import nn def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class QNetwork(nn.Module): def __init__(self, num_inputs, num_actions, 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 from torch import nn assert_s...
DailinH/pytorch-soft-actor-critic
QNetwork
false
345
[ "MIT" ]
0
0669e22cf2ba1ddd7cd373687a7ed8ba2a65fd8b
https://github.com/DailinH/pytorch-soft-actor-critic/tree/0669e22cf2ba1ddd7cd373687a7ed8ba2a65fd8b
GameNet
import torch import torch.utils.data class GameNet(torch.nn.Module): def __init__(self): super(GameNet, self).__init__() self.conv1 = torch.nn.Conv2d(1, 16, (3, 3), stride=1, padding=1) self.conv2 = torch.nn.Conv2d(16, 16, (3, 3), stride=1, padding=1) self.conv3 = torch.nn.Conv2d(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 asser...
DanIulian/minigrid_rl
GameNet
false
346
[ "MIT" ]
0
d7b59fd1d1e62fc99d5134c89f59c6ad16246cfa
https://github.com/DanIulian/minigrid_rl/tree/d7b59fd1d1e62fc99d5134c89f59c6ad16246cfa
PPReLU
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
CuongNguyen218/ObjectDetection-OneStageDet
PPReLU
false
347
[ "MIT" ]
0
60efe8b0ee6782b2aea20a32264b2ce1fc21901f
https://github.com/CuongNguyen218/ObjectDetection-OneStageDet/tree/60efe8b0ee6782b2aea20a32264b2ce1fc21901f
ImageLevelFeaturePooling2D
import torch from torch import nn from torch.nn import functional as F class ImageLevelFeaturePooling2D(nn.Module): def __init__(self, out_channels): super().__init__() self.out_channels = out_channels def forward(self, x): x1 = torch.mean(x.view(x.size(0) * 2, x.size(1), -1), dim=2)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Dauriel/weather4cast2021
ImageLevelFeaturePooling2D
false
349
[ "Apache-2.0" ]
0
29e818c4bcd488ec84b51558bf5392e4a887db70
https://github.com/Dauriel/weather4cast2021/tree/29e818c4bcd488ec84b51558bf5392e4a887db70
SRCNN
import torch from torch import nn class SRCNN(nn.Module): def __init__(self, num_channels=1): super(SRCNN, self).__init__() self.conv1 = nn.Conv2d(num_channels, 64, kernel_size=9, padding=9 // 2) self.conv2 = nn.Conv2d(64, 32, kernel_size=5, padding=5 // 2) self.conv3 = nn.Conv2d(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
DanielLiang1/a-PyTorch-Tutorial-to-Super-Resolution
SRCNN
false
350
[ "MIT" ]
0
cf7b519029687fe9726bb194fe3765934afa18b3
https://github.com/DanielLiang1/a-PyTorch-Tutorial-to-Super-Resolution/tree/cf7b519029687fe9726bb194fe3765934afa18b3
ConditionalBatchNorm2d
import torch import torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=0.0001): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.module = module 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.triton_helpers import libdevice import torch.nn as ...
Crazy-Jack/BigGAN-PyTorch
ConditionalBatchNorm2d
false
351
[ "MIT" ]
0
1a5644e9c87cc399580c96cfeb180052076888da
https://github.com/Crazy-Jack/BigGAN-PyTorch/tree/1a5644e9c87cc399580c96cfeb180052076888da
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, 400) self.l2 = nn.Linear(400, 300) self.l3 = nn.Linear(300, 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 ...
DanielTakeshi/DCUR
Critic
false
352
[ "MIT" ]
0
1cdb00e7e68060ad3bba9a497106c327f6b5a663
https://github.com/DanielTakeshi/DCUR/tree/1cdb00e7e68060ad3bba9a497106c327f6b5a663
SEModule
import torch import torch.nn as nn import torch.nn.functional as F class SEModule(nn.Module): def __init__(self, planes, compress_rate): super(SEModule, self).__init__() self.conv1 = nn.Conv2d(planes, planes // compress_rate, kernel_size =1, stride=1, bias=True) self.conv2 = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Darshan-Ramesh/EmpRecognition
SEModule
false
353
[ "MIT" ]
0
c85775659bcbb79f62de29a7a764cc72f1de0674
https://github.com/Darshan-Ramesh/EmpRecognition/tree/c85775659bcbb79f62de29a7a764cc72f1de0674
DepthwiseSeparableConv
import torch from torch import nn class DepthwiseSeparableConv(nn.Module): def __init__(self, in_channels, output_channels, kernel_size, padding=0, kernels_per_layer=1): super(DepthwiseSeparableConv, self).__init__() self.depthwise = nn.Conv2d(in_channels, in_channels * kernel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
Dauriel/weather4cast2021
DepthwiseSeparableConv
false
354
[ "Apache-2.0" ]
0
29e818c4bcd488ec84b51558bf5392e4a887db70
https://github.com/Dauriel/weather4cast2021/tree/29e818c4bcd488ec84b51558bf5392e4a887db70