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
OptimizedResidualBlock
import torch import torch.nn as nn import torch.nn.utils as utils from torchvision import utils class CustomConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=None, bias=True, spectral_norm=False, residual_init=True): super(CustomConv2d, self).__init__...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
takuhirok/rGAN
OptimizedResidualBlock
false
16,602
[ "MIT" ]
103
6f7a092de5814c662fd17224b3d48bebe7e03c2f
https://github.com/takuhirok/rGAN/tree/6f7a092de5814c662fd17224b3d48bebe7e03c2f
WassersteinGeneratorLoss
import torch import torch.nn as nn def reduce(x, reduction=None): """Applies reduction on a torch.Tensor. Args: x (torch.Tensor): The tensor on which reduction is to be applied. reduction (str, optional): The reduction to be applied. If ``mean`` the mean value of the Tensor is re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
torchgan/torchgan
WassersteinGeneratorLoss
false
16,603
[ "MIT" ]
1,300
f4139537ac2d3d8609d5aecc859a6fb797b107a1
https://github.com/torchgan/torchgan/tree/f4139537ac2d3d8609d5aecc859a6fb797b107a1
Buck
import torch import torch.nn class Buck(torch.nn.Module): def __init__(self, A=1.0, B=1.0, C=1.0): super(Buck, self).__init__() self.A = torch.nn.Parameter(torch.Tensor([A])) self.B = torch.nn.Parameter(torch.Tensor([B])) self.C = torch.nn.Parameter(torch.Tensor([C])) def Buc...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_...
torchmd/mdgrad
Buck
false
16,604
[ "MIT" ]
54
77bd7685b74b41acf54a9483546e1e8cb545eb01
https://github.com/torchmd/mdgrad/tree/77bd7685b74b41acf54a9483546e1e8cb545eb01
ParityPonderGRU
from torch.nn import Module import torch from torch import nn from typing import Tuple import torch.utils.data import torch.nn.functional import torch.autograd class ParityPonderGRU(Module): """ ## PonderNet with GRU for Parity Task This is a simple model that uses a [GRU Cell](https://pytorch.org/docs/s...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch import nn import...
techthiyanes/annotated_deep_learning_paper_implementations
ParityPonderGRU
false
16,605
[ "MIT" ]
3,714
8af24da2dd39a9a87482a4d18c2dc829bbd3fd47
https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47
WassersteinDiscriminatorLoss
import torch import torch.nn as nn def reduce(x, reduction=None): """Applies reduction on a torch.Tensor. Args: x (torch.Tensor): The tensor on which reduction is to be applied. reduction (str, optional): The reduction to be applied. If ``mean`` the mean value of the Tensor is re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
torchgan/torchgan
WassersteinDiscriminatorLoss
false
16,606
[ "MIT" ]
1,300
f4139537ac2d3d8609d5aecc859a6fb797b107a1
https://github.com/torchgan/torchgan/tree/f4139537ac2d3d8609d5aecc859a6fb797b107a1
NormalizedLinear
import math import torch import torch.utils.data from itertools import product as product from math import sqrt as sqrt import torch.nn class NormalizedLinear(torch.nn.Module): """ A advanced Linear layer which supports weight normalization or cosine normalization. """ def __init__(self, in_features...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
tonysy/cvpods
NormalizedLinear
false
16,607
[ "Apache-2.0" ]
548
e322d7842ca0e34b1ef6237ea6d350633efc793a
https://github.com/tonysy/cvpods/tree/e322d7842ca0e34b1ef6237ea6d350633efc793a
Value
import torch import torch.nn as nn import torch.nn.functional as F class Value(nn.Module): def __init__(self, num_inputs): super(Value, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.value_head = nn.Linear(64, 1) self.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 import torch.nn as ...
tpbarron/pytorch-ppo
Value
false
16,608
[ "MIT" ]
47
f73226865e34443f93dbec58939329c9278828e8
https://github.com/tpbarron/pytorch-ppo/tree/f73226865e34443f93dbec58939329c9278828e8
MinimaxDiscriminatorLoss
import torch import torch.nn as nn import torch.nn.functional as F def minimax_discriminator_loss(dx, dgz, label_smoothing=0.0, reduction='mean'): target_ones = torch.ones_like(dgz) * (1.0 - label_smoothing) target_zeros = torch.zeros_like(dx) loss = F.binary_cross_entropy_with_logits(dx, target_ones, red...
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...
torchgan/torchgan
MinimaxDiscriminatorLoss
false
16,609
[ "MIT" ]
1,300
f4139537ac2d3d8609d5aecc859a6fb797b107a1
https://github.com/torchgan/torchgan/tree/f4139537ac2d3d8609d5aecc859a6fb797b107a1
VirtualBatchNorm
import torch import torch.nn as nn class VirtualBatchNorm(nn.Module): """Virtual Batch Normalization Module as proposed in the paper `"Improved Techniques for Training GANs by Salimans et. al." <https://arxiv.org/abs/1805.08318>`_ Performs Normalizes the features of a batch based on the statistics collec...
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_...
torchgan/torchgan
VirtualBatchNorm
false
16,610
[ "MIT" ]
1,300
f4139537ac2d3d8609d5aecc859a6fb797b107a1
https://github.com/torchgan/torchgan/tree/f4139537ac2d3d8609d5aecc859a6fb797b107a1
CosineFastRCNNOutputLayers
import math import torch import numpy as np import torch.nn as nn import torch.utils.data from itertools import product as product from math import sqrt as sqrt import torch.nn class NormalizedLinear(torch.nn.Module): """ A advanced Linear layer which supports weight normalization or cosine normalization. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tonysy/cvpods
CosineFastRCNNOutputLayers
false
16,611
[ "Apache-2.0" ]
548
e322d7842ca0e34b1ef6237ea6d350633efc793a
https://github.com/tonysy/cvpods/tree/e322d7842ca0e34b1ef6237ea6d350633efc793a
MinibatchDiscrimination1d
import torch import torch.nn as nn class MinibatchDiscrimination1d(nn.Module): """1D Minibatch Discrimination Module as proposed in the paper `"Improved Techniques for Training GANs by Salimans et. al." <https://arxiv.org/abs/1805.08318>`_ Allows the Discriminator to easily detect mode collapse by augmen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
torchgan/torchgan
MinibatchDiscrimination1d
false
16,612
[ "MIT" ]
1,300
f4139537ac2d3d8609d5aecc859a6fb797b107a1
https://github.com/torchgan/torchgan/tree/f4139537ac2d3d8609d5aecc859a6fb797b107a1
GaussMembFunc
import torch def _mk_param(val): """Make a torch parameter from a scalar value""" if isinstance(val, torch.Tensor): val = val.item() return torch.nn.Parameter(torch.tensor(val, dtype=torch.float)) class GaussMembFunc(torch.nn.Module): """ Gaussian membership functions, defined by two...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
trituenhantaoio/anfis-pytorch
GaussMembFunc
false
16,613
[ "MIT" ]
66
7a6bf123d69b550e46abeddd5b4a776243d43aa6
https://github.com/trituenhantaoio/anfis-pytorch/tree/7a6bf123d69b550e46abeddd5b4a776243d43aa6
DisAlignCosineFastRCNNOutputLayers
import math import torch import numpy as np import torch.nn as nn import torch.utils.data from itertools import product as product from math import sqrt as sqrt import torch.nn def cat(tensors, dim=0): """ Efficient version of torch.cat that avoids a copy if there is only a single element in a list """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tonysy/cvpods
DisAlignCosineFastRCNNOutputLayers
false
16,615
[ "Apache-2.0" ]
548
e322d7842ca0e34b1ef6237ea6d350633efc793a
https://github.com/tonysy/cvpods/tree/e322d7842ca0e34b1ef6237ea6d350633efc793a
Policy
import copy import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def square(a): return torch.pow(a, 2.0) class Policy(nn.Module): def __init__(self, num_inputs, num_outputs): super(Policy, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
tpbarron/pytorch-ppo
Policy
false
16,616
[ "MIT" ]
47
f73226865e34443f93dbec58939329c9278828e8
https://github.com/tpbarron/pytorch-ppo/tree/f73226865e34443f93dbec58939329c9278828e8
ActorCritic
import copy import torch import torch.nn as nn import torch.nn.functional as F class ActorCritic(nn.Module): def __init__(self, num_inputs, num_outputs, hidden=64): super(ActorCritic, self).__init__() self.affine1 = nn.Linear(num_inputs, hidden) self.affine2 = nn.Linear(hidden, hidden) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
tpbarron/pytorch-ppo
ActorCritic
false
16,617
[ "MIT" ]
47
f73226865e34443f93dbec58939329c9278828e8
https://github.com/tpbarron/pytorch-ppo/tree/f73226865e34443f93dbec58939329c9278828e8
BellMembFunc
import torch def _mk_param(val): """Make a torch parameter from a scalar value""" if isinstance(val, torch.Tensor): val = val.item() return torch.nn.Parameter(torch.tensor(val, dtype=torch.float)) class BellMembFunc(torch.nn.Module): """ Generalised Bell membership function; defined ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
trituenhantaoio/anfis-pytorch
BellMembFunc
false
16,618
[ "MIT" ]
66
7a6bf123d69b550e46abeddd5b4a776243d43aa6
https://github.com/trituenhantaoio/anfis-pytorch/tree/7a6bf123d69b550e46abeddd5b4a776243d43aa6
DataEmbedding_wo_pos
import math import torch import torch.nn as nn class PositionalEmbedding(nn.Module): def __init__(self, d_model, max_len=5000): super(PositionalEmbedding, self).__init__() pe = torch.zeros(max_len, d_model).float() pe.require_grad = False position = torch.arange(0, max_len).float(...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.a...
thuml/Autoformer
DataEmbedding_wo_pos
false
16,619
[ "MIT" ]
263
6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab
https://github.com/thuml/Autoformer/tree/6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab
UpsampleConv
import torch import torch.nn.functional as F import torch.nn as nn def l2normalize(v, esp=1e-08): return v / (v.norm() + esp) def sn_weight(weight, u, height, n_power_iterations): weight.requires_grad_(False) for _ in range(n_power_iterations): v = l2normalize(torch.mv(weight.view(height, -1).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.functional as F import torch.nn as nn assert_size_stride = torch...
tsirif/cortex
UpsampleConv
false
16,620
[ "BSD-3-Clause" ]
109
2837b220f9fb73279df3815bb18b274106412c08
https://github.com/tsirif/cortex/tree/2837b220f9fb73279df3815bb18b274106412c08
DQN_RAM
import torch import torch.nn as nn import torch.nn.functional as F class DQN_RAM(nn.Module): def __init__(self, in_features=4, num_actions=18): """ Initialize a deep Q-learning network for testing algorithm in_features: number of features of input. num_actions: number of 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 import torch.nn as nn assert_...
transedward/pytoch-dqn
DQN_RAM
false
16,621
[ "MIT" ]
358
1ffda6f3724b3bb37c3195b09b651b1682d4d4fd
https://github.com/transedward/pytoch-dqn/tree/1ffda6f3724b3bb37c3195b09b651b1682d4d4fd
MySimpleNet
import torch import torch.nn.functional as F from torch import nn class MySimpleNet(nn.Module): """ Very simple 2-layer net, slightly adapted from the docs: https://skorch.readthedocs.io/en/stable/user/quickstart.html """ def __init__(self, num_in, num_feat, num_hidden=10, nonlin=F.re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
trituenhantaoio/anfis-pytorch
MySimpleNet
false
16,622
[ "MIT" ]
66
7a6bf123d69b550e46abeddd5b4a776243d43aa6
https://github.com/trituenhantaoio/anfis-pytorch/tree/7a6bf123d69b550e46abeddd5b4a776243d43aa6
MeanPoolConv
import torch import torch.nn.functional as F import torch.nn as nn def l2normalize(v, esp=1e-08): return v / (v.norm() + esp) def sn_weight(weight, u, height, n_power_iterations): weight.requires_grad_(False) for _ in range(n_power_iterations): v = l2normalize(torch.mv(weight.view(height, -1).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.functional as F import torch.nn as nn assert_size_stride = torch...
tsirif/cortex
MeanPoolConv
false
16,623
[ "BSD-3-Clause" ]
109
2837b220f9fb73279df3815bb18b274106412c08
https://github.com/tsirif/cortex/tree/2837b220f9fb73279df3815bb18b274106412c08
ECB
import torch import torch.nn as nn import torch.nn.functional as F class SeqConv3x3(nn.Module): def __init__(self, seq_type, inp_planes, out_planes, depth_multiplier): super(SeqConv3x3, self).__init__() self.type = seq_type self.inp_planes = inp_planes self.out_planes = out_planes...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
thinkreed/ECBSR
ECB
false
16,624
[ "Apache-2.0" ]
162
152b9fef9b9fb61b6e5a93677229143652ef305d
https://github.com/thinkreed/ECBSR/tree/152b9fef9b9fb61b6e5a93677229143652ef305d
XTanhLoss
import torch class XTanhLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, y_t, y_prime_t): ey_t = y_t - y_prime_t return torch.mean(ey_t * torch.tanh(ey_t)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_ini...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
tuantle/regression-losses-pytorch
XTanhLoss
false
16,625
[ "MIT" ]
82
2893f4439ada5df239e3afd0ec7e781dd61403e9
https://github.com/tuantle/regression-losses-pytorch/tree/2893f4439ada5df239e3afd0ec7e781dd61403e9
BondEnergyModule
import torch import torch.nn import torch.nn as nn from itertools import repeat def gen(src, index, dim=-1, out=None, dim_size=None, fill_value=0): dim = range(src.dim())[dim] if index.dim() == 1: index_size = list(repeat(1, src.dim())) index_size[dim] = src.size(dim) index = index.vie...
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 import torch.nn as nn from itertools import repeat assert_size_...
torchmd/mdgrad
BondEnergyModule
false
16,626
[ "MIT" ]
54
77bd7685b74b41acf54a9483546e1e8cb545eb01
https://github.com/torchmd/mdgrad/tree/77bd7685b74b41acf54a9483546e1e8cb545eb01
ConvMeanPool
import torch import torch.nn.functional as F import torch.nn as nn def l2normalize(v, esp=1e-08): return v / (v.norm() + esp) def sn_weight(weight, u, height, n_power_iterations): weight.requires_grad_(False) for _ in range(n_power_iterations): v = l2normalize(torch.mv(weight.view(height, -1).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.functional as F import torch.nn as nn assert_size_stride = torch...
tsirif/cortex
ConvMeanPool
false
16,627
[ "BSD-3-Clause" ]
109
2837b220f9fb73279df3815bb18b274106412c08
https://github.com/tsirif/cortex/tree/2837b220f9fb73279df3815bb18b274106412c08
XSigmoidLoss
import torch class XSigmoidLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, y_t, y_prime_t): ey_t = y_t - y_prime_t return torch.mean(2 * ey_t * torch.sigmoid(ey_t) - ey_t) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
tuantle/regression-losses-pytorch
XSigmoidLoss
false
16,628
[ "MIT" ]
82
2893f4439ada5df239e3afd0ec7e781dd61403e9
https://github.com/tuantle/regression-losses-pytorch/tree/2893f4439ada5df239e3afd0ec7e781dd61403e9
BiAttention
import torch from typing import Optional import torch.nn as nn from torch.nn.parameter import Parameter class BiAttention(nn.Module): def __init__(self, input_size_encoder: 'int', input_size_decoder: 'int', num_labels: 'int', biaffine: 'bool'=True, **kwargs) ->None: super(BiAttention, self).__ini...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_strid...
tucan9389/KLUE-baseline
BiAttention
false
16,629
[ "Apache-2.0" ]
71
add61158e61f86adfca65087237443828b650090
https://github.com/tucan9389/KLUE-baseline/tree/add61158e61f86adfca65087237443828b650090
AlgebraicLoss
import torch class AlgebraicLoss(torch.nn.Module): def __init__(self): super().__init__() def forward(self, y_t, y_prime_t): ey_t = y_t - y_prime_t return torch.mean(ey_t * ey_t / torch.sqrt(1 + ey_t * ey_t)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
tuantle/regression-losses-pytorch
AlgebraicLoss
false
16,630
[ "MIT" ]
82
2893f4439ada5df239e3afd0ec7e781dd61403e9
https://github.com/tuantle/regression-losses-pytorch/tree/2893f4439ada5df239e3afd0ec7e781dd61403e9
GPT2Postprocessing
from _paritybench_helpers import _mock_config import torch from torch import nn class GPT2Postprocessing(nn.Module): def __init__(self, config): super().__init__() self.ln_f = nn.LayerNorm(config.hidden_size, eps=config. layer_norm_epsilon) self.lm_head = nn.Linear(config.hidd...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
tunib-ai/large-scale-lm-tutorials
GPT2Postprocessing
false
16,631
[ "Apache-2.0" ]
128
ca29ff9f945a59abcc3e3f1000c4d83de97973d4
https://github.com/tunib-ai/large-scale-lm-tutorials/tree/ca29ff9f945a59abcc3e3f1000c4d83de97973d4
KLDivergenceLoss
from torch.nn import Module import torch import torch.utils.data import torch.nn.functional import torch.autograd class KLDivergenceLoss(Module): """ <a id="KLDivergenceLoss"></a> ## KL Divergence Regularization Loss This tries to shrink the total evidence to zero if the sample cannot be correctly c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Module import torch.utils.data import torch.nn.functional ...
techthiyanes/annotated_deep_learning_paper_implementations
KLDivergenceLoss
false
16,632
[ "MIT" ]
3,714
8af24da2dd39a9a87482a4d18c2dc829bbd3fd47
https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47
Conv2dZeroInit
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn class Conv2dZeroInit(nn.Conv2d): def __init__(self, channels_in, channels_out, filter_size, stride=1, padding=0, logscale=3.0): super().__init__(channels_in, channels_out, filter_size, stride= stri...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
tychovdo/RevGAN
Conv2dZeroInit
false
16,633
[ "BSD-3-Clause" ]
79
2af25e6a8176eaab3d424db45fb6ee2cfc5dc9a3
https://github.com/tychovdo/RevGAN/tree/2af25e6a8176eaab3d424db45fb6ee2cfc5dc9a3
netmodel
import torch import numpy as np from torch.nn import Parameter class netmodel(torch.nn.Module): def __init__(self): super(netmodel, self).__init__() self.w0 = Parameter(torch.Tensor(1)) self.w1 = Parameter(torch.Tensor(1)) self.w0.data.uniform_(-1, 1) self.w1.data.uniform_...
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 numpy as np from torch.nn import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch...
uber-common/safemutations
netmodel
false
16,634
[ "MIT" ]
91
40e5fd03a244f89bf157d4bedf79201e706aedc1
https://github.com/uber-common/safemutations/tree/40e5fd03a244f89bf157d4bedf79201e706aedc1
DSC_loss
import torch import torch.nn as nn class DSC_loss(nn.Module): def __init__(self): super(DSC_loss, self).__init__() self.epsilon = 1e-06 return def forward(self, pred, target): batch_num = pred.shape[0] pred = pred.contiguous().view(batch_num, -1) target = targ...
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...
twni2016/OrganSegRSTN_PyTorch
DSC_loss
false
16,635
[ "MIT" ]
100
bf571320e718c8f138e04d48645e3b4dfe75801d
https://github.com/twni2016/OrganSegRSTN_PyTorch/tree/bf571320e718c8f138e04d48645e3b4dfe75801d
ConformerConvBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.cuda class ConformerConvBlock(nn.Module): def __init__(self, channels, kernel_size, activation=nn.ReLU(), bias=True): super(ConformerConvBlock, self).__init__() assert (kernel_size - 1) % 2 == ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
tuannamnguyen93/NMTGMinor
ConformerConvBlock
false
16,636
[ "MIT" ]
75
acde3454343bda7060fae541c110d0ad1a8ac4f4
https://github.com/tuannamnguyen93/NMTGMinor/tree/acde3454343bda7060fae541c110d0ad1a8ac4f4
N2
import torch from typing import Tuple from abc import ABC from abc import abstractmethod from torch import nn class Regularizer(nn.Module, ABC): @abstractmethod def forward(self, factors: 'Tuple[torch.Tensor]'): pass class N2(Regularizer): def __init__(self, weight: 'float'): super(N2,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from typing import Tuple from abc import ABC from abc import abstractmethod fro...
uclnlp/cqd
N2
false
16,637
[ "MIT" ]
59
36148c110f336415250c98873fc27ca847741a78
https://github.com/uclnlp/cqd/tree/36148c110f336415250c98873fc27ca847741a78
L2LossWithLogit
import torch import torch.utils.data import torch from torch import nn class L2LossWithLogit(nn.Module): def __init__(self): super(L2LossWithLogit, self).__init__() self.mse = nn.MSELoss(reduction='sum') def forward(self, logits, targets): p = torch.sigmoid(logits) return sel...
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 from torch import nn assert_size_stride = torch._C._...
ucas-vg/TinyBenchmark
L2LossWithLogit
false
16,638
[ "MIT" ]
495
36436df3716d842b6148fb6f6bc7715a2fbdfd92
https://github.com/ucas-vg/TinyBenchmark/tree/36436df3716d842b6148fb6f6bc7715a2fbdfd92
LayerNorm
import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(1)) self.beta = nn.Parameter(torch.zeros(1)) self.eps = eps def forward(self, x): mean = x.me...
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_...
uber-common/safemutations
LayerNorm
false
16,639
[ "MIT" ]
91
40e5fd03a244f89bf157d4bedf79201e706aedc1
https://github.com/uber-common/safemutations/tree/40e5fd03a244f89bf157d4bedf79201e706aedc1
HammingLoss
import torch class HammingLoss(torch.nn.Module): def forward(self, suggested, target): errors = suggested * (1.0 - target) + (1.0 - suggested) * target return errors.mean(dim=0).sum() def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
uclnlp/torch-imle
HammingLoss
false
16,640
[ "MIT" ]
205
f595cd8d527466f6b5db79276f6ceee01d100a1c
https://github.com/uclnlp/torch-imle/tree/f595cd8d527466f6b5db79276f6ceee01d100a1c
FCGenerator
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class FCGenerator(nn.Module): def __init__(self, options): """ The fully connected generator is initialized by creating a chain of fully connected layers that perform transform...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
unicredit/ganzo
FCGenerator
false
16,641
[ "Apache-2.0" ]
73
fb1d270f5091073e8f27da76ab508ab24e5d40e9
https://github.com/unicredit/ganzo/tree/fb1d270f5091073e8f27da76ab508ab24e5d40e9
FusedDownsample
import torch import torch.nn.functional as F from torch import nn from math import sqrt class FusedDownsample(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, padding=0): super().__init__() weight = torch.randn(out_channel, in_channel, kernel_size, kernel_size) bias = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from math import sqrt assert_size_stride = torch._C._dynamo...
uzielroy/StyleGan_FewShot
FusedDownsample
false
16,642
[ "MIT" ]
76
94e4c49dbf39d1c6299f33787afb3e471ece11e3
https://github.com/uzielroy/StyleGan_FewShot/tree/94e4c49dbf39d1c6299f33787afb3e471ece11e3
L1Loss
import torch import torch.nn.functional as F import torch.onnx class L1Loss(torch.nn.Module): """ L1 loss """ def __init__(self, **kwargs): super(L1Loss, self).__init__() self.loss_w = kwargs.get('loss_weight', 1) def forward(self, preds, gts): return F.l1_loss(preds.view...
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.onnx asse...
usutdzxych/CenseoQoE
L1Loss
false
16,643
[ "BSD-3-Clause" ]
75
3f653296b223da6190e1e1781e7b9b54ff877102
https://github.com/usutdzxych/CenseoQoE/tree/3f653296b223da6190e1e1781e7b9b54ff877102
Linear
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Linear): def forward(self, x): weight = self.weight weight_mean = weight.mean(dim=1, keepdim=True) weight = weight - weight_mean std = weight.std(dim=1, keepdim=True) + 1e-05 weight = weight...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
untitled-ai/self_supervised
Linear
false
16,644
[ "MIT" ]
370
6d14ca0402ecc13feda9b3a9fdc056fd1ac24473
https://github.com/untitled-ai/self_supervised/tree/6d14ca0402ecc13feda9b3a9fdc056fd1ac24473
FusedUpsample
import torch import torch.nn.functional as F from torch import nn from math import sqrt class FusedUpsample(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, padding=0): super().__init__() weight = torch.randn(in_channel, out_channel, kernel_size, kernel_size) bias = 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 import nn from math import sqrt assert_size_stride = torch._C._dynamo...
uzielroy/StyleGan_FewShot
FusedUpsample
false
16,645
[ "MIT" ]
76
94e4c49dbf39d1c6299f33787afb3e471ece11e3
https://github.com/uzielroy/StyleGan_FewShot/tree/94e4c49dbf39d1c6299f33787afb3e471ece11e3
AlbertAttentionWithoutSkipConnection
from _paritybench_helpers import _mock_config import math import torch import torch.utils.checkpoint from torch import nn class AlbertAttentionWithoutSkipConnection(nn.Module): def __init__(self, config): super().__init__() if (config.hidden_size % config.num_attention_heads != 0 and 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....
twistedcubic/attention-rank-collapse
AlbertAttentionWithoutSkipConnection
false
16,646
[ "Apache-2.0" ]
118
38b5df6dc2add25f6d945e48a6baf96862368c20
https://github.com/twistedcubic/attention-rank-collapse/tree/38b5df6dc2add25f6d945e48a6baf96862368c20
FCDiscriminator
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class FCDiscriminator(nn.Module): def __init__(self, options): """ The fully connected generator is initialized by creating a chain of fully connected layers that perform trans...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
unicredit/ganzo
FCDiscriminator
false
16,647
[ "Apache-2.0" ]
73
fb1d270f5091073e8f27da76ab508ab24e5d40e9
https://github.com/unicredit/ganzo/tree/fb1d270f5091073e8f27da76ab508ab24e5d40e9
Highway
import torch from torch import nn import torch.utils.data class Highway(nn.Module): def __init__(self, input_dim, dropout): super(Highway, self).__init__() self.input_linear = nn.Linear(input_dim, input_dim) self.relu = nn.ReLU() self.gate_linear = nn.Linear(input_dim, input_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 import t...
uwnlp/piqa
Highway
false
16,648
[ "Apache-2.0" ]
89
e18f2189c93965c94655d5cc943dcecdc2c1ea57
https://github.com/uwnlp/piqa/tree/e18f2189c93965c94655d5cc943dcecdc2c1ea57
Router
from torch.nn import Module import torch from torch import nn import torch.utils.data import torch.nn.functional import torch.autograd class Squash(Module): '\n ## Squash\n\n This is **squashing** function from paper, given by equation $(1)$.\n\n $$\\mathbf{v}_j = \x0crac{{\\lVert \\mathbf{s}_j \rVert}^2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
techthiyanes/annotated_deep_learning_paper_implementations
Router
false
16,649
[ "MIT" ]
3,714
8af24da2dd39a9a87482a4d18c2dc829bbd3fd47
https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47
NoiseInjection
import torch from torch import nn class NoiseInjection(nn.Module): def __init__(self, channel): super().__init__() self.weight = nn.Parameter(torch.zeros(1, channel, 1, 1)) def forward(self, image, noise): return image + self.weight * noise def get_inputs(): return [torch.rand(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
uzielroy/StyleGan_FewShot
NoiseInjection
false
16,650
[ "MIT" ]
76
94e4c49dbf39d1c6299f33787afb3e471ece11e3
https://github.com/uzielroy/StyleGan_FewShot/tree/94e4c49dbf39d1c6299f33787afb3e471ece11e3
L2Normalize
import torch import torch.nn import torch.nn.parallel import torch.backends.cudnn import torch.distributed import torch.multiprocessing import torch.nn as nn import torch.nn.functional as F import torch.optim class L2Normalize(nn.Module): def __init__(self, dim): super(L2Normalize, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch...
valeoai/obow
L2Normalize
false
16,651
[ "Apache-2.0" ]
84
3758504f5e058275725c35ca7faca3731572b911
https://github.com/valeoai/obow/tree/3758504f5e058275725c35ca7faca3731572b911
LDS
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product class LDS(nn.Module): def __init__(self): super(LDS, self).__init__() self.pool1 = nn.MaxPool2d(kernel_size=(2, 2), stride=2, padding=0) self.pool2 = nn.MaxPool2d(kernel_size=(2, 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 import torch.nn as nn from math import sqrt as sqrt from itertools import product as prod...
vaesl/LRF-Net
LDS
false
16,653
[ "MIT" ]
180
e44b120dd55288c02852f8e58cda31313525d748
https://github.com/vaesl/LRF-Net/tree/e44b120dd55288c02852f8e58cda31313525d748
conv2d
import torch import torch.nn as nn from torch.autograd import Variable def spectral_norm(module, name='weight'): SpectralNorm.apply(module, name) return module class SpectralNorm: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import Variable assert_size_stride = t...
vandit15/Self-Supervised-Gans-Pytorch
conv2d
false
16,654
[ "MIT" ]
66
01408fcce3e6cf4795d90c0f9d27e6906d5b59f3
https://github.com/vandit15/Self-Supervised-Gans-Pytorch/tree/01408fcce3e6cf4795d90c0f9d27e6906d5b59f3
EntropyLossEncap
import torch from torch import nn def feature_map_permute(input): s = input.data.shape l = len(s) if l == 2: x = input elif l == 3: x = input.permute(0, 2, 1) elif l == 4: x = input.permute(0, 2, 3, 1) elif l == 5: x = input.permute(0, 2, 3, 4, 1) else: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
vartikagpt10/memae-anomaly-detection
EntropyLossEncap
false
16,655
[ "MIT" ]
297
ceece7714fb241e82ef3f3785d3d1ed86c28113e
https://github.com/vartikagpt10/memae-anomaly-detection/tree/ceece7714fb241e82ef3f3785d3d1ed86c28113e
deconv2d
import torch import torch.nn as nn from torch.autograd import Variable def spectral_norm(module, name='weight'): SpectralNorm.apply(module, name) return module class SpectralNorm: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import Variable assert_size_stride = t...
vandit15/Self-Supervised-Gans-Pytorch
deconv2d
false
16,656
[ "MIT" ]
66
01408fcce3e6cf4795d90c0f9d27e6906d5b59f3
https://github.com/vandit15/Self-Supervised-Gans-Pytorch/tree/01408fcce3e6cf4795d90c0f9d27e6906d5b59f3
L1RankLoss
import torch import torch.nn.functional as F import torch.onnx class L1RankLoss(torch.nn.Module): """ L1 loss + Rank loss """ def __init__(self, **kwargs): super(L1RankLoss, self).__init__() self.l1_w = kwargs.get('l1_w', 1) self.rank_w = kwargs.get('rank_w', 1) self.h...
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.onnx asse...
usutdzxych/CenseoQoE
L1RankLoss
false
16,658
[ "BSD-3-Clause" ]
75
3f653296b223da6190e1e1781e7b9b54ff877102
https://github.com/usutdzxych/CenseoQoE/tree/3f653296b223da6190e1e1781e7b9b54ff877102
Iter_Downsample
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product class Iter_Downsample(nn.Module): def __init__(self): super(Iter_Downsample, self).__init__() self.init_ds = nn.Sequential(nn.MaxPool2d(kernel_size=2, stride=2, padding=0), nn.Max...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from math import sqrt as sqrt from itertools import product as prod...
vaesl/LFIP
Iter_Downsample
false
16,659
[ "MIT" ]
59
eb9d934616c508c9a9032f170baa1d97fa792822
https://github.com/vaesl/LFIP/tree/eb9d934616c508c9a9032f170baa1d97fa792822
_Residual_Block
import torch import torch.nn as nn class _Residual_Block(nn.Module): def __init__(self): super(_Residual_Block, self).__init__() self.conv1 = nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, stride=1, padding=1, bias=False) self.relu = nn.ReLU(inplace=True) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
twtygqyy/pytorch-EDSR
_Residual_Block
false
16,661
[ "MIT" ]
59
001031b6563fcc45d4e7edb7e14c41fb9982ce64
https://github.com/twtygqyy/pytorch-EDSR/tree/001031b6563fcc45d4e7edb7e14c41fb9982ce64
Residual_D
import torch import torch.nn as nn from torch.autograd import Variable def spectral_norm(module, name='weight'): SpectralNorm.apply(module, name) return module class SpectralNorm: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
vandit15/Self-Supervised-Gans-Pytorch
Residual_D
false
16,663
[ "MIT" ]
66
01408fcce3e6cf4795d90c0f9d27e6906d5b59f3
https://github.com/vandit15/Self-Supervised-Gans-Pytorch/tree/01408fcce3e6cf4795d90c0f9d27e6906d5b59f3
GumbelSoftmaxLayer
import torch import torch.nn as nn from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch.distributions def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0, training: 'bool'=True, straight_through: 'bool'=False): size = log...
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 from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch...
vengalraoguttha/EGG
GumbelSoftmaxLayer
false
16,664
[ "MIT" ]
254
e4f8412f197543ec7f1f00cf89b5a364b038dc57
https://github.com/vengalraoguttha/EGG/tree/e4f8412f197543ec7f1f00cf89b5a364b038dc57
ReinforcedReceiver
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data from torch.distributions import Bernoulli import torch.distributions class ReinforcedReceiver(nn.Module): def __init__(self, n_bits, n_hidden): super(ReinforcedReceiver, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data import to...
vengalraoguttha/EGG
ReinforcedReceiver
false
16,665
[ "MIT" ]
254
e4f8412f197543ec7f1f00cf89b5a364b038dc57
https://github.com/vengalraoguttha/EGG/tree/e4f8412f197543ec7f1f00cf89b5a364b038dc57
EntropyLoss
import torch from torch import nn class EntropyLoss(nn.Module): def __init__(self, eps=1e-12): super(EntropyLoss, self).__init__() self.eps = eps def forward(self, x): b = x * torch.log(x + self.eps) b = -1.0 * b.sum(dim=1) b = b.mean() return b def get_inpu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
vartikagpt10/memae-anomaly-detection
EntropyLoss
false
16,666
[ "MIT" ]
297
ceece7714fb241e82ef3f3785d3d1ed86c28113e
https://github.com/vartikagpt10/memae-anomaly-detection/tree/ceece7714fb241e82ef3f3785d3d1ed86c28113e
BahdanauAttention
import torch import torch.nn as nn class BahdanauAttention(nn.Module): def __init__(self, annot_dim, query_dim, attn_dim): super(BahdanauAttention, self).__init__() self.query_layer = nn.Linear(query_dim, attn_dim, bias=True) self.annot_layer = nn.Linear(annot_dim, attn_dim, bias=True) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
vigilancetrent/chatbot-advanced
BahdanauAttention
false
16,667
[ "Apache-2.0" ]
52
2e0c72c4df2e1434da995b7105f8f0414aba6248
https://github.com/vigilancetrent/chatbot-advanced/tree/2e0c72c4df2e1434da995b7105f8f0414aba6248
Interpolate
import torch import torch.nn as nn import torch.nn.functional as F class Interpolate(nn.Module): def __init__(self, scale_factor, mode='bilinear', align_corners=True): super(Interpolate, self).__init__() self.scale_factor = scale_factor self.mode = mode self.align_corners = align_...
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...
vietnhatthai/3d-vehicle-tracking
Interpolate
false
16,668
[ "BSD-3-Clause" ]
603
8ee189f6792897651bb56bb2950ce07c9629a89d
https://github.com/vietnhatthai/3d-vehicle-tracking/tree/8ee189f6792897651bb56bb2950ce07c9629a89d
UpSample
import torch import torch.nn as nn import torch.nn.functional as F class UpSample(nn.Sequential): def __init__(self, skip_input, output_features): super(UpSample, self).__init__() self.convA = nn.Conv2d(skip_input, output_features, kernel_size=3, stride=1, padding=1) self.leak...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
varun-affinsys/Monocular-Depth-Estimation-with-Transfer-Learning-pretrained-MobileNetV2
UpSample
false
16,669
[ "MIT" ]
70
9b20c5b3d7a9f90e1dc6f40e17ee31d9b3dee684
https://github.com/varun-affinsys/Monocular-Depth-Estimation-with-Transfer-Learning-pretrained-MobileNetV2/tree/9b20c5b3d7a9f90e1dc6f40e17ee31d9b3dee684
GTConv_2
import torch import torch.nn.functional as F from torch import nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class GTConv_2(nn.Module): def __init__(self, in_channels, out_channels): super(GTConv_2, self).__init__() self.in_channels = in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn i...
verashira/TSPNet
GTConv_2
false
16,670
[ "MIT" ]
83
ee454165dcc61cdbbff19565364e2221727ed2b8
https://github.com/verashira/TSPNet/tree/ee454165dcc61cdbbff19565364e2221727ed2b8
TemporalBlock
import torch from torch import nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler def TemporalConvLayer(input_channels, output_channels, kernel_size): m = nn.Conv1d(in_channels=input_channels, out_channels=output_channels, kernel_size=kernel_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
verashira/TSPNet
TemporalBlock
false
16,671
[ "MIT" ]
83
ee454165dcc61cdbbff19565364e2221727ed2b8
https://github.com/verashira/TSPNet/tree/ee454165dcc61cdbbff19565364e2221727ed2b8
SoftmaxAllocator
import torch class SoftmaxAllocator(torch.nn.Module): """Portfolio creation by computing a softmax over the asset dimension with temperature. Parameters ---------- temperature : None or float If None, then needs to be provided per sample during forward pass. If ``float`` then assumed ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
vishalbelsare/deepdow
SoftmaxAllocator
false
16,672
[ "Apache-2.0" ]
511
cbb99347fba9a447d4fcae64fe5137c203643e44
https://github.com/vishalbelsare/deepdow/tree/cbb99347fba9a447d4fcae64fe5137c203643e44
TransformerEncoderLayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class TransformerEncoderLayer(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.0): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
vengalraoguttha/EGG
TransformerEncoderLayer
false
16,673
[ "MIT" ]
254
e4f8412f197543ec7f1f00cf89b5a364b038dc57
https://github.com/vengalraoguttha/EGG/tree/e4f8412f197543ec7f1f00cf89b5a364b038dc57
SpatialCrossMapLRN
import torch import torch.nn as nn import torch.nn.parallel class SpatialCrossMapLRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, k=1, ACROSS_CHANNELS=True): super(SpatialCrossMapLRN, self).__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if ACROSS_CHANNELS:...
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 assert_size_stride = torch._C._d...
vfdev-5/models-comparison.pytorch
SpatialCrossMapLRN
false
16,674
[ "BSD-3-Clause" ]
174
6a09c41c1ed6160af0734924700a9150249c3df6
https://github.com/vfdev-5/models-comparison.pytorch/tree/6a09c41c1ed6160af0734924700a9150249c3df6
Symmetric
import torch from torch import nn class NonSquareError(ValueError): def __init__(self, name, size): super().__init__( 'The {} parametrization can just be applied to square matrices. Got a tensor of size {}' .format(name, size)) class VectorError(ValueError): def __init__(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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
vishalbelsare/geotorch
Symmetric
false
16,675
[ "MIT" ]
422
ba38d406c245d609fee4b4dac3f6427bf6d73a8e
https://github.com/vishalbelsare/geotorch/tree/ba38d406c245d609fee4b4dac3f6427bf6d73a8e
Cov2Corr
import torch import torch.nn as nn class Cov2Corr(nn.Module): """Conversion from covariance matrix to correlation matrix.""" def forward(self, covmat): """Convert. Parameters ---------- covmat : torch.Tensor Covariance matrix of shape (n_samples, n_assets, n_asset...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
vishalbelsare/deepdow
Cov2Corr
false
16,676
[ "Apache-2.0" ]
511
cbb99347fba9a447d4fcae64fe5137c203643e44
https://github.com/vishalbelsare/deepdow/tree/cbb99347fba9a447d4fcae64fe5137c203643e44
InformedSender
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class InformedSender(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super(InformedSender, se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
vengalraoguttha/EGG
InformedSender
false
16,677
[ "MIT" ]
254
e4f8412f197543ec7f1f00cf89b5a364b038dc57
https://github.com/vengalraoguttha/EGG/tree/e4f8412f197543ec7f1f00cf89b5a364b038dc57
Skew
import torch from torch import nn class NonSquareError(ValueError): def __init__(self, name, size): super().__init__( 'The {} parametrization can just be applied to square matrices. Got a tensor of size {}' .format(name, size)) class VectorError(ValueError): def __init__(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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
vishalbelsare/geotorch
Skew
false
16,678
[ "MIT" ]
422
ba38d406c245d609fee4b4dac3f6427bf6d73a8e
https://github.com/vishalbelsare/geotorch/tree/ba38d406c245d609fee4b4dac3f6427bf6d73a8e
Naked
from torch.nn import Module import torch from torch import Tensor class Naked(Module): """Returns a tensor filled with the scalar value zero. Args: out_features (int, default=1): Size of each output sample. Shape: - Input: :math:`(N, *, H_{\\text{in}})` where :math:`*` means an...
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.nn import Module assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._em...
vishalbelsare/pfhedge
Naked
false
16,679
[ "MIT" ]
81
4d7ff173995e0795942bc6ec55f3fdc5bfb7a5f1
https://github.com/vishalbelsare/pfhedge/tree/4d7ff173995e0795942bc6ec55f3fdc5bfb7a5f1
GatingMechanism
import torch class GatingMechanism(torch.nn.Module): def __init__(self, d_input, bg=0.1): super(GatingMechanism, self).__init__() self.Wr = torch.nn.Linear(d_input, d_input) self.Ur = torch.nn.Linear(d_input, d_input) self.Wz = torch.nn.Linear(d_input, d_input) self.Uz = 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 assert_size_stride ...
victor-psiori/Transformers-RL
GatingMechanism
false
16,680
[ "MIT" ]
50
85b3f2376ba473a45ca18c969aebb1ae82cf8475
https://github.com/victor-psiori/Transformers-RL/tree/85b3f2376ba473a45ca18c969aebb1ae82cf8475
EntropicLoss
from torch.nn import Module import torch from torch import Tensor from typing import Callable from typing import Union from abc import ABC def _format_float(value: 'float') ->str: """ >>> _format_float(1) '1' >>> _format_float(1.0) '1.' >>> _format_float(1e-4) '1.0000e-04' """ tens...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import Module from torch import Tensor from typing import C...
vishalbelsare/pfhedge
EntropicLoss
false
16,681
[ "MIT" ]
81
4d7ff173995e0795942bc6ec55f3fdc5bfb7a5f1
https://github.com/vishalbelsare/pfhedge/tree/4d7ff173995e0795942bc6ec55f3fdc5bfb7a5f1
ActorNetwork
import torch import torch.nn as nn import torch.nn.functional as F class ActorNetwork(nn.Module): def __init__(self, state_size, action_size, hidden_size, seed=1412): super(ActorNetwork, self).__init__() self.seed = torch.manual_seed(seed) self.fc1 = nn.Linear(state_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 from torch._inductor.runtime....
vlgiitr/Workshop-Spring-2022
ActorNetwork
false
16,682
[ "MIT" ]
69
003ed62c75a876e946eaa481c27224dd38914015
https://github.com/vlgiitr/Workshop-Spring-2022/tree/003ed62c75a876e946eaa481c27224dd38914015
SphereEmbedded
import torch from torch import nn def _extra_repr(**kwargs): if 'n' in kwargs: ret = 'n={}'.format(kwargs['n']) elif 'dim' in kwargs: ret = 'dim={}'.format(kwargs['dim']) else: ret = '' if 'k' in kwargs: ret += ', k={}'.format(kwargs['k']) if 'rank' in kwargs: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
vishalbelsare/geotorch
SphereEmbedded
false
16,683
[ "MIT" ]
422
ba38d406c245d609fee4b4dac3f6427bf6d73a8e
https://github.com/vishalbelsare/geotorch/tree/ba38d406c245d609fee4b4dac3f6427bf6d73a8e
Decoder
import torch import torch.nn as nn from collections import OrderedDict class Decoder(nn.Module): def __init__(self, style_dim, class_dim): super(Decoder, self).__init__() self.linear_model = nn.Sequential(OrderedDict([('linear_1', nn. Linear(in_features=style_dim + class_dim, out_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
vicissitude1999/multi-level-vae
Decoder
false
16,684
[ "MIT" ]
68
83bc98fbe5046c61941298d4fd49b08fd868ee89
https://github.com/vicissitude1999/multi-level-vae/tree/83bc98fbe5046c61941298d4fd49b08fd868ee89
MixtureDensityHead
from _paritybench_helpers import _mock_config import torch import torch.nn as nn from torch.autograd import Variable from torch.distributions import Categorical class MixtureDensityHead(nn.Module): def __init__(self, config: 'DictConfig', **kwargs): self.hparams = config 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.triton_helpers import libdevice import torch.nn as ...
robburdon/pytorch_tabular
MixtureDensityHead
false
16,685
[ "MIT" ]
560
9bf75f22c6e1b3033ad699713e77c283d55f3555
https://github.com/robburdon/pytorch_tabular/tree/9bf75f22c6e1b3033ad699713e77c283d55f3555
EntropicRiskMeasure
from torch.nn import Module import torch from torch import Tensor from typing import Callable from typing import Union from abc import ABC def _format_float(value: 'float') ->str: """ >>> _format_float(1) '1' >>> _format_float(1.0) '1.' >>> _format_float(1e-4) '1.0000e-04' """ tens...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import Module from torch import Tensor from typing import C...
vishalbelsare/pfhedge
EntropicRiskMeasure
false
16,686
[ "MIT" ]
81
4d7ff173995e0795942bc6ec55f3fdc5bfb7a5f1
https://github.com/vishalbelsare/pfhedge/tree/4d7ff173995e0795942bc6ec55f3fdc5bfb7a5f1
VectorQuantizer
import torch from torch import Tensor from torch import nn import torch.nn.functional as F class VectorQuantizer(nn.Module): """ Reference: [1] https://github.com/deepmind/sonnet/blob/v2/sonnet/src/nets/vqvae.py """ def __init__(self, num_embeddings: 'int', embedding_dim: 'int', beta: 'fl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 from...
vipavlovic/pyprobml
VectorQuantizer
false
16,687
[ "MIT" ]
4,895
59a2edc682d0163955db5e2f27491ad772b60141
https://github.com/vipavlovic/pyprobml/tree/59a2edc682d0163955db5e2f27491ad772b60141
Warp
import torch import torch.nn as nn class Warp(torch.nn.Module): """Custom warping layer.""" def __init__(self, mode='bilinear', padding_mode='reflection'): super().__init__() self.mode = mode self.padding_mode = padding_mode def forward(self, x, tform): """Warp the tensor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math assert_size...
vishalbelsare/deepdow
Warp
false
16,688
[ "Apache-2.0" ]
511
cbb99347fba9a447d4fcae64fe5137c203643e44
https://github.com/vishalbelsare/deepdow/tree/cbb99347fba9a447d4fcae64fe5137c203643e44
BertLayerNormNoVar
import torch import torch.nn as nn class BertLayerNormNoVar(nn.Module): def __init__(self, hidden_size, eps=1e-12): super(BertLayerNormNoVar, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.bias = nn.Parameter(torch.zeros(hidden_size)) self.variance_epsil...
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...
vtu81/auto_LiRPA
BertLayerNormNoVar
false
16,689
[ "BSD-3-Clause" ]
161
294152077c0abfafb5d62fee39335e60eff087b4
https://github.com/vtu81/auto_LiRPA/tree/294152077c0abfafb5d62fee39335e60eff087b4
ExpectedShortfall
from torch.nn import Module import torch from torch import Tensor from typing import Callable from typing import Union from typing import Optional from abc import ABC from math import ceil def bisect(fn: 'Callable[[Tensor], Tensor]', target: 'Tensor', lower: 'Union[float, Tensor]', upper: 'Union[float, Tensor]', ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch import Tensor from typing import Callable from typing import Union from typing import Optional from a...
vishalbelsare/pfhedge
ExpectedShortfall
false
16,690
[ "MIT" ]
81
4d7ff173995e0795942bc6ec55f3fdc5bfb7a5f1
https://github.com/vishalbelsare/pfhedge/tree/4d7ff173995e0795942bc6ec55f3fdc5bfb7a5f1
MultiHeadDenseLayer
import torch import tensorflow as tf import torch.nn as nn import torch.nn.functional as F def get_activation(activ): if callable(activ): return activ if activ is None: return lambda x: x if activ == 'tanh': return F.tanh elif activ == 'relu': return F.relu elif act...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import tensorflow as tf import torch.nn as nn import torch.nn.functional as F as...
ishine/neurst
MultiHeadDenseLayer
false
16,691
[ "Apache-2.0" ]
208
2ba322393fcfed4261b33f4a657e12bbe321baaa
https://github.com/ishine/neurst/tree/2ba322393fcfed4261b33f4a657e12bbe321baaa
FocalLoss
import torch import torch.nn as nn from matplotlib.font_manager import * class FocalLoss(nn.Module): """ Focal loss: focus more on hard samples """ def __init__(self, gamma=0, eps=1e-07): """ :param gamma: :param eps: """ super(FocalLoss, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
wang-tf/RepNet-MDNet-VehicleReID
FocalLoss
false
16,692
[ "MIT" ]
226
d3d184331206ca4bdb5ea399e5b90a9ccc53b400
https://github.com/wang-tf/RepNet-MDNet-VehicleReID/tree/d3d184331206ca4bdb5ea399e5b90a9ccc53b400
L1DepthLoss
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class L1DepthLoss(nn.Module): """Custom L1 loss for depth sequences.""" def __init__(self, args): super(L1DepthLoss, self).__init__() self.args = args self.word_dim = 1 def forward(self, predictions,...
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...
wanyao1992/structural-probes
L1DepthLoss
false
16,693
[ "Apache-2.0" ]
357
3071c93b23601d834628d79a74e46e8ab5e5a66b
https://github.com/wanyao1992/structural-probes/tree/3071c93b23601d834628d79a74e46e8ab5e5a66b
HLoss
import torch import torch.nn.functional as F from torch import nn class HLoss(nn.Module): """ returning the negative entropy of an input tensor """ def __init__(self, is_maximization=False): super(HLoss, self).__init__() self.is_neg = is_maximization 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._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
vt-vl-lab/SDN
HLoss
false
16,694
[ "MIT" ]
88
d1f0a448acf720b9b86527f808cb17d30ed2f4e9
https://github.com/vt-vl-lab/SDN/tree/d1f0a448acf720b9b86527f808cb17d30ed2f4e9
Align
import torch import torch.nn.functional as F class Align(torch.nn.Module): def __init__(self, p): super(Align, self).__init__() self.p = p def forward(self, e1, e2): pred = -torch.norm(e1 - e2, p=self.p, dim=1) return pred def only_pos_loss(self, e1, r, e2): 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 libdevice import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.as...
weihangzhang/EAkit
Align
false
16,695
[ "MIT" ]
102
dde8e914480cd1a3585271f70db11d567d9c2a04
https://github.com/weihangzhang/EAkit/tree/dde8e914480cd1a3585271f70db11d567d9c2a04
N_TransE
import torch import torch.nn.functional as F class N_TransE(torch.nn.Module): def __init__(self, p, params): super(N_TransE, self).__init__() self.p = p self.params = params def forward(self, e1, r, e2): pred = -torch.norm(e1 + r - e2, p=self.p, dim=1) return pred ...
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.functional as F assert_size_stride = torch._C._dynamo.guards.as...
weihangzhang/EAkit
N_TransE
false
16,696
[ "MIT" ]
102
dde8e914480cd1a3585271f70db11d567d9c2a04
https://github.com/weihangzhang/EAkit/tree/dde8e914480cd1a3585271f70db11d567d9c2a04
L1DistanceLoss
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class L1DistanceLoss(nn.Module): """Custom L1 loss for distance matrices.""" def __init__(self, args): super(L1DistanceLoss, self).__init__() self.args = args self.word_pair_dims = 1, 2 def forward(s...
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...
wanyao1992/structural-probes
L1DistanceLoss
false
16,697
[ "Apache-2.0" ]
357
3071c93b23601d834628d79a74e46e8ab5e5a66b
https://github.com/wanyao1992/structural-probes/tree/3071c93b23601d834628d79a74e46e8ab5e5a66b
LayerNorm
import torch class LayerNorm(torch.nn.Module): def __init__(self, input_dim): super(LayerNorm, self).__init__() self.gamma = torch.nn.Parameter(torch.ones(input_dim)) self.beta = torch.nn.Parameter(torch.zeros(input_dim)) self.eps = 1e-06 def forward(self, x, mask): 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.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
watchernyu/MatchLSTM-Analyze-Adversarial-Training
LayerNorm
false
16,698
[ "MIT" ]
50
00bd33d3dd22d5291dc2c1ec5feef5eb93b59b3a
https://github.com/watchernyu/MatchLSTM-Analyze-Adversarial-Training/tree/00bd33d3dd22d5291dc2c1ec5feef5eb93b59b3a
StructuredAttention_bi
import torch import torch.nn as nn import torch.nn.functional as F class StructuredAttention_bi(nn.Module): def __init__(self, dropout=0.1, scale=100): super(StructuredAttention_bi, self).__init__() self.dropout = dropout self.scale = scale def forward(self, C, Q, c_mask, q_mask): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
vivekrajput566/03testing2022
StructuredAttention_bi
false
16,699
[ "MIT" ]
49
f7e04f921c6607d383806ca2bbb85d2de84e0369
https://github.com/vivekrajput566/03testing2022/tree/f7e04f921c6607d383806ca2bbb85d2de84e0369
AlignEA
import torch import torch.nn.functional as F class AlignEA(torch.nn.Module): def __init__(self, p, feat_drop, params): super(AlignEA, self).__init__() self.params = params def forward(self, e1, r, e2): return torch.sum(torch.pow(e1 + r - e2, 2), 1) def only_pos_loss(self, e1, 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.functional as F assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards...
weihangzhang/EAkit
AlignEA
false
16,700
[ "MIT" ]
102
dde8e914480cd1a3585271f70db11d567d9c2a04
https://github.com/weihangzhang/EAkit/tree/dde8e914480cd1a3585271f70db11d567d9c2a04
N_R_Align
import torch import torch.nn as nn class N_R_Align(torch.nn.Module): def __init__(self, params): super(N_R_Align, self).__init__() self.params = params self.cos_sim = nn.CosineSimilarity(dim=1, eps=1e-06) def forward(self, e1, e2, n1, n2): return self.params * torch.sigmoid(s...
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...
weihangzhang/EAkit
N_R_Align
false
16,701
[ "MIT" ]
102
dde8e914480cd1a3585271f70db11d567d9c2a04
https://github.com/weihangzhang/EAkit/tree/dde8e914480cd1a3585271f70db11d567d9c2a04
HLoss
import torch import torch.nn as nn class HLoss(nn.Module): def __init__(self): super(HLoss, self).__init__() def forward(self, x): b = x * torch.log(x) b[torch.isnan(b)] = 0 b = -1.0 * b.sum() return b def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ge...
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...
wengong-jin/chemprop
HLoss
false
16,702
[ "MIT" ]
77
3ad3577367d8a53f28aade0be41b56b1f25b6125
https://github.com/wengong-jin/chemprop/tree/3ad3577367d8a53f28aade0be41b56b1f25b6125
depthwise_block
import torch import torch.nn as nn import torch.utils.data class depthwise_conv(nn.Module): def __init__(self, kernel_size=3, stride=1, padding=1): super(depthwise_conv, self).__init__() self.depthwise = nn.Conv2d(1, 1, kernel_size=kernel_size, stride= stride, padding=padding) de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
whiteking64/lang-seg
depthwise_block
false
16,703
[ "MIT" ]
202
9d063b126f1b64e38ddb20cc75fc74435bfdcbd3
https://github.com/whiteking64/lang-seg/tree/9d063b126f1b64e38ddb20cc75fc74435bfdcbd3
AttentionCollapse
import torch import torch.nn as nn class AttentionCollapse(nn.Module): """Collapsing over the channels with attention. Parameters ---------- n_channels : int Number of input channels. Attributes ---------- affine : nn.Module Fully connected layer performing linear mapping...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
vishalbelsare/deepdow
AttentionCollapse
false
16,704
[ "Apache-2.0" ]
511
cbb99347fba9a447d4fcae64fe5137c203643e44
https://github.com/vishalbelsare/deepdow/tree/cbb99347fba9a447d4fcae64fe5137c203643e44
Gating
import torch import torch.nn as nn import torch.nn.functional as F class Gating(nn.Module): """ FCN architecture for large scale scene coordiante regression. """ def __init__(self, num_experts, capacity=1): """ Constructor. """ super(Gating, self).__init__() self.capacity = cap...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
vislearn/esac
Gating
false
16,705
[ "BSD-3-Clause" ]
62
4004b251525fa238a1cb6e1043fb41a4719a4ff2
https://github.com/vislearn/esac/tree/4004b251525fa238a1cb6e1043fb41a4719a4ff2
LearnedKernel
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class LearnedKernel(nn.Module): def __init__(self, args: 'Namespace'): super(LearnedKernel, self).__init__() self.A = nn.Linear(args.ffn_hidden_size, args.ffn_hidden_size) def forward(self, encodings: 'torch.Ten...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
wengong-jin/chemprop
LearnedKernel
false
16,706
[ "MIT" ]
77
3ad3577367d8a53f28aade0be41b56b1f25b6125
https://github.com/wengong-jin/chemprop/tree/3ad3577367d8a53f28aade0be41b56b1f25b6125