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
ConvRelu
import torch from torch import nn import torch.nn.functional as F import torch.cuda import torch.backends.cudnn import torch.backends.mkl import torch.backends.cuda import torch.backends.quantized class ConvRelu(nn.Module): def __init__(self): super(ConvRelu, self).__init__() self.conv = torch.nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
XiaobingSuper/intel-extension-for-pytorch
ConvRelu
false
9,723
[ "Apache-2.0" ]
0
b61029be10e46e6d2e13b0e700c81f8e59164df0
https://github.com/XiaobingSuper/intel-extension-for-pytorch/tree/b61029be10e46e6d2e13b0e700c81f8e59164df0
AttentionBlock
import math import torch import torch.cuda from torch.nn import functional as F from torch import nn import torch.distributed import torch.utils.data import torch.optim def convert_pad_shape(pad_shape): """ Used to get arguments for F.pad """ l = pad_shape[::-1] pad_shape = [item for sublist in l ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Oreoluwa1234/NeMo
AttentionBlock
false
9,724
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928
InvConvNear
import torch import torch.cuda from torch.nn import functional as F from torch import nn import torch.distributed import torch.utils.data import torch.optim class InvConvNear(nn.Module): def __init__(self, channels, n_split=4, no_jacobian=False, **kwargs): super().__init__() assert n_split % 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.cuda from torch import nn import torch.distributed import torch.uti...
Oreoluwa1234/NeMo
InvConvNear
false
9,725
[ "Apache-2.0" ]
0
b01e3ceed34efe31fd43866685dbdd19a6b30928
https://github.com/Oreoluwa1234/NeMo/tree/b01e3ceed34efe31fd43866685dbdd19a6b30928
GeLU
import math import torch import torch.nn as nn def gelu(x): """Implementation of the gelu activation function. For information: OpenAI GPT's gelu is slightly different (and gives slightly different results): 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3)))) ...
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 math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards....
aditya10/vilbert-multi-task
GeLU
false
9,726
[ "MIT" ]
0
dda8c16187ac6cc4f6266a823fbde528f65af720
https://github.com/aditya10/vilbert-multi-task/tree/dda8c16187ac6cc4f6266a823fbde528f65af720
DiceLoss
import torch from torch import nn class DiceLoss(nn.Module): def __init__(self, image=False): super().__init__() self.image = image def forward(self, x, y): x = x.sigmoid() i, u = [(t.flatten(1).sum(1) if self.image else t.sum()) for t in [ x * y, x + 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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
agrawalshubham01/FracNet
DiceLoss
false
9,727
[ "Apache-2.0" ]
0
8b912ca65651ff0ee203d9d73cf6ca18539728ac
https://github.com/agrawalshubham01/FracNet/tree/8b912ca65651ff0ee203d9d73cf6ca18539728ac
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_...
arifmujib/MIT-Machine-Learning-Projects
DQN
false
9,728
[ "MIT" ]
0
445f2dddf4441bf8248166e6eb15a0716444ab21
https://github.com/arifmujib/MIT-Machine-Learning-Projects/tree/445f2dddf4441bf8248166e6eb15a0716444ab21
LblLoss
import torch from torch import nn from torchvision.models import * class LblLoss(nn.Module): def __init__(self): super().__init__() def forward(self, pred_batch, true_batch): wgt = torch.ones_like(pred_batch) wgt[true_batch > 0] = 100 dis = (pred_batch - true_batch) ** 2 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from torchvision.models import * assert_size_stride = torch._C._dyna...
amoshyc/human-pose-estimation
LblLoss
false
9,729
[ "Apache-2.0" ]
0
8fd2962caee43b979f44637441d88d80f2ea951e
https://github.com/amoshyc/human-pose-estimation/tree/8fd2962caee43b979f44637441d88d80f2ea951e
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(1, 4, (3, 8), bias=False, stride=1) self.fc1 = nn.Linear(25 * 4, 1) def forward(self, x): x = self.conv1(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 torch.nn as nn assert_...
aoreskovic/TimeSeriesWithXNOR-Net
Net
false
9,730
[ "Apache-2.0" ]
0
5124b6c4ec19e657b49c370936efbd8adff4e60f
https://github.com/aoreskovic/TimeSeriesWithXNOR-Net/tree/5124b6c4ec19e657b49c370936efbd8adff4e60f
MultiHeadAttention
import math import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): """Multi-headed Attention for input Query, Key, Value Multi-headed Attention is a module for attention mechanisms which runs through attention in several times in parallel, then the multiple...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
UdbhavPrasad072300/CPS843_Final_Project
MultiHeadAttention
false
9,731
[ "MIT" ]
0
042f0bad48c7e49b71ab8efbc4ac5a9e6a6cf31c
https://github.com/UdbhavPrasad072300/CPS843_Final_Project/tree/042f0bad48c7e49b71ab8efbc4ac5a9e6a6cf31c
VAE
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data import torch.onnx import torch.optim import torch.utils.data.distributed import torch.nn.functional as F import torch.autograd class VAE(nn.Module): def __init__(self): super(VAE, self).__init__() self.fc1 = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
angelajiang/examples
VAE
false
9,732
[ "BSD-3-Clause" ]
0
9964d6bd97a93420f101ebcdc40f8bd540930956
https://github.com/angelajiang/examples/tree/9964d6bd97a93420f101ebcdc40f8bd540930956
QNetwork
import torch import torch.nn as nn import torch.nn.functional as F class QNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Parameters: ========== state_size (int): Dimension of each...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
andreaspts/DRL_CartPole
QNetwork
false
9,733
[ "MIT" ]
0
e4f018ab4adaeeaac2902c541e14933b56957e22
https://github.com/andreaspts/DRL_CartPole/tree/e4f018ab4adaeeaac2902c541e14933b56957e22
Conv2D
import math import torch from torch import nn class Conv2D(nn.Module): def __init__(self, in_channels, kernel_size, last): super().__init__() if last: out_channels = 1 else: out_channels = 5 self.conv2d = nn.Conv2d(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 import math from torch import nn assert_size_stride = torch._C._dynamo.guards.as...
Yusoi/mmdetection
Conv2D
false
9,734
[ "Apache-2.0" ]
0
cbb5fb00f6e124fbb2c15e7e3438d7fa76b8850a
https://github.com/Yusoi/mmdetection/tree/cbb5fb00f6e124fbb2c15e7e3438d7fa76b8850a
MultiHead
import math import torch from torch import nn from torch.nn import functional as F class Attention(nn.Module): def __init__(self, d_key, drop_ratio, causal): super(Attention, self).__init__() self.scale = math.sqrt(d_key) self.dropout = nn.Dropout(drop_ratio) self.causal = causal ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Sy-Zhang/recurrent-transformer
MultiHead
false
9,735
[ "MIT" ]
0
f66ba49a2c9ec42759d3d00d497b49ffe39e18de
https://github.com/Sy-Zhang/recurrent-transformer/tree/f66ba49a2c9ec42759d3d00d497b49ffe39e18de
EncoderImagePrecomp
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(X): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=1, keepdim=True).sqrt() X = torch.div(X, norm) return X class EncoderImagePrecomp(nn.Module): def __i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
ascott02/vsepp
EncoderImagePrecomp
false
9,736
[ "Apache-2.0" ]
0
c09abd2be5f1fec237ccfe3d7f41bfdea2acfde2
https://github.com/ascott02/vsepp/tree/c09abd2be5f1fec237ccfe3d7f41bfdea2acfde2
DuplicateModel
import torch import torch.nn as nn class DuplicateModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=12, prior=0.01, feature_size=256): super(DuplicateModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors self.c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
alexrusciano/nms_free_retinanet
DuplicateModel
false
9,737
[ "Apache-2.0" ]
0
3461a86e9dea71a756b92a434c62798bbf86b52d
https://github.com/alexrusciano/nms_free_retinanet/tree/3461a86e9dea71a756b92a434c62798bbf86b52d
Threshold
import torch from torch import nn class Threshold(nn.Module): def __init__(self, threshold): super(Threshold, self).__init__() self.threshold = nn.Threshold(threshold, 0.0) def forward(self, x): return self.threshold(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ...
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...
Yusoi/mmdetection
Threshold
false
9,738
[ "Apache-2.0" ]
0
cbb5fb00f6e124fbb2c15e7e3438d7fa76b8850a
https://github.com/Yusoi/mmdetection/tree/cbb5fb00f6e124fbb2c15e7e3438d7fa76b8850a
Softmax2d
import torch from torch import nn class Softmax2d(nn.Module): def __init__(self): super().__init__() self.Softmax2d = nn.Softmax2d() def forward(self, x): x = self.Softmax2d(x) return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ret...
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...
Yusoi/mmdetection
Softmax2d
false
9,739
[ "Apache-2.0" ]
0
cbb5fb00f6e124fbb2c15e7e3438d7fa76b8850a
https://github.com/Yusoi/mmdetection/tree/cbb5fb00f6e124fbb2c15e7e3438d7fa76b8850a
Block
import torch import torch.nn as nn from torch.nn import functional as F def get_conv(in_dim, out_dim, kernel_size, stride, padding, zero_bias=True, zero_weights=False, groups=1, scaled=False): c = nn.Conv2d(in_dim, out_dim, kernel_size, stride, padding, groups=groups) if zero_bias: c.bias.data *= ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
ashesh-0/vdvae
Block
false
9,740
[ "MIT" ]
0
a1ed5dfaf01a88af750413f5fcb907a5b73833a5
https://github.com/ashesh-0/vdvae/tree/a1ed5dfaf01a88af750413f5fcb907a5b73833a5
RegressionModel
import torch import torch.nn as nn class RegressionModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, feature_size=256): super(RegressionModel, self).__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = nn.ReL...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
alexrusciano/nms_free_retinanet
RegressionModel
false
9,741
[ "Apache-2.0" ]
0
3461a86e9dea71a756b92a434c62798bbf86b52d
https://github.com/alexrusciano/nms_free_retinanet/tree/3461a86e9dea71a756b92a434c62798bbf86b52d
NegativeScaledDotProduct
import torch import torch.utils.data.dataloader import torch.nn def dot_product(a: 'torch.Tensor', b: 'torch.Tensor', normalize=False): """ Computes dot product for pairs of vectors. :param normalize: Vectors are normalized (leads to cosine similarity) :return: Matrix with res[i][j] = dot_product(a[i...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.dataloader import torch.nn assert_size_stride = torch._C...
adriensas/flair
NegativeScaledDotProduct
false
9,742
[ "MIT" ]
0
f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
https://github.com/adriensas/flair/tree/f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
EuclideanMean
import torch from torch import Tensor import torch.utils.data.dataloader from torch import nn import torch.nn class EuclideanMean(nn.Module): """Implement a EuclideanMean object.""" def forward(self, data: 'Tensor') ->Tensor: """Performs a forward pass through the network. Parameters ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data.dataloader from torch import nn import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
adriensas/flair
EuclideanMean
false
9,743
[ "MIT" ]
0
f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
https://github.com/adriensas/flair/tree/f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
NegativeBinomial
import torch from torch import nn class NegativeBinomial(nn.Module): def __init__(self, input_size, output_size): """ Negative Binomial Supports Positive Count Data Args: input_size (int): hidden h_{i,t} column size output_size (int): embedding size """ sup...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
ashfarhangi/COVID-19_Impact
NegativeBinomial
false
9,744
[ "Apache-2.0" ]
0
7ce46616278cac95e31b3e853bb28ea7b8e58b7e
https://github.com/ashfarhangi/COVID-19_Impact/tree/7ce46616278cac95e31b3e853bb28ea7b8e58b7e
LogitCosineDistance
import torch import torch.utils.data.dataloader import torch.nn def dot_product(a: 'torch.Tensor', b: 'torch.Tensor', normalize=False): """ Computes dot product for pairs of vectors. :param normalize: Vectors are normalized (leads to cosine similarity) :return: Matrix with res[i][j] = dot_product(a[i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
adriensas/flair
LogitCosineDistance
false
9,745
[ "MIT" ]
0
f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
https://github.com/adriensas/flair/tree/f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
ClassificationModel
import torch import torch.nn as nn class ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256): super(ClassificationModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
alexrusciano/nms_free_retinanet
ClassificationModel
false
9,746
[ "Apache-2.0" ]
0
3461a86e9dea71a756b92a434c62798bbf86b52d
https://github.com/alexrusciano/nms_free_retinanet/tree/3461a86e9dea71a756b92a434c62798bbf86b52d
GATgate_lp
import torch from torch import nn class GATgate_lp(nn.Module): def __init__(self, n_dim): super(GATgate_lp, self).__init__() self.w_l1 = nn.Linear(n_dim, n_dim) self.w_l2 = nn.Linear(n_dim, n_dim) self.w_p1 = nn.Linear(n_dim, n_dim) self.w_p2 = nn.Linear(n_dim, n_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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
arwhirang/affinity_prediction_BGNN
GATgate_lp
false
9,747
[ "MIT" ]
0
b8a2a5de16a61a46dadd53856d758e7f63f9ca91
https://github.com/arwhirang/affinity_prediction_BGNN/tree/b8a2a5de16a61a46dadd53856d758e7f63f9ca91
CRF
import torch import torch.utils.data.dataloader import torch.nn class CRF(torch.nn.Module): """ Conditional Random Field Implementation according to sgrvinod (https://github.com/sgrvinod). Classifier which predicts single tag / class / label for given word based on not just the word, but also on previ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data.dataloader import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
adriensas/flair
CRF
false
9,748
[ "MIT" ]
0
f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
https://github.com/adriensas/flair/tree/f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
EncoderLayer
import math import torch from torch import nn from torch.nn import functional as F class LayerNorm(nn.Module): def __init__(self, d_model, eps=1e-06): super(LayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torch.zeros(d_model)) 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....
Sy-Zhang/recurrent-transformer
EncoderLayer
false
9,749
[ "MIT" ]
0
f66ba49a2c9ec42759d3d00d497b49ffe39e18de
https://github.com/Sy-Zhang/recurrent-transformer/tree/f66ba49a2c9ec42759d3d00d497b49ffe39e18de
TenLayerNet
import torch class TenLayerNet(torch.nn.Module): def __init__(self, D_in, H, D_out): super(TenLayerNet, self).__init__() self.linear1 = torch.nn.Linear(D_in, H) self.linear2 = torch.nn.Linear(H, H) self.linear3 = torch.nn.Linear(H, H) self.linear4 = torch.nn.Linear(H, 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 assert_size_stride = torch._C...
anvitha-bhat/iot_final_project
TenLayerNet
false
9,750
[ "MIT" ]
0
e9301c083d5e7a228d0ad868e44cb1df3a5f7363
https://github.com/anvitha-bhat/iot_final_project/tree/e9301c083d5e7a228d0ad868e44cb1df3a5f7363
CosineDistance
import torch import torch.utils.data.dataloader import torch.nn def dot_product(a: 'torch.Tensor', b: 'torch.Tensor', normalize=False): """ Computes dot product for pairs of vectors. :param normalize: Vectors are normalized (leads to cosine similarity) :return: Matrix with res[i][j] = dot_product(a[i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
adriensas/flair
CosineDistance
false
9,751
[ "MIT" ]
0
f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
https://github.com/adriensas/flair/tree/f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
L1_Charbonnier_loss
import torch import torch.nn as nn class L1_Charbonnier_loss(nn.Module): """L1 Charbonnierloss loss function where the epsilon has been taken as 1e-3 from the paper""" def __init__(self): super(L1_Charbonnier_loss, self).__init__() self.eps = 0.001 def forward(self, X, Y): diff =...
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...
ankurbhatia24/image-super-resolution
L1_Charbonnier_loss
false
9,752
[ "Apache-2.0" ]
0
7ebc2be70e1a940addb6ba886a663f88167e6007
https://github.com/ankurbhatia24/image-super-resolution/tree/7ebc2be70e1a940addb6ba886a663f88167e6007
Value
import torch import torch.nn as nn class Value(nn.Module): def __init__(self, num_inputs): super(Value, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.value_head = nn.Linear(64, 1) self.value_head.weight.data.mul_(0.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.triton_helpers import libdevice import torch.nn as ...
aranganath/pytorch-trpo
Value
false
9,753
[ "MIT" ]
0
a85bc48261eb4ed5833209da706379e9dc84592f
https://github.com/aranganath/pytorch-trpo/tree/a85bc48261eb4ed5833209da706379e9dc84592f
GATgate_lp2
import torch from torch import nn class GATgate_lp2(nn.Module): def __init__(self, n_dim): super(GATgate_lp2, self).__init__() self.w_l = nn.Linear(n_dim, n_dim) self.w_p = nn.Linear(n_dim, n_dim) self.LR = nn.LeakyReLU() def forward(self, vec_l, vec_p, adj_inter): 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
arwhirang/affinity_prediction_BGNN
GATgate_lp2
false
9,754
[ "MIT" ]
0
b8a2a5de16a61a46dadd53856d758e7f63f9ca91
https://github.com/arwhirang/affinity_prediction_BGNN/tree/b8a2a5de16a61a46dadd53856d758e7f63f9ca91
Gaussian
import torch from torch import nn class Gaussian(nn.Module): def __init__(self, hidden_size, output_size): """ Gaussian Likelihood Supports Continuous Data Args: input_size (int): hidden h_{i,t} column size output_size (int): embedding size """ super(Gaussi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
ashfarhangi/COVID-19_Impact
Gaussian
false
9,755
[ "Apache-2.0" ]
0
7ce46616278cac95e31b3e853bb28ea7b8e58b7e
https://github.com/ashfarhangi/COVID-19_Impact/tree/7ce46616278cac95e31b3e853bb28ea7b8e58b7e
EuclideanDistance
import torch from torch import Tensor import torch.utils.data.dataloader from torch import nn import torch.nn def arccosh(x): """Compute the arcosh, numerically stable.""" x = torch.clamp(x, min=1 + EPSILON) a = torch.log(x) b = torch.log1p(torch.sqrt(x * x - 1) / x) return a + b def mdot(x, 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 import torch.utils.data.dataloader from torch import nn import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
adriensas/flair
EuclideanDistance
false
9,756
[ "MIT" ]
0
f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
https://github.com/adriensas/flair/tree/f01b0e7ff9a87d3862acae50aeaffdc8e8b8ac21
AddReadout
import torch import torch.nn as nn import torch.utils.data class AddReadout(nn.Module): def __init__(self, start_index=1): super(AddReadout, self).__init__() self.start_index = start_index def forward(self, x): if self.start_index == 2: readout = (x[:, 0] + x[:, 1]) / 2 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Zacchaeus14/lang-seg
AddReadout
false
9,757
[ "MIT" ]
0
ad1196a4d33830f3219dbe2260a69364a745f094
https://github.com/Zacchaeus14/lang-seg/tree/ad1196a4d33830f3219dbe2260a69364a745f094
SigmoidModel
import torch import torch.nn as nn class SigmoidModel(nn.Module): """ Model architecture from: https://medium.com/coinmonks/create-a-neural-network-in -pytorch-and-make-your-life-simpler-ec5367895199 """ def __init__(self, num_in, num_hidden, num_out): super().__init__...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
archydeberker/captum
SigmoidModel
false
9,758
[ "BSD-3-Clause" ]
0
2d72a060f12f5e325c9d1c411a2ef69bf43a06fd
https://github.com/archydeberker/captum/tree/2d72a060f12f5e325c9d1c411a2ef69bf43a06fd
depthwise_clipseg_conv
import torch import torch.nn as nn import torch.utils.data class depthwise_clipseg_conv(nn.Module): def __init__(self): super(depthwise_clipseg_conv, self).__init__() self.depthwise = nn.Conv2d(1, 1, kernel_size=3, padding=1) def depthwise_clipseg(self, x, channels): x = torch.cat([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 import torch.utils.data assert_size_stride = torch._C._dyn...
Zacchaeus14/lang-seg
depthwise_clipseg_conv
false
9,759
[ "MIT" ]
0
ad1196a4d33830f3219dbe2260a69364a745f094
https://github.com/Zacchaeus14/lang-seg/tree/ad1196a4d33830f3219dbe2260a69364a745f094
Policy
import torch import torch.nn as nn class Policy(nn.Module): def __init__(self, num_inputs, num_outputs): super(Policy, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.action_mean = nn.Linear(64, num_outputs) self.action_mean....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
aranganath/pytorch-trpo
Policy
false
9,760
[ "MIT" ]
0
a85bc48261eb4ed5833209da706379e9dc84592f
https://github.com/aranganath/pytorch-trpo/tree/a85bc48261eb4ed5833209da706379e9dc84592f
DownBlock
import torch import torch.nn as nn def get_activation(activation: 'str'): if activation == 'relu': return nn.ReLU() elif activation == 'leaky': return nn.LeakyReLU(negative_slope=0.1) elif activation == 'elu': return nn.ELU() def conv_layer(dim: 'int'): if dim == 3: 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_...
arshadzahangirchowdhury/TomoEncoders
DownBlock
false
9,761
[ "BSD-3-Clause" ]
0
9c2b15fd515d864079f198546821faee5d78df17
https://github.com/arshadzahangirchowdhury/TomoEncoders/tree/9c2b15fd515d864079f198546821faee5d78df17
C1Bilinear
import torch from torch import nn class C1Bilinear(nn.Module): def __init__(self, num_class=150, fc_dim=4096, segSize=384, use_softmax =False): super(C1Bilinear, self).__init__() self.segSize = segSize self.use_softmax = use_softmax self.conv_last = nn.Conv2d(fc_dim, num_c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
PCIHD/Project_Daydream
C1Bilinear
false
9,762
[ "MIT" ]
0
94c75ff494e7489a4066e3f9d056a85ff768f40e
https://github.com/PCIHD/Project_Daydream/tree/94c75ff494e7489a4066e3f9d056a85ff768f40e
ResidualConvUnit
import torch import torch.nn as nn import torch.utils.data class ResidualConvUnit(nn.Module): """Residual convolution module.""" def __init__(self, features): """Init. Args: features (int): number of features """ super().__init__() self.conv1 = nn.Conv2d(f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Zacchaeus14/lang-seg
ResidualConvUnit
false
9,763
[ "MIT" ]
0
ad1196a4d33830f3219dbe2260a69364a745f094
https://github.com/Zacchaeus14/lang-seg/tree/ad1196a4d33830f3219dbe2260a69364a745f094
GlobalConvBlock
import torch import torch.nn as nn from math import sqrt class GlobalConvBlock(nn.Module): def __init__(self, in_dim, out_dim, kernel_size): super(GlobalConvBlock, self).__init__() pad0 = (kernel_size[0] - 1) // 2 pad1 = (kernel_size[1] - 1) // 2 self.conv_l1 = nn.Conv2d(in_dim, 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 from math import sqrt assert_size_stride = torch._C._dynam...
andy091045/SEGANTest
GlobalConvBlock
false
9,764
[ "MIT" ]
0
90f626461f021ed76716730f78673bc83196f0af
https://github.com/andy091045/SEGANTest/tree/90f626461f021ed76716730f78673bc83196f0af
GuidedBackpropReLUasModule
from torch.autograd import Function import torch class GuidedBackpropReLU(Function): @staticmethod def forward(self, input_img): positive_mask = (input_img > 0).type_as(input_img) output = torch.addcmul(torch.zeros(input_img.size()).type_as( input_img), input_img, positive_mask) ...
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.autograd import Function assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.gu...
bei2/pytorch-grad-cam
GuidedBackpropReLUasModule
false
9,765
[ "MIT" ]
0
c7f4a6cc26638fc668738c81ca35908ed6b1845b
https://github.com/bei2/pytorch-grad-cam/tree/c7f4a6cc26638fc668738c81ca35908ed6b1845b
up
import torch import torch.nn as nn import torch.nn.functional as F class up(nn.Module): def __init__(self, in_ch, out_ch): super(up, self).__init__() self.up_scale = nn.ConvTranspose2d(in_ch, out_ch, 2, stride=2) def forward(self, x1, x2): x2 = self.up_scale(x2) diffY = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
aribryan/pytorch_task
up
false
9,766
[ "MIT" ]
0
c661f201bbf03cfd06a13deb4c1c0c61d017adb1
https://github.com/aribryan/pytorch_task/tree/c661f201bbf03cfd06a13deb4c1c0c61d017adb1
depthwise_block
import torch import torch.nn as nn import torch.utils.data class depthwise_conv(nn.Module): def __init__(self, kernel_size=3, stride=1, padding=1): super(depthwise_conv, self).__init__() self.depthwise = nn.Conv2d(1, 1, kernel_size=kernel_size, stride= stride, padding=padding) de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Zacchaeus14/lang-seg
depthwise_block
false
9,767
[ "MIT" ]
0
ad1196a4d33830f3219dbe2260a69364a745f094
https://github.com/Zacchaeus14/lang-seg/tree/ad1196a4d33830f3219dbe2260a69364a745f094
Attention
import math import torch import torch.nn.functional as F import torch.nn as nn class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_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....
aquibjaved/ABSA-PyTorch
Attention
false
9,768
[ "MIT" ]
0
fd904250ceec436e49dc50694f79891c0c67d6b1
https://github.com/aquibjaved/ABSA-PyTorch/tree/fd904250ceec436e49dc50694f79891c0c67d6b1
PatchEmbedding
import torch import torch.nn as nn class PatchEmbedding(nn.Module): def __init__(self, image_size, patch_size, embed_dim, channels): super().__init__() self.image_size = image_size if image_size[0] % patch_size != 0 or image_size[1] % patch_size != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
avniculae/segmenter
PatchEmbedding
false
9,769
[ "MIT" ]
0
ca9683399b7dae13a8ccbadc744826306b8dbf94
https://github.com/avniculae/segmenter/tree/ca9683399b7dae13a8ccbadc744826306b8dbf94
AddTensors
import torch import torch.nn as nn import torch.hub class AddTensors(nn.Module): """ Adds all its inputs together. """ def forward(self, xs): return sum(xs) 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 import torch.hub assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo...
azavea/keras-image-segmentation
AddTensors
false
9,770
[ "Apache-2.0" ]
0
eb67d12e1c88f04387873444c7c9b05f767280e6
https://github.com/azavea/keras-image-segmentation/tree/eb67d12e1c88f04387873444c7c9b05f767280e6
ClassificationLogSoftmax
import torch import torch.nn as nn class ClassificationLogSoftmax(nn.Module): """ Classifier on top of the hidden representation of the first token, which is usually [CLS] token in BERT-like architectures. """ def __init__(self, hidden_size, num_classes): super().__init__() self.d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
awesome-archive/NeMo
ClassificationLogSoftmax
false
9,771
[ "Apache-2.0" ]
0
0e566e62f0d102b725d3839564e51f7f40fa41b5
https://github.com/awesome-archive/NeMo/tree/0e566e62f0d102b725d3839564e51f7f40fa41b5
group
import torch import torch.nn as nn class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, type=1): super(mfm, self).__init__() self.out_channels = out_channels if type == 1: self.filter = nn.Conv2d(in_channels, 2 * out_c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
aryachiranjeev/Dependable-AI
group
false
9,772
[ "MIT" ]
0
750570572c1baaa2590a89c0982e2f71b15b48b9
https://github.com/aryachiranjeev/Dependable-AI/tree/750570572c1baaa2590a89c0982e2f71b15b48b9
ConvBlock
import torch import torch.nn as nn class Conv3x3(nn.Module): """Layer to pad and convolve input """ def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: 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.triton_helpers import libdevice, math as tl_math im...
aliasghar53/packnet-sfm
ConvBlock
false
9,773
[ "MIT" ]
0
d07dcbf026194b618a2bd9fc05b599563611f9a3
https://github.com/aliasghar53/packnet-sfm/tree/d07dcbf026194b618a2bd9fc05b599563611f9a3
ChannelNorm2D
import torch import torch.nn as nn class ChannelNorm2D(nn.Module): """ Similar to default Torch instanceNorm2D but calculates moments over channel dimension instead of spatial dims. Expects input_dim in format (B,C,H,W) """ def __init__(self, input_channels, momentum=0.1, eps=0.001, affine=T...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
ali-zafari/high-fidelity-generative-compression
ChannelNorm2D
false
9,774
[ "Apache-2.0" ]
0
37ab8d6727df48f8ebf4577db0986ccd0ffe404b
https://github.com/ali-zafari/high-fidelity-generative-compression/tree/37ab8d6727df48f8ebf4577db0986ccd0ffe404b
Attention
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, dim, heads, dropout): super().__init__() self.heads = heads head_dim = dim // heads self.scale = head_dim ** -0.5 self.attn = None self.qkv = nn.Linear(dim, dim * 3) self.attn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
avniculae/segmenter
Attention
false
9,775
[ "MIT" ]
0
ca9683399b7dae13a8ccbadc744826306b8dbf94
https://github.com/avniculae/segmenter/tree/ca9683399b7dae13a8ccbadc744826306b8dbf94
SilogLoss
import torch import torch.nn as nn class SilogLoss(nn.Module): def __init__(self, ratio=10, ratio2=0.85): super().__init__() self.ratio = ratio self.ratio2 = ratio2 def forward(self, pred, gt): log_diff = torch.log(pred * self.ratio) - torch.log(gt * self.ratio) silog...
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...
aliasghar53/packnet-sfm
SilogLoss
false
9,776
[ "MIT" ]
0
d07dcbf026194b618a2bd9fc05b599563611f9a3
https://github.com/aliasghar53/packnet-sfm/tree/d07dcbf026194b618a2bd9fc05b599563611f9a3
Swish
import torch import torch.nn as nn 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([4, 4, 4, 4])] def get_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...
ali-zafari/high-fidelity-generative-compression
Swish
false
9,777
[ "Apache-2.0" ]
0
37ab8d6727df48f8ebf4577db0986ccd0ffe404b
https://github.com/ali-zafari/high-fidelity-generative-compression/tree/37ab8d6727df48f8ebf4577db0986ccd0ffe404b
Conv3x3
import torch import torch.nn as nn class Conv3x3(nn.Module): """Layer to pad and convolve input """ def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: 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.triton_helpers import math as tl_math import torch....
aliasghar53/packnet-sfm
Conv3x3
false
9,778
[ "MIT" ]
0
d07dcbf026194b618a2bd9fc05b599563611f9a3
https://github.com/aliasghar53/packnet-sfm/tree/d07dcbf026194b618a2bd9fc05b599563611f9a3
UnpackLayerConv2d
import torch import torch.nn as nn class Conv2D(nn.Module): """ 2D convolution with GroupNorm and ELU Parameters ---------- in_channels : int Number of input channels out_channels : int Number of output channels kernel_size : int Kernel size stride : int ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
aliasghar53/packnet-sfm
UnpackLayerConv2d
false
9,779
[ "MIT" ]
0
d07dcbf026194b618a2bd9fc05b599563611f9a3
https://github.com/aliasghar53/packnet-sfm/tree/d07dcbf026194b618a2bd9fc05b599563611f9a3
BasicModel_ConvNet_MaxPool1d
import torch import torch.nn as nn class BasicModel_ConvNet_MaxPool1d(nn.Module): """Same as above, but with the MaxPool2d replaced with a MaxPool1d. This is useful because the MaxPool modules behave differently to other modules from the perspective of the DeepLift Attributions """ def __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....
archydeberker/captum
BasicModel_ConvNet_MaxPool1d
false
9,780
[ "BSD-3-Clause" ]
0
2d72a060f12f5e325c9d1c411a2ef69bf43a06fd
https://github.com/archydeberker/captum/tree/2d72a060f12f5e325c9d1c411a2ef69bf43a06fd
resblock
import torch import torch.nn as nn class mfm(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, type=1): super(mfm, self).__init__() self.out_channels = out_channels if type == 1: self.filter = nn.Conv2d(in_channels, 2 * out_c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
aryachiranjeev/Dependable-AI
resblock
false
9,781
[ "MIT" ]
0
750570572c1baaa2590a89c0982e2f71b15b48b9
https://github.com/aryachiranjeev/Dependable-AI/tree/750570572c1baaa2590a89c0982e2f71b15b48b9
InvDepth
import torch import torch.nn as nn class InvDepth(nn.Module): """Inverse depth layer""" def __init__(self, in_channels, out_channels=1, min_depth=0.5): """ Initializes an InvDepth object. Parameters ---------- in_channels : int Number of input 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...
aliasghar53/packnet-sfm
InvDepth
false
9,782
[ "MIT" ]
0
d07dcbf026194b618a2bd9fc05b599563611f9a3
https://github.com/aliasghar53/packnet-sfm/tree/d07dcbf026194b618a2bd9fc05b599563611f9a3
bottleneck_block
import torch import torch.nn as nn import torch.utils.data class depthwise_conv(nn.Module): def __init__(self, kernel_size=3, stride=1, padding=1): super(depthwise_conv, self).__init__() self.depthwise = nn.Conv2d(1, 1, kernel_size=kernel_size, stride= stride, padding=padding) de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Zacchaeus14/lang-seg
bottleneck_block
false
9,783
[ "MIT" ]
0
ad1196a4d33830f3219dbe2260a69364a745f094
https://github.com/Zacchaeus14/lang-seg/tree/ad1196a4d33830f3219dbe2260a69364a745f094
HyperpriorSynthesisDLMM
import torch import torch.nn as nn import torch.nn.functional as F def get_num_DLMM_channels(C, K=4, params=['mu', 'scale', 'mix']): """ C: Channels of latent representation (L3C uses 5). K: Number of mixture coefficients. """ return C * K * len(params) class HyperpriorSynthesisDLMM(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.nn as nn import ...
ali-zafari/high-fidelity-generative-compression
HyperpriorSynthesisDLMM
false
9,784
[ "Apache-2.0" ]
0
37ab8d6727df48f8ebf4577db0986ccd0ffe404b
https://github.com/ali-zafari/high-fidelity-generative-compression/tree/37ab8d6727df48f8ebf4577db0986ccd0ffe404b
LBM
import torch import torch.nn as nn class LBM(nn.Module): def __init__(self, l_dim, r_dim): super(LBM, self).__init__() self.W = nn.Bilinear(l_dim, r_dim, 1, bias=False) def forward(self, e1, e2): """ e1: tensor of size (*, l_dim) e2: tensor of size (*, r_dim) ...
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...
aryaman4/TaxoExpan
LBM
false
9,785
[ "Apache-2.0" ]
0
3d9b9a21ba7cdd872dc62181dd14ff271e20b245
https://github.com/aryaman4/TaxoExpan/tree/3d9b9a21ba7cdd872dc62181dd14ff271e20b245
depthwise_conv
import torch import torch.nn as nn import torch.utils.data class depthwise_conv(nn.Module): def __init__(self, kernel_size=3, stride=1, padding=1): super(depthwise_conv, self).__init__() self.depthwise = nn.Conv2d(1, 1, kernel_size=kernel_size, stride= stride, padding=padding) de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
Zacchaeus14/lang-seg
depthwise_conv
false
9,786
[ "MIT" ]
0
ad1196a4d33830f3219dbe2260a69364a745f094
https://github.com/Zacchaeus14/lang-seg/tree/ad1196a4d33830f3219dbe2260a69364a745f094
GramMatrix
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): a, b, c, d = input.size() features = input.view(a * b, c * d) G = torch.mm(features, features.t()) return G.div(a * b * c * d) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bigsshark/mycode
GramMatrix
false
9,787
[ "MIT" ]
0
550e58675cd533265b6a21258aa7bc1859191011
https://github.com/bigsshark/mycode/tree/550e58675cd533265b6a21258aa7bc1859191011
RBF_activation
import torch import numpy as np import torch.nn as nn class RBF_activation(torch.nn.Module): def __init__(self, input_features): super(RBF_activation, self).__init__() self.input_features = input_features self.centers = nn.Parameter(torch.ones(input_features)) self.log_sigma2 = nn...
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 import numpy as np import torch.nn as nn assert_size_stride = ...
bkompa/PyTorch_CIFAR10_GAU
RBF_activation
false
9,789
[ "MIT" ]
0
2c6da19b251a9536167df473dabcb5cc34c66133
https://github.com/bkompa/PyTorch_CIFAR10_GAU/tree/2c6da19b251a9536167df473dabcb5cc34c66133
ConditionalBatchNorm2d
import torch import torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=0.0001): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.module = module 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 ...
bhagwanalbert/BigGAN-PyTorch
ConditionalBatchNorm2d
false
9,790
[ "MIT" ]
0
34bd6d9d04bb2e9699c27324454197dd01584d22
https://github.com/bhagwanalbert/BigGAN-PyTorch/tree/34bd6d9d04bb2e9699c27324454197dd01584d22
CutMixCrossEntropyLoss
from torch.nn import Module import torch from torch.nn.modules.module import Module import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed def cross_entropy(input, target, size_average=True): """ Cross entropy that accepts soft targets Args: pred: 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 from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import M...
bottlenome/cutmix
CutMixCrossEntropyLoss
false
9,791
[ "MIT" ]
0
d18c2bda47e7d1786819420edbb2c8e5ad43385f
https://github.com/bottlenome/cutmix/tree/d18c2bda47e7d1786819420edbb2c8e5ad43385f
Pool
import torch import torch.nn as nn import torch.nn.functional as F class Pool(nn.Module): def __init__(self): super(Pool, self).__init__() def forward(self, x): return F.adaptive_avg_pool2d(x, (5, 5)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
borisfom/TRTorch
Pool
false
9,792
[ "BSD-3-Clause" ]
0
1660633c6f6a480cd123d9d91cabf4eced12e8f3
https://github.com/borisfom/TRTorch/tree/1660633c6f6a480cd123d9d91cabf4eced12e8f3
HyperpriorSynthesis
import torch import torch.nn as nn import torch.nn.functional as F class HyperpriorSynthesis(nn.Module): """ Hyperprior 'synthesis model' as proposed in [1]. Outputs distribution parameters of input latents. [1] Ballé et. al., "Variational image compression with a scale hyperprior", arXiv:1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ali-zafari/high-fidelity-generative-compression
HyperpriorSynthesis
false
9,793
[ "Apache-2.0" ]
0
37ab8d6727df48f8ebf4577db0986ccd0ffe404b
https://github.com/ali-zafari/high-fidelity-generative-compression/tree/37ab8d6727df48f8ebf4577db0986ccd0ffe404b
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda import torch.distributed import torch.multiprocessing class FocalLoss(nn.Module): """Focal Loss - https://arxiv.org/abs/1708.02002""" def __init__(self, alpha=0.25, gamma=2): super().__init__() self.alpha = 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 libdevice, math as tl_math import torc...
azuredsky/retinanet-examples
FocalLoss
false
9,794
[ "BSD-3-Clause" ]
0
1b35d8e7d3360050f25fd80e09ecac3eb2654301
https://github.com/azuredsky/retinanet-examples/tree/1b35d8e7d3360050f25fd80e09ecac3eb2654301
TSA_Fusion
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class TSA_Fusion(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super(TSA_Fusion, self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
andreistirb/mmsr
TSA_Fusion
false
9,795
[ "Apache-2.0" ]
0
da6b1109c8dab795a7d451d80dc78e9eb8cfe16c
https://github.com/andreistirb/mmsr/tree/da6b1109c8dab795a7d451d80dc78e9eb8cfe16c
Postnet
import torch from torch import nn class Postnet(nn.Module): """Postnet is a simple linear layer for predicting the target frames given the RNN context during training. We don't need the Postnet for feature extraction. """ def __init__(self, input_size, output_size=80): super(Postnet, 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
apoorv2904/Self-Supervised-Speech-Pretraining-and-Representation-Learning
Postnet
false
9,796
[ "MIT" ]
0
6bdf02836ed31fdf7f185eddcd004770526c57c3
https://github.com/apoorv2904/Self-Supervised-Speech-Pretraining-and-Representation-Learning/tree/6bdf02836ed31fdf7f185eddcd004770526c57c3
SmoothL1Loss
import torch import torch.nn as nn import torch.cuda import torch.distributed import torch.multiprocessing class SmoothL1Loss(nn.Module): """Smooth L1 Loss""" def __init__(self, beta=0.11): super().__init__() self.beta = beta def forward(self, pred, target): x = (pred - target).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.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda import torch.distributed import t...
azuredsky/retinanet-examples
SmoothL1Loss
false
9,797
[ "BSD-3-Clause" ]
0
1b35d8e7d3360050f25fd80e09ecac3eb2654301
https://github.com/azuredsky/retinanet-examples/tree/1b35d8e7d3360050f25fd80e09ecac3eb2654301
ResnetBlockFC
import torch from torch import nn import torch.autograd.profiler as profiler class ResnetBlockFC(nn.Module): """ Fully connected ResNet Block class. Taken from DVR code. :param size_in (int): input dimension :param size_out (int): output dimension :param size_h (int): hidden 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 from torch import nn assert_s...
alrivero/pixel-nerf
ResnetBlockFC
false
9,798
[ "BSD-2-Clause" ]
0
c054befe189602627f021cda8376adc5940c8668
https://github.com/alrivero/pixel-nerf/tree/c054befe189602627f021cda8376adc5940c8668
TwoHiddenLayerFc
import torch import torch.nn as nn import torch.nn.functional as F class TwoHiddenLayerFc(nn.Module): def __init__(self, input_shape, out_dim): super(TwoHiddenLayerFc, self).__init__() self.fc1 = nn.Linear(input_shape, 200) self.fc2 = nn.Linear(200, 200) self.fc3 = nn.Linear(200, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bokunwang/fedavgpy
TwoHiddenLayerFc
false
9,799
[ "MIT" ]
0
22f2fae287f15025e953ab595aa6fd6faedf83d2
https://github.com/bokunwang/fedavgpy/tree/22f2fae287f15025e953ab595aa6fd6faedf83d2
LxmertAttentionOutput
import torch from torch import nn from itertools import * class LxmertAttentionOutput(nn.Module): def __init__(self, hidden_size, hidden_dropout_prob): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.LayerNorm = nn.LayerNorm(hidden_size, eps=1e-12) self.dr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
ashutoshbsathe/SmBop
LxmertAttentionOutput
false
9,800
[ "MIT" ]
0
ce5f67ec070df55b84d7f3617659011732020c96
https://github.com/ashutoshbsathe/SmBop/tree/ce5f67ec070df55b84d7f3617659011732020c96
LxmertCrossAttentionLayer
import math import torch from torch import nn from itertools import * class LxmertAttention(nn.Module): def __init__(self, hidden_size, num_attention_heads, attention_probs_dropout_prob, ctx_dim): super().__init__() if hidden_size % num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ashutoshbsathe/SmBop
LxmertCrossAttentionLayer
false
9,801
[ "MIT" ]
0
ce5f67ec070df55b84d7f3617659011732020c96
https://github.com/ashutoshbsathe/SmBop/tree/ce5f67ec070df55b84d7f3617659011732020c96
SoftQNetwork
import torch import torch.nn as nn import torch.nn.functional as F class SoftQNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003): super(SoftQNetwork, self).__init__() self.linear1 = nn.Linear(num_inputs + num_actions, hidden_size) self.linear2 = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
biemann/rl-testbed-for-energyplus
SoftQNetwork
false
9,802
[ "MIT" ]
0
a01be4d12eda970b352729ff6cb4a3eea8ddee6a
https://github.com/biemann/rl-testbed-for-energyplus/tree/a01be4d12eda970b352729ff6cb4a3eea8ddee6a
Conv_ReLU_Block
import torch import torch.nn as nn class Conv_ReLU_Block(nn.Module): def __init__(self): super(Conv_ReLU_Block, self).__init__() self.conv = nn.Conv2d(in_channels=64, out_channels=64, kernel_size= 3, stride=1, padding=1, bias=False) self.relu = nn.ReLU(inplace=True) def f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
b4435242/pytorch-vdsr
Conv_ReLU_Block
false
9,803
[ "MIT" ]
0
01541bc3d52105c8fd0e4d9cf7308ac267fe5f49
https://github.com/b4435242/pytorch-vdsr/tree/01541bc3d52105c8fd0e4d9cf7308ac267fe5f49
PolicyNetwork
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal class PolicyNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, action_range= 1.0, init_w=0.003, log_std_min=-20, log_std_max=2): super(PolicyNetwo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 tor...
biemann/rl-testbed-for-energyplus
PolicyNetwork
false
9,804
[ "MIT" ]
0
a01be4d12eda970b352729ff6cb4a3eea8ddee6a
https://github.com/biemann/rl-testbed-for-energyplus/tree/a01be4d12eda970b352729ff6cb4a3eea8ddee6a
NTN
import torch import torch.nn as nn import torch.nn.functional as F class NTN(nn.Module): def __init__(self, l_dim, r_dim, k=4, non_linear=F.tanh): super(NTN, self).__init__() self.u_R = nn.Linear(k, 1, bias=False) self.f = non_linear self.W = nn.Bilinear(l_dim, r_dim, k, bias=True...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
aryaman4/TaxoExpan
NTN
false
9,805
[ "Apache-2.0" ]
0
3d9b9a21ba7cdd872dc62181dd14ff271e20b245
https://github.com/aryaman4/TaxoExpan/tree/3d9b9a21ba7cdd872dc62181dd14ff271e20b245
MultiHeadAttentionWithMetrics
import torch import numpy as np import torch.nn as nn class MultiHeadAttentionWithMetrics(nn.Module): def __init__(self, ctx, heads_count, d_model, dropout_prob=0.1, mode= 'self-attention'): super(MultiHeadAttentionWithMetrics, self).__init__() assert d_model % heads_count == 0 as...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bingrao/deeplearning
MultiHeadAttentionWithMetrics
false
9,806
[ "MIT" ]
0
8488478a4355a7f56d49c5126f529c21d5a95798
https://github.com/bingrao/deeplearning/tree/8488478a4355a7f56d49c5126f529c21d5a95798
DepthwiseSeparableConvolution
import torch from torch import nn class DepthwiseSeparableConvolution(nn.Module): def __init__(self, in_ch, out_ch, kernel_size=3, stride=1, padding=1): super().__init__() """ input : N*C1 output : N*C1 groups = C1 """ self.depthwise_conv = nn.C...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
LiChengChen666/DetectDee
DepthwiseSeparableConvolution
false
9,807
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
DuelingQNetwork
import torch import torch.nn.functional as F import torch.nn as nn class DuelingQNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
bfMendonca/deep-reinforcement-learning
DuelingQNetwork
false
9,808
[ "MIT" ]
0
fa8f68d960542658429a4e1a4b1e9fdfb1af0030
https://github.com/bfMendonca/deep-reinforcement-learning/tree/fa8f68d960542658429a4e1a4b1e9fdfb1af0030
SpatialGroupEnhance
import torch from torch import nn from torch.nn import init class SpatialGroupEnhance(nn.Module): def __init__(self, groups): super().__init__() self.groups = groups self.avg_pool = nn.AdaptiveAvgPool2d(1) self.weight = nn.Parameter(torch.zeros(1, groups, 1, 1)) self.bias ...
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 from torch.nn import init assert_size_stride = torch._C._d...
LiChengChen666/DetectDee
SpatialGroupEnhance
false
9,809
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
Depth_Pointwise_Conv1d
import torch from torch import nn class Depth_Pointwise_Conv1d(nn.Module): def __init__(self, in_ch, out_ch, k): super().__init__() if k == 1: self.depth_conv = nn.Identity() else: self.depth_conv = nn.Conv1d(in_channels=in_ch, out_channels= in_ch, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
LiChengChen666/DetectDee
Depth_Pointwise_Conv1d
false
9,810
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
DoubleAttention
import torch from torch import nn from torch.nn import init from torch.nn import functional as F class DoubleAttention(nn.Module): def __init__(self, in_channels, c_m, c_n, reconstruct=True): super().__init__() self.in_channels = in_channels self.reconstruct = reconstruct self.c_m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
DoubleAttention
false
9,811
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
SpatialAttention
import torch from torch import nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super().__init__() self.conv = nn.Conv2d(2, 1, kernel_size=kernel_size, padding= kernel_size // 2) self.sigmoid = nn.Sigmoid() def forward(self, x): max_result,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
LiChengChen666/DetectDee
SpatialAttention
false
9,812
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
LxmertAttention
import math import torch from torch import nn from itertools import * class LxmertAttention(nn.Module): def __init__(self, hidden_size, num_attention_heads, attention_probs_dropout_prob, ctx_dim): super().__init__() if hidden_size % num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ashutoshbsathe/SmBop
LxmertAttention
false
9,813
[ "MIT" ]
0
ce5f67ec070df55b84d7f3617659011732020c96
https://github.com/ashutoshbsathe/SmBop/tree/ce5f67ec070df55b84d7f3617659011732020c96
ExternalAttention
import torch from torch import nn from torch.nn import init class ExternalAttention(nn.Module): def __init__(self, d_model, S=64): super().__init__() self.mk = nn.Linear(d_model, S, bias=False) self.mv = nn.Linear(S, d_model, bias=False) self.softmax = nn.Softmax(dim=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 from torch._inductor.runtime....
LiChengChen666/DetectDee
ExternalAttention
false
9,814
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
HyperpriorAnalysis
import torch import torch.nn as nn import torch.nn.functional as F class HyperpriorAnalysis(nn.Module): """ Hyperprior 'analysis model' as proposed in [1]. [1] Ballé et. al., "Variational image compression with a scale hyperprior", arXiv:1802.01436 (2018). C: Number of input channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ali-zafari/high-fidelity-generative-compression
HyperpriorAnalysis
false
9,815
[ "Apache-2.0" ]
0
37ab8d6727df48f8ebf4577db0986ccd0ffe404b
https://github.com/ali-zafari/high-fidelity-generative-compression/tree/37ab8d6727df48f8ebf4577db0986ccd0ffe404b
ChannelAttentionModule
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
ChannelAttentionModule
false
9,816
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
ECAAttention
import torch from torch import nn from torch.nn import init class ECAAttention(nn.Module): def __init__(self, kernel_size=3): super().__init__() self.gap = nn.AdaptiveAvgPool2d(1) self.conv = nn.Conv1d(1, 1, kernel_size=kernel_size, padding=( kernel_size - 1) // 2) 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 import nn from torch.nn import init assert_size_stride = torch._C._dy...
LiChengChen666/DetectDee
ECAAttention
false
9,817
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
VectorQuantizeLayer_GB
import torch from torch import nn import torch.nn.functional as F class VectorQuantizeLayer_GB(nn.Module): def __init__(self, input_dim, vq_size, vq_dim, temp=(1.0, 0.1, 0.99), groups=1, combine_groups=True, time_first=True, activation=nn.GELU( ), weight_proj_depth=1, weight_proj_factor=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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
apoorv2904/Self-Supervised-Speech-Pretraining-and-Representation-Learning
VectorQuantizeLayer_GB
false
9,818
[ "MIT" ]
0
6bdf02836ed31fdf7f185eddcd004770526c57c3
https://github.com/apoorv2904/Self-Supervised-Speech-Pretraining-and-Representation-Learning/tree/6bdf02836ed31fdf7f185eddcd004770526c57c3
ZPool
import torch from torch import nn class ZPool(nn.Module): def forward(self, x): return torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1) .unsqueeze(1)), dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
LiChengChen666/DetectDee
ZPool
false
9,819
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
SimplifiedScaledDotProductAttention
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
SimplifiedScaledDotProductAttention
false
9,820
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
OutlookAttention
import math import torch from torch import nn from torch.nn import functional as F class OutlookAttention(nn.Module): def __init__(self, dim, num_heads=1, kernel_size=3, padding=1, stride=1, qkv_bias=False, attn_drop=0.1): super().__init__() self.dim = dim self.num_heads = num_hea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
OutlookAttention
false
9,823
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
ScaledDotProductAttention
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
ScaledDotProductAttention
false
9,824
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
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 ...
bendavidsteel/BigDL
CustomizedNet
false
9,825
[ "Apache-2.0" ]
0
b49d978c5ec8ebaf3d4c1343f25edeb5a21e31f3
https://github.com/bendavidsteel/BigDL/tree/b49d978c5ec8ebaf3d4c1343f25edeb5a21e31f3