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
GLU
import torch import torch.nn as nn import torch.nn.parallel import torch.onnx class GLU(nn.Module): def __init__(self): super(GLU, self).__init__() def forward(self, x): nc = x.size(1) assert nc % 2 == 0, 'channels dont divide 2!' nc = int(nc / 2) return x[:, :nc] * 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 import torch.nn.parallel import torch.onnx assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
Nakachi-S/AttnGAN
GLU
false
869
[ "MIT" ]
0
2dfd1e38f78f2a58895d81131cd8c17e74dbacb2
https://github.com/Nakachi-S/AttnGAN/tree/2dfd1e38f78f2a58895d81131cd8c17e74dbacb2
LinearBlock
import torch from torch import nn from scipy.stats import truncnorm def truncated_normal_(tensor, mean=0.0, std=1.0): values = truncnorm.rvs(-2, 2, size=tensor.shape) values = mean + std * values tensor.copy_(torch.from_numpy(values)) return tensor def fc_init_(module): if hasattr(module, 'weigh...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JasonMa2016/learn2learn
LinearBlock
false
870
[ "MIT" ]
0
502e1ea6db64481d7464fdda4d4d0be9b0f1089a
https://github.com/JasonMa2016/learn2learn/tree/502e1ea6db64481d7464fdda4d4d0be9b0f1089a
ClipLoss
import torch from torch import nn from torch.nn import functional as F from torch import distributed as dist import torch.distributed.nn def gather_features(image_features, text_features, local_loss=False, gather_with_grad=False, rank=0, world_size=1, use_horovod=False): if use_horovod: assert hvd is ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
NYU-DICE-Lab/open_clip
ClipLoss
false
871
[ "MIT" ]
0
fd71804b503135fb1c7cc8de3a0d6599741c8ed9
https://github.com/NYU-DICE-Lab/open_clip/tree/fd71804b503135fb1c7cc8de3a0d6599741c8ed9
DenseBlock
import torch import torch.nn as nn import torch.nn.functional as F class CausalConv1d(nn.Module): """A 1D causal convolution layer. Input: (B, D_in, T), where B is the minibatch size, D_in is the number of dimensions per step, and T is the number of steps. Output: (B, D_out, T), where B is the mi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
NagisaZj/oyster
DenseBlock
false
872
[ "MIT" ]
0
069a510fe63bb29ecd9871e0e189e58b03c8cad9
https://github.com/NagisaZj/oyster/tree/069a510fe63bb29ecd9871e0e189e58b03c8cad9
distLinear
import torch import torch.nn as nn import torch.utils.data from torch.nn.utils.weight_norm import WeightNorm import torch.nn.parallel import torch.optim class distLinear(nn.Module): def __init__(self, indim, outdim): super(distLinear, self).__init__() self.L = nn.Linear(indim, outdim, bias=False)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
MuawizChaudhary/STARTUP
distLinear
false
873
[ "MIT" ]
0
03f39b34a4ec232f132173b4a1e67ea04165e52b
https://github.com/MuawizChaudhary/STARTUP/tree/03f39b34a4ec232f132173b4a1e67ea04165e52b
BothContextGate
import torch import torch.nn as nn import torch.cuda import torch.distributed class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
NaomiatLibrary/OpenNMT-kpg-release
BothContextGate
false
874
[ "MIT" ]
0
1da3468d7dad22529a77f3526abf9b373bd3dc4c
https://github.com/NaomiatLibrary/OpenNMT-kpg-release/tree/1da3468d7dad22529a77f3526abf9b373bd3dc4c
SourceContextGate
import torch import torch.nn as nn import torch.cuda import torch.distributed class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
NaomiatLibrary/OpenNMT-kpg-release
SourceContextGate
false
875
[ "MIT" ]
0
1da3468d7dad22529a77f3526abf9b373bd3dc4c
https://github.com/NaomiatLibrary/OpenNMT-kpg-release/tree/1da3468d7dad22529a77f3526abf9b373bd3dc4c
IIDTransform
import torch import torch.nn.parallel import torch.utils.data from torchvision import transforms import torch.nn as nn import torch.cuda class IIDTransform(nn.Module): def __init__(self): super(IIDTransform, self).__init__() self.transform_op = transforms.Normalize((0.5,), (0.5,)) def mask_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._inductor.runtime import triton_helpers import torch.nn.parallel import torch.utils.data from torchvision import transforms impor...
NeilDG/NeuralNets-Experiment3
IIDTransform
false
876
[ "MIT" ]
0
f0d2f788eeca49f803f65810c155491ce687cf9e
https://github.com/NeilDG/NeuralNets-Experiment3/tree/f0d2f788eeca49f803f65810c155491ce687cf9e
TargetContextGate
import torch import torch.nn as nn import torch.cuda import torch.distributed class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
NaomiatLibrary/OpenNMT-kpg-release
TargetContextGate
false
877
[ "MIT" ]
0
1da3468d7dad22529a77f3526abf9b373bd3dc4c
https://github.com/NaomiatLibrary/OpenNMT-kpg-release/tree/1da3468d7dad22529a77f3526abf9b373bd3dc4c
UpSampler
import torch from torch import nn from torch.nn import functional as F class UpSampler(nn.Module): """Up Sample module Decrease the channels size and increase the spatial size of tensor Extends: nn.Module """ def __init__(self, inChannels, outChannels, spatial_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 assert_s...
Myyyr/segmentation
UpSampler
false
878
[ "MIT" ]
0
6b9423e327cff1eb23599404031b7fb8e9ecf75d
https://github.com/Myyyr/segmentation/tree/6b9423e327cff1eb23599404031b7fb8e9ecf75d
Conv
import torch import torch.nn as nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from math import sqrt assert_size_stride = torch._C._dynam...
NethraGunti/Woven-Artificial-Profile-WARP-Face-Video-Synthesis-from-Profile-and-Audio
Conv
false
879
[ "MIT" ]
0
231d8daa8dddfd5eda8a092eb99c5d0e59d8b3f7
https://github.com/NethraGunti/Woven-Artificial-Profile-WARP-Face-Video-Synthesis-from-Profile-and-Audio/tree/231d8daa8dddfd5eda8a092eb99c5d0e59d8b3f7
AverageAttention
import torch import torch.nn as nn import torch.cuda import torch.distributed class PositionwiseFeedForward(nn.Module): """ A two-layer Feed-Forward-Network with residual layer norm. Args: d_model (int): the size of input for the first-layer of the FFN. d_ff (int): the hidden layer size of th...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.cuda import torch.distributed assert_size_str...
NaomiatLibrary/OpenNMT-kpg-release
AverageAttention
false
880
[ "MIT" ]
0
1da3468d7dad22529a77f3526abf9b373bd3dc4c
https://github.com/NaomiatLibrary/OpenNMT-kpg-release/tree/1da3468d7dad22529a77f3526abf9b373bd3dc4c
ContextGate
import torch import torch.nn as nn import torch.cuda import torch.distributed class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.cuda import torch.distributed assert_size_str...
NaomiatLibrary/OpenNMT-kpg-release
ContextGate
false
881
[ "MIT" ]
0
1da3468d7dad22529a77f3526abf9b373bd3dc4c
https://github.com/NaomiatLibrary/OpenNMT-kpg-release/tree/1da3468d7dad22529a77f3526abf9b373bd3dc4c
MultiHeadAttention
import torch import torch.nn as nn class MultiHeadAttention(nn.Module): def __init__(self, embedding_size, number_of_heads): super(MultiHeadAttention, self).__init__() self.embedding_size = embedding_size self.number_of_heads = number_of_heads self.head_dimension = embedding_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._inductor.runtime....
NMT-hub/transformer
MultiHeadAttention
false
882
[ "MIT" ]
0
e5b332da6a322e8025c30ee7e31fe34a323e7388
https://github.com/NMT-hub/transformer/tree/e5b332da6a322e8025c30ee7e31fe34a323e7388
AdaIN
import torch import torch.nn as nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
NethraGunti/Woven-Artificial-Profile-WARP-Face-Video-Synthesis-from-Profile-and-Audio
AdaIN
false
883
[ "MIT" ]
0
231d8daa8dddfd5eda8a092eb99c5d0e59d8b3f7
https://github.com/NethraGunti/Woven-Artificial-Profile-WARP-Face-Video-Synthesis-from-Profile-and-Audio/tree/231d8daa8dddfd5eda8a092eb99c5d0e59d8b3f7
GlobalAttention
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda import torch.distributed def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
NaomiatLibrary/OpenNMT-kpg-release
GlobalAttention
false
884
[ "MIT" ]
0
1da3468d7dad22529a77f3526abf9b373bd3dc4c
https://github.com/NaomiatLibrary/OpenNMT-kpg-release/tree/1da3468d7dad22529a77f3526abf9b373bd3dc4c
PolicyNetwork
import torch import torch.nn as nn import torch.nn.functional as F class PolicyNetwork(torch.nn.Module): def __init__(self, input_size, output_size): super().__init__() self.input_size = input_size self.linear1 = nn.Linear(input_size, 32) self.linear2 = nn.Linear(32, output_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._inductor.runtime....
NiccoloSacchi/rlcard
PolicyNetwork
false
885
[ "MIT" ]
0
046129e8616b12e25652957869a94ab5fd838ae1
https://github.com/NiccoloSacchi/rlcard/tree/046129e8616b12e25652957869a94ab5fd838ae1
VdConv1D
import math import torch import torch.nn as nn import torch.nn.functional as F def calculate_kl(log_alpha): return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha))) class VdConv1D(nn.Module): """ Conv1D Layer variational dropout """ def __init__(self, in_channels, out_channels, kernel_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Neronjust2017/pytorch-classification-project
VdConv1D
false
886
[ "MIT" ]
0
fc5f4d7c46d071765f682ce20e6580646d4e5c76
https://github.com/Neronjust2017/pytorch-classification-project/tree/fc5f4d7c46d071765f682ce20e6580646d4e5c76
SpatialAttention
import torch import torch.nn.parallel import torch.utils.data import torch.nn as nn import torch.cuda class SpatialAttention(nn.Module): def __init__(self): super(SpatialAttention, self).__init__() self.conv = nn.Conv2d(2, 1, 7, padding=3, bias=False) self.sigmoid = nn.Sigmoid() def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn.parallel impo...
NeilDG/NeuralNets-Experiment3
SpatialAttention
false
887
[ "MIT" ]
0
f0d2f788eeca49f803f65810c155491ce687cf9e
https://github.com/NeilDG/NeuralNets-Experiment3/tree/f0d2f788eeca49f803f65810c155491ce687cf9e
Loss
import math import torch import torch.nn as nn class Loss(nn.Module): def __init__(self, device, type_in='pred_intervals', alpha=0.1, loss_type='qd_soft', censor_R=False, soften=100.0, lambda_in=10.0, sigma_in=0.5): super().__init__() self.alpha = alpha self.lambda_in = la...
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 ...
Neronjust2017/pytorch-classification-project
Loss
false
888
[ "MIT" ]
0
fc5f4d7c46d071765f682ce20e6580646d4e5c76
https://github.com/Neronjust2017/pytorch-classification-project/tree/fc5f4d7c46d071765f682ce20e6580646d4e5c76
Linear
import torch import torch.nn as nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from math import sqrt assert_size_stride = torch._C._dynam...
NethraGunti/Woven-Artificial-Profile-WARP-Face-Video-Synthesis-from-Profile-and-Audio
Linear
false
889
[ "MIT" ]
0
231d8daa8dddfd5eda8a092eb99c5d0e59d8b3f7
https://github.com/NethraGunti/Woven-Artificial-Profile-WARP-Face-Video-Synthesis-from-Profile-and-Audio/tree/231d8daa8dddfd5eda8a092eb99c5d0e59d8b3f7
PixelNorm
import torch import torch.nn as nn class PixelNorm(nn.Module): def __init__(self): super().__init__() def forward(self, input): return input / torch.sqrt(torch.mean(input ** 2, dim=0, keepdim= True) + 1e-08) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
NethraGunti/Woven-Artificial-Profile-WARP-Face-Video-Synthesis-from-Profile-and-Audio
PixelNorm
false
890
[ "MIT" ]
0
231d8daa8dddfd5eda8a092eb99c5d0e59d8b3f7
https://github.com/NethraGunti/Woven-Artificial-Profile-WARP-Face-Video-Synthesis-from-Profile-and-Audio/tree/231d8daa8dddfd5eda8a092eb99c5d0e59d8b3f7
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_...
NickSchoelkopf/SummerTime
LayerNorm
false
891
[ "Apache-2.0" ]
0
9a89aab8e1544e3c52c043b9c47ab325e665e11e
https://github.com/NickSchoelkopf/SummerTime/tree/9a89aab8e1544e3c52c043b9c47ab325e665e11e
VdLinear
import math import torch import torch.nn as nn import torch.nn.functional as F def calculate_kl(log_alpha): return 0.5 * torch.sum(torch.log1p(torch.exp(-log_alpha))) class VdLinear(nn.Module): """ Linear Layer variational dropout """ def __init__(self, n_in, n_out, alpha_shape=(1, 1), bias=Tr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Neronjust2017/pytorch-classification-project
VdLinear
false
892
[ "MIT" ]
0
fc5f4d7c46d071765f682ce20e6580646d4e5c76
https://github.com/Neronjust2017/pytorch-classification-project/tree/fc5f4d7c46d071765f682ce20e6580646d4e5c76
C
import torch import torch.nn as nn class C(nn.Module): def __init__(self, input_channel, output_channel, kernel_size, stride, padding, activation=None): """ At the final layer, a 3x3 convolution is used to map each 64-component feature vector to the desired number of classes. ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Nikronic/Deep-Halftoning
C
false
893
[ "MIT" ]
0
9564c592abf139ccab2791c1dbb354505edab5f9
https://github.com/Nikronic/Deep-Halftoning/tree/9564c592abf139ccab2791c1dbb354505edab5f9
ConcatReLU
import torch import torch.nn as nn import torch.nn.functional as F def concat_relu(x): """Concatenated ReLU (http://arxiv.org/abs/1603.05201).""" return F.relu(torch.cat([x, -x], dim=1)) class ConcatReLU(nn.Module): """Concatenated ReLU (http://arxiv.org/abs/1603.05201).""" 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 import triton_helpers import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dyna...
Nintorac/survae_experiments
ConcatReLU
false
894
[ "MIT" ]
0
d68cc25e2604aab08b53617c1f3ffe4716f166c4
https://github.com/Nintorac/survae_experiments/tree/d68cc25e2604aab08b53617c1f3ffe4716f166c4
CrossEntropyLossOneHot
import torch from torch import Tensor from torch.nn.modules.loss import CrossEntropyLoss class CrossEntropyLossOneHot(CrossEntropyLoss): EPS: 'int' = 1e-07 def forward(self, input: 'Tensor', target: 'Tensor') ->Tensor: assert self.weight is None or isinstance(self.weight, Tensor) 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 from torch.nn.modules....
NikolayZakharevich/music-processing
CrossEntropyLossOneHot
false
895
[ "MIT" ]
0
516a3bca585f211d232cac7ede6cc417fb8878fe
https://github.com/NikolayZakharevich/music-processing/tree/516a3bca585f211d232cac7ede6cc417fb8878fe
Lookahead
import torch import torch.utils.data.distributed from torch import nn import torch.nn.functional as F class Lookahead(nn.Module): def __init__(self, n_features, context): super(Lookahead, self).__init__() assert context > 0 self.context = context self.n_features = n_features ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data.distributed from torch import nn assert_size_stride = to...
NikolaiBabkin/deepspeech.pytorch
Lookahead
false
896
[ "MIT" ]
0
2b120c6b735cc46200e10f81e169c8d7b75e8495
https://github.com/NikolaiBabkin/deepspeech.pytorch/tree/2b120c6b735cc46200e10f81e169c8d7b75e8495
ResidualAttentionBlock
import torch from typing import Callable from torch import nn from torch.nn import functional as F import torch.distributed.nn from collections import OrderedDict from typing import Optional class LayerNorm(nn.LayerNorm): """Subclass torch's LayerNorm to handle fp16.""" def forward(self, x: 'torch.Tensor'): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
NYU-DICE-Lab/open_clip
ResidualAttentionBlock
false
897
[ "MIT" ]
0
fd71804b503135fb1c7cc8de3a0d6599741c8ed9
https://github.com/NYU-DICE-Lab/open_clip/tree/fd71804b503135fb1c7cc8de3a0d6599741c8ed9
SoftCrossEntropyLoss2d
import torch import torch.utils.data.distributed import torch import torch.nn as nn from numpy import int64 as int64 from torchvision.transforms import functional as F import torch.nn.functional as F import torch.utils class SoftCrossEntropyLoss2d(nn.Module): def __init__(self): super(SoftCrossEntropyLos...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
HRTNet/HRTNet
SoftCrossEntropyLoss2d
false
898
[ "MIT" ]
0
6a51c9c34568988ea6125a1638794c63d8fadbea
https://github.com/HRTNet/HRTNet/tree/6a51c9c34568988ea6125a1638794c63d8fadbea
GatedTanhUnit
import torch import torch.nn as nn def gated_tanh(x, dim): """Gated Tanh activation.""" x_tanh, x_sigmoid = torch.chunk(x, 2, dim=dim) return torch.tanh(x_tanh) * torch.sigmoid(x_sigmoid) class GatedTanhUnit(nn.Module): """Gated Tanh activation.""" def __init__(self, dim=-1): super(Gate...
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_...
Nintorac/survae_experiments
GatedTanhUnit
false
899
[ "MIT" ]
0
d68cc25e2604aab08b53617c1f3ffe4716f166c4
https://github.com/Nintorac/survae_experiments/tree/d68cc25e2604aab08b53617c1f3ffe4716f166c4
ConcatELU
import torch import torch.nn as nn import torch.nn.functional as F def concat_elu(x): """Like concatenated ReLU (http://arxiv.org/abs/1603.05201), but with ELU instead.""" return F.elu(torch.cat([x, -x], dim=1)) class ConcatELU(nn.Module): """Like concatenated ReLU (http://arxiv.org/abs/1603.05201), but...
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.functional as F assert_size_stride = torc...
Nintorac/survae_experiments
ConcatELU
false
900
[ "MIT" ]
0
d68cc25e2604aab08b53617c1f3ffe4716f166c4
https://github.com/Nintorac/survae_experiments/tree/d68cc25e2604aab08b53617c1f3ffe4716f166c4
PositionalEncoding1d
import math import torch import torch.nn as nn class PositionalEncoding1d(nn.Module): """ Learning positional embeddings. Args: shape: Iterable, the shape of the input. embedding_dim: int, the size of each embedding vector. """ def __init__(self, size, embedding_dim): sup...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guar...
Nintorac/survae_experiments
PositionalEncoding1d
false
901
[ "MIT" ]
0
d68cc25e2604aab08b53617c1f3ffe4716f166c4
https://github.com/Nintorac/survae_experiments/tree/d68cc25e2604aab08b53617c1f3ffe4716f166c4
AutoregressiveShift
import torch import torch.nn as nn class AutoregressiveShift(nn.Module): """Shifts input right to make model autoregressive.""" def __init__(self, embed_dim): super(AutoregressiveShift, self).__init__() self.embed_dim = embed_dim self.first_token = nn.Parameter(torch.Tensor(1, 1, embe...
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...
Nintorac/survae_experiments
AutoregressiveShift
false
902
[ "MIT" ]
0
d68cc25e2604aab08b53617c1f3ffe4716f166c4
https://github.com/Nintorac/survae_experiments/tree/d68cc25e2604aab08b53617c1f3ffe4716f166c4
GatedConv2d
import torch import torch.nn as nn class GatedConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding): super(GatedConv2d, self).__init__() self.in_channels = in_channels self.conv = nn.Conv2d(in_channels, out_channels * 3, kernel_size= kernel_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Nintorac/survae_experiments
GatedConv2d
false
903
[ "MIT" ]
0
d68cc25e2604aab08b53617c1f3ffe4716f166c4
https://github.com/Nintorac/survae_experiments/tree/d68cc25e2604aab08b53617c1f3ffe4716f166c4
HeatmapLoss
import torch import torch.utils.data class HeatmapLoss(torch.nn.Module): """ loss for detection heatmap """ def __init__(self): super(HeatmapLoss, self).__init__() def forward(self, pred, gt): l = (pred - gt) ** 2 l = l.mean(dim=3).mean(dim=2).mean(dim=1) return l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
NiranthS/pytorch_stacked_hourglass
HeatmapLoss
false
904
[ "BSD-3-Clause" ]
0
db9838eb13f6848ba3b9db844c1e023eb8688c3c
https://github.com/NiranthS/pytorch_stacked_hourglass/tree/db9838eb13f6848ba3b9db844c1e023eb8688c3c
AvgPoolHead
import torch import torch.nn as nn import torch.optim class AvgPoolHead(nn.Module): def __init__(self, in_channels, out_channels, fea_map_size): super(AvgPoolHead, self).__init__() self.avgpool = nn.AvgPool2d(fea_map_size, stride=1) self.fc = nn.Linear(in_channels, out_channels) def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo.g...
NiteshBharadwaj/structured_aleatoric_uncertainty_for_human_pose
AvgPoolHead
false
905
[ "MIT" ]
0
c74fb7384be562f0a0f1966b3fadf19e13a235f2
https://github.com/NiteshBharadwaj/structured_aleatoric_uncertainty_for_human_pose/tree/c74fb7384be562f0a0f1966b3fadf19e13a235f2
PositionalEncodingImage
import math import torch import torch.nn as nn class PositionalEncodingImage(nn.Module): """ Learning positional embeddings for images. Embeddings for channel, height and width are added to form the full positional embedding. These encodings correspond to the ones from Sparse Transformers (https://arx...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guar...
Nintorac/survae_experiments
PositionalEncodingImage
false
906
[ "MIT" ]
0
d68cc25e2604aab08b53617c1f3ffe4716f166c4
https://github.com/Nintorac/survae_experiments/tree/d68cc25e2604aab08b53617c1f3ffe4716f166c4
LinearZeros
import torch import torch.nn as nn class LinearZeros(nn.Linear): def __init__(self, in_features, out_features, bias=True, logscale_factor=3.0): """ Linear layer with zero initialization :param in_features: size of each input sample :type in_features: int :param ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
NirDiamant/pytorch-glow
LinearZeros
false
907
[ "MIT" ]
0
2ab11f3a8486b86a279fe4fa64f25aa91226ee8a
https://github.com/NirDiamant/pytorch-glow/tree/2ab11f3a8486b86a279fe4fa64f25aa91226ee8a
Conv2dZeros
import torch import torch.nn as nn class ActNorm(nn.Module): def __init__(self, num_channels, scale=1.0, logscale_factor=3.0, batch_variance=False): """ Activation normalization layer :param num_channels: number of channels :type num_channels: int :param scale: sc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
NirDiamant/pytorch-glow
Conv2dZeros
false
908
[ "MIT" ]
0
2ab11f3a8486b86a279fe4fa64f25aa91226ee8a
https://github.com/NirDiamant/pytorch-glow/tree/2ab11f3a8486b86a279fe4fa64f25aa91226ee8a
GaussianKernel
import torch from typing import Optional import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class GaussianKernel(nn.Module): """Gaussian Kernel Matrix Gaussian Kernel k is defined by .. math:: k(x_1, x_2) = \\exp \\left( ...
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 typing import Opt...
NiteshBharadwaj/ignoringhumanpose
GaussianKernel
false
909
[ "MIT" ]
0
1fb7a063fded9cff18f7de4e1d71845983077256
https://github.com/NiteshBharadwaj/ignoringhumanpose/tree/1fb7a063fded9cff18f7de4e1d71845983077256
Multihead_Attention_Layer
import math import torch import torch.nn as nn import torch.nn.functional as F def scaled_self_attention(q, k, v, key_size): weight = torch.matmul(q, k) weight = F.softmax(weight / math.sqrt(key_size), dim=-1) attention = torch.matmul(weight, v) return attention class Multihead_Attention_Layer(nn.Mo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
NilsLusch/Point-Cloud-Transformer
Multihead_Attention_Layer
false
910
[ "MIT" ]
0
84a16b45b8949bbf8e7730b10bd5835e2ab4e642
https://github.com/NilsLusch/Point-Cloud-Transformer/tree/84a16b45b8949bbf8e7730b10bd5835e2ab4e642
Conv
import torch import torch.nn as nn class Conv(nn.Module): """ Convolution Module """ def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True, w_init='linear'): """ :param in_channels: dimension of input :param out_channel...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Numb523/FastSpeech2_emotion
Conv
false
911
[ "MIT" ]
0
a541ce89ddf66625ee57c0a294d0bec1ae701f0c
https://github.com/Numb523/FastSpeech2_emotion/tree/a541ce89ddf66625ee57c0a294d0bec1ae701f0c
Theta
from torch.autograd import Function import torch from typing import Optional from typing import Tuple import torch.nn as nn from typing import Any import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class GradientReverseFunction(Function): @staticmethod def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.autograd import Function from typing import Optional from typing impo...
NiteshBharadwaj/ignoringhumanpose
Theta
false
912
[ "MIT" ]
0
1fb7a063fded9cff18f7de4e1d71845983077256
https://github.com/NiteshBharadwaj/ignoringhumanpose/tree/1fb7a063fded9cff18f7de4e1d71845983077256
LastTimeStep
import torch from torch import nn import torch.utils.data from typing import Tuple class LastTimeStep(nn.Module): """ A class for extracting the hidden activations of the last time step following the output of a PyTorch RNN module. """ def __init__(self, bidirectional=False): super(Last...
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.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
Onion-Team-VN/skilledlab
LastTimeStep
false
913
[ "Apache-2.0" ]
0
ac5cd7b5aee52da98aee8a32e5d161fd8b7dddab
https://github.com/Onion-Team-VN/skilledlab/tree/ac5cd7b5aee52da98aee8a32e5d161fd8b7dddab
myLoss2
import torch import torch.nn.functional as F import torch.nn as nn class myLoss2(nn.Module): def __init__(self, alpha=1.0): super(myLoss2, self).__init__() self.alpha = alpha def forward(self, sent_probs, doc_probs, sent_targets, doc_targets): loss_1 = F.mse_loss(sent_probs, sent_tar...
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...
PKULiuHui/LiveBlogSum
myLoss2
false
914
[ "MIT" ]
0
b6a22521ee454e649981d70ddca6c89a1bac5a4c
https://github.com/PKULiuHui/LiveBlogSum/tree/b6a22521ee454e649981d70ddca6c89a1bac5a4c
relu_constant_fraction
import torch import numpy as np from torch import nn from torch.nn.functional import relu def regula_falsi(func, a, b, iterations): f_a = func(a, -1) f_b = func(b, -1) if torch.any(f_a * f_b >= 0): None raise Exception( 'You have not assumed right initial values in regula falsi...
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 from torch import nn from torch.nn.functional import relu assert_size_...
Noppornying00/constant-fraction-activation
relu_constant_fraction
false
915
[ "Apache-2.0" ]
0
b25745e7339df13e3db34d8c8372d5cbaa3c13bb
https://github.com/Noppornying00/constant-fraction-activation/tree/b25745e7339df13e3db34d8c8372d5cbaa3c13bb
MarginDisparityDiscrepancy
import torch from typing import Optional 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 def shift_log(x: 'torch.Tensor', offset: 'Optional[float]'=1e-06 ) ->torch.Tensor: """ First shift, then ca...
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 typing import Opt...
NiteshBharadwaj/ignoringhumanpose
MarginDisparityDiscrepancy
false
916
[ "MIT" ]
0
1fb7a063fded9cff18f7de4e1d71845983077256
https://github.com/NiteshBharadwaj/ignoringhumanpose/tree/1fb7a063fded9cff18f7de4e1d71845983077256
DivisiveNormalization2d
from torch.nn import Module import torch from torch import Tensor from typing import Union from typing import Tuple import torch.nn.functional as F class DivisiveNormalization2d(Module): """Applies a 2D divisive normalization over an input signal composed of several input planes. In the simplest case, th...
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...
Noppornying00/constant-fraction-activation
DivisiveNormalization2d
false
917
[ "Apache-2.0" ]
0
b25745e7339df13e3db34d8c8372d5cbaa3c13bb
https://github.com/Noppornying00/constant-fraction-activation/tree/b25745e7339df13e3db34d8c8372d5cbaa3c13bb
UPChannelRPN
import torch import torch.nn as nn import torch.nn.functional as F def xcorr_fast(x, kernel): """group conv2d to calculate cross correlation, fast version """ batch = kernel.size()[0] pk = kernel.view(-1, x.size()[1], kernel.size()[2], kernel.size()[3]) px = x.view(1, -1, x.size()[2], x.size()[3])...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch...
LSH9832/MyPythonModules
UPChannelRPN
false
918
[ "MIT" ]
0
442566a0fbd6ebe2bc20b6914686a1e2663d10c0
https://github.com/LSH9832/MyPythonModules/tree/442566a0fbd6ebe2bc20b6914686a1e2663d10c0
MatrixTree
import torch import torch.nn as nn import torch.cuda import torch.distributed class MatrixTree(nn.Module): """Implementation of the matrix-tree theorem for computing marginals of non-projective dependency parsing. This attention layer is used in the paper "Learning Structured Text Representations" :ci...
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 import torch.cuda import torch.distributed assert_s...
NaomiatLibrary/OpenNMT-kpg-release
MatrixTree
false
919
[ "MIT" ]
0
1da3468d7dad22529a77f3526abf9b373bd3dc4c
https://github.com/NaomiatLibrary/OpenNMT-kpg-release/tree/1da3468d7dad22529a77f3526abf9b373bd3dc4c
JointsMSELossNoReduction
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class JointsMSELossNoReduction(nn.Module): def __init__(self, use_target_weight, logger): super(JointsMSELossNoReduction, self).__init__() self.criterion = la...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed assert_size_st...
NiteshBharadwaj/ignoringhumanpose
JointsMSELossNoReduction
false
920
[ "MIT" ]
0
1fb7a063fded9cff18f7de4e1d71845983077256
https://github.com/NiteshBharadwaj/ignoringhumanpose/tree/1fb7a063fded9cff18f7de4e1d71845983077256
Attention
import math import torch import torch.nn import torch.optim from torch.nn import functional as F from torch import nn class Attention(nn.Module): def __init__(self, hidden_size): super(Attention, self).__init__() self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
OneAdder/hseling-repo-chukchi-type
Attention
false
921
[ "MIT" ]
0
5f5e651510bca7cfb89dc2e98b07bcc63b6330a4
https://github.com/OneAdder/hseling-repo-chukchi-type/tree/5f5e651510bca7cfb89dc2e98b07bcc63b6330a4
myLoss3
import torch import torch.nn.functional as F import torch.nn as nn class myLoss3(nn.Module): def __init__(self, alpha=1.0, beta=1.0): super(myLoss3, self).__init__() self.alpha = alpha self.beta = beta def forward(self, sent_probs, doc_probs, event_probs, sent_targets, doc_ta...
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...
PKULiuHui/LiveBlogSum
myLoss3
false
924
[ "MIT" ]
0
b6a22521ee454e649981d70ddca6c89a1bac5a4c
https://github.com/PKULiuHui/LiveBlogSum/tree/b6a22521ee454e649981d70ddca6c89a1bac5a4c
GraphLearner
from torch.nn import Module import torch from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.functional as F class GraphLearner(Module): def __init__(self, in_feature_dim, combined_feature_dim, n_obj, dropout=0.0 ): """ eq(1): A=EE^T, build adj matrix ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Originofamonia/vqa-project
GraphLearner
false
925
[ "Apache-2.0" ]
0
cf67b62ddf5732881dfb4278478accfd15c4df6d
https://github.com/Originofamonia/vqa-project/tree/cf67b62ddf5732881dfb4278478accfd15c4df6d
AE_Net
import torch from torch.optim import * from torch import nn class AE_Net(nn.Module): """docstring for AE_Net.""" def __init__(self, input_shape): super(AE_Net, self).__init__() self.encoder_hidden_layer = nn.Linear(in_features=input_shape, out_features=128) self.encoder_ou...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 import * fro...
Paratra/IoTAnalytics_pub
AE_Net
false
926
[ "MIT" ]
0
8c1d02b60ef609c3cba654ce4a5568c39fc63edf
https://github.com/Paratra/IoTAnalytics_pub/tree/8c1d02b60ef609c3cba654ce4a5568c39fc63edf
NormedLinear
import torch import torch.nn.functional as F from torch import nn class NormedLinear(nn.Linear): """Normalized Linear Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Parskatt/mmdetection
NormedLinear
false
927
[ "Apache-2.0" ]
0
ee4cfa29e7f479b2454b1f1355f8c05be62d8466
https://github.com/Parskatt/mmdetection/tree/ee4cfa29e7f479b2454b1f1355f8c05be62d8466
NormedConv2d
import torch from torch import nn class NormedConv2d(nn.Conv2d): """Normalized Conv2d Layer. Args: tempeature (float, optional): Tempeature term. Default to 20. power (int, optional): Power term. Default to 1.0. eps (float, optional): The minimal value of divisor to keep ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Parskatt/mmdetection
NormedConv2d
false
928
[ "Apache-2.0" ]
0
ee4cfa29e7f479b2454b1f1355f8c05be62d8466
https://github.com/Parskatt/mmdetection/tree/ee4cfa29e7f479b2454b1f1355f8c05be62d8466
Net
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Net(nn.Module): def __init__(self, num_rej=0): super(Net, self).__init__() self.num_rej = num_rej + 1 self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
NlGG/Rejection
Net
false
929
[ "MIT" ]
0
5f7cc64b71dacc2eb794b3f7c48390457e363cc5
https://github.com/NlGG/Rejection/tree/5f7cc64b71dacc2eb794b3f7c48390457e363cc5
BPMLLLoss
import torch from torch import Tensor class BPMLLLoss(torch.nn.Module): def __init__(self, bias=(1, 1)): super(BPMLLLoss, self).__init__() self.bias = bias assert len(self.bias) == 2 and all(map(lambda x: isinstance(x, int) and x > 0, bias)), 'bias must be positive integers' ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import Tensor assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
PaulStryck/nih-chest-x-ray
BPMLLLoss
false
931
[ "MIT" ]
0
92bfef80f49e7e38ad8a0156be43f10879b3f737
https://github.com/PaulStryck/nih-chest-x-ray/tree/92bfef80f49e7e38ad8a0156be43f10879b3f737
FirstNet
import torch import torch.nn as nn import torch.nn.functional as F class FirstNet(nn.Module): def __init__(self): super(FirstNet, self).__init__() self.conv1 = nn.Conv2d(in_channels=1, out_channels=64, kernel_size= 3, padding=1, stride=1) self.conv2 = nn.Conv2d(64, 128, 3, pad...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
PacktPublishing/Designing-Models-for-Responsible-AI
FirstNet
false
932
[ "MIT" ]
0
36b60f1e3e9db8b3d2db3ace873dbdee1b076b74
https://github.com/PacktPublishing/Designing-Models-for-Responsible-AI/tree/36b60f1e3e9db8b3d2db3ace873dbdee1b076b74
AsymmetricLoss
import torch import torch.nn as nn class AsymmetricLoss(nn.Module): def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=False): super(AsymmetricLoss, self).__init__() self.gamma_neg = gamma_neg self.gamma_pos = gamma_pos self.cl...
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...
Pepijnnn/MasterThesis
AsymmetricLoss
false
933
[ "MIT" ]
0
7ec831f5e55f5f181e0196fa78284e2846ce2e26
https://github.com/Pepijnnn/MasterThesis/tree/7ec831f5e55f5f181e0196fa78284e2846ce2e26
ConvBlockFixup
import torch from torch import nn class ConvBlockFixup(nn.Module): def __init__(self, filter_width, input_filters, nb_filters, dilation): super(ConvBlockFixup, self).__init__() self.filter_width = filter_width self.input_filters = input_filters self.nb_filters = nb_filters ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
OmarNajdi/dl-for-har
ConvBlockFixup
false
934
[ "MIT" ]
0
5e1b7c29caf2b41fcba106cd901c45d8f2d18429
https://github.com/OmarNajdi/dl-for-har/tree/5e1b7c29caf2b41fcba106cd901c45d8f2d18429
MarginRankingLoss_learning_loss
import torch import torch.nn as nn import torch.nn.functional as F class MarginRankingLoss_learning_loss(nn.Module): """ Ranking loss as described in LPM paper inputs/targets are randomly permutated final target is a list of -1 and 1's -1 means the item in the i list is higher 1 means the item i...
import torch from torch import device import triton import triton.language as tl from 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.guar...
Pepijnnn/MasterThesis
MarginRankingLoss_learning_loss
false
936
[ "MIT" ]
0
7ec831f5e55f5f181e0196fa78284e2846ce2e26
https://github.com/Pepijnnn/MasterThesis/tree/7ec831f5e55f5f181e0196fa78284e2846ce2e26
LRN
import torch import torch.nn as nn class LRN(nn.Module): def __init__(self, local_size=1, alpha=0.0001, beta=0.75, ACROSS_CHANNELS=False): super(LRN, self).__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if self.ACROSS_CHANNELS: self.average = nn.AvgPool3d(kernel_siz...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
PengJingchao/DFNet
LRN
false
937
[ "MIT" ]
0
49e83501f81515aebca211351e315896da7afc54
https://github.com/PengJingchao/DFNet/tree/49e83501f81515aebca211351e315896da7afc54
ListNetLoss
import torch import torch.nn as nn import torch.nn.functional as F class ListNetLoss(nn.Module): def __init__(self): super(ListNetLoss, self).__init__() return def forward(self, y_pred, y_true, eps=0.0005, padded_value_indicator=-1): """ ListNet loss introduced in "Learning 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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Pepijnnn/MasterThesis
ListNetLoss
false
938
[ "MIT" ]
0
7ec831f5e55f5f181e0196fa78284e2846ce2e26
https://github.com/Pepijnnn/MasterThesis/tree/7ec831f5e55f5f181e0196fa78284e2846ce2e26
AsymmetricLossOptimized
import torch import torch.nn as nn class AsymmetricLossOptimized(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations""" def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=False): ...
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...
Pepijnnn/MasterThesis
AsymmetricLossOptimized
false
939
[ "MIT" ]
0
7ec831f5e55f5f181e0196fa78284e2846ce2e26
https://github.com/Pepijnnn/MasterThesis/tree/7ec831f5e55f5f181e0196fa78284e2846ce2e26
HorizontalMaxPool2d
import torch import torch.nn as nn class HorizontalMaxPool2d(nn.Module): def __init__(self): super(HorizontalMaxPool2d, self).__init__() def forward(self, x): inp_size = x.size() return nn.functional.max_pool2d(input=x, kernel_size=(1, inp_size[3])) def get_inputs(): return [to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Qidian213/NAIC2019
HorizontalMaxPool2d
false
940
[ "MIT" ]
0
23e05a8a096168ccfa4d1743467fdf78ffcaabba
https://github.com/Qidian213/NAIC2019/tree/23e05a8a096168ccfa4d1743467fdf78ffcaabba
BinaryLoss
import torch import torch.nn as nn import torch.nn.functional as F class BinaryLoss(nn.Module): def __init__(self): super(BinaryLoss, self).__init__() def forward(self, pos_score, neg_score): pos_loss = -F.log_softmax(pos_score, dim=1)[:, 1] neg_loss = -F.log_softmax(neg_score, dim=1...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
PengJingchao/DFNet
BinaryLoss
false
941
[ "MIT" ]
0
49e83501f81515aebca211351e315896da7afc54
https://github.com/PengJingchao/DFNet/tree/49e83501f81515aebca211351e315896da7afc54
HSigmoid
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional import torch.optim import torch.nn.parallel import torch.utils.data.distributed class HSigmoid(nn.Module): """ Applies the Hard-Sigmoid function element-wise. `"Searching for Mob...
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.utils.data import torch import torch.nn as nn import torch.nn.functional imp...
PhelaPoscam/SRGAN-PyTorch
HSigmoid
false
942
[ "Apache-2.0" ]
0
c1c68707dbddd1130b2ea71023df748080bcbd52
https://github.com/PhelaPoscam/SRGAN-PyTorch/tree/c1c68707dbddd1130b2ea71023df748080bcbd52
Module_CharbonnierLoss
import torch import torch.nn as nn class Module_CharbonnierLoss(nn.Module): def __init__(self, epsilon=0.001): super(Module_CharbonnierLoss, self).__init__() self.epsilon = epsilon def forward(self, output, gt): return torch.mean(torch.sqrt((output - gt) ** 2 + self.epsilon ** 2)) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
Pumpkin123709/LBEC
Module_CharbonnierLoss
false
944
[ "MIT" ]
0
18661faa35769f731847e0226ff601754e134668
https://github.com/Pumpkin123709/LBEC/tree/18661faa35769f731847e0226ff601754e134668
Attention
import torch import torch.nn as nn class Attention(nn.Module): """ Applies attention mechanism on the `context` using the `query`. **Thank you** to IBM for their initial implementation of :class:`Attention`. Here is their `License <https://github.com/IBM/pytorch-seq2seq/blob/master/LICENSE>`__. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
PattynR/PyTorch-NLP
Attention
false
945
[ "BSD-3-Clause" ]
0
8995774abf3734db6da174425843d883face5218
https://github.com/PattynR/PyTorch-NLP/tree/8995774abf3734db6da174425843d883face5218
Reg_layer
import torch from torch import nn class Reg_layer(nn.Module): """ modified by Zylo117 """ def __init__(self, in_channels, out_channels): super().__init__() self.conv = nn.Conv2d(in_channels, in_channels, kernel_size=3, padding=1, bias=True) self.header = 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...
Peiiii/detro
Reg_layer
false
946
[ "MIT" ]
0
26d74468d7554dc20b2a2daf7ec5009302c820f2
https://github.com/Peiiii/detro/tree/26d74468d7554dc20b2a2daf7ec5009302c820f2
Classifier
import torch import torch.nn as nn class Classifier(nn.Module): def __init__(self, num_inputs1, num_inputs2): super().__init__() self.network = nn.Bilinear(num_inputs1, num_inputs2, 1) def forward(self, x1, x2): return self.network(x1, x2) def get_inputs(): return [torch.rand([...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride reinterpret_tensor = torch._C._dynamo.guards._reinterp...
Project-Agni/Detection
Classifier
false
947
[ "MIT" ]
0
6b2c8ec25f8bd2bd15995d67f2808352cec9e2af
https://github.com/Project-Agni/Detection/tree/6b2c8ec25f8bd2bd15995d67f2808352cec9e2af
DQNetwork
import torch import torch.nn.functional as F import torch.nn as nn class Prediction(nn.Module): """Defines the prediction module as an ANN""" def __init__(self, state_size: 'int', action_size: 'int', fc1: 'int'=24, fc2: 'int'=24): super(Prediction, self).__init__() self.state_size = 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.functional as...
QasimWani/EARL
DQNetwork
false
948
[ "MIT" ]
0
05c303335e67903380771c4954a5317bd46fc0e7
https://github.com/QasimWani/EARL/tree/05c303335e67903380771c4954a5317bd46fc0e7
hsigmoid
import torch import torch.nn as nn import torch.nn.functional as F class hsigmoid(nn.Module): def forward(self, x): out = F.relu6(x + 3, inplace=True) / 6 return out def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Qidian213/NAIC2019
hsigmoid
false
949
[ "MIT" ]
0
23e05a8a096168ccfa4d1743467fdf78ffcaabba
https://github.com/Qidian213/NAIC2019/tree/23e05a8a096168ccfa4d1743467fdf78ffcaabba
SeparableConv2d
import torch class SeparableConv2d(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=False): super(SeparableConv2d, self).__init__() self.conv1 = torch.nn.Conv2d(in_channels, in_channels, kernel_size, stride, p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit de...
Pumpkin123709/LBEC
SeparableConv2d
false
950
[ "MIT" ]
0
18661faa35769f731847e0226ff601754e134668
https://github.com/Pumpkin123709/LBEC/tree/18661faa35769f731847e0226ff601754e134668
InputProjectionA
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class InputProjectionA(nn.Module): """ This class projects the input image to the same spatial dimensions as the feature map. For example, if the input image is 512 x512 x3 and spatial dimensions of feature map size are 56...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
PhillipHuang2017/ext_portrait_segmentation
InputProjectionA
false
951
[ "MIT" ]
0
6d0cec0a953dacbc94a01ea8b719feb687b7c029
https://github.com/PhillipHuang2017/ext_portrait_segmentation/tree/6d0cec0a953dacbc94a01ea8b719feb687b7c029
SelfAttention
import torch from torch import nn class SelfAttention(nn.Module): """ Self attention Layer""" def __init__(self, in_dim, activation): super(SelfAttention, self).__init__() self.chanel_in = in_dim self.activation = activation self.query_conv = nn.Conv2d(in_channels=in_dim, out_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
PauPerezT/EmoSSpeech
SelfAttention
false
952
[ "Apache-2.0" ]
0
168a951a838d0bfb838e7d0e3f6895bff68164a4
https://github.com/PauPerezT/EmoSSpeech/tree/168a951a838d0bfb838e7d0e3f6895bff68164a4
Environment
import torch import torch.nn.functional as F import torch.nn as nn class Environment(nn.Module): """Defines the Environment module as an ANN""" def __init__(self, state_size: 'int', action_size: 'int', fc1: 'int'=24, fc2: 'int'=24): super(Environment, self).__init__() self.state_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_...
QasimWani/EARL
Environment
false
953
[ "MIT" ]
0
05c303335e67903380771c4954a5317bd46fc0e7
https://github.com/QasimWani/EARL/tree/05c303335e67903380771c4954a5317bd46fc0e7
attention2d
import torch import torch.nn as nn import torch.nn.functional as F class attention2d(nn.Module): def __init__(self, in_planes, ratios, K, temperature, init_weight=True): super(attention2d, self).__init__() assert temperature % 3 == 1 self.avgpool = nn.AdaptiveAvgPool2d(1) if in_pl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
PengJingchao/DFNet
attention2d
false
954
[ "MIT" ]
0
49e83501f81515aebca211351e315896da7afc54
https://github.com/PengJingchao/DFNet/tree/49e83501f81515aebca211351e315896da7afc54
ShearY
import torch import torch.nn as nn from torchvision import transforms as ttf class ShearY(nn.Module): def __init__(self, M): super().__init__() self.M = M self.angle = 359 / 10 * self.M - 180 def forward(self, img): return ttf.functional.affine(img, 0, [0, 0], 1, [0, self.ang...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Hayoung93/UDA
ShearY
false
955
[ "Apache-2.0" ]
0
a587b01c76141d64e7cead55b62e0f3ed75890bf
https://github.com/Hayoung93/UDA/tree/a587b01c76141d64e7cead55b62e0f3ed75890bf
fully_conv_layer
import torch import torch.nn as nn class fully_conv_layer(nn.Module): def __init__(self, c): super(fully_conv_layer, self).__init__() self.conv = nn.Conv2d(c, 1, 1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inpu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
QiweiMa-LL/STAGCN
fully_conv_layer
false
956
[ "MIT" ]
0
c6889c845ac7fcba4419b2727022a599981f2a54
https://github.com/QiweiMa-LL/STAGCN/tree/c6889c845ac7fcba4419b2727022a599981f2a54
HSwish
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional import torch.optim import torch.nn.parallel import torch.utils.data.distributed class HSwish(nn.Module): """ Applies the Hard-Swish function element-wise. `"Searching for MobileN...
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.utils.data import torch import torch.nn as nn import torch.nn.functional imp...
PhelaPoscam/SRGAN-PyTorch
HSwish
false
957
[ "Apache-2.0" ]
0
c1c68707dbddd1130b2ea71023df748080bcbd52
https://github.com/PhelaPoscam/SRGAN-PyTorch/tree/c1c68707dbddd1130b2ea71023df748080bcbd52
TranslateX
import torch import torch.nn as nn from torchvision import transforms as ttf class TranslateX(nn.Module): def __init__(self, M): super().__init__() self.M = M def forward(self, img): try: max_size = img.size()[0] except TypeError: max_size = img.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 import torch.nn as ...
Hayoung93/UDA
TranslateX
false
958
[ "Apache-2.0" ]
0
a587b01c76141d64e7cead55b62e0f3ed75890bf
https://github.com/Hayoung93/UDA/tree/a587b01c76141d64e7cead55b62e0f3ed75890bf
Rotate
import torch import torch.nn as nn from torchvision import transforms as ttf class Rotate(nn.Module): def __init__(self, M): super().__init__() self.M = M self.angle = 359 / 10 * self.M def forward(self, img): return ttf.functional.rotate(img, self.angle) def get_inputs(): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Hayoung93/UDA
Rotate
false
959
[ "Apache-2.0" ]
0
a587b01c76141d64e7cead55b62e0f3ed75890bf
https://github.com/Hayoung93/UDA/tree/a587b01c76141d64e7cead55b62e0f3ed75890bf
hswish
import torch import torch.nn as nn import torch.nn.functional as F class hswish(nn.Module): def forward(self, x): out = x * F.relu6(x + 3, inplace=True) / 6 return out def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Qidian213/NAIC2019
hswish
false
960
[ "MIT" ]
0
23e05a8a096168ccfa4d1743467fdf78ffcaabba
https://github.com/Qidian213/NAIC2019/tree/23e05a8a096168ccfa4d1743467fdf78ffcaabba
TranslateY
import torch import torch.nn as nn from torchvision import transforms as ttf class TranslateY(nn.Module): def __init__(self, M): super().__init__() self.M = M def forward(self, img): try: max_size = img.size()[1] except TypeError: max_size = img.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 import torch.nn as ...
Hayoung93/UDA
TranslateY
false
961
[ "Apache-2.0" ]
0
a587b01c76141d64e7cead55b62e0f3ed75890bf
https://github.com/Hayoung93/UDA/tree/a587b01c76141d64e7cead55b62e0f3ed75890bf
ListMLELoss
import torch import torch.nn as nn class ListMLELoss(nn.Module): def __init__(self): super(ListMLELoss, self).__init__() return def forward(self, y_pred, y_true, eps=1e-05, padded_value_indicator=-1): """ ListMLE loss introduced in "Listwise Approach to Learning to Rank - The...
import torch from torch import device import triton import triton.language as tl from 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_ma...
Pepijnnn/MasterThesis
ListMLELoss
false
962
[ "MIT" ]
0
7ec831f5e55f5f181e0196fa78284e2846ce2e26
https://github.com/Pepijnnn/MasterThesis/tree/7ec831f5e55f5f181e0196fa78284e2846ce2e26
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self): super(DiceLoss, self).__init__() def forward(self, input, target): N = target.size(0) smooth = 1 input_flat = input.view(N, -1) target_flat = target.view(N, -1) intersection = in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Qsingle/MedicalImage
DiceLoss
false
963
[ "MIT" ]
0
a5020d7d2266669a4d6ffec224430e8b25cc1dfc
https://github.com/Qsingle/MedicalImage/tree/a5020d7d2266669a4d6ffec224430e8b25cc1dfc
DummyLayer
import torch class DummyLayer(torch.nn.Module): def __init__(self): super().__init__() self.dummy = torch.nn.Parameter(torch.ones(1, dtype=torch.float32)) def forward(self, x): return x + self.dummy - self.dummy 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
RICE-EIC/Early-Bird-GCN
DummyLayer
false
964
[ "Apache-2.0" ]
0
25a80b23f2ecfc46ffe00b1cf0e06052b32aad0f
https://github.com/RICE-EIC/Early-Bird-GCN/tree/25a80b23f2ecfc46ffe00b1cf0e06052b32aad0f
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): """ Criterion that computes Sørensen-Dice Coefficient loss. https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient """ def __init__(self): super().__init__() self.smooth = 1.0 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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Quentin18/road-segmentation
DiceLoss
false
965
[ "MIT" ]
0
9d212c80fa3f6926c431847337d2ca38ec96b614
https://github.com/Quentin18/road-segmentation/tree/9d212c80fa3f6926c431847337d2ca38ec96b614
ShearX
import torch import torch.nn as nn from torchvision import transforms as ttf class ShearX(nn.Module): def __init__(self, M): super().__init__() self.M = M self.angle = 359 / 10 * self.M - 180 def forward(self, img): return ttf.functional.affine(img, 0, [0, 0], 1, [self.angle,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Hayoung93/UDA
ShearX
false
966
[ "Apache-2.0" ]
0
a587b01c76141d64e7cead55b62e0f3ed75890bf
https://github.com/Hayoung93/UDA/tree/a587b01c76141d64e7cead55b62e0f3ed75890bf
Convolution
import torch import torch.nn as nn import torch.nn.functional as fn from torch.nn.parameter import Parameter import torch.nn def to_pair(data): """Converts a single or a tuple of data into a pair. If the data is a tuple with more than two elements, it selects the first two of them. In case of single data, it dup...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.parameter import Parameter import torch.nn a...
R1704/SpeechRecognitionSNN
Convolution
false
967
[ "MIT" ]
0
4b788d1bd20d8ce201da6da8b200b3ca722c7efa
https://github.com/R1704/SpeechRecognitionSNN/tree/4b788d1bd20d8ce201da6da8b200b3ca722c7efa
HighwayLayer
import torch import torch.nn.functional as F import torch.nn as nn import torch.jit import torch.jit.quantized import torch.onnx.operators class HighwayLayer(nn.Module): def __init__(self, input_dim, transform_activation=F.relu, gate_activation=F.softmax, gate_bias=-2): super().__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ROCmSoftwarePlatform/translate
HighwayLayer
false
968
[ "BSD-3-Clause" ]
0
32a6380d914ebe1a6c38c4992aac9600ed3d9810
https://github.com/ROCmSoftwarePlatform/translate/tree/32a6380d914ebe1a6c38c4992aac9600ed3d9810
Attention
import torch import torch.nn as nn import torch.utils.data import torch.utils.checkpoint class Attention(nn.Module): def __init__(self, in_size, hidden_size): super(Attention, self).__init__() self.hidden = nn.Linear(in_size, hidden_size) nn.init.orthogonal_(self.hidden.weight.data) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
MarvinLvn/platalea
Attention
false
969
[ "Apache-2.0" ]
0
31def0813c90a3259f86f7d86cb576cd66dca3fe
https://github.com/MarvinLvn/platalea/tree/31def0813c90a3259f86f7d86cb576cd66dca3fe
Generator
import torch import torch.nn as nn class Generator(nn.Module): """Define standard linear + softmax generation step.""" def __init__(self, size, vocab): super(Generator, self).__init__() self.size = size self.proj = nn.Linear(self.size, vocab) def forward(self, x): sliced_...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
QuLog1/QuLog
Generator
false
970
[ "Apache-2.0" ]
0
121f3a8c6f5ee60cde771c36b9eef823a1b2597a
https://github.com/QuLog1/QuLog/tree/121f3a8c6f5ee60cde771c36b9eef823a1b2597a
CosLoss
import torch from torch import nn import torch.utils.data class CosLoss(nn.Module): def __init__(self, factor=6e-07, havesum=True, havemax=True): super(CosLoss, self).__init__() self.factor = factor self.havesum = havesum self.havemax = havemax def forward(self, w): m...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards...
PatrickGui/Face_Pytorch
CosLoss
false
971
[ "Apache-2.0" ]
0
ff5b820ca3978883f7cf95f0209fba3ee958c939
https://github.com/PatrickGui/Face_Pytorch/tree/ff5b820ca3978883f7cf95f0209fba3ee958c939
CumulativeLinkLoss
import torch import numpy as np from torch import nn from typing import Optional import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed def _reduction(loss: 'torch.Tensor', reduction: 'str') ->torch.Tensor: """ Reduce loss Parameters ---------- 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 from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np fro...
Ramstein/Retinopathy2
CumulativeLinkLoss
false
972
[ "MIT" ]
0
669e74206c466e6351d4e3df6087c6aa39b5c6c2
https://github.com/Ramstein/Retinopathy2/tree/669e74206c466e6351d4e3df6087c6aa39b5c6c2
CustomBatchNormAutograd
import torch import torch.nn as nn class CustomBatchNormAutograd(nn.Module): """ This nn.module implements a custom version of the batch norm operation for MLPs. The operations called in self.forward track the history if the input tensors have the flag requires_grad set to True. """ def __ini...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
RaymondKoopmanschap/DL_assignment_code
CustomBatchNormAutograd
false
973
[ "MIT" ]
0
68b3290be9fbd6c55433a7585e2cfa18e0f35f5c
https://github.com/RaymondKoopmanschap/DL_assignment_code/tree/68b3290be9fbd6c55433a7585e2cfa18e0f35f5c