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
SRNet
import torch import torch.nn as nn import torch.optim class eca_layer(nn.Module): """Constructs a ECA module. Args: channel: Number of channels of the input feature map k_size: Adaptive selection of kernel size """ def __init__(self, channel, k_size=3): super(eca_layer, self)....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
purbayankar/PyTorch-Zero-Shot-Super-Resolution
SRNet
false
12,968
[ "MIT" ]
0
434fe5e84e166eef1f8c03880fc83c7e8749c49c
https://github.com/purbayankar/PyTorch-Zero-Shot-Super-Resolution/tree/434fe5e84e166eef1f8c03880fc83c7e8749c49c
EncoderLayer
import math import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): def __init__(self, heads, d_model): super(MultiHeadAttention, self).__init__() assert d_model % heads == 0 self.d_k = d_model // heads self.h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sd2001/seqModeling
EncoderLayer
false
12,969
[ "MIT" ]
0
393f680de711ea8477e5450633b492298d253368
https://github.com/sd2001/seqModeling/tree/393f680de711ea8477e5450633b492298d253368
WassersteinDiscriminatorLoss
import torch import torch.nn as nn def reduce(x, reduction=None): """Applies reduction on a torch.Tensor. Args: x (torch.Tensor): The tensor on which reduction is to be applied. reduction (str, optional): The reduction to be applied. If ``mean`` the mean value of the Tensor is re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
shi-weili/torchgan
WassersteinDiscriminatorLoss
false
12,970
[ "MIT" ]
0
28ffd4026b8c0db2217b667d30a222d6758bfc41
https://github.com/shi-weili/torchgan/tree/28ffd4026b8c0db2217b667d30a222d6758bfc41
_BoundaryRefineModule
import torch from torch import nn class _BoundaryRefineModule(nn.Module): def __init__(self, dim): super(_BoundaryRefineModule, self).__init__() self.relu = nn.ReLU(inplace=True) self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1) self.conv2 = nn.Conv2d(dim, dim, kernel_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
sharanry/pytorch-semantic-segmentation
_BoundaryRefineModule
false
12,971
[ "MIT" ]
0
47d637e3d5fcc1e2569203306c2fa5dca6f0e68a
https://github.com/sharanry/pytorch-semantic-segmentation/tree/47d637e3d5fcc1e2569203306c2fa5dca6f0e68a
MinimaxDiscriminatorLoss
import torch import torch.nn as nn import torch.nn.functional as F def minimax_discriminator_loss(dx, dgz, label_smoothing=0.0, reduction='mean'): target_ones = torch.ones_like(dgz) * (1.0 - label_smoothing) target_zeros = torch.zeros_like(dx) loss = F.binary_cross_entropy_with_logits(dx, target_ones, red...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
shi-weili/torchgan
MinimaxDiscriminatorLoss
false
12,972
[ "MIT" ]
0
28ffd4026b8c0db2217b667d30a222d6758bfc41
https://github.com/shi-weili/torchgan/tree/28ffd4026b8c0db2217b667d30a222d6758bfc41
WassersteinGeneratorLoss
import torch import torch.nn as nn def reduce(x, reduction=None): """Applies reduction on a torch.Tensor. Args: x (torch.Tensor): The tensor on which reduction is to be applied. reduction (str, optional): The reduction to be applied. If ``mean`` the mean value of the Tensor is re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
shi-weili/torchgan
WassersteinGeneratorLoss
false
12,973
[ "MIT" ]
0
28ffd4026b8c0db2217b667d30a222d6758bfc41
https://github.com/shi-weili/torchgan/tree/28ffd4026b8c0db2217b667d30a222d6758bfc41
MinibatchDiscrimination1d
import torch import torch.nn as nn class MinibatchDiscrimination1d(nn.Module): """1D Minibatch Discrimination Module as proposed in the paper `"Improved Techniques for Training GANs by Salimans et. al." <https://arxiv.org/abs/1805.08318>`_ Allows the Discriminator to easily detect mode collapse by augmen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
shi-weili/torchgan
MinibatchDiscrimination1d
false
12,974
[ "MIT" ]
0
28ffd4026b8c0db2217b667d30a222d6758bfc41
https://github.com/shi-weili/torchgan/tree/28ffd4026b8c0db2217b667d30a222d6758bfc41
Swish
import torch import torch.nn as nn import torch.distributed class Swish(nn.Module): def __init__(self): super(Swish, self).__init__() self.beta = nn.Parameter(torch.tensor(1.0)) def forward(self, x): return x * torch.sigmoid(self.beta * x) def get_inputs(): return [torch.rand([...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.distributed assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
shnhrtkyk/PointFlow
Swish
false
12,975
[ "MIT" ]
0
26b8fac79bf3e71533f5c8b12f90cf5f9a385a99
https://github.com/shnhrtkyk/PointFlow/tree/26b8fac79bf3e71533f5c8b12f90cf5f9a385a99
PerceptronTanh
import torch import torch.nn as nn from typing import Any import torch.nn.functional as F class PerceptronTanh(nn.Module): """Implements a 1-layer perceptron with Tanh activaton.""" def _forward_unimplemented(self, *input: Any) ->None: pass def __init__(self, input_dimension, hidden_dimension, o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
shi27feng/PDP-Solver
PerceptronTanh
false
12,976
[ "MIT" ]
0
bf6e392f72f8a3572e0987313230943d94d53c95
https://github.com/shi27feng/PDP-Solver/tree/bf6e392f72f8a3572e0987313230943d94d53c95
Perceptron
import torch import torch.nn as nn from typing import Any import torch.nn.functional as fn class Perceptron(nn.Module): """Implements a 1-layer perceptron.""" def _forward_unimplemented(self, *input: Any) ->None: pass def __init__(self, input_dimension, hidden_dimension, output_dimension): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ty...
shi27feng/PDP-Solver
Perceptron
false
12,977
[ "MIT" ]
0
bf6e392f72f8a3572e0987313230943d94d53c95
https://github.com/shi27feng/PDP-Solver/tree/bf6e392f72f8a3572e0987313230943d94d53c95
MinimaxGeneratorLoss
import torch import torch.nn as nn import torch.nn.functional as F def minimax_generator_loss(dgz, nonsaturating=True, reduction='mean'): if nonsaturating: target = torch.ones_like(dgz) return F.binary_cross_entropy_with_logits(dgz, target, reduction= reduction) else: targe...
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...
shi-weili/torchgan
MinimaxGeneratorLoss
false
12,978
[ "MIT" ]
0
28ffd4026b8c0db2217b667d30a222d6758bfc41
https://github.com/shi-weili/torchgan/tree/28ffd4026b8c0db2217b667d30a222d6758bfc41
SpatialCrossMapLRN
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data class SpatialCrossMapLRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, k=1, ACROSS_CHANNELS=True): super(SpatialCrossMapLRN, self).__init__() self.ACROSS_CHANNELS = ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel import torch.optim import torch....
shubham1206agra/pretrained-models.pytorch
SpatialCrossMapLRN
false
12,979
[ "BSD-3-Clause" ]
0
a2940f79dd65656eabe5a0cd6d5d014ef1fc2523
https://github.com/shubham1206agra/pretrained-models.pytorch/tree/a2940f79dd65656eabe5a0cd6d5d014ef1fc2523
GraphConv
import torch from torch import nn import torch.nn import torch.autograd def sparse_bmm(sparse_matrix, dense_matrix_batch): """ Perform torch.bmm on an unbatched sparse matrix and a batched dense matrix. Args: sparse_matrix (torch.sparse.FloatTensor): Shape = (m, n) dense_matrix_batch (tor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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.nn import torch.autograd assert_size_stride = ...
shumash/kaolin
GraphConv
false
12,980
[ "ECL-2.0", "Apache-2.0" ]
0
2158b5ec7a28d57d7df7e606adbb0c693a0145f0
https://github.com/shumash/kaolin/tree/2158b5ec7a28d57d7df7e606adbb0c693a0145f0
Qnet
import random import torch import torch.nn as nn import torch.nn.functional as F class Qnet(nn.Module): def __init__(self): super(Qnet, self).__init__() self.fc1 = nn.Linear(4, 128) self.fc2 = nn.Linear(128, 128) self.fc3 = nn.Linear(128, 2) def forward(self, x): x = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import random import torch.nn...
shwetasrsh/minimalRL
Qnet
false
12,981
[ "MIT" ]
0
e6fef1730238dd268b1a43fd9fca0b0c40d97837
https://github.com/shwetasrsh/minimalRL/tree/e6fef1730238dd268b1a43fd9fca0b0c40d97837
ScaleHead
import torch import torch.nn as nn class ScaleHead(nn.Module): def __init__(self): super().__init__() self.flatten = torch.flatten self.dot = torch.dot def forward(self, mag, height): curr_mag = self.flatten(mag, start_dim=1) curr_height = self.flatten(height, start_d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
shvedfun/geo_pos_baseline
ScaleHead
false
12,982
[ "Apache-2.0" ]
0
024716bfdaefd23baccfb5a0d2686015385d7b9c
https://github.com/shvedfun/geo_pos_baseline/tree/024716bfdaefd23baccfb5a0d2686015385d7b9c
RNNCell
import torch import torch.nn as nn class RNNCell(nn.Module): def __init__(self, embed_dim, hidden_size, vocab_dim): super().__init__() self.hidden_size = hidden_size self.input2hidden = nn.Linear(embed_dim + hidden_size, hidden_size) def forward(self, inputs, hidden): combine...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
saidulislam/RNN-Sequential-Data-Processing
RNNCell
false
12,983
[ "Apache-2.0" ]
0
2e043f37f9a67177a3dc19cbfe67d187c9cbb5f9
https://github.com/saidulislam/RNN-Sequential-Data-Processing/tree/2e043f37f9a67177a3dc19cbfe67d187c9cbb5f9
EnsembleFC
import torch import torch.nn as nn class EnsembleFC(nn.Module): def __init__(self, in_features: 'int', out_features: 'int', ensemble_size: 'int', weight_decay: 'float'=0.0, bias: 'bool'=True ) ->None: super(EnsembleFC, self).__init__() self.in_features = in_features self.o...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
si0wang/transfer_dmc
EnsembleFC
false
12,984
[ "MIT" ]
0
6bda773244e0b709b3c13add2597f5f1cd01bfd7
https://github.com/si0wang/transfer_dmc/tree/6bda773244e0b709b3c13add2597f5f1cd01bfd7
DynamicsModel
import torch import torch.nn as nn import torch.nn.functional as F def weights_init_(m): if isinstance(m, nn.Linear) or isinstance(m, nn.Conv2d) or isinstance(m, nn.ConvTranspose2d): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class Swish(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 import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
si0wang/transfer_dmc
DynamicsModel
false
12,985
[ "MIT" ]
0
6bda773244e0b709b3c13add2597f5f1cd01bfd7
https://github.com/si0wang/transfer_dmc/tree/6bda773244e0b709b3c13add2597f5f1cd01bfd7
MnistMlp
import torch from torch import nn as nn from torch.nn import functional as F class MnistMlp(nn.Module): def __init__(self, width, dropout_p): super().__init__() self.fc1 = nn.Linear(784, width) self.fc2 = nn.Linear(width, 10) self.dropout = nn.Dropout(dropout_p) def forward(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....
shyam196/exptune
MnistMlp
false
12,986
[ "MIT" ]
0
be9bb23355ecd1a464dbc93dc35050b7f9d40227
https://github.com/shyam196/exptune/tree/be9bb23355ecd1a464dbc93dc35050b7f9d40227
EnsembleFC
import torch import torch.nn as nn class EnsembleFC(nn.Module): __constants__ = ['in_features', 'out_features'] in_features: 'int' out_features: 'int' ensemble_size: 'int' weight: 'torch.Tensor' def __init__(self, in_features: 'int', out_features: 'int', ensemble_size: 'int', weight_d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
simonat2011/DI-engine
EnsembleFC
false
12,987
[ "Apache-2.0" ]
0
3a91c4297d58b3beff40b48bd37eb0b399c724a7
https://github.com/simonat2011/DI-engine/tree/3a91c4297d58b3beff40b48bd37eb0b399c724a7
EnsembleModel
import torch import torch.nn as nn import torch.nn.functional as F def weights_init_(m): if isinstance(m, nn.Linear) or isinstance(m, nn.Conv2d) or isinstance(m, nn.ConvTranspose2d): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class Swish(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 import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch...
si0wang/transfer_dmc
EnsembleModel
false
12,988
[ "MIT" ]
0
6bda773244e0b709b3c13add2597f5f1cd01bfd7
https://github.com/si0wang/transfer_dmc/tree/6bda773244e0b709b3c13add2597f5f1cd01bfd7
Quantization
import torch import torch.utils.data import torch.nn as nn class Quant(torch.autograd.Function): @staticmethod def forward(ctx, input): input = torch.clamp(input, 0, 1) output = (input * 255.0).round() / 255.0 return output @staticmethod def backward(ctx, grad_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 from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data impo...
skipper17/Invertible-Image-Rescaling
Quantization
false
12,989
[ "Apache-2.0" ]
0
4755f21faa5f7c4599dfb971a875ecee86bc35a1
https://github.com/skipper17/Invertible-Image-Rescaling/tree/4755f21faa5f7c4599dfb971a875ecee86bc35a1
FocalLoss
import torch from torch import nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, gamma=2): super().__init__() self.gamma = gamma def forward(self, logit, target, epoch=0): target = target.float() max_val = (-logit).clamp(min=0) loss = 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 libdevice, math as tl_math from torch ...
sin1012/kaggle_baidu_autonomous_driving
FocalLoss
false
12,990
[ "Apache-2.0" ]
0
afa0da4fc06a05548306b885c6c804881104b403
https://github.com/sin1012/kaggle_baidu_autonomous_driving/tree/afa0da4fc06a05548306b885c6c804881104b403
PretrainedUNet
import torch import torchvision class Block(torch.nn.Module): def __init__(self, in_channels, mid_channel, out_channels, batch_norm=False ): super().__init__() self.conv1 = torch.nn.Conv2d(in_channels=in_channels, out_channels= mid_channel, kernel_size=3, padding=1) 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 import torchvision assert_siz...
amrane99/lung-segmentation
PretrainedUNet
false
12,991
[ "MIT" ]
0
ab29db75ac78918da5cbf66b830acaf36cf7b44a
https://github.com/amrane99/lung-segmentation/tree/ab29db75ac78918da5cbf66b830acaf36cf7b44a
BertSelfAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class BertSelfAttention(nn.Module): def __init__(self, config): super().__init__() self.num_attention_heads = config.num_attention_heads self.attention_head_size = int(config.hidden_size / config....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
shrishabh/cs769-assignments
BertSelfAttention
false
12,992
[ "MIT" ]
0
babce1def0d65728bf1d4e4a725d8939f1d5f9a7
https://github.com/shrishabh/cs769-assignments/tree/babce1def0d65728bf1d4e4a725d8939f1d5f9a7
diceloss
import torch class diceloss(torch.nn.Module): def init(self): super(diceloss, self).init() def forward(self, pred, target): smooth = 1.0 iflat = pred.contiguous().view(-1) tflat = target.contiguous().view(-1) intersection = (iflat * tflat).sum() A_sum = torch....
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...
soffiafdz/nma-dl-modality-mongoose
diceloss
false
12,993
[ "MIT" ]
0
41ac1f2e0e818538bafedae93e5c68f8857411bd
https://github.com/soffiafdz/nma-dl-modality-mongoose/tree/41ac1f2e0e818538bafedae93e5c68f8857411bd
ConvReluPool
import torch from torch.nn import Conv2d from torch import nn from torch.nn import functional as F def Pool(k, stride=1, pad=0): return torch.nn.MaxPool2d(k, stride=stride, padding=pad) class ConvReluPool(nn.Module): def __init__(self, fIn, fOut, k, stride=1, pool=2): super().__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.nn import Conv2d f...
smearle/neural-mmo
ConvReluPool
false
12,994
[ "MIT" ]
0
7f1e98857cb32bdb59a273eb71ec43bbd9793b34
https://github.com/smearle/neural-mmo/tree/7f1e98857cb32bdb59a273eb71ec43bbd9793b34
mix_Linear
import torch from torch import nn def Binarize(tensor): """ Binarize function: binarize input tensors Input: tensor: the input tensor. Output: binarized: the binarized tensor. """ binarized = torch.where(tensor > 0, torch.ones_like(tensor, dtype=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 from torch._inductor.runtime....
snudatalab/SensiMix
mix_Linear
false
12,995
[ "Apache-2.0" ]
0
e5d790f48a96806e9ae01449bb4a66e8f09c4d3a
https://github.com/snudatalab/SensiMix/tree/e5d790f48a96806e9ae01449bb4a66e8f09c4d3a
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, 128) self.l2 = nn.Linear(128, 128) self.l3 = nn.Linear(128, action_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sridas123/TD3
Actor
false
12,996
[ "MIT" ]
0
2556c952ef7623c8201fdfdd9102e23d98101f5c
https://github.com/sridas123/TD3/tree/2556c952ef7623c8201fdfdd9102e23d98101f5c
BackwardsNet
import torch from torch import nn class BackwardsNet(nn.Module): def __init__(self, h, ydim): super().__init__() self.loss = torch.nn.CrossEntropyLoss() self.fc1 = torch.nn.Linear(2 * h, h) self.fc2 = torch.nn.Linear(h, ydim) def forward(self, phiPrev, phi, atn): x = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
smearle/neural-mmo
BackwardsNet
false
12,997
[ "MIT" ]
0
7f1e98857cb32bdb59a273eb71ec43bbd9793b34
https://github.com/smearle/neural-mmo/tree/7f1e98857cb32bdb59a273eb71ec43bbd9793b34
DQN
import torch import torch.nn.functional as F import torch.nn as nn class DQN(nn.Module): """A simple deep Q network implementation. Computes Q values for each (action, object) tuple given an input state vector """ def __init__(self, state_dim, action_dim, object_dim, hidden_size=100): super(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 import triton_helpers import torch.nn as nn assert_...
stepinski/machinelearning
DQN
false
12,998
[ "MIT" ]
0
1f84883a25616da4cd76bb4655267efd3421e561
https://github.com/stepinski/machinelearning/tree/1f84883a25616da4cd76bb4655267efd3421e561
SelfAttentionPooling
import torch import torch.nn as nn class SelfAttentionPooling(nn.Module): """ Implementation of SelfAttentionPooling Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition https://arxiv.org/pdf/2008.01077v1.pdf """ def __init__(self, input_dim): super(SelfAttenti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sumanthd17/s3prl
SelfAttentionPooling
false
12,999
[ "MIT" ]
0
bb74c705295d121c4308ceb6b6a2c8d1814d6f4c
https://github.com/sumanthd17/s3prl/tree/bb74c705295d121c4308ceb6b6a2c8d1814d6f4c
BertSelfAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn import torch.nn.functional as F class BertSelfAttention(nn.Module): def __init__(self, config): super().__init__() self.num_attention_heads = config.num_attention_heads self.attention_head_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....
sleepope/cs769-assignments
BertSelfAttention
false
13,000
[ "MIT" ]
0
36c7a75d39507b7fe7b2b1bf1de6b8033b110da5
https://github.com/sleepope/cs769-assignments/tree/36c7a75d39507b7fe7b2b1bf1de6b8033b110da5
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, 128) self.l2 = nn.Linear(128, 128) self.l3 = nn.Linear(128, 1) def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
sridas123/TD3
Critic
false
13,001
[ "MIT" ]
0
2556c952ef7623c8201fdfdd9102e23d98101f5c
https://github.com/sridas123/TD3/tree/2556c952ef7623c8201fdfdd9102e23d98101f5c
BertLayer
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn import torch.nn.functional as F class BertSelfAttention(nn.Module): def __init__(self, config): super().__init__() self.num_attention_heads = config.num_attention_heads self.attention_head_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....
shrishabh/cs769-assignments
BertLayer
false
13,002
[ "MIT" ]
0
babce1def0d65728bf1d4e4a725d8939f1d5f9a7
https://github.com/shrishabh/cs769-assignments/tree/babce1def0d65728bf1d4e4a725d8939f1d5f9a7
DecoderLayer
import math import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): def __init__(self, heads, d_model): super(MultiHeadAttention, self).__init__() assert d_model % heads == 0 self.d_k = d_model // heads self.h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sd2001/seqModeling
DecoderLayer
false
13,003
[ "MIT" ]
0
393f680de711ea8477e5450633b492298d253368
https://github.com/sd2001/seqModeling/tree/393f680de711ea8477e5450633b492298d253368
BertLayer
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn import torch.nn.functional as F class BertSelfAttention(nn.Module): def __init__(self, config): super().__init__() self.num_attention_heads = config.num_attention_heads self.attention_head_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....
sleepope/cs769-assignments
BertLayer
false
13,004
[ "MIT" ]
0
36c7a75d39507b7fe7b2b1bf1de6b8033b110da5
https://github.com/sleepope/cs769-assignments/tree/36c7a75d39507b7fe7b2b1bf1de6b8033b110da5
FuseUnit
import torch import torch.nn as nn class FuseUnit(nn.Module): def __init__(self, channels): super(FuseUnit, self).__init__() self.proj1 = nn.Conv2d(2 * channels, channels, (1, 1)) self.proj2 = nn.Conv2d(channels, channels, (1, 1)) self.proj3 = nn.Conv2d(channels, channels, (1, 1))...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sugi-san/PAMA
FuseUnit
false
13,005
[ "MIT" ]
0
95141ebf0d3b61828a0e545f989f96b8ef569f34
https://github.com/sugi-san/PAMA/tree/95141ebf0d3b61828a0e545f989f96b8ef569f34
ConvNet
import torch import torch.nn as nn class ConvNet(nn.Module): def __init__(self): super(ConvNet, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size= 5, padding=2) self.conv2 = nn.Conv2d(in_channels=32, out_channels=32, kernel_size =3...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
slowy07/dffml
ConvNet
false
13,006
[ "MIT" ]
0
bbf491064470f1170be75b6bec572b6e576940b9
https://github.com/slowy07/dffml/tree/bbf491064470f1170be75b6bec572b6e576940b9
SAP
import torch import torch.nn as nn class SelfAttentionPooling(nn.Module): """ Implementation of SelfAttentionPooling Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition https://arxiv.org/pdf/2008.01077v1.pdf """ def __init__(self, input_dim): super(SelfAttenti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sumanthd17/s3prl
SAP
false
13,007
[ "MIT" ]
0
bb74c705295d121c4308ceb6b6a2c8d1814d6f4c
https://github.com/sumanthd17/s3prl/tree/bb74c705295d121c4308ceb6b6a2c8d1814d6f4c
MultiHeadAttention
import torch import torch.nn as nn from torch import matmul class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropout, inp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
superMC5657/BiLSTMTransformer
MultiHeadAttention
false
13,008
[ "MIT" ]
0
43aa7bb4d8831a898c79ea89fcb1d3f5e09d564a
https://github.com/superMC5657/BiLSTMTransformer/tree/43aa7bb4d8831a898c79ea89fcb1d3f5e09d564a
AttentionUnit
import torch import torch.nn as nn def calc_mean_std(feat, eps=1e-05): size = feat.size() assert len(size) == 4 N, C = size[:2] feat_var = feat.view(N, C, -1).var(dim=2) + eps feat_std = feat_var.sqrt().view(N, C, 1, 1) feat_mean = feat.view(N, C, -1).mean(dim=2).view(N, C, 1, 1) return fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sugi-san/PAMA
AttentionUnit
false
13,009
[ "MIT" ]
0
95141ebf0d3b61828a0e545f989f96b8ef569f34
https://github.com/sugi-san/PAMA/tree/95141ebf0d3b61828a0e545f989f96b8ef569f34
Critic
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def hidden_init(layer): in_size = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(in_size) return -lim, lim class Critic(nn.Module): def __init__(self, state_size, action_size, seed=0, fc1_size=128, fc2_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 from torch._inductor.runtime....
swastiknath/rl_ud_2
Critic
false
13,010
[ "MIT" ]
0
666e538f967252fa609c6b31cb5d66f9415eae82
https://github.com/swastiknath/rl_ud_2/tree/666e538f967252fa609c6b31cb5d66f9415eae82
LinearEmbedding
import math import torch import torch.utils.data import torch.nn as nn class LinearEmbedding(nn.Module): def __init__(self, inp_size, d_model): super(LinearEmbedding, self).__init__() self.lut = nn.Linear(inp_size, d_model) self.d_model = d_model def forward(self, x): return ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.nn as nn assert_size_stride = torch._C._dyn...
swift88-clone/Trajectory-Transformer
LinearEmbedding
false
13,011
[ "MIT" ]
0
62983b645ec88d8972bc2c2af1b7b4a299d3feb0
https://github.com/swift88-clone/Trajectory-Transformer/tree/62983b645ec88d8972bc2c2af1b7b4a299d3feb0
FFN
import torch import torch.nn as nn import torch.utils.data class Conv(nn.Module): """ Convolution Module """ def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True, w_init='linear'): """ :param in_channels: dimension of input ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
supikiti/FastSpeech
FFN
false
13,012
[ "MIT" ]
0
775a9429c273450aefc2d346e5fc66c3f1e36832
https://github.com/supikiti/FastSpeech/tree/775a9429c273450aefc2d346e5fc66c3f1e36832
HubertFeatureProjection
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.utils.checkpoint class HubertFeatureProjection(nn.Module): def __init__(self, config): super().__init__() self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config. layer_norm_eps) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Clemens123/transformers
HubertFeatureProjection
false
13,013
[ "Apache-2.0" ]
0
22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
https://github.com/Clemens123/transformers/tree/22abe7bbc587c16ec30f9d1aa549dcbeba6e9e26
MaskNorm
import torch from torch import nn class MaskNorm(nn.Module): def __init__(self, norm_nc): super(MaskNorm, self).__init__() self.norm_layer = nn.InstanceNorm2d(norm_nc, affine=False) def normalize_region(self, region, mask): _b, _c, h, w = region.size() num_pixels = mask.sum((...
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...
swpang/xray-align-AR
MaskNorm
false
13,014
[ "MIT" ]
0
43cb0173ada9d1d71a6a923d605cb6fdae4d27aa
https://github.com/swpang/xray-align-AR/tree/43cb0173ada9d1d71a6a923d605cb6fdae4d27aa
FeatureCorrelation
import torch from torch import nn class FeatureCorrelation(nn.Module): def __init__(self): super(FeatureCorrelation, self).__init__() def forward(self, featureA, featureB): b, c, h, w = featureA.size() featureA = featureA.permute(0, 3, 2, 1).reshape(b, w * h, c) featureB = fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
swpang/xray-align-AR
FeatureCorrelation
false
13,015
[ "MIT" ]
0
43cb0173ada9d1d71a6a923d605cb6fdae4d27aa
https://github.com/swpang/xray-align-AR/tree/43cb0173ada9d1d71a6a923d605cb6fdae4d27aa
Discriminator
import torch import torch.nn as nn class Discriminator(nn.Module): def __init__(self, num_inputs, hidden_size): super(Discriminator, self).__init__() self.linear1 = nn.Linear(num_inputs, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) self.linear3 = nn.Linear(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.triton_helpers import libdevice import torch.nn as ...
syuntoku14/flow
Discriminator
false
13,016
[ "MIT" ]
0
3a1157cde31d0b7d6a3cc2f91eef0ec9ea53575e
https://github.com/syuntoku14/flow/tree/3a1157cde31d0b7d6a3cc2f91eef0ec9ea53575e
Generator
import torch import torch.nn as nn import torch.nn.functional as F class Generator(nn.Module): def __init__(self, input_size, hidden_size, out_size): super(Generator, self).__init__() self.map1 = nn.Linear(input_size, hidden_size) self.map2 = nn.Linear(hidden_size, 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 ...
tan-huaiyu/Network_science-and-Evolutionary_dynamics
Generator
false
13,017
[ "Apache-2.0" ]
0
4bdaaed18c6f230213fd69a31144db8e97eb0c7b
https://github.com/tan-huaiyu/Network_science-and-Evolutionary_dynamics/tree/4bdaaed18c6f230213fd69a31144db8e97eb0c7b
DepthwiseSeparableConv
import torch import torch.nn as nn import torch.nn.functional as F class DepthwiseSeparableConv(nn.Module): def __init__(self, in_ch, out_ch, k, bias=True): super().__init__() self.depthwise_conv = nn.Conv1d(in_channels=in_ch, out_channels= in_ch, kernel_size=k, groups=in_ch, padding=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
raghavjajodia/squad
DepthwiseSeparableConv
false
13,018
[ "MIT" ]
0
4eb6ccdfaa904aa97215c8bc65cd77b54ff54601
https://github.com/raghavjajodia/squad/tree/4eb6ccdfaa904aa97215c8bc65cd77b54ff54601
Matcher
import math import torch import torch.nn as nn class Matcher(nn.Module): """ Matching between a pair of nodes to conduct link prediction. Use multi-head attention as matching model. """ def __init__(self, n_hid): super(Matcher, self).__init__() self.left_linear = nn.Linear...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
syyunn/pyHGT-1
Matcher
false
13,019
[ "MIT" ]
0
ad0918a48777add1495b80f35b5f2b7a44b74625
https://github.com/syyunn/pyHGT-1/tree/ad0918a48777add1495b80f35b5f2b7a44b74625
FusionLayer
import torch from torch import nn from torch.nn import init class FusionLayer(nn.Module): def __init__(self, nums=6): super(FusionLayer, self).__init__() self.weights = nn.Parameter(torch.randn(nums)) self.nums = nums self._reset_parameters() def _reset_parameters(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 import nn from torch.nn import init assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
tansyl/6883-SOD
FusionLayer
false
13,020
[ "MIT" ]
0
3a32c45be1c6c449fc7de145fe01746e3eeb16df
https://github.com/tansyl/6883-SOD/tree/3a32c45be1c6c449fc7de145fe01746e3eeb16df
GRUCell
import torch import numpy as np import torch.nn.functional as F import torch.utils.data import torch.nn as nn class GRUCell(nn.Module): def __init__(self, input_size, hidden_size, bias=True): super(GRUCell, self).__init__() self.input_size = input_size self.hidden_size = hidden_size ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
systemshift/PyGrid
GRUCell
false
13,021
[ "Apache-2.0" ]
0
d0ee3df8731a7576d6689fa8b4f5d3fe05ac11ff
https://github.com/systemshift/PyGrid/tree/d0ee3df8731a7576d6689fa8b4f5d3fe05ac11ff
Debayer2x2
import torch import torch.nn import torch.nn.functional class Debayer2x2(torch.nn.Module): """Demosaicing of Bayer images using 2x2 convolutions. Requires BG-Bayer color filter array layout. That is, the image[1,1]='B', image[1,2]='G'. This corresponds to OpenCV naming conventions. ""...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tasptz/pytorch-debayer
Debayer2x2
false
13,022
[ "MIT" ]
0
ec35f34a57c045eb2319f4ef87f371d95f7394c3
https://github.com/tasptz/pytorch-debayer/tree/ec35f34a57c045eb2319f4ef87f371d95f7394c3
PowerLaw_Compressed_Loss
import torch import torch.nn as nn import torch.utils.data class PowerLaw_Compressed_Loss(nn.Module): def __init__(self, power=0.3, complex_loss_ratio=0.113): super(PowerLaw_Compressed_Loss, self).__init__() self.power = power self.complex_loss_ratio = complex_loss_ratio self.crit...
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...
taylorjdlee/VoiceSplit
PowerLaw_Compressed_Loss
false
13,023
[ "Apache-2.0" ]
0
bd914c42ae065bdda95d81a0ce0c173c29bb040f
https://github.com/taylorjdlee/VoiceSplit/tree/bd914c42ae065bdda95d81a0ce0c173c29bb040f
Discriminator
import torch import torch.nn as nn import torch.nn.functional as F class Discriminator(nn.Module): def __init__(self, input_size, hidden_size, out_size): super(Discriminator, self).__init__() self.map1 = nn.Linear(input_size, hidden_size) self.map2 = nn.Linear(hidden_size, hidden_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
tan-huaiyu/Network_science-and-Evolutionary_dynamics
Discriminator
false
13,024
[ "Apache-2.0" ]
0
4bdaaed18c6f230213fd69a31144db8e97eb0c7b
https://github.com/tan-huaiyu/Network_science-and-Evolutionary_dynamics/tree/4bdaaed18c6f230213fd69a31144db8e97eb0c7b
Conv2
import math import torch import torch.nn as nn class Conv2(nn.Module): """ 1D conv with (kernel, stride)=(4, 2). Input: x: (N, 2L+2, in_channels) numeric tensor global_cond: (N, global_cond_channels) numeric tensor Output: y: (N, L, out_channels) numeric tensor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
tarepan/vqvaevc
Conv2
false
13,025
[ "MIT" ]
0
dabbb9bae5ccb9d5dcb110caf3f0a59f68006a97
https://github.com/tarepan/vqvaevc/tree/dabbb9bae5ccb9d5dcb110caf3f0a59f68006a97
Debayer3x3
import torch import torch.nn import torch.nn.functional class Debayer3x3(torch.nn.Module): """Demosaicing of Bayer images using 3x3 convolutions. Requires BG-Bayer color filter array layout. That is, the image[1,1]='B', image[1,2]='G'. This corresponds to OpenCV naming conventions. Compared to D...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn import torch.nn.functional assert_size_stride = torch._C._dynamo...
tasptz/pytorch-debayer
Debayer3x3
false
13,026
[ "MIT" ]
0
ec35f34a57c045eb2319f4ef87f371d95f7394c3
https://github.com/tasptz/pytorch-debayer/tree/ec35f34a57c045eb2319f4ef87f371d95f7394c3
nSGC
import math import torch import torch.nn.functional as F import torch.utils.dlpack import torch.nn as nn class nSGC(nn.Module): def __init__(self, nfeat, nclass): super(nSGC, self).__init__() self.W1 = nn.Linear(nfeat, nclass * 2) self.W2 = nn.Linear(nclass * 2, nclass) self.init(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.util...
tealminivan/FinalProject
nSGC
false
13,027
[ "MIT" ]
0
ef6e0cda619b7e00f112ffadd56d259a5cc8a85b
https://github.com/tealminivan/FinalProject/tree/ef6e0cda619b7e00f112ffadd56d259a5cc8a85b
Joiner
import torch from torch import nn import torch.nn.functional as F class Joiner(nn.Module): def __init__(self, input_dim: 'int', output_dim: 'int'): super().__init__() self.output_linear = nn.Linear(input_dim, output_dim) def forward(self, encoder_out: 'torch.Tensor', decoder_out: 'torch.Tens...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
thangdepzai/icefall
Joiner
false
13,028
[ "Apache-2.0" ]
0
8c7995d493c4309c3d09bdabfa1ab12b4eec2657
https://github.com/thangdepzai/icefall/tree/8c7995d493c4309c3d09bdabfa1ab12b4eec2657
NNTest
import torch import torch.nn as nn import torch.nn.functional as F class NNTest(nn.Module): def __init__(self, input_size, output_size): super(NNTest, self).__init__() self.fc1 = nn.Linear(input_size, 50) self.fc2 = nn.Linear(50, 100) self.fc3 = nn.Linear(100, 50) self.fc4...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
tassotirap/data-science
NNTest
false
13,029
[ "Apache-2.0" ]
0
644bc351740cda90c0d8c907132d9da9630266c9
https://github.com/tassotirap/data-science/tree/644bc351740cda90c0d8c907132d9da9630266c9
ConvElement
import torch import torch.nn as nn import torch.nn.functional as F class ConvElement(nn.Module): """ Residual Core element used inside the NN. Control the number of filters and batch normalization. """ def __init__(self, input_size, num_filters, use_leaky=True, stride=1, leaky_p=0.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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
tensormedical/PARIETAL
ConvElement
false
13,030
[ "Apache-2.0" ]
0
25bf1cf7828b24d60ccff42efbd0537989aaf160
https://github.com/tensormedical/PARIETAL/tree/25bf1cf7828b24d60ccff42efbd0537989aaf160
Hill
import torch import torch.nn as nn class Hill(nn.Module): def forward(self, p): n = 2 return 1 / (1 + p ** n) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
tianyu-lu/latent_ode
Hill
false
13,031
[ "MIT" ]
0
1a9e9415eda1837ed78e50009752b90eda3ca0db
https://github.com/tianyu-lu/latent_ode/tree/1a9e9415eda1837ed78e50009752b90eda3ca0db
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 12, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(12, 16, 5) self.fc1 = nn.Linear(16 * 5 * 5, 120) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
tassotirap/data-science
Net
false
13,032
[ "Apache-2.0" ]
0
644bc351740cda90c0d8c907132d9da9630266c9
https://github.com/tassotirap/data-science/tree/644bc351740cda90c0d8c907132d9da9630266c9
MaxPoolStride1
import torch import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import torch.nn.functional as F import torch._utils class MaxPoolStride1(nn.Module): def __init__(self, kernel_size): super(MaxPoolStride1, self).__init__() self.kernel_size = kernel_size self.p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torch.utils.data.distributed import ...
tiahflorens/AlphaPose
MaxPoolStride1
false
13,033
[ "Apache-2.0" ]
0
84b844eff543eaa619d994ea0b15cb6caf69950d
https://github.com/tiahflorens/AlphaPose/tree/84b844eff543eaa619d994ea0b15cb6caf69950d
ConcatBlock
import torch import torch.nn as nn import torch.nn.functional class ConcatBlock(nn.Module): def __init__(self, in_channels, out_channels): super(ConcatBlock, self).__init__() self.in_chns = in_channels self.out_chns = out_channels self.conv1 = nn.Conv2d(self.in_chns, self.in_chns,...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._...
timothytancy/SSL4MIS
ConcatBlock
false
13,034
[ "MIT" ]
0
7879ad3483223e31a2785f5112eac1d4fa36b66e
https://github.com/timothytancy/SSL4MIS/tree/7879ad3483223e31a2785f5112eac1d4fa36b66e
RingLoss
import torch import warnings import torch.nn as nn from torchvision.transforms import * class RingLoss(nn.Module): """Ring loss. Reference: Zheng et al. Ring loss: Convex Feature Normalization for Face Recognition. CVPR 2018. """ def __init__(self): super(RingLoss, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import warnings import torch.nn as nn from torchvision.transforms import * asse...
theodorhusefest/ABD-Net
RingLoss
false
13,035
[ "MIT" ]
0
4ad71205954726b88d081ca079c28378f74e3007
https://github.com/theodorhusefest/ABD-Net/tree/4ad71205954726b88d081ca079c28378f74e3007
OutPutBlock
import torch import torch.nn as nn import torch.nn.functional class OutPutBlock(nn.Module): def __init__(self, in_channels, out_channels): super(OutPutBlock, self).__init__() self.in_chns = in_channels self.out_chns = out_channels self.conv1 = nn.Conv2d(self.in_chns, self.in_chns ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._...
timothytancy/SSL4MIS
OutPutBlock
false
13,036
[ "MIT" ]
0
7879ad3483223e31a2785f5112eac1d4fa36b66e
https://github.com/timothytancy/SSL4MIS/tree/7879ad3483223e31a2785f5112eac1d4fa36b66e
ConvolutionModule
import torch from torch import Tensor from torch import nn class Swish(torch.nn.Module): """Construct an Swish object.""" def forward(self, x: 'Tensor') ->Tensor: """Return Swich activation function.""" return x * torch.sigmoid(x) class ConvolutionModule(nn.Module): """ConvolutionModule...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 T...
thangdepzai/icefall
ConvolutionModule
false
13,037
[ "Apache-2.0" ]
0
8c7995d493c4309c3d09bdabfa1ab12b4eec2657
https://github.com/thangdepzai/icefall/tree/8c7995d493c4309c3d09bdabfa1ab12b4eec2657
PAMA
import torch import torch.nn as nn def calc_mean_std(feat, eps=1e-05): size = feat.size() assert len(size) == 4 N, C = size[:2] feat_var = feat.view(N, C, -1).var(dim=2) + eps feat_std = feat_var.sqrt().view(N, C, 1, 1) feat_mean = feat.view(N, C, -1).mean(dim=2).view(N, C, 1, 1) return fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
sugi-san/PAMA
PAMA
false
13,038
[ "MIT" ]
0
95141ebf0d3b61828a0e545f989f96b8ef569f34
https://github.com/sugi-san/PAMA/tree/95141ebf0d3b61828a0e545f989f96b8ef569f34
Actor
import torch import numpy as np import torch.nn.functional as F from torch import nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Actor(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tjkemp/tennis-example
Actor
false
13,039
[ "MIT" ]
0
3cb0c52a93c65f88872cf44e3782bf87d9d8cef3
https://github.com/tjkemp/tennis-example/tree/3cb0c52a93c65f88872cf44e3782bf87d9d8cef3
CausalAttentionSortNet
import torch from torch.nn import functional as F from torch import nn def bucket(buckets, t, dim=1): shape = list(t.shape) shape[dim:dim + 1] = [buckets, -1] return t.reshape(*shape) def differentiable_topk(x, k, temperature=1.0): *_, n, dim = x.shape topk_tensors = [] for i in range(k): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tatp22/sinkhorn-transformer
CausalAttentionSortNet
false
13,040
[ "MIT" ]
0
3eaa76e99efeee75cf8298defaaef51621c55ff4
https://github.com/tatp22/sinkhorn-transformer/tree/3eaa76e99efeee75cf8298defaaef51621c55ff4
Critic
import torch import numpy as np import torch.nn.functional as F from torch import nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Critic(nn.Module): """Critic (Value) Model.""" def __init__(self, state_size, action_size, seed, 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 numpy as np from torch...
tjkemp/tennis-example
Critic
false
13,041
[ "MIT" ]
0
3cb0c52a93c65f88872cf44e3782bf87d9d8cef3
https://github.com/tjkemp/tennis-example/tree/3cb0c52a93c65f88872cf44e3782bf87d9d8cef3
DeepModel
import torch import torch.nn as nn import torch.nn.functional as F class DeepModel(nn.Module): def __init__(self, in_size, out_size): super().__init__() self.linear1 = nn.Linear(in_size, 1024) self.linear2 = nn.Linear(1024, 512) self.linear3 = nn.Linear(512, 256) self.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.nn as nn assert_...
tianyi-ge/eecs598-a1
DeepModel
false
13,042
[ "MIT" ]
0
540140c5c2a59931ee051a0064932a1e81f84806
https://github.com/tianyi-ge/eecs598-a1/tree/540140c5c2a59931ee051a0064932a1e81f84806
GaussianNoiseSampler
import torch import torch as th import torch.nn as nn class GaussianNoiseSampler(nn.Module): def __init__(self, scale=0.01, inplace=False): super(GaussianNoiseSampler, self).__init__() if scale < 0: raise ValueError( 'noise scale has to be greather than 0, but got {}'....
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit def triton_poi_...
tritas/mixdat
GaussianNoiseSampler
false
13,043
[ "BSD-3-Clause" ]
0
38fb10df76df55cc1eddba5375c7699c23771fb3
https://github.com/tritas/mixdat/tree/38fb10df76df55cc1eddba5375c7699c23771fb3
Projection
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class TimeDistributed(nn.Module): def __init__(self, layer, activation='relu'): super().__init__() self.layer = layer self.activation = self.select_activation(activation) def forward(self, x): x_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
tndls9304/chatspace
Projection
false
13,044
[ "Apache-2.0" ]
0
42cb4bd9bd3b553706d9ac227150329103d681aa
https://github.com/tndls9304/chatspace/tree/42cb4bd9bd3b553706d9ac227150329103d681aa
Model
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, output_class_num, **kwargs): super(Model, self).__init__() self.linear = nn.Linear(input_dim, output_class_num) def forward(self, features): pooled = features.mean(dim=1) predicted = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
triper1022/s3prl
Model
false
13,045
[ "MIT" ]
0
d48e9e1d062d6cb14b66048eb56193fb50c60c24
https://github.com/triper1022/s3prl/tree/d48e9e1d062d6cb14b66048eb56193fb50c60c24
resnet_block
import torch import torch.nn as nn import torch.nn.functional as F class resnet_block(nn.Module): def __init__(self, dim_in, dim_out): super(resnet_block, self).__init__() self.dim_in = dim_in self.dim_out = dim_out if self.dim_in == self.dim_out: self.conv_1 = nn.Conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
trisct/BSP-NET-pytorch
resnet_block
false
13,046
[ "MIT" ]
0
31f148aa3d7321bac854bc3de6c88f676236b7e4
https://github.com/trisct/BSP-NET-pytorch/tree/31f148aa3d7321bac854bc3de6c88f676236b7e4
MLP
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self): super(MLP, self).__init__() self.fc1 = nn.Linear(in_features=28 * 28, out_features=500) self.fc2 = nn.Linear(in_features=500, out_features=200) self.fc3 = nn.Linear(in_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
trGiang99/ml-glossary-vn
MLP
false
13,047
[ "MIT" ]
0
1160300cee6ccb02712c790b76bbc11c06c2ca55
https://github.com/trGiang99/ml-glossary-vn/tree/1160300cee6ccb02712c790b76bbc11c06c2ca55
generator
import torch import torch.nn as nn class generator(nn.Module): def __init__(self, p_dim, c_dim): super(generator, self).__init__() self.p_dim = p_dim self.c_dim = c_dim convex_layer_weights = torch.zeros((self.p_dim, self.c_dim)) self.convex_layer_weights = nn.Parameter(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 import torch.nn as nn assert_...
trisct/BSP-NET-pytorch
generator
false
13,048
[ "MIT" ]
0
31f148aa3d7321bac854bc3de6c88f676236b7e4
https://github.com/trisct/BSP-NET-pytorch/tree/31f148aa3d7321bac854bc3de6c88f676236b7e4
FocalLoss
import torch from torch import nn class FocalLoss(nn.Module): def __init__(self, gamma=0, eps=1e-07): super(FocalLoss, self).__init__() self.gamma = gamma self.eps = eps self.ce = torch.nn.CrossEntropyLoss(reduction='none') def forward(self, input, target): logp = sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
tropicbird/kaggle-landmark-recognition-2020-1st-place
FocalLoss
false
13,049
[ "MIT" ]
0
79a9d1b05c326a77b4859d4d41d30e52e6be710e
https://github.com/tropicbird/kaggle-landmark-recognition-2020-1st-place/tree/79a9d1b05c326a77b4859d4d41d30e52e6be710e
Conv2dStaticSamePadding
import math import torch from torch import nn from torch.nn import functional as F class Conv2dStaticSamePadding(nn.Module): """ created by Zylo117 The real keras/tensorflow conv2d with same padding """ def __init__(self, in_channels, out_channels, kernel_size, stride=1, bias=False, group...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
tujikuangmo/FishNet
Conv2dStaticSamePadding
false
13,050
[ "MIT" ]
0
1c2f7112639416bd12a02585a9e04e1d05960520
https://github.com/tujikuangmo/FishNet/tree/1c2f7112639416bd12a02585a9e04e1d05960520
GAT
import torch import torch.nn as nn import torch.nn.functional as F class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super(GraphAttentionLayer, 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....
thilinicooray/pyGAT
GAT
false
13,051
[ "MIT" ]
0
0c8fd0fdae20e42a41116cc9691e1223fd9d0a93
https://github.com/thilinicooray/pyGAT/tree/0c8fd0fdae20e42a41116cc9691e1223fd9d0a93
BinaryFocalLoss
import torch class BinaryFocalLoss(torch.nn.Module): """ from https://github.com/qubvel/segmentation_models""" def __init__(self, gamma=2.0, alpha=0.25, eps=1e-07): super().__init__() self.gamma = gamma self.alpha = alpha self.eps = eps def forward(self, pr, gt): ...
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...
uncharted-distil/d3m-primitives
BinaryFocalLoss
false
13,054
[ "Apache-2.0" ]
0
e8d37dbe302c0f2bae4e7f7fa241a46faebc9b79
https://github.com/uncharted-distil/d3m-primitives/tree/e8d37dbe302c0f2bae4e7f7fa241a46faebc9b79
GeM
import torch from torch import nn from torch.nn import functional as F from torchvision.transforms import * class GeM(nn.Module): def __init__(self, dim=2048, p=3, eps=1e-06): super(GeM, self).__init__() self.p = nn.Parameter(torch.ones(dim) * p, requires_grad=True) 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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
uestcwcw/University1652-Baseline
GeM
false
13,056
[ "MIT" ]
0
fda1e4773fc911cbb43a9b96901d436298dc1284
https://github.com/uestcwcw/University1652-Baseline/tree/fda1e4773fc911cbb43a9b96901d436298dc1284
CrossEntropy
import torch from torch import nn import torch.nn.functional as F def cross_entropy(y, target, mask=None): if target.ndim == 1: loss = F.cross_entropy(y, target, reduction='none') else: loss = -(target * F.log_softmax(y, 1)).sum(1) if mask is not None: loss = mask * loss 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 from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn i...
uncharted-distil/d3m-primitives
CrossEntropy
false
13,057
[ "Apache-2.0" ]
0
e8d37dbe302c0f2bae4e7f7fa241a46faebc9b79
https://github.com/uncharted-distil/d3m-primitives/tree/e8d37dbe302c0f2bae4e7f7fa241a46faebc9b79
CircleLoss
import torch from torch import Tensor from torch import nn from torchvision.transforms import * class CircleLoss(nn.Module): def __init__(self, m: 'float', gamma: 'float') ->None: super(CircleLoss, self).__init__() self.m = m self.gamma = gamma self.soft_plus = nn.Softplus() ...
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 from torch ...
uestcwcw/University1652-Baseline
CircleLoss
false
13,058
[ "MIT" ]
0
fda1e4773fc911cbb43a9b96901d436298dc1284
https://github.com/uestcwcw/University1652-Baseline/tree/fda1e4773fc911cbb43a9b96901d436298dc1284
Image2Patch
import torch import torch.nn as nn import torch.nn.functional as F class Image2Patch(nn.Module): """Some Information about Image2Patch""" def __init__(self, channels, image_size, patch_size): super(Image2Patch, self).__init__() if type(patch_size) == int: patch_size = [patch_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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
uthree/ReMixer
Image2Patch
false
13,059
[ "MIT" ]
0
587e1b6a01850df649eccf043689f84a7dd5e2dc
https://github.com/uthree/ReMixer/tree/587e1b6a01850df649eccf043689f84a7dd5e2dc
CEFL
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class CEFL(nn.Module): def __init__(self, gamma=1): super(CEFL, self).__init__() self.gamma = gamma def get_prob(self, input, target): prob = F.softmax(input, dim=-1) prob = prob[range(target...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
umairjavaid/staff-employee-classification
CEFL
false
13,060
[ "MIT" ]
0
fc5fe32acfbde2b188094df90d888eeb0f4f4acd
https://github.com/umairjavaid/staff-employee-classification/tree/fc5fe32acfbde2b188094df90d888eeb0f4f4acd
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx class FocalLoss(nn.Module): def __init__(self, alpha=1, gamma=0): super(FocalLoss, self).__init__() self.gamma = gamma self.alpha = alpha def get_attention(self, input, target): prob = F.soft...
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 ...
umairjavaid/staff-employee-classification
FocalLoss
false
13,061
[ "MIT" ]
0
fc5fe32acfbde2b188094df90d888eeb0f4f4acd
https://github.com/umairjavaid/staff-employee-classification/tree/fc5fe32acfbde2b188094df90d888eeb0f4f4acd
encoder
import torch import torch.nn as nn import torch.nn.functional as F class encoder(nn.Module): def __init__(self, ef_dim): super(encoder, self).__init__() self.ef_dim = ef_dim self.conv_1 = nn.Conv3d(1, self.ef_dim, 4, stride=2, padding=1, bias=True) self.conv_2 = nn.Con...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
trisct/BSP-NET-pytorch
encoder
false
13,062
[ "MIT" ]
0
31f148aa3d7321bac854bc3de6c88f676236b7e4
https://github.com/trisct/BSP-NET-pytorch/tree/31f148aa3d7321bac854bc3de6c88f676236b7e4
CustomInverse
import torch class CustomTorchOp(torch.autograd.Function): @staticmethod def symbolic(g, input): return g.op('torchcustom::Add10', input) @staticmethod def forward(ctx, x): return x + 10 class CustomInverse(torch.nn.Module): def forward(self, x, y): ress = CustomTorchO...
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...
shaahji/onnxruntime-extensions
CustomInverse
false
13,063
[ "MIT" ]
0
c30df08aee69db761b97185be9f87160a4efa6bc
https://github.com/shaahji/onnxruntime-extensions/tree/c30df08aee69db761b97185be9f87160a4efa6bc
MixerMLP
import torch import torch.nn as nn class MixerMLP(nn.Module): """Some Information about MixerMLP""" def __init__(self, dim, activation='gelu'): super(MixerMLP, self).__init__() if activation == 'gelu': self.activation = nn.GELU() elif activation == 'relu': self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
uthree/ReMixer
MixerMLP
false
13,064
[ "MIT" ]
0
587e1b6a01850df649eccf043689f84a7dd5e2dc
https://github.com/uthree/ReMixer/tree/587e1b6a01850df649eccf043689f84a7dd5e2dc
SpatialShift2d
import torch import torch.nn as nn import torch.nn.functional as F class SpatialShift2d(nn.Module): def __init__(self, channels, padding_mode='replicate'): super(SpatialShift2d, self).__init__() qc = channels // 4 self.num_shift_left = qc self.num_shift_right = qc self.num...
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...
uthree/ReMixer
SpatialShift2d
false
13,065
[ "MIT" ]
0
587e1b6a01850df649eccf043689f84a7dd5e2dc
https://github.com/uthree/ReMixer/tree/587e1b6a01850df649eccf043689f84a7dd5e2dc
ElementWiseMLP
import torch import torch.nn as nn class ElementWiseMLP(nn.Module): """Some Information about ElementWiseMLP""" def __init__(self, dim, activation='gelu'): super(ElementWiseMLP, self).__init__() if activation == 'gelu': self.activation = nn.GELU() elif activation == '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.triton_helpers import libdevice import torch.nn as ...
uthree/ReMixer
ElementWiseMLP
false
13,066
[ "MIT" ]
0
587e1b6a01850df649eccf043689f84a7dd5e2dc
https://github.com/uthree/ReMixer/tree/587e1b6a01850df649eccf043689f84a7dd5e2dc
DQN_Linear
import torch import torch.nn as nn import torch.nn.functional as F class DQN_Linear(nn.Module): def __init__(self, input_size, output_size): super(DQN_Linear, self).__init__() self.l1 = nn.Linear(input_size, 32) self.l2 = nn.Linear(32, 64) self.head = nn.Linear(64, 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 import torch.nn as nn assert_...
vashineyu/dqn_cartpole
DQN_Linear
false
13,067
[ "MIT" ]
0
7d3d2c26e29d40fce7710dbd56c59045514f2e84
https://github.com/vashineyu/dqn_cartpole/tree/7d3d2c26e29d40fce7710dbd56c59045514f2e84
EnvModel
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class EnvModel(nn.Module): def __init__(self, phi_dim, action_dim): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
spacegoing/oc_hrl_pytorch
EnvModel
false
13,068
[ "MIT" ]
0
3e6c3b32b41d7dad40a9ee35f436f8cbcde8633b
https://github.com/spacegoing/oc_hrl_pytorch/tree/3e6c3b32b41d7dad40a9ee35f436f8cbcde8633b
Scale
import math import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, d_model): super(Scale, self).__init__() self.d_model = d_model def forward(self, x): return x * math.sqrt(self.d_model) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_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...
voidism/End-to-end-ASR-Pytorch
Scale
false
13,069
[ "MIT" ]
0
509c389fa6ab98c30e227c6f4c8f7474adbc1bb2
https://github.com/voidism/End-to-end-ASR-Pytorch/tree/509c389fa6ab98c30e227c6f4c8f7474adbc1bb2
GeneratorBlock
import torch import torch.nn as nn def leaky_relu(p=0.2): return nn.LeakyReLU(p) class GeneratorBlock(nn.Module): def __init__(self, input_channels, latent_channels, output_channels, upsample=True): super(GeneratorBlock, self).__init__() if upsample: self.upsample = nn.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 torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
uthree/pg-gan
GeneratorBlock
false
13,070
[ "MIT" ]
0
7a72a9f3487a66ddc6c8c51a774e3d8128369b2a
https://github.com/uthree/pg-gan/tree/7a72a9f3487a66ddc6c8c51a774e3d8128369b2a