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
NSELoss
import torch class NSELoss(torch.nn.Module): """Calculate (batch-wise) NSE Loss. Each sample i is weighted by 1 / (std_i + eps)^2, where std_i is the standard deviation of the discharge from the basin, to which the sample belongs. Parameters: ----------- eps : float Constant, added ...
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...
bernharl/CamelsML
NSELoss
false
3,211
[ "Apache-2.0" ]
0
4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
https://github.com/bernharl/CamelsML/tree/4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
Encoder
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Encoder(nn.Module): """ VAE encoder """ def __init__(self, img_channels, latent_size): super(Encoder, self).__init__() self.latent_size = latent_size self.img_channels = img_channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
benedictquartey/modified-wm
Encoder
false
3,212
[ "MIT" ]
0
bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
https://github.com/benedictquartey/modified-wm/tree/bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
ac_net
import torch import torch.nn.functional as F import torch.nn as nn class ac_net(nn.Module): def __init__(self, n_states, n_actions, n_hidden=32): super(ac_net, self).__init__() self.fc1 = nn.Linear(n_states, n_hidden) self.action_head = nn.Linear(n_hidden, n_actions) self.value_he...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bigtreeljc/force_learning
ac_net
false
3,213
[ "MIT" ]
0
183a7c96c411e282966604e3cb375ba49e91a88c
https://github.com/bigtreeljc/force_learning/tree/183a7c96c411e282966604e3cb375ba49e91a88c
Decoder
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Decoder(nn.Module): """ VAE decoder """ def __init__(self, img_channels, latent_size): super(Decoder, self).__init__() self.latent_size = latent_size self.img_channels = img_channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
benedictquartey/modified-wm
Decoder
false
3,214
[ "MIT" ]
0
bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
https://github.com/benedictquartey/modified-wm/tree/bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
LSTM
import torch from typing import Tuple import torch.nn as nn class LSTM(nn.Module): """Implementation of the standard LSTM. Parameters ---------- input_size : int Number of input features hidden_size : int Number of hidden/memory cells. batch_first : bool, optional If ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
bernharl/CamelsML
LSTM
false
3,215
[ "Apache-2.0" ]
0
4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
https://github.com/bernharl/CamelsML/tree/4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
TemporalDecayRegression
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def linear(input, weight, bias=None): if input.dim() == 2 and bias is not None: ret = torch.addmm(bias, input, weight.t()) else: output = input.matmul(weight.t()) if bias is 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....
asifr/armisc
TemporalDecayRegression
false
3,216
[ "MIT" ]
0
486220ba498353faeb94f70cd8ffe917109526d2
https://github.com/asifr/armisc/tree/486220ba498353faeb94f70cd8ffe917109526d2
Hflip
import torch import torch.nn as nn def hflip(input: 'torch.Tensor') ->torch.Tensor: """Horizontally flip a tensor image or a batch of tensor images. .. image:: _static/img/hflip.png Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: input: input 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
bkntr/kornia
Hflip
false
3,217
[ "ECL-2.0", "Apache-2.0" ]
0
aa31f8d730864c71948cef32f9d3ed9138401755
https://github.com/bkntr/kornia/tree/aa31f8d730864c71948cef32f9d3ed9138401755
GlobalpoolFC
import torch import torch.nn as nn class GlobalpoolFC(nn.Module): def __init__(self, num_in, num_class): super(GlobalpoolFC, self).__init__() self.pool = nn.AdaptiveAvgPool2d(output_size=1) self.fc = nn.Linear(num_in, num_class) def forward(self, x): y = self.pool(x) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
blackcow/pytorch-cifar-master
GlobalpoolFC
false
3,218
[ "MIT" ]
0
c571c8fd7fe521907755ca2eacb6aa877abe3493
https://github.com/blackcow/pytorch-cifar-master/tree/c571c8fd7fe521907755ca2eacb6aa877abe3493
FeatureEmbedding
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def linear(input, weight, bias=None): if input.dim() == 2 and bias is not None: ret = torch.addmm(bias, input, weight.t()) else: output = input.matmul(weight.t()) if bias is 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....
asifr/armisc
FeatureEmbedding
false
3,219
[ "MIT" ]
0
486220ba498353faeb94f70cd8ffe917109526d2
https://github.com/asifr/armisc/tree/486220ba498353faeb94f70cd8ffe917109526d2
waspIntrinsicComposer
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class waspIntrinsicComposer(nn.Module): def __init__(self, opt): super(waspIntrinsicComposer, self).__init__() self.ngpu = opt.ngpu self.nc = opt.nc def 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 import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
bhushan23/illumination-nets
waspIntrinsicComposer
false
3,220
[ "BSD-2-Clause" ]
0
a7e579489e3ed67c926b27113cf65eec2aea6287
https://github.com/bhushan23/illumination-nets/tree/a7e579489e3ed67c926b27113cf65eec2aea6287
VAE
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Decoder(nn.Module): """ VAE decoder """ def __init__(self, img_channels, latent_size): super(Decoder, self).__init__() self.latent_size = latent_size self.img_channels = img_channels ...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
benedictquartey/modified-wm
VAE
false
3,221
[ "MIT" ]
0
bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
https://github.com/benedictquartey/modified-wm/tree/bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
LexaAttention
import torch from torch import nn class LexaAttention(nn.Module): def __init__(self, dim): super(LexaAttention, self).__init__() self.query_layer = nn.Linear(dim, dim, bias=False) self.tanh = nn.Tanh() self.v = nn.Linear(dim, 1, bias=False) def forward(self, query, processed_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
blackbawx/LEXA
LexaAttention
false
3,222
[ "Apache-2.0" ]
0
75e5180ca61d3e0bd78c3b8b1ece0b21c8300026
https://github.com/blackbawx/LEXA/tree/75e5180ca61d3e0bd78c3b8b1ece0b21c8300026
dqn_net
import torch import torch.nn.functional as F import torch.nn as nn class dqn_net(nn.Module): def __init__(self, n_states, n_actions): super(dqn_net, self).__init__() self.fc1 = nn.Linear(n_states, 50) self.fc1.weight.data.normal_(0, 0.1) self.fc2 = nn.Linear(50, 30) self.f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bigtreeljc/force_learning
dqn_net
false
3,223
[ "MIT" ]
0
183a7c96c411e282966604e3cb375ba49e91a88c
https://github.com/bigtreeljc/force_learning/tree/183a7c96c411e282966604e3cb375ba49e91a88c
point_model
import torch import torch.nn as nn import torch.nn.functional as F class point_model(nn.Module): def __init__(self, num_classes): super(point_model, self).__init__() self.mlp1 = nn.Conv1d(3, 64, 1) self.mlp2 = nn.Conv1d(64, 128, 1) self.mlp3 = nn.Conv1d(128, 1024, 1) self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
berkbilir/point-cloud-classification
point_model
false
3,224
[ "MIT" ]
0
4188b317acc8efccb694831b26a3a8564dee5530
https://github.com/berkbilir/point-cloud-classification/tree/4188b317acc8efccb694831b26a3a8564dee5530
SigmaL1SmoothLoss
import torch from torch import nn class SigmaL1SmoothLoss(nn.Module): def forward(self, pred, targ): reg_diff = torch.abs(targ - pred) reg_loss = torch.where(torch.le(reg_diff, 1 / 9), 4.5 * torch.pow( reg_diff, 2), reg_diff - 1 / 18) return reg_loss.mean() def get_inputs():...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
bene401/Practical-Deep-Learning-for-Coders-2.0
SigmaL1SmoothLoss
false
3,225
[ "MIT" ]
0
c648afc6113cfca2f16c50cc13d197be0306ff98
https://github.com/bene401/Practical-Deep-Learning-for-Coders-2.0/tree/c648afc6113cfca2f16c50cc13d197be0306ff98
DuelingNetwork
import torch import torch.nn as nn class DuelingNetwork(nn.Module): def __init__(self, state_size, action_size, seed): super(DuelingNetwork, self).__init__() self.seed = torch.manual_seed(seed) self.action_size = action_size self.fc1 = nn.Linear(state_size, 64) self.relu1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bluebibi/rl_book_codes
DuelingNetwork
false
3,226
[ "MIT" ]
0
ef7fc9993eb66618e4b4e80e59cc2879a8db3522
https://github.com/bluebibi/rl_book_codes/tree/ef7fc9993eb66618e4b4e80e59cc2879a8db3522
QNetwork
import torch import torch.nn as nn class QNetwork(nn.Module): def __init__(self, state_size, action_size, seed): super(QNetwork, self).__init__() self.seed = torch.manual_seed(seed) self.fc1 = nn.Linear(state_size, 32) self.relu1 = nn.PReLU() self.fc2 = nn.Linear(32, 32) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
bluebibi/rl_book_codes
QNetwork
false
3,227
[ "MIT" ]
0
ef7fc9993eb66618e4b4e80e59cc2879a8db3522
https://github.com/bluebibi/rl_book_codes/tree/ef7fc9993eb66618e4b4e80e59cc2879a8db3522
PolicyNetwork
import torch import torch.nn as nn import torch.nn.functional as F class PolicyNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size=256): super(PolicyNetwork, self).__init__() self.num_actions = num_actions self.linear1 = nn.Linear(num_inputs, hidden_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 from torch._inductor.runtime....
bluebibi/rl_book_codes
PolicyNetwork
false
3,228
[ "MIT" ]
0
ef7fc9993eb66618e4b4e80e59cc2879a8db3522
https://github.com/bluebibi/rl_book_codes/tree/ef7fc9993eb66618e4b4e80e59cc2879a8db3522
output
import math import torch import torch.nn as nn class output(nn.Module): def __init__(self, scope=512): super(output, self).__init__() self.conv1 = nn.Conv2d(32, 1, 1) self.sigmoid1 = nn.Sigmoid() self.conv2 = nn.Conv2d(32, 4, 1) self.sigmoid2 = nn.Sigmoid() self.co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
binzh93/EAST
output
false
3,229
[ "MIT" ]
0
b5f66ab1a5dd37b6a5134336d494000e1add6da1
https://github.com/binzh93/EAST/tree/b5f66ab1a5dd37b6a5134336d494000e1add6da1
CNN_2
import torch import torch.nn.functional as F import torch.nn as nn class CNN_2(nn.Module): def __init__(self, input_size, n_feature, output_size): super(CNN_2, self).__init__() self.n_feature = n_feature self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5) self.co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
berthine/Cat_Dog_project
CNN_2
false
3,230
[ "MIT" ]
0
1ea08c7e8f4b44ded8853ecbb3966590f5aea144
https://github.com/berthine/Cat_Dog_project/tree/1ea08c7e8f4b44ded8853ecbb3966590f5aea144
GramMatrix
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): a, b, c, d = input.size() features = input.view(a * b, c * d) G = torch.mm(features, features.t()) return G.div(a * b * c * d) def get_inputs(): return [torch.rand([4, 4, 4, 4])] 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
booiljung/torchtutorials
GramMatrix
false
3,231
[ "MIT" ]
0
827b1bcd0b701c573d7423de277d78a36f6e20d8
https://github.com/booiljung/torchtutorials/tree/827b1bcd0b701c573d7423de277d78a36f6e20d8
ScaleNorm
import torch import torch.nn as nn class ScaleNorm(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.g = nn.Parameter(torch.ones(1)) self.eps = eps def forward(self, x): n = torch.norm(x, dim=-1, keepdim=True).clamp(min=self.eps) return x / n * 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...
blizda/reformer-pytorch
ScaleNorm
false
3,232
[ "MIT" ]
0
f7187d887c3522124d265dd11e4bb42b2f2906c6
https://github.com/blizda/reformer-pytorch/tree/f7187d887c3522124d265dd11e4bb42b2f2906c6
ScaleNorm
import torch from torch import nn class ScaleNorm(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.scale = dim ** -0.5 self.eps = eps self.g = nn.Parameter(torch.ones(1)) def forward(self, x): norm = torch.norm(x, dim=-1, keepdim=True) * self.sc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
booydar/x-transformers
ScaleNorm
false
3,233
[ "MIT" ]
0
97f0a854fdf4df8a3fbf6a580e2375463af3538c
https://github.com/booydar/x-transformers/tree/97f0a854fdf4df8a3fbf6a580e2375463af3538c
RMSNorm
import torch from torch import nn class RMSNorm(nn.Module): def __init__(self, dim, eps=1e-08): super().__init__() self.scale = dim ** -0.5 self.eps = eps self.g = nn.Parameter(torch.ones(dim)) def forward(self, x): norm = torch.norm(x, dim=-1, keepdim=True) * self.sc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
booydar/x-transformers
RMSNorm
false
3,234
[ "MIT" ]
0
97f0a854fdf4df8a3fbf6a580e2375463af3538c
https://github.com/booydar/x-transformers/tree/97f0a854fdf4df8a3fbf6a580e2375463af3538c
SmoothCrossEntropyLoss
import torch import torch.nn.functional as F from torch.nn.modules.loss import _WeightedLoss class SmoothCrossEntropyLoss(_WeightedLoss): def __init__(self, weight=None, reduction='mean', smoothing=0.0): super().__init__(weight=weight, reduction=reduction) self.smoothing = smoothing self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules....
bluetyson/archai
SmoothCrossEntropyLoss
false
3,235
[ "MIT" ]
0
b370a7397cb8703a052d82297ae748a35c6a49c7
https://github.com/bluetyson/archai/tree/b370a7397cb8703a052d82297ae748a35c6a49c7
ActorCriticNetwork
import torch import torch.nn as nn import torch.nn.functional as F class ActorCriticNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size=256): super(ActorCriticNetwork, self).__init__() self.num_actions = num_actions self.critic_linear1 = nn.Linear(num_inputs, hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bluebibi/rl_book_codes
ActorCriticNetwork
false
3,236
[ "MIT" ]
0
ef7fc9993eb66618e4b4e80e59cc2879a8db3522
https://github.com/bluebibi/rl_book_codes/tree/ef7fc9993eb66618e4b4e80e59cc2879a8db3522
AgreementRouting
import torch import torch.nn as nn import torch.nn.functional as F def squash(x): lengths2 = x.pow(2).sum(dim=2) lengths = lengths2.sqrt() x = x * (lengths2 / (1 + lengths2) / lengths).view(x.size(0), x.size(1), 1) return x class AgreementRouting(nn.Module): def __init__(self, input_caps, outpu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
bentrevett/capsules
AgreementRouting
false
3,237
[ "MIT" ]
0
239273de25c607d7a7504e8c6900772fddd15cd3
https://github.com/bentrevett/capsules/tree/239273de25c607d7a7504e8c6900772fddd15cd3
SvmLoss
import torch class SvmLoss(torch.nn.Module): def __init__(self): super(SvmLoss, self).__init__() def forward(self, decisions, targets): targets = targets.float() * 2 - 1 projection_dist = 1 - targets * decisions margin = torch.max(torch.zeros_like(projection_dist), projection...
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...
brainsqueeze/Kaggle-competitions
SvmLoss
false
3,238
[ "MIT" ]
0
e734ca71303619fd2c9a6f10aaf98b2c0a800758
https://github.com/brainsqueeze/Kaggle-competitions/tree/e734ca71303619fd2c9a6f10aaf98b2c0a800758
DPGRUCell
import math import torch from torch import Tensor from torch import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the same as a ``torch.nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
bogdan-kulynych/opacus
DPGRUCell
false
3,239
[ "Apache-2.0" ]
0
e2d13003a179f64920835bc585f3729b8148279f
https://github.com/bogdan-kulynych/opacus/tree/e2d13003a179f64920835bc585f3729b8148279f
GEGLU
import torch from torch.nn import functional as F from torch import nn class GEGLU(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.proj = nn.Linear(dim_in, dim_out * 2) def forward(self, x): x, gate = self.proj(x).chunk(2, dim=-1) return x * F.gelu(ga...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
booydar/x-transformers
GEGLU
false
3,240
[ "MIT" ]
0
97f0a854fdf4df8a3fbf6a580e2375463af3538c
https://github.com/booydar/x-transformers/tree/97f0a854fdf4df8a3fbf6a580e2375463af3538c
DPRNNCell
import math import torch from torch import Tensor from torch import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the same as a ``torch.nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
bogdan-kulynych/opacus
DPRNNCell
false
3,241
[ "Apache-2.0" ]
0
e2d13003a179f64920835bc585f3729b8148279f
https://github.com/bogdan-kulynych/opacus/tree/e2d13003a179f64920835bc585f3729b8148279f
PoolingF
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out ...
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.utils.data impo...
bronemos/contrastive-unpaired-translation-focal
PoolingF
false
3,242
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
DPLSTMCell
import math import torch from torch import Tensor from torch import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional from typing import Tuple class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
bogdan-kulynych/opacus
DPLSTMCell
false
3,243
[ "Apache-2.0" ]
0
e2d13003a179f64920835bc585f3729b8148279f
https://github.com/bogdan-kulynych/opacus/tree/e2d13003a179f64920835bc585f3729b8148279f
LogisticLoss
import torch class LogisticLoss(torch.nn.Module): def __init__(self): super(LogisticLoss, self).__init__() def forward(self, logits, targets, multi_label=False): y = targets.float() n_plus = torch.sum(y, dim=0) n_minus = torch.sum(1.0 - y, dim=0) n_plus_rate = (n_plus...
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...
brainsqueeze/Kaggle-competitions
LogisticLoss
false
3,244
[ "MIT" ]
0
e734ca71303619fd2c9a6f10aaf98b2c0a800758
https://github.com/brainsqueeze/Kaggle-competitions/tree/e734ca71303619fd2c9a6f10aaf98b2c0a800758
MLPDecoder
import torch import torch.nn as nn import torch.nn.functional as F class MLPDecoder(nn.Module): def __init__(self, input_channels, output_channels, set_size, dim, particle_types): super().__init__() self.output_channels = output_channels self.set_size = set_size self.parti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
bostdiek/DarkMachinesAutoEncoder
MLPDecoder
false
3,245
[ "MIT" ]
0
f05f482b1bbd79cd777221bfe0d37e75b72c3e2b
https://github.com/bostdiek/DarkMachinesAutoEncoder/tree/f05f482b1bbd79cd777221bfe0d37e75b72c3e2b
GroupedChannelNorm
import torch import torch.utils.data import torch import torch.nn as nn class GroupedChannelNorm(nn.Module): def __init__(self, num_groups): super().__init__() self.num_groups = num_groups def forward(self, x): shape = list(x.shape) new_shape = [shape[0], self.num_groups, sha...
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.utils.data import torch import torch.nn as nn assert_size_stride =...
bronemos/contrastive-unpaired-translation-focal
GroupedChannelNorm
false
3,246
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
L2Norm
import torch import torch.nn as nn import torch.nn.functional as F class L2Norm(nn.Module): """L2Norm layer across all channels.""" def __init__(self, in_features, scale): super(L2Norm, self).__init__() self.weight = nn.Parameter(torch.Tensor(in_features)) self.reset_parameters(scale)...
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...
bigh2000/torchcv_edit
L2Norm
false
3,247
[ "MIT" ]
0
999da61b9b7441520280f7977239b6fc21c2f019
https://github.com/bigh2000/torchcv_edit/tree/999da61b9b7441520280f7977239b6fc21c2f019
ReshapeF
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out ...
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.utils.data import torch import torch.nn as nn assert_size_stride =...
bronemos/contrastive-unpaired-translation-focal
ReshapeF
false
3,248
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
FusedLeakyReLU
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return F.leaky_relu(input + bias, negative_slope) * scale class FusedLeakyReLU(nn.Module): def __init__(self, channel, negative_slop...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.asse...
bronemos/contrastive-unpaired-translation-focal
FusedLeakyReLU
false
3,249
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
CDFLayer
import torch import torch.nn as nn from torch.nn.parameter import Parameter class CDFLayer(nn.Module): def __init__(self, device='cpu'): super(CDFLayer, self).__init__() self.loc_scale = Parameter(torch.FloatTensor([0.0, 1.0])) def forward(self, x, dim=1): m = torch.distributions.Cau...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
asifr/armisc
CDFLayer
false
3,250
[ "MIT" ]
0
486220ba498353faeb94f70cd8ffe917109526d2
https://github.com/asifr/armisc/tree/486220ba498353faeb94f70cd8ffe917109526d2
ToRGB
import math import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, u...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.utils.data import torch import torch.nn as nn import to...
bronemos/contrastive-unpaired-translation-focal
ToRGB
false
3,251
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
SoftmaxWithTemperature
import torch import torch.nn as nn import torch.cuda import torch.distributed class SoftmaxWithTemperature(nn.Module): def __init__(self, dim=0, alpha=1.0): super(SoftmaxWithTemperature, self).__init__() self._softmax = nn.Softmax(dim) self._alpha = alpha 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 import torch.nn as nn ...
bingrao/Bug-Transformer
SoftmaxWithTemperature
false
3,252
[ "MIT" ]
0
9e39dc553c281f6372b7a8cfc8205aa186645899
https://github.com/bingrao/Bug-Transformer/tree/9e39dc553c281f6372b7a8cfc8205aa186645899
Attention
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the output features from the decoder. .. math:: \\begin{array}{ll} x = context*output \\\\ attn = exp(x_i) / sum_j exp(x_j) \\\\ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bigheiniu/FakeReviewAll
Attention
false
3,253
[ "Apache-2.0" ]
0
b5efc0fe8ad88b5aff986e900f50d4e0b90fbff1
https://github.com/bigheiniu/FakeReviewAll/tree/b5efc0fe8ad88b5aff986e900f50d4e0b90fbff1
FcnBinaryClassifier
import torch import torch.nn.functional as F import torch.nn as nn class FcnBinaryClassifier(nn.Module): """ A fully-connected neural network with a single hidden layer and batchnorm for binary classification. Architecture: Linear(input_size, hidden_size) ReLU() BatchNorm() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
breid1313/nlp_hw3_text_fcn_pytorch
FcnBinaryClassifier
false
3,254
[ "Apache-2.0" ]
0
a4234e90d37e94a3043d9715c90bac7543f4b0ae
https://github.com/breid1313/nlp_hw3_text_fcn_pytorch/tree/a4234e90d37e94a3043d9715c90bac7543f4b0ae
MegatronGelu
import torch import torch.nn import torch.onnx class MegatronGelu(torch.nn.Module): def forward(self, x): return x * 0.5 * (torch.erf(x / 1.41421) + 1.0) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch.onnx assert_size_stride = torch._C._dynamo.guards....
carefreekk/onnxruntime
MegatronGelu
false
3,255
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
SigmoidFocalClassificationLoss
import torch import torch.nn as nn def _sigmoid_cross_entropy_with_logits(logits, labels): loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits) loss += torch.log1p(torch.exp(-torch.abs(logits))) return loss class SigmoidFocalClassificationLoss(nn.Module): """Sigmoid focal cross entrop...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
brudermueller/PointRCNN
SigmoidFocalClassificationLoss
false
3,256
[ "MIT" ]
0
430bb45d6d512ad4e3eb509d65377511361c300f
https://github.com/brudermueller/PointRCNN/tree/430bb45d6d512ad4e3eb509d65377511361c300f
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, ignore_target=-1): super().__init__() self.ignore_target = ignore_target def forward(self, input, target): """ :param input: (N), logit :param target: (N), {0, 1} :return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
brudermueller/PointRCNN
DiceLoss
false
3,257
[ "MIT" ]
0
430bb45d6d512ad4e3eb509d65377511361c300f
https://github.com/brudermueller/PointRCNN/tree/430bb45d6d512ad4e3eb509d65377511361c300f
ModulatedConv2d
import math import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, u...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
bronemos/contrastive-unpaired-translation-focal
ModulatedConv2d
false
3,258
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
MegatronFastGelu
import torch import torch.nn import torch.onnx class MegatronFastGelu(torch.nn.Module): def forward(self, x): return 0.5 * x * (1.0 + torch.tanh(0.7978845608028654 * x * (1.0 + 0.044715 * x * x))) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch.onnx assert_size_stride = torch._C._dynamo.guards....
carefreekk/onnxruntime
MegatronFastGelu
false
3,259
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
CosNorm_Classifier
import math import torch import torch.optim import torch.utils.data import torch.nn as nn from torch.nn.parameter import Parameter class CosNorm_Classifier(nn.Module): def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001 ): super(CosNorm_Classifier, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
caisarl76/BalancedMetaSoftmax-Classification
CosNorm_Classifier
false
3,260
[ "BSD-3-Clause" ]
0
48b9c8af19de261d95a5ef38f5780cbadf7bb64b
https://github.com/caisarl76/BalancedMetaSoftmax-Classification/tree/48b9c8af19de261d95a5ef38f5780cbadf7bb64b
FSPool
import torch import torch.nn as nn def deterministic_sort(s, tau): """ "Stochastic Optimization of Sorting Networks via Continuous Relaxations" https://openreview.net/forum?id=H1eSS3CcKX Aditya Grover, Eric Wang, Aaron Zweig, Stefano Ermon s: input elements to be sorted. Shape: batch_size x n x 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 libdevice, math as tl_math import torc...
bostdiek/DarkMachinesAutoEncoder
FSPool
false
3,261
[ "MIT" ]
0
f05f482b1bbd79cd777221bfe0d37e75b72c3e2b
https://github.com/bostdiek/DarkMachinesAutoEncoder/tree/f05f482b1bbd79cd777221bfe0d37e75b72c3e2b
FourierFeatures
import math import torch from torch import nn class FourierFeatures(nn.Module): def __init__(self, in_features, out_features, std=1.0): super().__init__() assert out_features % 2 == 0 self.weight = nn.Parameter(torch.randn([out_features // 2, in_features]) * std) def forw...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 im...
cansakirt/disco-diffusion
FourierFeatures
false
3,262
[ "MIT" ]
0
a7e9cfc098e1c216f8ab04901e3e9c6dc9ca4edb
https://github.com/cansakirt/disco-diffusion/tree/a7e9cfc098e1c216f8ab04901e3e9c6dc9ca4edb
Embedder
import math import torch import torch.nn as nn import torch.utils.data._utils import torch.nn import torch.optim class Embedder(nn.Module): def __init__(self, dim_in, dim_out): super(Embedder, self).__init__() self.dim_in = dim_in self.dim_out = dim_out self.linear = nn.Linear(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 import torch.nn as nn import torch.utils.data._utils import torch.nn import torc...
badrinarayan/ReAgent
Embedder
false
3,263
[ "BSD-3-Clause" ]
0
d49b02dce53d9a5d5ee077cea7efded507677641
https://github.com/badrinarayan/ReAgent/tree/d49b02dce53d9a5d5ee077cea7efded507677641
NeuralNetPartialNoGradModel
import torch import torch.nn import torch.onnx class NeuralNetPartialNoGradModel(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetPartialNoGradModel, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size).requires_grad_( 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 import triton_helpers import torch.nn import torch....
carefreekk/onnxruntime
NeuralNetPartialNoGradModel
false
3,264
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
SvmProbsLoss
import torch class SvmProbsLoss(torch.nn.Module): def __init__(self): super(SvmProbsLoss, self).__init__() def forward(self, decisions, logits, targets, multi_label=False): y = targets.float() svm_targets = y * 2 - 1 projection_dist = 1 - svm_targets * decisions margi...
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...
brainsqueeze/Kaggle-competitions
SvmProbsLoss
false
3,265
[ "MIT" ]
0
e734ca71303619fd2c9a6f10aaf98b2c0a800758
https://github.com/brainsqueeze/Kaggle-competitions/tree/e734ca71303619fd2c9a6f10aaf98b2c0a800758
SelfDisLoss
import torch from torch import nn from torch import einsum class SelfDisLoss(nn.Module): def __init__(self): super(SelfDisLoss, self).__init__() def forward(self, feat, mean_feat): sim = einsum('nc,nc->n', [feat, mean_feat]) dis = torch.sqrt(2.0 * (1 - sim)) loss = torch.mean...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
catcodee/cluster-contrast-reid
SelfDisLoss
false
3,266
[ "MIT" ]
0
f6359990a4326375f23c3fd654df3fc6dcc9c579
https://github.com/catcodee/cluster-contrast-reid/tree/f6359990a4326375f23c3fd654df3fc6dcc9c579
ShapedSineModel
import torch import torch.utils.data class ShapedSineModel(torch.nn.Module): def __init__(self, theta=None): super(ShapedSineModel, self).__init__() if theta is None: self.freq = torch.nn.Parameter(torch.Tensor([0.1])) else: self.freq = torch.nn.Parameter(torch.Ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asse...
bechtle/LearningToLearn
ShapedSineModel
false
3,267
[ "MIT" ]
0
52eed5359e8a42bd99abe1df554a3b035dd3e2d2
https://github.com/bechtle/LearningToLearn/tree/52eed5359e8a42bd99abe1df554a3b035dd3e2d2
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
import torch import torch.nn import torch.onnx class NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency(torch .nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency , 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 from torch._inductor.runtime....
carefreekk/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
false
3,268
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
NeuralNetNonDifferentiableOutput
import torch import torch.nn import torch.onnx class NeuralNetNonDifferentiableOutput(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetNonDifferentiableOutput, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu = torch....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
carefreekk/onnxruntime
NeuralNetNonDifferentiableOutput
false
3,269
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
LearnableTimeDepWeightedCost
import torch import torch.utils.data class LearnableTimeDepWeightedCost(torch.nn.Module): def __init__(self, time_horizon, dim=9, weights=None): super(LearnableTimeDepWeightedCost, self).__init__() if weights is None: self.weights = torch.nn.Parameter(0.01 * torch.ones([ ...
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_...
bechtle/LearningToLearn
LearnableTimeDepWeightedCost
false
3,270
[ "MIT" ]
0
52eed5359e8a42bd99abe1df554a3b035dd3e2d2
https://github.com/bechtle/LearningToLearn/tree/52eed5359e8a42bd99abe1df554a3b035dd3e2d2
NeuralNetMultiplePositionalArguments
import torch import torch.nn import torch.onnx class NeuralNetMultiplePositionalArguments(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArguments, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
carefreekk/onnxruntime
NeuralNetMultiplePositionalArguments
false
3,271
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
Similarity
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from torch.nn import functional as F class Similarity(nn.Module): def __init__(self, mem_dim, hidden_dim, num_classes): super(Similarity, self).__init__() self.mem_dim = mem_dim self.hidden_dim = hidden_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
carol-hsu/relay-bench
Similarity
false
3,272
[ "Apache-2.0" ]
0
0facffedb3cbb0d5f110769a84bba68718cff72b
https://github.com/carol-hsu/relay-bench/tree/0facffedb3cbb0d5f110769a84bba68718cff72b
Downsample
import torch import torch.nn as nn import torch.nn.functional as F class Downsample(nn.Module): def __init__(self, in_ch=None, out_ch=None, with_conv=False, fir=False, fir_kernel=(1, 3, 3, 1)): super().__init__() out_ch = out_ch if out_ch else in_ch if not fir: if with...
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...
chen-hao-chao/dlsm
Downsample
false
3,273
[ "Apache-2.0" ]
0
aea88aa7e59a02fe44f25f4de9d6f2eaf044093b
https://github.com/chen-hao-chao/dlsm/tree/aea88aa7e59a02fe44f25f4de9d6f2eaf044093b
ModelClassifier
import torch from torch import nn import torch.nn.functional as F class ModelClassifier(nn.Module): """ This class creates new classifier to update the pre-trained Neural Network. """ def __init__(self, in_features, hidden_features, hidden_features2, out_features=102, drop_prob=0.25): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
carlosmertens/Flowers-Classifier
ModelClassifier
false
3,274
[ "MIT" ]
0
d454348e3f6eba4e0c176f5e8e05c8a4f6fe9ba2
https://github.com/carlosmertens/Flowers-Classifier/tree/d454348e3f6eba4e0c176f5e8e05c8a4f6fe9ba2
AddReadout
import torch import torch.nn as nn class AddReadout(nn.Module): def __init__(self, start_index=1): super(AddReadout, self).__init__() self.start_index = start_index def forward(self, x): if self.start_index == 2: readout = (x[:, 0] + x[:, 1]) / 2 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
blguweb/Tap-Tap-computer
AddReadout
false
3,275
[ "MIT" ]
0
4e2007b5a31e6d5f902b1e3ca58206870331ef07
https://github.com/blguweb/Tap-Tap-computer/tree/4e2007b5a31e6d5f902b1e3ca58206870331ef07
Network
import torch import torch.nn as nn import torch.nn.functional as F class Network(nn.Module): def __init__(self): super().__init__() self.hidden1 = nn.Linear(4, 1) self.hidden2 = nn.Linear(1, 16) self.output = nn.Linear(16, 1) def forward(self, x): x = F.relu(self.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 import triton_helpers import torch.nn as nn assert_...
chathurawidanage/cylon
Network
false
3,276
[ "Apache-2.0" ]
0
ac61b7a50880138fe67de21adee208016a94979a
https://github.com/chathurawidanage/cylon/tree/ac61b7a50880138fe67de21adee208016a94979a
SimpleGate
import torch import torch.cuda import torch.distributed class SimpleGate(torch.nn.Module): def __init__(self, dim): super(SimpleGate, self).__init__() self.gate = torch.nn.Linear(2 * dim, dim, bias=True) self.sig = torch.nn.Sigmoid() def forward(self, in1, in2): z = self.sig(...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.cuda import torch.distributed assert_size_stride = torch._C._dynamo...
chardmeier/OpenNMT-py
SimpleGate
false
3,277
[ "MIT" ]
0
8ef64d10c507418102af42551c0f335270cb5b51
https://github.com/chardmeier/OpenNMT-py/tree/8ef64d10c507418102af42551c0f335270cb5b51
EALSTM
import torch from typing import Tuple import torch.nn as nn class EALSTM(nn.Module): """Implementation of the Entity-Aware-LSTM (EA-LSTM) TODO: Include paper ref and latex equations Parameters ---------- input_size_dyn : int Number of dynamic features, which are those, passed to the LSTM...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
bernharl/CamelsML
EALSTM
false
3,278
[ "Apache-2.0" ]
0
4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
https://github.com/bernharl/CamelsML/tree/4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
GeneralizedMeanPoolingFpn
import torch from abc import ABC from torch import nn class GeneralizedMeanPoolingFpn(nn.Module, ABC): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At p = infinity, one gets...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from abc import ABC from tor...
catcodee/cluster-contrast-reid
GeneralizedMeanPoolingFpn
false
3,279
[ "MIT" ]
0
f6359990a4326375f23c3fd654df3fc6dcc9c579
https://github.com/catcodee/cluster-contrast-reid/tree/f6359990a4326375f23c3fd654df3fc6dcc9c579
HeatmapLoss
import torch import torch.nn as nn import torch.utils.data import torch.nn.parallel import torch.optim import torch.utils.data.distributed import torch.multiprocessing class HeatmapLoss(nn.Module): def __init__(self): super().__init__() def forward(self, pred, gt, mask): assert pred.size() =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.nn.parallel import torch.optim import torch.utils.data.distributed import torch.m...
chaowentao/DEKRv2
HeatmapLoss
false
3,280
[ "MIT" ]
0
e092c3eb10766b099a8a9681dc26f9eb781ec070
https://github.com/chaowentao/DEKRv2/tree/e092c3eb10766b099a8a9681dc26f9eb781ec070
Linear_QNet
import torch import torch.nn as nn class Linear_QNet(nn.Module): def __init__(self, input_size, hidden_size_1, hidden_size_2, output_size): super().__init__() self.linear1 = nn.Linear(input_size, hidden_size_1) self.leakyrelu = nn.LeakyReLU() self.linear2 = nn.Linear(hidden_size_1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
cheapmouse94/Machine-Learning-tank1990-python
Linear_QNet
false
3,281
[ "MIT" ]
0
8b75983289c7bc0831827561cec12d4ad2addee2
https://github.com/cheapmouse94/Machine-Learning-tank1990-python/tree/8b75983289c7bc0831827561cec12d4ad2addee2
Actor
import torch import torch.nn.functional as F class Actor(torch.nn.Module): """Defines custom model Inherits from torch.nn.Module """ def __init__(self, dim_input, dim_output): super(Actor, self).__init__() self._dim_input = dim_input self._dim_output = dim_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 assert_size_stride = torch._C...
cheng-xie/dpgfddagger
Actor
false
3,282
[ "MIT" ]
0
5264d5b9e0ab76fc9620da63bcfd78b25dadcbec
https://github.com/cheng-xie/dpgfddagger/tree/5264d5b9e0ab76fc9620da63bcfd78b25dadcbec
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, dim_input, dim_output): super(Critic, self).__init__() self._dim_input = dim_input self._dim_output = dim_output H_LAYER1 = 50 H_LAYER2 = 20 self.linear1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
cheng-xie/dpgfddagger
Critic
false
3,283
[ "MIT" ]
0
5264d5b9e0ab76fc9620da63bcfd78b25dadcbec
https://github.com/cheng-xie/dpgfddagger/tree/5264d5b9e0ab76fc9620da63bcfd78b25dadcbec
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency
import torch import torch.nn import torch.onnx class NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency(torch. nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency, self).__init__() s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
carefreekk/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithDependency
false
3,284
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
ResidualBlock
import torch import torch.nn as nn from functools import partial def ncsn_conv3x3(in_planes, out_planes, stride=1, bias=True, dilation=1, init_scale=1.0, padding=1): """3x3 convolution with PyTorch initialization. Same as NCSNv1/NCSNv2.""" init_scale = 1e-10 if init_scale == 0 else init_scale conv = n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
chen-hao-chao/dlsm
ResidualBlock
false
3,285
[ "Apache-2.0" ]
0
aea88aa7e59a02fe44f25f4de9d6f2eaf044093b
https://github.com/chen-hao-chao/dlsm/tree/aea88aa7e59a02fe44f25f4de9d6f2eaf044093b
Attention
import math import torch from torch import nn from torch.functional import F import torch.nn.functional as F class Attention(nn.Module): """ Scaled Dot-Product Attention proposed in "Attention Is All You Need" Compute the dot products of the query with all keys, divide each by sqrt(dim), and apply a s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
chentuochao/Learn_attention_and_transformer
Attention
false
3,286
[ "MIT" ]
0
3934ea3b700c6b8c0709057700372c531f43345f
https://github.com/chentuochao/Learn_attention_and_transformer/tree/3934ea3b700c6b8c0709057700372c531f43345f
LateralBlock
import torch import torch.nn as nn import torch.nn.functional as F class LateralBlock(nn.Module): def __init__(self, c_planes, p_planes, out_planes): super(LateralBlock, self).__init__() self.lateral = nn.Conv2d(c_planes, p_planes, kernel_size=1, padding =0, stride=1) self.top...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
chicm/detect
LateralBlock
false
3,287
[ "Apache-2.0" ]
0
c1b611344d102fd7e94d94c678a44339e18ddd21
https://github.com/chicm/detect/tree/c1b611344d102fd7e94d94c678a44339e18ddd21
AvgPool
import torch from torch import nn import torch.utils.data import torch.nn.functional as F import torch.utils import torch.cuda class AvgPool(nn.Module): def __init__(self, in_channels, reduction, save_device=torch.device('cpu') ): super(AvgPool, self).__init__() self.save_device = save_de...
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 import torch.utils import torch.cuda assert_size_stride = torch._C._dynamo.guards.assert_size_s...
chomin/BayesNAS
AvgPool
false
3,288
[ "Apache-2.0" ]
0
7b1d991d1e10213fa999eab513d1e12fe4bb571b
https://github.com/chomin/BayesNAS/tree/7b1d991d1e10213fa999eab513d1e12fe4bb571b
Conv2d
from torch.autograd import Function import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def _setup_kernel(k): k = np.asarray(k, dtype=np.float32) if k.ndim == 1: k = np.outer(k, k) k /= np.sum(k) assert k.ndim == 2 assert k.shape[0] == k.shape[1] retur...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 import numpy as np import torch.nn as nn imp...
chen-hao-chao/dlsm
Conv2d
false
3,289
[ "Apache-2.0" ]
0
aea88aa7e59a02fe44f25f4de9d6f2eaf044093b
https://github.com/chen-hao-chao/dlsm/tree/aea88aa7e59a02fe44f25f4de9d6f2eaf044093b
MiniBatchAverageLayer
import torch import torch.nn as nn import torch.fft class MiniBatchAverageLayer(nn.Module): """Minibatch stat concatenation layer. Implementation is from https://github.com/shanexn/pytorch-pggan.""" def __init__(self, offset=1e-08): super().__init__() self.offset = offset def forward(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.triton_helpers import libdevice import torch.nn as nn import torch.fft assert_size_stride = torch._C._dynamo.gu...
catherine-qian/image2reverb
MiniBatchAverageLayer
false
3,290
[ "MIT" ]
0
0fbcb35d6252dc8652cf98af0e64371cb81967e4
https://github.com/catherine-qian/image2reverb/tree/0fbcb35d6252dc8652cf98af0e64371cb81967e4
InnerProductDecoder
import torch import torch.nn as nn import torch.nn.functional as F class InnerProductDecoder(nn.Module): """ Description of InnerProductDecoder Inheritance: nn.Module: """ def __init__(self, activation=torch.sigmoid, dropout=0.1): super(InnerProductDecoder, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ciortanmadalina/graph-sc-package
InnerProductDecoder
false
3,291
[ "MIT" ]
0
df920f0acfa7b596a4d677df011e8ece51136949
https://github.com/ciortanmadalina/graph-sc-package/tree/df920f0acfa7b596a4d677df011e8ece51136949
WeightedFeatureFusion
import torch import torch.nn as nn class WeightedFeatureFusion(nn.Module): def __init__(self, layers, weight=False): super(WeightedFeatureFusion, self).__init__() self.layers = layers self.weight = weight self.n = len(layers) + 1 if weight: self.w = nn.Paramete...
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...
cititude/Media-and-Cognition-Homework
WeightedFeatureFusion
false
3,292
[ "MIT" ]
0
dabaaef6d8ec115171e7115731c5f76b518d9bde
https://github.com/cititude/Media-and-Cognition-Homework/tree/dabaaef6d8ec115171e7115731c5f76b518d9bde
MaxPool
import torch from torch import nn import torch.utils.data import torch.nn.functional as F import torch.utils import torch.cuda class MaxPool(nn.Module): def __init__(self, in_channels, reduction, save_device=torch.device('cpu') ): super(MaxPool, self).__init__() self.save_device = save_de...
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 import torch.utils import torch.cuda assert_...
chomin/BayesNAS
MaxPool
false
3,293
[ "Apache-2.0" ]
0
7b1d991d1e10213fa999eab513d1e12fe4bb571b
https://github.com/chomin/BayesNAS/tree/7b1d991d1e10213fa999eab513d1e12fe4bb571b
StochasticGate
import torch import torchvision.transforms.functional as F import torch.nn as nn import torch.nn.functional as F class StochasticGate(nn.Module): """Stochastically merges features from two levels with varying size of the receptive field """ def __init__(self): super(StochasticGate, self).__i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
candacelax/1-stage-wseg
StochasticGate
false
3,294
[ "Apache-2.0" ]
0
7a24791a3a78454e6611399ba55a808491551543
https://github.com/candacelax/1-stage-wseg/tree/7a24791a3a78454e6611399ba55a808491551543
HingeLoss
import torch import torch.nn as nn import torch.nn.functional as F class HingeLoss(nn.Module): """Hinge loss function module for multi-label classification""" def __init__(self, margin=1.0, power=2, cost_weighted=False): """ Args: margin (float, optional): margin for the hinge los...
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...
cjhsieh/pecos
HingeLoss
false
3,295
[ "Apache-2.0", "BSD-3-Clause" ]
0
22e88ee544d5a5e891a1d23a578881fdf26dfcf7
https://github.com/cjhsieh/pecos/tree/22e88ee544d5a5e891a1d23a578881fdf26dfcf7
FCLayer
import torch from torch import Tensor import torch.nn as nn class FCLayer(nn.Module): def __init__(self, input_dim: 'int', output_dim: 'int', dropout_rate: 'float'=0.0, use_activation: 'bool'=True) ->None: super(FCLayer, self).__init__() self.use_activation = use_activation self.d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
cjber/georelations
FCLayer
false
3,296
[ "MIT" ]
0
fe97e62a950b556c88be6e43fc67a55a16a65938
https://github.com/cjber/georelations/tree/fe97e62a950b556c88be6e43fc67a55a16a65938
GeneralizedMeanPoolingList
import torch from abc import ABC from torch import nn class GeneralizedMeanPoolingList(nn.Module, ABC): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)` - At p = infinity, one get...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from abc import ABC from torch import nn assert_size_stride = torch._C._dynamo.guards.ass...
catcodee/cluster-contrast-reid
GeneralizedMeanPoolingList
false
3,297
[ "MIT" ]
0
f6359990a4326375f23c3fd654df3fc6dcc9c579
https://github.com/catcodee/cluster-contrast-reid/tree/f6359990a4326375f23c3fd654df3fc6dcc9c579
Model
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ An example pytorch model for classifying iris flower """ def __init__(self, input_dim=4, output_dim=3): super(Model, self).__init__() self.layer1 = nn.Linear(input_dim, 50) self.laye...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
clam004/docker-pytorch-api
Model
false
3,298
[ "MIT" ]
0
2ba390ea581c774e8bdfa1ad434b42181376430f
https://github.com/clam004/docker-pytorch-api/tree/2ba390ea581c774e8bdfa1ad434b42181376430f
FCDiscriminator
import torch import torch.nn as nn class FCDiscriminator(nn.Module): def __init__(self, num_classes, ndf=64): super().__init__() self.conv1 = nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2, padding=1) self.conv2 = nn.Conv2d(ndf, ndf * 2, kernel_size=4, stride=2, padding=1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ciampluca/unsupervised_counting
FCDiscriminator
false
3,299
[ "MIT" ]
0
4445d48f68da75359643bcf3003e90ef61d817e3
https://github.com/ciampluca/unsupervised_counting/tree/4445d48f68da75359643bcf3003e90ef61d817e3
TransformerLinearXMCHead
import torch import numpy as np import torch.nn as nn class TransformerLinearXMCHead(nn.Module): """XMC head for Transformers Containing label weight embeddings and label bias embeddings """ def __init__(self, hidden_size, num_labels): super().__init__() self.label_pad = num_labels ...
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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
cjhsieh/pecos
TransformerLinearXMCHead
false
3,300
[ "Apache-2.0", "BSD-3-Clause" ]
0
22e88ee544d5a5e891a1d23a578881fdf26dfcf7
https://github.com/cjhsieh/pecos/tree/22e88ee544d5a5e891a1d23a578881fdf26dfcf7
InitialSpanEncoder
import torch from torch import Tensor from torch.nn.modules.transformer import TransformerEncoderLayer class InitialSpanEncoder(TransformerEncoderLayer): """ The initial layer for the Segmental Transformer Encoder. Representations of the source sequence attend over all unmasked positions in the sequence ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cmdowney88/XLSLM
InitialSpanEncoder
false
3,301
[ "MIT" ]
0
7fe266bd0f0ad8a79a30052a18104b974d1c32e8
https://github.com/cmdowney88/XLSLM/tree/7fe266bd0f0ad8a79a30052a18104b974d1c32e8
SegmentalTransformerEncoder
import torch import numpy as np from torch import Tensor import torch.nn as nn from torch.nn.modules.transformer import TransformerEncoderLayer from torch.nn.modules.transformer import _get_clones class InitialSpanEncoder(TransformerEncoderLayer): """ The initial layer for the Segmental Transformer Encoder. R...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
cmdowney88/XLSLM
SegmentalTransformerEncoder
false
3,302
[ "MIT" ]
0
7fe266bd0f0ad8a79a30052a18104b974d1c32e8
https://github.com/cmdowney88/XLSLM/tree/7fe266bd0f0ad8a79a30052a18104b974d1c32e8
Encoder
import torch import torch.nn as nn import torch.nn.functional as F class Encoder(nn.Module): def __init__(self, out_dim=64): super(Encoder, self).__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1) self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=1, padding=1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
cloughurd/SimCLR
Encoder
false
3,303
[ "MIT" ]
0
79029b6cb422aa16c939bcc550ca4acd495c2651
https://github.com/cloughurd/SimCLR/tree/79029b6cb422aa16c939bcc550ca4acd495c2651
VarifocalLoss
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data.distributed def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tenso...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
cocopambag/insightface
VarifocalLoss
false
3,304
[ "MIT" ]
0
c33102e4844520cda6c2b3df63278aed935e2f4e
https://github.com/cocopambag/insightface/tree/c33102e4844520cda6c2b3df63278aed935e2f4e
CReLU_IN
import torch import torch.nn as nn import torch.nn.functional as F class CReLU_IN(nn.Module): def __init__(self, channels): super(CReLU_IN, self).__init__() self.bn = nn.InstanceNorm2d(channels * 2, eps=1e-05, momentum=0.1, affine=True) def forward(self, x): cat = torch.c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
cnzeki/PSENet
CReLU_IN
false
3,305
[ "Apache-2.0" ]
0
c7e0785404e12866171e9da678736abae9cdb8cb
https://github.com/cnzeki/PSENet/tree/c7e0785404e12866171e9da678736abae9cdb8cb
CReLU
import torch import torch.nn as nn import torch.nn.functional as F class CReLU(nn.Module): def __init__(self): super(CReLU, self).__init__() def forward(self, x): return torch.cat((F.leaky_relu(x, 0.01, inplace=True), F.leaky_relu (-x, 0.01, inplace=True)), 1) def get_inputs():...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
cnzeki/PSENet
CReLU
false
3,306
[ "Apache-2.0" ]
0
c7e0785404e12866171e9da678736abae9cdb8cb
https://github.com/cnzeki/PSENet/tree/c7e0785404e12866171e9da678736abae9cdb8cb
MultiheadAttention
import torch import torch.nn as nn import torch.utils.data.distributed class MultiheadAttention(nn.Module): """A warpper for torch.nn.MultiheadAttention. This module implements MultiheadAttention with residual connection, and positional encoding used in DETR is also passed as input. Args: em...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cocopambag/insightface
MultiheadAttention
false
3,307
[ "MIT" ]
0
c33102e4844520cda6c2b3df63278aed935e2f4e
https://github.com/cocopambag/insightface/tree/c33102e4844520cda6c2b3df63278aed935e2f4e
BasicBlockIn
import torch import torch.nn as nn from torch.nn import InstanceNorm2d class BasicBlockIn(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1, downsample=None): super(BasicBlockIn, self).__init__() self.conv1 = nn.Conv2d(inplanes, planes, kernel_size=3, stride= ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cnzeki/PSENet
BasicBlockIn
false
3,308
[ "Apache-2.0" ]
0
c7e0785404e12866171e9da678736abae9cdb8cb
https://github.com/cnzeki/PSENet/tree/c7e0785404e12866171e9da678736abae9cdb8cb
SLMLexicon
import torch from torch import Tensor from typing import Tuple import torch.nn as nn class SLMLexicon(nn.Module): """ The optional "Lexicon" or "Memory" component of the Segmental Language Model. Decodes context/position encodings to logits over a segmental vocabulary, as well as a mixture proportion ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
cmdowney88/XLSLM
SLMLexicon
false
3,309
[ "MIT" ]
0
7fe266bd0f0ad8a79a30052a18104b974d1c32e8
https://github.com/cmdowney88/XLSLM/tree/7fe266bd0f0ad8a79a30052a18104b974d1c32e8
CrossEntropy
import torch import torch.nn as nn import torch.nn.functional as F class CrossEntropy(nn.Module): def __init__(self, is_weight=False, weight=[]): super(CrossEntropy, self).__init__() self.is_weight = is_weight self.weight = weight def forward(self, input, target, batchsize=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 math as tl_math import torch.nn as nn ...
coolservices/rock-fracture-identification
CrossEntropy
false
3,310
[ "Apache-2.0" ]
0
3e7349be7e76dc87800c630f53f8d1ad5673d28b
https://github.com/coolservices/rock-fracture-identification/tree/3e7349be7e76dc87800c630f53f8d1ad5673d28b