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
L2loss
import torch class L2loss(torch.nn.Module): def __init__(self): super(L2loss, self).__init__() def forward(self, y, yhat): loss = (y - yhat).pow(2).sum() / y.shape[0] return loss 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 from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
btolooshams/densae
L2loss
false
6,365
[ "MIT" ]
1
a1e4c4cc1b4be0386d42136f2695615ea3cf4815
https://github.com/btolooshams/densae/tree/a1e4c4cc1b4be0386d42136f2695615ea3cf4815
FeedForwardActorNN
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class FeedForwardActorNN(nn.Module): def __init__(self, in_dim, out_dim, is_discrete): super(FeedForwardActorNN, self).__init__() self.layer1 = nn.Linear(in_dim, 64) self.layer2 = nn.Linear(64, 64) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
britig/policy-refinement-bo
FeedForwardActorNN
false
6,366
[ "MIT" ]
1
c8a1e347d6e27c991e945afae9b5d9b482806f4b
https://github.com/britig/policy-refinement-bo/tree/c8a1e347d6e27c991e945afae9b5d9b482806f4b
Disc
import torch from torch import nn from torch.nn import functional as F class MLP(nn.Module): """ Multi-Layer Perceptron :param in_dim: int, size of input feature :param n_classes: int, number of output classes :param hidden_dim: int, size of hidden vector :param dropout: 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 import nn from torch.nn import functional as F assert_size_stride = t...
bigdata-ustc/DisenQNet
Disc
false
6,367
[ "MIT" ]
1
908fadeb9b8d278450213deff70205703bd91da6
https://github.com/bigdata-ustc/DisenQNet/tree/908fadeb9b8d278450213deff70205703bd91da6
MultiheadAttentionWrapper
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import weight_norm from torch.optim.lr_scheduler import * import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler def linear(x): return x def activation(func_a): """Activatio...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F from torch.nn.utils import weight_norm from torch.optim.lr_scheduler import * import t...
brightgems/BartWithRL
MultiheadAttentionWrapper
false
6,368
[ "MIT" ]
1
17614c4009ec976cdc73dacaf94573a6d8f6d529
https://github.com/brightgems/BartWithRL/tree/17614c4009ec976cdc73dacaf94573a6d8f6d529
CNNCifar
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.nn.functional as F class CNNCifar(nn.Module): def __init__(self, args): super(CNNCifar, self).__init__() self.conv1 = nn.Conv2d(3, 64, 5) self.pool1 = nn.MaxPool2d(2, 2) self.conv2 = nn.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 import nn assert_s...
bobvo23/Federated-Learning-PyTorch
CNNCifar
false
6,369
[ "MIT" ]
1
e5cffe8f39cfad76c13c78b9f1c6ef0976e4cc81
https://github.com/bobvo23/Federated-Learning-PyTorch/tree/e5cffe8f39cfad76c13c78b9f1c6ef0976e4cc81
MLP
import torch import torch as th import torch.nn as nn class MLP(nn.Module): def __init__(self, input_size, output_size, hidden=128): super(MLP, self).__init__() self.linear1 = nn.Linear(input_size, hidden, bias=False) self.linear2 = nn.Linear(hidden, output_size, bias=False) 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 libdevice import torch.nn as ...
bwubrian/cherry
MLP
false
6,370
[ "Apache-2.0" ]
1
de0cd2d833336144bce2a0b97e4dad40cbd78d7c
https://github.com/bwubrian/cherry/tree/de0cd2d833336144bce2a0b97e4dad40cbd78d7c
Parseval_Conv2d
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn class Parseval_Conv2d(nn.Conv2d): def forward(self, input): new_weight = self.weight / np.sqrt(2 * self.kernel_size[0] * self. kernel_size[1] + 1) return F.conv2d(input, new_weight, self.bias, self.s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
cadurosar/laplacian_networks
Parseval_Conv2d
false
6,371
[ "MIT" ]
1
27f6f2d7145426b38f578e9c1beecae3e7392f1b
https://github.com/cadurosar/laplacian_networks/tree/27f6f2d7145426b38f578e9c1beecae3e7392f1b
SuperLoss
import torch import torch.utils.data from torch import nn import torch class netMSELoss(nn.Module): def __init__(self): super().__init__() def forward(self, output, target): return self.computeLoss(output, target) def computeLoss(self, output, target): loss = torch.mean((output ...
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 from torch import nn import torch assert_size_stride = torch._C._...
brown-ivl/beacon
SuperLoss
false
6,372
[ "MIT" ]
1
66a1714473b362294f787f261561e39c52f00e42
https://github.com/brown-ivl/beacon/tree/66a1714473b362294f787f261561e39c52f00e42
Bicubic
import torch import torch.nn as nn import torch.nn.functional as F class Bicubic(nn.Module): def __init__(self, scale_factor=2): super().__init__() self.scale_factor = scale_factor def forward(self, inputs): bicubic_output = F.interpolate(inputs, scale_factor=self. 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...
bui-thanh-lam/image-super-resolution
Bicubic
false
6,373
[ "BSD-2-Clause" ]
1
8eee69c9fdd3aaf760fabfb5a294f083c7ddf4ac
https://github.com/bui-thanh-lam/image-super-resolution/tree/8eee69c9fdd3aaf760fabfb5a294f083c7ddf4ac
FCBottleNeck
import torch import torch.utils.data import torch.nn.functional as F from torch import nn import torch class FCBottleNeck(nn.Module): def __init__(self, InFeatureSize): super().__init__() self.FC1 = nn.Linear(InFeatureSize, 2048) self.FC2 = nn.Linear(2048, 2048) self.FC3 = nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data from ...
brown-ivl/beacon
FCBottleNeck
false
6,374
[ "MIT" ]
1
66a1714473b362294f787f261561e39c52f00e42
https://github.com/brown-ivl/beacon/tree/66a1714473b362294f787f261561e39c52f00e42
CustomizedNet
import torch import torch.nn as nn import torch.utils.data.distributed class CustomizedNet(nn.Module): def __init__(self, dropout, input_size, input_feature_num, hidden_dim, output_size): """ Simply use linear layers for multi-variate single-step forecasting. """ super()._...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
cabuliwallah/analytics-zoo
CustomizedNet
false
6,375
[ "Apache-2.0" ]
1
5e662bd01c5fc7eed412973119594cf2ecea8b11
https://github.com/cabuliwallah/analytics-zoo/tree/5e662bd01c5fc7eed412973119594cf2ecea8b11
Policy
import torch import torch.nn as nn import torch.nn.functional as F class Policy(nn.Module): """ implements both actor and critic in one model """ def __init__(self): super(Policy, self).__init__() self.affine1 = nn.Linear(4, 128) self.action_head = nn.Linear(128, 2) 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....
caimingxue/Reinforcement-Learning
Policy
false
6,376
[ "MIT" ]
1
5ccb8a6a25b41526f4d6195e69964245abc46d38
https://github.com/caimingxue/Reinforcement-Learning/tree/5ccb8a6a25b41526f4d6195e69964245abc46d38
Decoder
import torch import torch.nn as nn import torch.nn.functional as F class RC(nn.Module): """ A wrapper class for ReflectionPad2d, Conv2d and an optional relu """ def __init__(self, in_dim, out_dim, kernel_size=3, padding=1, activation_function=True): super().__init__() self.pad...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
benningtonlee7/AdaIn_Style_Transfer_From_Scratch_In_Pytorch
Decoder
false
6,377
[ "MIT" ]
1
50dfe4bdcbcdd0f4e647f9ee45de2a3f81eb6722
https://github.com/benningtonlee7/AdaIn_Style_Transfer_From_Scratch_In_Pytorch/tree/50dfe4bdcbcdd0f4e647f9ee45de2a3f81eb6722
DurationPredictorLoss
import torch class DurationPredictorLoss(torch.nn.Module): """Loss function module for duration predictor. The loss value is Calculated in log domain to make it Gaussian. """ def __init__(self, offset=1.0): """Initilize duration predictor loss module. Args: offset (floa...
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...
carankt/FastSpeech2-1
DurationPredictorLoss
false
6,378
[ "Apache-2.0" ]
1
42c06e4fbdf741a0719154d1cb4617b7d3f15a5c
https://github.com/carankt/FastSpeech2-1/tree/42c06e4fbdf741a0719154d1cb4617b7d3f15a5c
MessageNorm
import torch from torch import Tensor import torch.nn.functional as F from torch.nn import Parameter import torch.fx import torch.utils.data from inspect import Parameter from torch.nn.parameter import Parameter class MessageNorm(torch.nn.Module): """Applies message normalization over the aggregated messages as d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import Paramet...
camus1337/pytorch_geometric
MessageNorm
false
6,379
[ "MIT" ]
1
38514197a327541eb47abb69d4ab224910852605
https://github.com/camus1337/pytorch_geometric/tree/38514197a327541eb47abb69d4ab224910852605
PGNetwork
import torch import torch.nn as nn import torch.nn.functional as F class PGNetwork(nn.Module): def __init__(self, state_dim, action_dim): super(PGNetwork, self).__init__() self.fc1 = nn.Linear(state_dim, 20) self.fc2 = nn.Linear(20, action_dim) def forward(self, x): out = F.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 import torch.nn as nn assert_...
caimingxue/Reinforcement-Learning
PGNetwork
false
6,380
[ "MIT" ]
1
5ccb8a6a25b41526f4d6195e69964245abc46d38
https://github.com/caimingxue/Reinforcement-Learning/tree/5ccb8a6a25b41526f4d6195e69964245abc46d38
LayerNorm
import torch class LayerNorm(torch.nn.Module): def __init__(self, nout: 'int'): super(LayerNorm, self).__init__() self.layer_norm = torch.nn.LayerNorm(nout, eps=1e-12) def forward(self, x: 'torch.Tensor') ->torch.Tensor: x = self.layer_norm(x.transpose(1, -1)) x = x.transpose...
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...
carankt/FastSpeech2-1
LayerNorm
false
6,381
[ "Apache-2.0" ]
1
42c06e4fbdf741a0719154d1cb4617b7d3f15a5c
https://github.com/carankt/FastSpeech2-1/tree/42c06e4fbdf741a0719154d1cb4617b7d3f15a5c
LayerNorm
import torch from torch import Tensor from torch.nn import Parameter from torch.nn import LayerNorm from typing import Optional import torch.fx from typing import Any import torch.utils.data from inspect import Parameter from torch.nn.parameter import Parameter def maybe_num_nodes(edge_index, num_nodes=None): if ...
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 Tensor fro...
camus1337/pytorch_geometric
LayerNorm
false
6,382
[ "MIT" ]
1
38514197a327541eb47abb69d4ab224910852605
https://github.com/camus1337/pytorch_geometric/tree/38514197a327541eb47abb69d4ab224910852605
MultiLayeredConv1d
import torch class MultiLayeredConv1d(torch.nn.Module): """Multi-layered conv1d for Transformer block. This is a module of multi-leyered conv1d designed to replace positionwise feed-forward network in Transforner block, which is introduced in `FastSpeech: Fast, Robust and Controllable Text to Speech`_. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
carankt/FastSpeech2-1
MultiLayeredConv1d
false
6,383
[ "Apache-2.0" ]
1
42c06e4fbdf741a0719154d1cb4617b7d3f15a5c
https://github.com/carankt/FastSpeech2-1/tree/42c06e4fbdf741a0719154d1cb4617b7d3f15a5c
DepthConv2d
import torch import torch.nn as nn class DepthConv2d(nn.Module): def __init__(self, input_channel, hidden_channel, kernel, padding, dilation=1): super(DepthConv2d, self).__init__() self.conv2d = nn.Conv2d(input_channel, hidden_channel, 1) self.padding = padding self.dconv2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
c-ma13/sepTFNet
DepthConv2d
false
6,384
[ "MIT" ]
1
a06c89c080f9449ac2e5090f80d9645deea7f23a
https://github.com/c-ma13/sepTFNet/tree/a06c89c080f9449ac2e5090f80d9645deea7f23a
SequenceQuantizerSoftEMA
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda class SequenceQuantizerSoftEMA(nn.Module): def __init__(self, codebook_size, d_model, l1_cost=1000, entropy_cost= 5e-05, num_samples=10, temp=1.0, epsilon=1e-05, padding_idx=None): super(SequenceQuantizerSoftEMA,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
brcsomnath/SemAE
SequenceQuantizerSoftEMA
false
6,385
[ "MIT" ]
1
8da5de73a5b334c6cb0b22eadaaacc35e98126ed
https://github.com/brcsomnath/SemAE/tree/8da5de73a5b334c6cb0b22eadaaacc35e98126ed
BertAttention
from _paritybench_helpers import _mock_config import math import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, 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....
caldoe/BERT-NL2SPARQL
BertAttention
false
6,386
[ "MIT" ]
1
2e09c1aeffc855bc7f1dc8c182e21153b2bc73a8
https://github.com/caldoe/BERT-NL2SPARQL/tree/2e09c1aeffc855bc7f1dc8c182e21153b2bc73a8
CTLoss
import torch import torch.nn as nn import torch.onnx def _neg_loss(preds, gt): pos_inds = gt.eq(1) neg_inds = gt.lt(1) neg_weights = torch.pow(1 - gt[neg_inds], 4) loss = 0 for pred in preds: pos_pred = pred[pos_inds] neg_pred = pred[neg_inds] pos_loss = torch.log(pos_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 import triton_helpers import torch.nn as nn import torch.onnx assert_size_stride = torch._C._dynamo.guards.asse...
c464851257/extremenet-lite
CTLoss
false
6,387
[ "BSD-3-Clause" ]
1
331446f2c5d9524d46d2b33823eff02416f43052
https://github.com/c464851257/extremenet-lite/tree/331446f2c5d9524d46d2b33823eff02416f43052
upsampleBlock
import torch import torch.nn as nn def swish(x): return x * torch.sigmoid(x) class upsampleBlock(nn.Module): def __init__(self, in_channels, out_channels): super(upsampleBlock, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, 3, stride=1, padding=1 ) 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
carl-zjr/super-resolution-reconstruction
upsampleBlock
false
6,388
[ "Apache-2.0" ]
1
37b5b42ea6e8864c12a93a7e90d3bf0920f502d4
https://github.com/carl-zjr/super-resolution-reconstruction/tree/37b5b42ea6e8864c12a93a7e90d3bf0920f502d4
SeparableConvBlock
import torch import torch.nn as nn import torch.nn.parallel import torch.optim class SeparableConvBlock(nn.Module): def __init__(self, inplanes, planes): super(SeparableConvBlock, self).__init__() self.depthwise_conv = nn.Conv2d(inplanes, inplanes, 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 import torch.nn as nn import torch.nn.parallel import torch.optim assert_size_st...
carol007/pytorch-ImageNet-CIFAR-COCO-VOC-training
SeparableConvBlock
false
6,389
[ "MIT" ]
1
e8b37046e6fbe914f6a68bbde1fe419c46373c1d
https://github.com/carol007/pytorch-ImageNet-CIFAR-COCO-VOC-training/tree/e8b37046e6fbe914f6a68bbde1fe419c46373c1d
GlobalChannelLayerNorm
import torch import torch.nn as nn class GlobalChannelLayerNorm(nn.Module): """ Global channel layer normalization """ def __init__(self, dim, eps=1e-05, elementwise_affine=True): super(GlobalChannelLayerNorm, self).__init__() self.eps = eps self.normalized_dim = dim 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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
c-ma13/sepTFNet
GlobalChannelLayerNorm
false
6,390
[ "MIT" ]
1
a06c89c080f9449ac2e5090f80d9645deea7f23a
https://github.com/c-ma13/sepTFNet/tree/a06c89c080f9449ac2e5090f80d9645deea7f23a
HighwayNetwork
import torch import torch.nn as nn import torch.nn.functional as F class HighwayNetwork(nn.Module): def __init__(self, size): super().__init__() self.W1 = nn.Linear(size, size) self.W2 = nn.Linear(size, size) self.W1.bias.data.fill_(0.0) def forward(self, x): x1 = sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
cassiavb/Tacotron
HighwayNetwork
false
6,391
[ "MIT" ]
1
946408f8cd7b5fe9c53931c631267ba2a723910d
https://github.com/cassiavb/Tacotron/tree/946408f8cd7b5fe9c53931c631267ba2a723910d
LevelVariabilityLoss
import torch import torch.nn as nn class LevelVariabilityLoss(nn.Module): """Computes the variability penalty for the level. levels: levels obtained from exponential smoothing component of ESRNN. tensor with shape (batch, n_time). level_variability_penalty: float. return: level_var_loss """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
cchallu/esrnn
LevelVariabilityLoss
false
6,392
[ "MIT" ]
1
543ca365c70be2775a4b5863820b246071ccde3c
https://github.com/cchallu/esrnn/tree/543ca365c70be2775a4b5863820b246071ccde3c
MultiHeadedAttention
import math import torch import numpy as np from typing import Optional from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention layer :param int n_head: the number of head s :param int n_feat: the number of features :param float dropout_rate: dropout rate """ def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
carankt/FastSpeech2-1
MultiHeadedAttention
false
6,393
[ "Apache-2.0" ]
1
42c06e4fbdf741a0719154d1cb4617b7d3f15a5c
https://github.com/carankt/FastSpeech2-1/tree/42c06e4fbdf741a0719154d1cb4617b7d3f15a5c
MaskedInstanceNorm1d
import torch import torch.cuda from torch import nn import torch.utils.data import torch.optim class MaskedInstanceNorm1d(nn.Module): """Instance norm + masking.""" MAX_CNT = 100000.0 def __init__(self, d_channel: 'int', unbiased: 'bool'=True, affine: 'bool'=False): super().__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.cuda from torch...
carolmanderson/NeMo
MaskedInstanceNorm1d
false
6,394
[ "Apache-2.0" ]
1
be7114e2d983af751e1af4119465c626682747b7
https://github.com/carolmanderson/NeMo/tree/be7114e2d983af751e1af4119465c626682747b7
MaxPool2d
import torch from typing import * from torch import nn class MaxPool2d(nn.Module): def __init__(self, kernel_size, **kwargs): super().__init__() stride = kwargs.setdefault('stride', kernel_size) padding = kwargs.setdefault('padding', 0) dilation = kwargs.setdefault('dilation', 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 typing import * from torch import nn assert_size_stride = torch._C._dynamo.guards.as...
cbarrick/csb
MaxPool2d
false
6,395
[ "MIT" ]
1
0368036ddb7594c0b6e7cdc704aeec918786e58a
https://github.com/cbarrick/csb/tree/0368036ddb7594c0b6e7cdc704aeec918786e58a
DeepNeuralNet
import torch class DeepNeuralNet(torch.nn.Module): """ This is a six-layer neural network. This is the default network for initializing sigma and center parameters """ def __init__(self, n_feature, n_hidden1, n_hidden2, n_hidden3, n_hidden4, n_hidden5, n_hidden6, n_output): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
cassberk/xps_peakfit
DeepNeuralNet
false
6,396
[ "MIT" ]
1
bbdd62dbfc4d64ec2af0c509361de81b0762bd41
https://github.com/cassberk/xps_peakfit/tree/bbdd62dbfc4d64ec2af0c509361de81b0762bd41
ConvReLUNorm
import torch import torch.cuda import torch.utils.data import torch.optim class ConvReLUNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, dropout=0.0): super(ConvReLUNorm, self).__init__() self.conv = torch.nn.Conv1d(in_channels, out_channels, kernel_size= ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
carolmanderson/NeMo
ConvReLUNorm
false
6,397
[ "Apache-2.0" ]
1
be7114e2d983af751e1af4119465c626682747b7
https://github.com/carolmanderson/NeMo/tree/be7114e2d983af751e1af4119465c626682747b7
SineLayer
import torch import numpy as np import torch.nn as nn class SineLayer(nn.Module): def __init__(self, in_features, out_features, bias=True, is_first=False, omega_0=30): super().__init__() self.omega_0 = omega_0 self.is_first = is_first self.in_features = 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.triton_helpers import math as tl_math import numpy ...
ccxiaotoancai/Anim-NeRF
SineLayer
false
6,398
[ "MIT" ]
1
1342a9e2d02411a09acecac40ac325f38708b9c9
https://github.com/ccxiaotoancai/Anim-NeRF/tree/1342a9e2d02411a09acecac40ac325f38708b9c9
Generator
import torch from torch import nn import torch.nn.functional as F class Generator(nn.Module): def __init__(self, input_size, hidden_size, output_size): super().__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = nn.Linear(hidden_size, hidden_size) self.fc3 = nn.Lin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
cclaypool/pytorch-dcgan
Generator
false
6,399
[ "MIT" ]
1
a2096daf7bb75bf95e189bb3d2f820c51147b61c
https://github.com/cclaypool/pytorch-dcgan/tree/a2096daf7bb75bf95e189bb3d2f820c51147b61c
Generator
import torch import torch.nn as nn import torch.nn.functional as F class Generator(nn.Module): def __init__(self, dim, hidden_dim, y_dim, sigma=0.02): super(Generator, self).__init__() input_dim = dim hidden_size = hidden_dim self.fc1 = nn.Linear(input_dim, hidden_size) 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.triton_helpers import libdevice import torch.nn as ...
ccha23/miml
Generator
false
6,400
[ "MIT" ]
1
6a41de1c0bb41d38e3cdc6e9c27363215b7729b9
https://github.com/ccha23/miml/tree/6a41de1c0bb41d38e3cdc6e9c27363215b7729b9
StochasticPool2d
import torch import torch.nn.functional as F class StochasticPool2d(torch.nn.Module): def __init__(self, kernel_size=2, stride=2, padding=0): super(StochasticPool2d, self).__init__() self.kernel_size = kernel_size self.stride = stride self.padding = padding self.grid_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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
cclauss/DL4AGX
StochasticPool2d
false
6,401
[ "Apache-2.0" ]
1
b4d73f6c39b0428e32ce5656352800cc7e2cfb22
https://github.com/cclauss/DL4AGX/tree/b4d73f6c39b0428e32ce5656352800cc7e2cfb22
GKDLoss
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.nn.functional as F class GKDLoss(nn.Module): """Knowledge Distillation Loss""" def __init__(self, T): super().__init__() self.t = T def forward(self, stu_pred, tea_pred, label): stu_pred_l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
carol007/pytorch-ImageNet-CIFAR-COCO-VOC-training
GKDLoss
false
6,402
[ "MIT" ]
1
e8b37046e6fbe914f6a68bbde1fe419c46373c1d
https://github.com/carol007/pytorch-ImageNet-CIFAR-COCO-VOC-training/tree/e8b37046e6fbe914f6a68bbde1fe419c46373c1d
makeStyle
import torch import torch.nn as nn import torch.nn.functional as F class makeStyle(nn.Module): def __init__(self): super().__init__() self.flatten = nn.Flatten() def forward(self, x0): style = F.avg_pool2d(x0, kernel_size=(x0.shape[-2], x0.shape[-1])) style = self.flatten(sty...
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_...
cellimnet/scellseg-publish
makeStyle
false
6,403
[ "BSD-3-Clause" ]
1
03bfbae11fedcf430c40419c9afadf55cbd3034d
https://github.com/cellimnet/scellseg-publish/tree/03bfbae11fedcf430c40419c9afadf55cbd3034d
LocalMLP
import torch from torch import nn import torch.nn.functional as F class LocalMLP(nn.Module): def __init__(self, dim_in: 'int', use_norm: 'bool'=True): """a Local 1 layer MLP :param dim_in: feat in size :type dim_in: int :param use_norm: if to apply layer norm, defaults to 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 from torch._inductor.runtime....
cdicle-motional/l5kit
LocalMLP
false
6,404
[ "Apache-2.0" ]
1
4dc4ee5391479bb71f0b373f39c316f9eef5a961
https://github.com/cdicle-motional/l5kit/tree/4dc4ee5391479bb71f0b373f39c316f9eef5a961
MV_Softmax
from torch.nn import Module import math import torch from torch.nn import functional as F import torch._utils from torch.nn import Parameter from itertools import product as product import torch.utils.data.distributed class MV_Softmax(Module): """Implementation for "Mis-classified Vector Guided Softmax Loss for 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 from torch._inductor.runtime....
cavalleria/FaceX-Zoo
MV_Softmax
false
6,405
[ "Apache-2.0" ]
1
c4bf8924f1858928f8cf83efabf8ad237c67f620
https://github.com/cavalleria/FaceX-Zoo/tree/c4bf8924f1858928f8cf83efabf8ad237c67f620
ShakeResNeXt
import math import torch from torch import nn from numpy import int64 as int64 import torch.nn.functional as F from torch.autograd import Variable class ShakeShake(torch.autograd.Function): @staticmethod def forward(ctx, x1, x2, training=True): if training: alpha = torch.FloatTensor(x1.si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 math from torch import...
cdtalley/AutoML
ShakeResNeXt
false
6,406
[ "MIT" ]
1
918cda6bb1bd55b4ca974bdcdd59e32b2e28399d
https://github.com/cdtalley/AutoML/tree/918cda6bb1bd55b4ca974bdcdd59e32b2e28399d
p_model
import torch from torch import nn import torch.nn.functional as F class p_model(nn.Module): """ input: N * C * W * H output: N * 1 * W * H """ def __init__(self): super(p_model, self).__init__() def forward(self, x): n, c, w, h = x.size() x = x.view(n, c, w * h).permu...
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...
cenkcorapci/visual-fashion-item-search
p_model
false
6,407
[ "MIT" ]
1
47b93f97383c1b7f9ec23bb4ff66f90504db3da8
https://github.com/cenkcorapci/visual-fashion-item-search/tree/47b93f97383c1b7f9ec23bb4ff66f90504db3da8
ShakeResNet
import math import torch from torch import nn from numpy import int64 as int64 import torch.nn.functional as F from torch.autograd import Variable class ShakeShake(torch.autograd.Function): @staticmethod def forward(ctx, x1, x2, training=True): if training: alpha = torch.FloatTensor(x1.si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 math from torch import...
cdtalley/AutoML
ShakeResNet
false
6,408
[ "MIT" ]
1
918cda6bb1bd55b4ca974bdcdd59e32b2e28399d
https://github.com/cdtalley/AutoML/tree/918cda6bb1bd55b4ca974bdcdd59e32b2e28399d
LanguageModelCriterion
import torch import torch.nn as nn from torch.autograd import * class LanguageModelCriterion(nn.Module): def __init__(self): super(LanguageModelCriterion, self).__init__() def forward(self, input, target, mask): target = target[:, :input.size(1)] mask = mask[:, :input.size(1)] ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
chagmgang/object_relation_transformer
LanguageModelCriterion
false
6,409
[ "MIT" ]
1
04b88514f97232c12b576720e4b82226751c3c48
https://github.com/chagmgang/object_relation_transformer/tree/04b88514f97232c12b576720e4b82226751c3c48
BertSelfOutput
from _paritybench_helpers import _mock_config import torch from torch import nn class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, 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.triton_helpers import libdevice from torch import n...
caldoe/BERT-NL2SPARQL
BertSelfOutput
false
6,410
[ "MIT" ]
1
2e09c1aeffc855bc7f1dc8c182e21153b2bc73a8
https://github.com/caldoe/BERT-NL2SPARQL/tree/2e09c1aeffc855bc7f1dc8c182e21153b2bc73a8
Norm
import torch import torch.nn as nn import torch.onnx class Norm(nn.Module): def __init__(self, emb_dim, eps=1e-06): super().__init__() self.size = emb_dim self.alpha = nn.Parameter(torch.ones(self.size)) self.bias = nn.Parameter(torch.zeros(self.size)) self.eps = eps ...
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.onnx assert_size_stride = torch._C._dynamo.g...
chandar-lab/CriticalGradientOptimization
Norm
false
6,411
[ "MIT" ]
1
1af4b1df40489991289bb50bb69859a00b2c97c6
https://github.com/chandar-lab/CriticalGradientOptimization/tree/1af4b1df40489991289bb50bb69859a00b2c97c6
RewardCriterion
import torch import torch.nn as nn from torch.autograd import * def to_contiguous(tensor): if tensor.is_contiguous(): return tensor else: return tensor.contiguous() class RewardCriterion(nn.Module): def __init__(self): super(RewardCriterion, self).__init__() 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 import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
chagmgang/object_relation_transformer
RewardCriterion
false
6,412
[ "MIT" ]
1
04b88514f97232c12b576720e4b82226751c3c48
https://github.com/chagmgang/object_relation_transformer/tree/04b88514f97232c12b576720e4b82226751c3c48
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, weight=None, size_average=True): super(DiceLoss, self).__init__() def forward(self, inputs, targets, smooth=1): inputs = torch.sigmoid(inputs) inputs = inputs.view(-1) targets = targets.view(-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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
chakerouari/UNET_segmetation
DiceLoss
false
6,413
[ "MIT" ]
1
a7d9e9ccd31595d482f620cbf9a625a486f5f0df
https://github.com/chakerouari/UNET_segmetation/tree/a7d9e9ccd31595d482f620cbf9a625a486f5f0df
LocalSubGraphLayer
import torch from torch import nn import torch.nn.functional as F class LocalMLP(nn.Module): def __init__(self, dim_in: 'int', use_norm: 'bool'=True): """a Local 1 layer MLP :param dim_in: feat in size :type dim_in: int :param use_norm: if to apply layer norm, defaults to 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 from torch._inductor.runtime....
cdicle-motional/l5kit
LocalSubGraphLayer
false
6,414
[ "Apache-2.0" ]
1
4dc4ee5391479bb71f0b373f39c316f9eef5a961
https://github.com/cdicle-motional/l5kit/tree/4dc4ee5391479bb71f0b373f39c316f9eef5a961
PinballLoss
import torch import torch.nn as nn class PinballLoss(nn.Module): """Computes the pinball loss between y and y_hat. y: actual values in torch tensor. y_hat: predicted values in torch tensor. tau: a float between 0 and 1 the slope of the pinball loss. In the context of quantile regression, the value of alph...
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...
cchallu/esrnn
PinballLoss
false
6,415
[ "MIT" ]
1
543ca365c70be2775a4b5863820b246071ccde3c
https://github.com/cchallu/esrnn/tree/543ca365c70be2775a4b5863820b246071ccde3c
TripletMarginLossCosine
import torch from torch import nn import torch.nn.functional as F class TripletMarginLossCosine(nn.Module): def __init__(self, margin=1.0): super(TripletMarginLossCosine, self).__init__() self.margin = margin def forward(self, anchor, positive, negative): d_p = 1 - F.cosine_similarit...
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_...
cenkcorapci/visual-fashion-item-search
TripletMarginLossCosine
false
6,416
[ "MIT" ]
1
47b93f97383c1b7f9ec23bb4ff66f90504db3da8
https://github.com/cenkcorapci/visual-fashion-item-search/tree/47b93f97383c1b7f9ec23bb4ff66f90504db3da8
ImgPatches
import torch import torch.nn as nn class ImgPatches(nn.Module): def __init__(self, input_channel=3, dim=768, patch_size=4): super().__init__() self.patch_embed = nn.Conv2d(input_channel, dim, kernel_size= patch_size, stride=patch_size) def forward(self, img): patches = se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ch0n9waiu/TransCycleGAN
ImgPatches
false
6,417
[ "MIT" ]
1
a3e846e21101400282a9f1393c1f8d150a3d92c9
https://github.com/ch0n9waiu/TransCycleGAN/tree/a3e846e21101400282a9f1393c1f8d150a3d92c9
MultiHeadAttn
import torch import torch.cuda from torch.nn import functional as F from torch import nn import torch.utils.data import torch.optim class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0.1, pre_lnorm=False): super(MultiHeadAttn, self).__init__() sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
carolmanderson/NeMo
MultiHeadAttn
false
6,418
[ "Apache-2.0" ]
1
be7114e2d983af751e1af4119465c626682747b7
https://github.com/carolmanderson/NeMo/tree/be7114e2d983af751e1af4119465c626682747b7
FeedForward
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class FeedForward(nn.Module): def __init__(self, emb_dim, ff_dim=2048, dropout=0.1): super().__init__() self.linear_1 = nn.Linear(emb_dim, ff_dim) self.dropout = nn.Dropout(dropout) self.linear_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 import torch.nn as nn import torch.onnx assert_size_stride = torch._C._dynamo.gu...
chandar-lab/CriticalGradientOptimization
FeedForward
false
6,419
[ "MIT" ]
1
1af4b1df40489991289bb50bb69859a00b2c97c6
https://github.com/chandar-lab/CriticalGradientOptimization/tree/1af4b1df40489991289bb50bb69859a00b2c97c6
RNN
import torch import torch.nn as nn class RNN(nn.Module): def __init__(self, input_size, hidden_size, output_size): super(RNN, self).__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(input_size + hidden_size, hidden_size) self.i2o = nn.Linear(input_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....
chauhankartik/DeepLearning-EarlySteps
RNN
false
6,420
[ "MIT" ]
1
44b0189cf6e81f8032a6a80cc33ff80496ebd462
https://github.com/chauhankartik/DeepLearning-EarlySteps/tree/44b0189cf6e81f8032a6a80cc33ff80496ebd462
MultiHeadAttention
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class MultiHeadAttention(nn.Module): def __init__(self, num_heads, emb_dim, dim_k=None, dropout=0.1): super().__init__() self.emb_dim = emb_dim self.dim_k = dim_k if dim_k else emb_dim // num_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
chandar-lab/CriticalGradientOptimization
MultiHeadAttention
false
6,421
[ "MIT" ]
1
1af4b1df40489991289bb50bb69859a00b2c97c6
https://github.com/chandar-lab/CriticalGradientOptimization/tree/1af4b1df40489991289bb50bb69859a00b2c97c6
Actor
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, state_dim, action_dim, max_action): super(Actor, self).__init__() self.l1 = nn.Linear(state_dim, 5) self.l2 = nn.Linear(5, 3) self.l3 = nn.Linear(3, action_dim) 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....
chenbq1234/CityLearn
Actor
false
6,422
[ "MIT" ]
1
baa162435954ecd58e7f4769a46fa9046f4d2cf6
https://github.com/chenbq1234/CityLearn/tree/baa162435954ecd58e7f4769a46fa9046f4d2cf6
BayesConv1d
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init def calculate_kl(mu_p, sig_p, mu_q, sig_q): """ Calculates the Kullback-Leibler divergence between two univariate Gaussians (p and q) Args: mu_p: mean of the Gaussian p sig_p: standard...
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...
chapmanbe/uncertainty
BayesConv1d
false
6,423
[ "Apache-2.0" ]
1
d4eec00e937c76043d57a13ffcc9618b1e08d967
https://github.com/chapmanbe/uncertainty/tree/d4eec00e937c76043d57a13ffcc9618b1e08d967
BayesLinear
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init def calculate_kl(mu_p, sig_p, mu_q, sig_q): """ Calculates the Kullback-Leibler divergence between two univariate Gaussians (p and q) Args: mu_p: mean of the Gaussian p sig_p: standard...
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.triton_helpers import libd...
chapmanbe/uncertainty
BayesLinear
false
6,424
[ "Apache-2.0" ]
1
d4eec00e937c76043d57a13ffcc9618b1e08d967
https://github.com/chapmanbe/uncertainty/tree/d4eec00e937c76043d57a13ffcc9618b1e08d967
PositionwiseFeedForward
import torch import torch.nn as nn class LayerNorm(nn.Module): """ Layer Normalization class """ def __init__(self, features, eps=1e-06): super(LayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(features)) self.bias = nn.Parameter(torch.zeros(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....
chengjunyan1/Graph-Sparse-Transformer
PositionwiseFeedForward
false
6,425
[ "Apache-2.0" ]
1
2c3b77f81789ca80e0c30c32f0c702b2d3bac048
https://github.com/chengjunyan1/Graph-Sparse-Transformer/tree/2c3b77f81789ca80e0c30c32f0c702b2d3bac048
Critic
import torch import torch.nn as nn import torch.nn.functional as F class Critic(nn.Module): def __init__(self, state_dim, action_dim): super(Critic, self).__init__() self.l1 = nn.Linear(state_dim + action_dim, 7) self.l2 = nn.Linear(7, 6) self.l3 = nn.Linear(6, 1) self.l4 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
chenbq1234/CityLearn
Critic
false
6,426
[ "MIT" ]
1
baa162435954ecd58e7f4769a46fa9046f4d2cf6
https://github.com/chenbq1234/CityLearn/tree/baa162435954ecd58e7f4769a46fa9046f4d2cf6
FM
import torch import torch.nn as nn from sklearn.metrics import * class FM(nn.Module): """Factorization Machine models pairwise (order-2) feature interactions without linear term and bias. Input shape - 3D tensor with shape: ``(batch_size,field_size,embedding_size)``. Output shape ...
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 sklearn.metrics import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = tor...
chenkkkk/DeepCTR-PyTorch
FM
false
6,427
[ "Apache-2.0" ]
1
a10a3ace4ad79171e7fb182407b3e4d22bf753e7
https://github.com/chenkkkk/DeepCTR-PyTorch/tree/a10a3ace4ad79171e7fb182407b3e4d22bf753e7
USConv2d
import torch import torch.nn as nn import torch.nn.functional as F class USConv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, us=[False, False]): super(USConv2d, self).__init__(in_channels, out_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
chenbong/torchsummaryDynamic
USConv2d
false
6,428
[ "MIT" ]
1
48ad7e46c4c762dda335b496313ed63b76507b59
https://github.com/chenbong/torchsummaryDynamic/tree/48ad7e46c4c762dda335b496313ed63b76507b59
DenseModel
import torch import torch.nn as nn class DenseModel(nn.Module): def __init__(self, input_dim, num_classes=2): super(DenseModel, self).__init__() self.fc1 = nn.Linear(input_dim, 400) self.relu1 = nn.ReLU(inplace=True) self.fc2 = nn.Linear(400, 400) self.relu2 = nn.ReLU(inpl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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_...
chawins/adv-exp
DenseModel
false
6,429
[ "MIT" ]
1
5423e135c5599e4ec2bf90372916d8d05c89f285
https://github.com/chawins/adv-exp/tree/5423e135c5599e4ec2bf90372916d8d05c89f285
PredictionLayer
import torch import torch.nn as nn from sklearn.metrics import * class PredictionLayer(nn.Module): """ Arguments - **task**: str, ``"binary"`` for binary logloss or ``"regression"`` for regression loss - **use_bias**: bool.Whether add bias term or not. """ def __init__(self, tas...
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 sklearn.metrics import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = tor...
chenkkkk/DeepCTR-PyTorch
PredictionLayer
false
6,430
[ "Apache-2.0" ]
1
a10a3ace4ad79171e7fb182407b3e4d22bf753e7
https://github.com/chenkkkk/DeepCTR-PyTorch/tree/a10a3ace4ad79171e7fb182407b3e4d22bf753e7
NPairLoss
import torch class NPairLoss(torch.nn.Module): def __init__(self, l2=0.05): """ Basic N-Pair Loss as proposed in 'Improved Deep Metric Learning with Multi-class N-pair Loss Objective' Args: l2: float, weighting parameter for weight penality due to embeddings not being normaliz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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_s...
bm2-lab/scPrivacy
NPairLoss
false
6,431
[ "MIT" ]
1
444c8f3a5e7b890c299cd823359e5414f73d6205
https://github.com/bm2-lab/scPrivacy/tree/444c8f3a5e7b890c299cd823359e5414f73d6205
InnerProductLayer
import torch import torch.nn as nn from sklearn.metrics import * class InnerProductLayer(nn.Module): """InnerProduct Layer used in PNN that compute the element-wise product or inner product between feature vectors. Input shape - a list of 3D tensor with shape: ``(batch_size,1,embedding_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 from sklearn.metrics import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = tor...
chenkkkk/DeepCTR-PyTorch
InnerProductLayer
false
6,432
[ "Apache-2.0" ]
1
a10a3ace4ad79171e7fb182407b3e4d22bf753e7
https://github.com/chenkkkk/DeepCTR-PyTorch/tree/a10a3ace4ad79171e7fb182407b3e4d22bf753e7
DilateContourLoss
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class DilateContourLoss(nn.Module): def __init__(self): super(DilateContourLoss, self).__init__() self.kernel = np.ones((3, 3), np.uint8) def forward(self, y_pred, y_true): assert y_pred.size() == y...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.ass...
chexqi/Tube_Contour_Detection
DilateContourLoss
false
6,433
[ "MIT" ]
1
d629c992022f22fb3338b6436fcaadab438f8bfb
https://github.com/chexqi/Tube_Contour_Detection/tree/d629c992022f22fb3338b6436fcaadab438f8bfb
DenseModelV2
import torch import torch.nn as nn class DenseModelV2(nn.Module): def __init__(self, input_dim, num_classes=2): super(DenseModelV2, self).__init__() self.fc1 = nn.Linear(input_dim, 2000) self.relu1 = nn.ReLU(inplace=True) self.fc2 = nn.Linear(2000, 2000) self.relu2 = nn.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 import torch.nn as nn assert_...
chawins/adv-exp
DenseModelV2
false
6,434
[ "MIT" ]
1
5423e135c5599e4ec2bf90372916d8d05c89f285
https://github.com/chawins/adv-exp/tree/5423e135c5599e4ec2bf90372916d8d05c89f285
FC
import torch import torch.nn as nn import torch.nn.functional as F class FC(nn.Module): """FC baseline implementation""" def __init__(self): super(FC, self).__init__() self.fc1 = nn.Linear(45 * 45, 1024) self.fc2 = nn.Linear(1024, 256) self.fc3 = nn.Linear(256, 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 import triton_helpers from torch._inductor.runtime....
chenxi-wang/cs420-codes
FC
false
6,435
[ "MIT" ]
1
756b71ea4f4d8c4694c8c3f32ed9d1c6e89fad15
https://github.com/chenxi-wang/cs420-codes/tree/756b71ea4f4d8c4694c8c3f32ed9d1c6e89fad15
FocalLossV2
import torch import torch.nn as nn import torch.nn.functional as F class FocalSigmoidLossFunc(torch.autograd.Function): """ compute backward directly for better numeric stability """ @staticmethod def forward(ctx, logits, label, alpha, gamma, reduction): logits = logits.float() co...
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...
chizhu/pytorch-loss
FocalLossV2
false
6,436
[ "MIT" ]
1
c8fbd78771f11a910b0b51ae3697c09761dd9696
https://github.com/chizhu/pytorch-loss/tree/c8fbd78771f11a910b0b51ae3697c09761dd9696
SwishV2
import torch import torch.nn as nn class SwishFunction(torch.autograd.Function): @staticmethod def forward(ctx, feat): sig = torch.sigmoid(feat) out = feat * torch.sigmoid(feat) grad = sig * (1 + feat * (1 - sig)) ctx.grad = grad return out @staticmethod def b...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
chizhu/pytorch-loss
SwishV2
false
6,437
[ "MIT" ]
1
c8fbd78771f11a910b0b51ae3697c09761dd9696
https://github.com/chizhu/pytorch-loss/tree/c8fbd78771f11a910b0b51ae3697c09761dd9696
PositionEmbedding
from _paritybench_helpers import _mock_config import torch from torch import nn class PositionEmbedding(nn.Module): """ adpated from transformers package by huggingface. """ def __init__(self, config): super(PositionEmbedding, self).__init__() self.config = config self.pos_emb...
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...
choumartin1234/Music-Eye
PositionEmbedding
false
6,438
[ "MIT" ]
1
059b43fd21f7e7bf6c84cb35a03fd936e64b59a5
https://github.com/choumartin1234/Music-Eye/tree/059b43fd21f7e7bf6c84cb35a03fd936e64b59a5
FocalLossV1
import torch import torch.nn as nn class FocalLossV1(nn.Module): def __init__(self, alpha=0.25, gamma=2, reduction='mean'): super(FocalLossV1, self).__init__() self.alpha = alpha self.gamma = gamma self.reduction = reduction self.crit = nn.BCEWithLogitsLoss(reduction='none...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
chizhu/pytorch-loss
FocalLossV1
false
6,439
[ "MIT" ]
1
c8fbd78771f11a910b0b51ae3697c09761dd9696
https://github.com/chizhu/pytorch-loss/tree/c8fbd78771f11a910b0b51ae3697c09761dd9696
InteractingLayer
import torch import torch.nn as nn import torch.nn.functional as F from sklearn.metrics import * class InteractingLayer(nn.Module): """A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism. Input shape - A 3D tensor with shape...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
chenkkkk/DeepCTR-PyTorch
InteractingLayer
false
6,440
[ "Apache-2.0" ]
1
a10a3ace4ad79171e7fb182407b3e4d22bf753e7
https://github.com/chenkkkk/DeepCTR-PyTorch/tree/a10a3ace4ad79171e7fb182407b3e4d22bf753e7
ScaleNetwork
import torch import torch.nn as nn class ScaleNetwork(nn.Module): """Network for parameterizing a scaling function""" def __init__(self, input_dim): super(ScaleNetwork, self).__init__() self.fc1 = nn.Linear(input_dim, 2000) self.relu1 = nn.ReLU(inplace=True) self.fc2 = nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
chawins/adv-exp
ScaleNetwork
false
6,441
[ "MIT" ]
1
5423e135c5599e4ec2bf90372916d8d05c89f285
https://github.com/chawins/adv-exp/tree/5423e135c5599e4ec2bf90372916d8d05c89f285
CauchyLoss
import torch from typing import * import torch.nn as nn class CauchyLoss(nn.Module): def __init__(self): super().__init__() def forward(self, x, y): err = torch.sum(torch.pow(x - y, 2), dim=-1) return torch.mean(torch.log(1 + err), dim=-1) 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._inductor.runtime.triton_helpers import math as tl_math from typing import * import torch.nn as nn assert_size_stride = torch._C....
ciwanceylan/gated-gradient-flow
CauchyLoss
false
6,442
[ "Apache-2.0" ]
1
c4f6c0c987f428697336e4514099aa7ef2351388
https://github.com/ciwanceylan/gated-gradient-flow/tree/c4f6c0c987f428697336e4514099aa7ef2351388
LabelSmoothSoftmaxCEV1
import torch import torch.nn as nn class LabelSmoothSoftmaxCEV1(nn.Module): """ This is the autograd version, you can also try the LabelSmoothSoftmaxCEV2 that uses derived gradients """ def __init__(self, lb_smooth=0.1, reduction='mean', ignore_index=-100): super(LabelSmoothSoftmaxCEV1, 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 import torch.nn as nn ...
chizhu/pytorch-loss
LabelSmoothSoftmaxCEV1
false
6,443
[ "MIT" ]
1
c8fbd78771f11a910b0b51ae3697c09761dd9696
https://github.com/chizhu/pytorch-loss/tree/c8fbd78771f11a910b0b51ae3697c09761dd9696
EncoderLayer
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class Norm(nn.Module): def __init__(self, emb_dim, eps=1e-06): super().__init__() self.size = emb_dim self.alpha = nn.Parameter(torch.ones(self.size)) self.bias = nn.Parameter(torch.ze...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
chandar-lab/CriticalGradientOptimization
EncoderLayer
false
6,444
[ "MIT" ]
1
1af4b1df40489991289bb50bb69859a00b2c97c6
https://github.com/chandar-lab/CriticalGradientOptimization/tree/1af4b1df40489991289bb50bb69859a00b2c97c6
co_peak_loss
import torch from torch import nn class co_peak_loss(nn.Module): def __init__(self): super(co_peak_loss, self).__init__() def forward(self, co_peak_value): a = -1 * co_peak_value b = torch.max(torch.zeros_like(co_peak_value), a) t = b + torch.log(torch.exp(-b) + torch.exp(a -...
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...
cj4L/DeepCO3-python
co_peak_loss
false
6,445
[ "MIT" ]
1
fa28ed7b43a3a236d0cc7bf31ce9fd68c01b5888
https://github.com/cj4L/DeepCO3-python/tree/fa28ed7b43a3a236d0cc7bf31ce9fd68c01b5888
Attention
import torch class Attention(torch.nn.Module): """ Applies attention mechanism on the `context` using the `query`. **Thank you** to IBM for their initial implementation of :class:`Attention`. Here is their `License <https://github.com/IBM/pytorch-seq2seq/blob/master/LICENSE>`__. Args: 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....
choderalab/pisco
Attention
false
6,446
[ "MIT" ]
1
dccb36edf49960929cfb823f885d38cb84d444d1
https://github.com/choderalab/pisco/tree/dccb36edf49960929cfb823f885d38cb84d444d1
DenseModelV3
import torch import torch.nn as nn class DenseModelV3(nn.Module): def __init__(self, input_dim, num_classes=2): super(DenseModelV3, self).__init__() self.fc1 = nn.Linear(input_dim, 2000) self.relu1 = nn.ReLU(inplace=True) self.fc2 = nn.Linear(2000, 2000) self.relu2 = nn.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 import torch.nn as nn assert_...
chawins/adv-exp
DenseModelV3
false
6,447
[ "MIT" ]
1
5423e135c5599e4ec2bf90372916d8d05c89f285
https://github.com/chawins/adv-exp/tree/5423e135c5599e4ec2bf90372916d8d05c89f285
Classifier
import torch import torch.nn.functional as F from torch import nn class Classifier(nn.Module): def __init__(self, dims): """ Single hidden layer classifier with softmax output. """ super(Classifier, self).__init__() [x_dim, h_dim, y_dim] = dims self.dense =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
chunglabmit/phathom
Classifier
false
6,448
[ "MIT" ]
1
304db7a95e898e9b03d6b2640172752d21a7e3ed
https://github.com/chunglabmit/phathom/tree/304db7a95e898e9b03d6b2640172752d21a7e3ed
Length
import torch from torch import nn class Length(nn.Module): def __init__(self, dim=1, keepdim=True, p='fro'): super(Length, self).__init__() self.dim = dim self.keepdim = keepdim self.p = p def forward(self, inputs): return inputs.norm(dim=self.dim, keepdim=self.keepdi...
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...
clementpoiret/3D-AGSCaps
Length
false
6,449
[ "MIT" ]
1
475eb1915bc1425cebbd0bec36e9096c9c2cb53c
https://github.com/clementpoiret/3D-AGSCaps/tree/475eb1915bc1425cebbd0bec36e9096c9c2cb53c
ElemAffineNetwork
import torch import torch.nn as nn class ElemAffineNetwork(nn.Module): """Network for parameterizing affine transformation""" def __init__(self, input_dim): super(ElemAffineNetwork, self).__init__() self.input_dim = input_dim self.fc1 = nn.Linear(input_dim, 2000) 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 from torch._inductor.runtime....
chawins/adv-exp
ElemAffineNetwork
false
6,450
[ "MIT" ]
1
5423e135c5599e4ec2bf90372916d8d05c89f285
https://github.com/chawins/adv-exp/tree/5423e135c5599e4ec2bf90372916d8d05c89f285
DecoderLayer
import math import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class Norm(nn.Module): def __init__(self, emb_dim, eps=1e-06): super().__init__() self.size = emb_dim self.alpha = nn.Parameter(torch.ones(self.size)) self.bias = nn.Parameter(torch.ze...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
chandar-lab/CriticalGradientOptimization
DecoderLayer
false
6,451
[ "MIT" ]
1
1af4b1df40489991289bb50bb69859a00b2c97c6
https://github.com/chandar-lab/CriticalGradientOptimization/tree/1af4b1df40489991289bb50bb69859a00b2c97c6
logreg
import torch import torch.nn as nn import torch.utils.data from torch.nn.utils import weight_norm class logreg(nn.Module): def __init__(self, input_size, classes): super(logreg, self).__init__() linear = nn.Linear(input_size, classes) self.logistic_reg = weight_norm(linear, name='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 ...
cjbumgardner/HE_for_Medical_Data
logreg
false
6,452
[ "MIT" ]
1
248dcd8b48924fe1f6edbeee4e16282d4a31069a
https://github.com/cjbumgardner/HE_for_Medical_Data/tree/248dcd8b48924fe1f6edbeee4e16282d4a31069a
affinity_loss
import torch from torch import nn class affinity_loss(nn.Module): def __init__(self): super(affinity_loss, self).__init__() def forward(self, pixel_affinity, sal_affinity, sal_diff): loss = torch.mean(pixel_affinity * (1 - sal_affinity) ) + 4 * torch.mean(sal_diff * sal_affinity)...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
cj4L/DeepCO3-python
affinity_loss
false
6,453
[ "MIT" ]
1
fa28ed7b43a3a236d0cc7bf31ce9fd68c01b5888
https://github.com/cj4L/DeepCO3-python/tree/fa28ed7b43a3a236d0cc7bf31ce9fd68c01b5888
MulScalarNegative
import torch import torch.nn as nn from torch.quantization import QuantStub from torch.quantization import DeQuantStub class MulScalarNegative(nn.Module): def __init__(self): super().__init__() self.float_op = nn.quantized.FloatFunctional() self.quant = QuantStub() self.dequant = ...
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.quantization import QuantStub from torch.quantization import DeQuantStub assert_size_stride = torch._C._dyn...
cli99/tvm
MulScalarNegative
false
6,454
[ "Apache-2.0" ]
1
6c6e873a1325a32418108daad6e38f3df8c37660
https://github.com/cli99/tvm/tree/6c6e873a1325a32418108daad6e38f3df8c37660
GramMatrix
import torch import torch.utils.data import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): b, c, h, w = input.size() F = input.view(b, c, h * w) G = torch.bmm(F, F.transpose(1, 2)) G.div_(h * w) return G def get_inputs(): return [t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch import torch.nn as nn assert_size_stride = ...
ckxy/1d_expan
GramMatrix
false
6,455
[ "MIT" ]
1
29cc294e0314d738e8e041f34c995fd22f9f980b
https://github.com/ckxy/1d_expan/tree/29cc294e0314d738e8e041f34c995fd22f9f980b
GramMSELoss
import torch import torch.utils.data import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): b, c, h, w = input.size() F = input.view(b, c, h * w) G = torch.bmm(F, F.transpose(1, 2)) G.div_(h * w) return G class GramMSELoss(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
ckxy/1d_expan
GramMSELoss
false
6,456
[ "MIT" ]
1
29cc294e0314d738e8e041f34c995fd22f9f980b
https://github.com/ckxy/1d_expan/tree/29cc294e0314d738e8e041f34c995fd22f9f980b
PlanarNormalizingFlow
import torch import torch.nn.functional as F from torch import nn class PlanarNormalizingFlow(nn.Module): """ Planar normalizing flow [Rezende & Mohamed 2015]. Provides a tighter bound on the ELBO by giving more expressive power to the approximate distribution, such as by introducing covariance be...
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, math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.gua...
chunglabmit/phathom
PlanarNormalizingFlow
false
6,457
[ "MIT" ]
1
304db7a95e898e9b03d6b2640172752d21a7e3ed
https://github.com/chunglabmit/phathom/tree/304db7a95e898e9b03d6b2640172752d21a7e3ed
poly
import torch import numpy as np import torch.nn as nn import torch.utils.data class poly(nn.Module): """Polynomial activation function. degreelist: list of powers of the polynomial. """ def __init__(self, degreelist): super(poly, self).__init__() self.degreelist = degreelist ...
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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
cjbumgardner/HE_for_Medical_Data
poly
false
6,458
[ "MIT" ]
1
248dcd8b48924fe1f6edbeee4e16282d4a31069a
https://github.com/cjbumgardner/HE_for_Medical_Data/tree/248dcd8b48924fe1f6edbeee4e16282d4a31069a
GCN
from torch.nn import Module import math import torch import numpy as np import torch.nn as nn from torch.nn.modules.module import Module class GraphConvolution(Module): def __init__(self, in_features, out_features, bias=True): super(GraphConvolution, self).__init__() self.in_features = in_feature...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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 import math import numpy as np import torch.nn as nn...
cjx96/CDRIB
GCN
false
6,459
[ "MIT" ]
1
e0d2d2b70ec195a76b479b94fb7758d286350c39
https://github.com/cjx96/CDRIB/tree/e0d2d2b70ec195a76b479b94fb7758d286350c39
SafeLength
import torch from torch import nn class SafeLength(nn.Module): def __init__(self, dim=2, keepdim=False, eps=1e-07): super(SafeLength, self).__init__() self.dim = dim self.keepdim = keepdim self.eps = eps def forward(self, x): squared_norm = torch.sum(torch.square(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.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
clementpoiret/3D-AGSCaps
SafeLength
false
6,460
[ "MIT" ]
1
475eb1915bc1425cebbd0bec36e9096c9c2cb53c
https://github.com/clementpoiret/3D-AGSCaps/tree/475eb1915bc1425cebbd0bec36e9096c9c2cb53c
StatsPool
import torch import warnings import torch.nn as nn from typing import Optional import torch.optim import torch.nn.functional as F class StatsPool(nn.Module): """Statistics pooling Compute temporal mean and (unbiased) standard deviation and returns their concatenation. Reference --------- htt...
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.optim assert_size_stride = torch._C._dynamo....
clmpt/pyannote-audio
StatsPool
false
6,461
[ "MIT" ]
1
7d1b7959ca5f817e08176e44d52a7499bbd3149c
https://github.com/clmpt/pyannote-audio/tree/7d1b7959ca5f817e08176e44d52a7499bbd3149c
UpsamplingBilinear
import torch import torch.nn as nn from torch.quantization import QuantStub from torch.quantization import DeQuantStub class UpsamplingBilinear(nn.Module): def __init__(self): super().__init__() self.quant = QuantStub() self.dequant = DeQuantStub() def forward(self, x): x = 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 from torch.quantization import QuantStub from torch.quantization im...
cli99/tvm
UpsamplingBilinear
false
6,462
[ "Apache-2.0" ]
1
6c6e873a1325a32418108daad6e38f3df8c37660
https://github.com/cli99/tvm/tree/6c6e873a1325a32418108daad6e38f3df8c37660
BinaryDiceLoss
import torch import torch.nn as nn class BinaryDiceLoss(nn.Module): """Dice loss of binary class Args: smooth: A float number to smooth loss, and avoid NaN error, default: 1 p: Denominator value: \\sum{x^p} + \\sum{y^p}, default: 2 predict: A tensor of shape [N, *] target: A te...
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...
cnuzh/CSNet
BinaryDiceLoss
false
6,463
[ "MIT" ]
1
a6c3163624f55dc294ec2e5a6de020d77bd4ff91
https://github.com/cnuzh/CSNet/tree/a6c3163624f55dc294ec2e5a6de020d77bd4ff91
BERTMultSelfOutput
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class BERTLayerNorm(nn.Module): def __init__(self, config, multi_params=None, variance_epsilon=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BERTLayerNorm...
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_...
DAQuestionAnswering/Bert-n-Pals
BERTMultSelfOutput
false
6,464
[ "MIT" ]
1
d5a288b9ac62259e70c249635108ba3906e19f00
https://github.com/DAQuestionAnswering/Bert-n-Pals/tree/d5a288b9ac62259e70c249635108ba3906e19f00