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
TemperatureHolder
import torch import torch.nn as nn class TemperatureHolder(nn.Module): """Module that holds a temperature as a learnable value. Args: initial_log_temperature (float): Initial value of log(temperature). """ def __init__(self, initial_log_temperature=0): super().__init__() self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
imatge-upc/pixelcoordEDL
TemperatureHolder
false
6,868
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
AsymmetricLossOptimized
import torch import torch.nn as nn class AsymmetricLossOptimized(nn.Module): """ Notice - optimized version, minimizes memory allocation and gpu uploading, favors inplace operations""" def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08, disable_torch_grad_focal_loss=False): ...
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...
imvladikon/pytorch-loss
AsymmetricLossOptimized
false
6,869
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
Self_Attentive_Pooling
import torch import torch.nn as nn import torch.nn.functional as F class Self_Attentive_Pooling(nn.Module): def __init__(self, dim): """SAP Paper: Self-Attentive Speaker Embeddings for Text-Independent Speaker Verification Link: https://danielpovey.com/files/2018_interspeech_xvector_atten...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ikunsaikou/lhy_ML2021Spring
Self_Attentive_Pooling
false
6,870
[ "WTFPL" ]
1
80d8922077e2f5abba6a440c17654a143ebc8c9c
https://github.com/ikunsaikou/lhy_ML2021Spring/tree/80d8922077e2f5abba6a440c17654a143ebc8c9c
FCLateActionSAQFunction
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from abc import ABCMeta from abc import abstractmethod def init_lecun_normal(tensor, scale=1.0): """Initializes the tensor with LeCunNormal.""" fan_in = torch.nn.init._calculate_correct_fan(tensor, 'fan_in') std = scale ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
imatge-upc/pixelcoordEDL
FCLateActionSAQFunction
false
6,871
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
TransformerEncoderLayer
import torch import torch.nn as nn class TransformerEncoderLayer(nn.Module): def __init__(self, d_model, nhead, dim_feedforward=16, dropout=0): super(TransformerEncoderLayer, self).__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.linear1 = 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
imperial-qore/CAROL
TransformerEncoderLayer
false
6,872
[ "BSD-3-Clause" ]
1
57dc42c4ddeb9e75eed43a91ceb336a1ecc9c8b9
https://github.com/imperial-qore/CAROL/tree/57dc42c4ddeb9e75eed43a91ceb336a1ecc9c8b9
WNConv2d
import torch import torch.nn as nn class WNConv2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True, activation=None): super().__init__() self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel, kernel_size, stride=s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
imatge-upc/pixelcoordEDL
WNConv2d
false
6,873
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
TransformerDecoderLayer
import torch import torch.nn as nn class TransformerDecoderLayer(nn.Module): def __init__(self, d_model, nhead, dim_feedforward=16, dropout=0): super(TransformerDecoderLayer, self).__init__() self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.multihead_attn = 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._inductor.runtime....
imperial-qore/CAROL
TransformerDecoderLayer
false
6,874
[ "BSD-3-Clause" ]
1
57dc42c4ddeb9e75eed43a91ceb336a1ecc9c8b9
https://github.com/imperial-qore/CAROL/tree/57dc42c4ddeb9e75eed43a91ceb336a1ecc9c8b9
FocalLossV1
import torch import torch.nn as nn class FocalLossV1(nn.Module): def __init__(self, alpha=0.25, gamma=2, reduction='mean'): super(FocalLossV1, self).__init__() self.alpha = alpha self.gamma = gamma self.reduction = reduction self.crit = nn.BCEWithLogitsLoss(reduction='none...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
imvladikon/pytorch-loss
FocalLossV1
false
6,875
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
SoftDiceLossV1
import torch import torch.nn as nn class SoftDiceLossV1(nn.Module): """ soft-dice loss, useful in binary segmentation """ def __init__(self, p=1, smooth=1, reduction='mean'): super(SoftDiceLossV1, self).__init__() self.p = p self.smooth = smooth self.reduction = reduct...
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...
imvladikon/pytorch-loss
SoftDiceLossV1
false
6,876
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
CoordConv2d
import torch import torch.nn as nn import torch.nn.functional as F class CoordConv2d(nn.Conv2d): def __init__(self, in_chan, out_chan, kernel_size=3, stride=1, padding= 1, dilation=1, groups=1, bias=True): super(CoordConv2d, self).__init__(in_chan + 2, out_chan, kernel_size, stride=st...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
imvladikon/pytorch-loss
CoordConv2d
false
6,877
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
EncoderLayer
import math import torch import torch.nn as nn import torch.nn.functional as F class AffineLayer(nn.Module): def __init__(self, dropout, d_model, d_ff): super(AffineLayer, self).__init__() self.w_1 = nn.Linear(d_model, d_ff) self.w_2 = nn.Linear(d_ff, d_model) self.dropout = nn.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 import triton_helpers from torch._inductor.runtime....
iamxpy/pointer_summarizer
EncoderLayer
false
6,878
[ "Apache-2.0" ]
1
ebeb2ad32a45162c0da14dac0b6241b0b0d00fa0
https://github.com/iamxpy/pointer_summarizer/tree/ebeb2ad32a45162c0da14dac0b6241b0b0d00fa0
SoftDiceLossV2
import torch import torch.nn as nn import torch.cuda.amp as amp class SoftDiceLossV2Func(torch.autograd.Function): """ compute backward directly for better numeric stability """ @staticmethod @amp.custom_fwd def forward(ctx, logits, labels, p, smooth): logits = logits.float() ...
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.cuda.amp as amp assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
imvladikon/pytorch-loss
SoftDiceLossV2
false
6,879
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
DilConv1dWithGLU
import torch import torch.nn as nn import torch.nn.functional as F class DilConv1dWithGLU(nn.Module): def __init__(self, num_channels, dilation, lenght=100, kernel_size=2, activation=F.leaky_relu, residual_connection=True, dropout=0.2): super(DilConv1dWithGLU, self).__init__() self.dilati...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
icyray/proGENTRL
DilConv1dWithGLU
false
6,880
[ "MIT" ]
1
c48305c3411ecb604c4f26f5e6b62f285e42e696
https://github.com/icyray/proGENTRL/tree/c48305c3411ecb604c4f26f5e6b62f285e42e696
CausalConv2d
import torch import torch.nn as nn class WNConv2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True, activation=None): super().__init__() self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel, kernel_size, stride=s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
imatge-upc/pixelcoordEDL
CausalConv2d
false
6,881
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
DY_Conv2d
import torch import torch.nn as nn import torch.nn.functional as F class DY_Conv2d(nn.Conv2d): def __init__(self, in_chan, out_chan, kernel_size=3, stride=1, padding= 1, dilation=1, groups=1, bias=False, act=nn.ReLU(inplace=True), K=4, temperature=30, temp_anneal_steps=3000): super(DY_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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
imvladikon/pytorch-loss
DY_Conv2d
false
6,882
[ "MIT" ]
1
6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
https://github.com/imvladikon/pytorch-loss/tree/6cfaabe1be898e1ff000b3dffb46d0ef09096f6b
Conv2dSame
import math import torch import torch.nn.functional as F import torch.nn as nn from typing import List from typing import Optional from typing import Tuple from torch.jit.annotations import List def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 -...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn.functional as F import torch.nn as nn from typing im...
infomon/meta_nas
Conv2dSame
false
6,883
[ "Apache-2.0" ]
1
b81b7de86d26ae1ec0d6646b4277f3c918e5e35d
https://github.com/infomon/meta_nas/tree/b81b7de86d26ae1ec0d6646b4277f3c918e5e35d
SelfAttention_naive
import math import torch from torch import nn import torch.nn.functional as F class SelfAttention_naive(nn.Module): def __init__(self, dim_emb, dim_internal, heads=8, mask=False, dropout= 0.0, dtype=torch.float32): """ A single self attention block :param dim_emb: embedding dimen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
insop/transformer_simple
SelfAttention_naive
false
6,884
[ "Apache-2.0" ]
1
d07e6c3b9ddc9687d332ac3a980bbce22880ad46
https://github.com/insop/transformer_simple/tree/d07e6c3b9ddc9687d332ac3a980bbce22880ad46
MultiHead
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self): super().__init__() self.softmax = nn.Softmax(dim=-1) def forward(self, Q, K, V, mask=None, dk=64): w = torch.bmm(Q, K.transpose(1, 2)) if mask is not None: assert w.size() == mask.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....
iml1111/machine-translation
MultiHead
false
6,885
[ "MIT" ]
1
a7dd673efbe8a172c1df49e0d50482dc84008c37
https://github.com/iml1111/machine-translation/tree/a7dd673efbe8a172c1df49e0d50482dc84008c37
IOU
import torch import torch.multiprocessing def _iou(pred, target, size_average=True): b = pred.shape[0] IoU = 0.0 for i in range(0, b): Iand1 = torch.sum(target[i, :, :, :] * pred[i, :, :, :]) Ior1 = torch.sum(target[i, :, :, :]) + torch.sum(pred[i, :, :, :] ) - Iand1 Io...
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.multiprocessing assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._e...
intchous/SmartText
IOU
false
6,886
[ "MIT" ]
1
81abb84ce135a3859c32257d861c9e87b51f8c3f
https://github.com/intchous/SmartText/tree/81abb84ce135a3859c32257d861c9e87b51f8c3f
CecaModule
import math import torch import torch.nn.functional as F import torch.nn as nn class CecaModule(nn.Module): """Constructs a circular ECA module. ECA module where the conv uses circular padding rather than zero padding. Unlike the spatial dimension, the channels do not have inherent ordering nor local...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
infomon/meta_nas
CecaModule
false
6,887
[ "Apache-2.0" ]
1
b81b7de86d26ae1ec0d6646b4277f3c918e5e35d
https://github.com/infomon/meta_nas/tree/b81b7de86d26ae1ec0d6646b4277f3c918e5e35d
Binarizer
import torch from abc import ABC from sklearn.preprocessing import Binarizer class BaseOperator(ABC): """ Abstract class defining the basic structure for operator implementations in Hummingbird. """ def __init__(self, regression=False, classification=False, transformer= False, anomaly_detecti...
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 abc import ABC assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_stri...
hannahaih/hummingbird
Binarizer
false
6,888
[ "MIT" ]
1
b8ec670b3c90ec7e87d3ae4a2b268075bd5eae65
https://github.com/hannahaih/hummingbird/tree/b8ec670b3c90ec7e87d3ae4a2b268075bd5eae65
ActorNetwork
import torch import torch as T import torch.nn as nn import torch.optim as optim class ActorNetwork(nn.Module): def __init__(self, alpha, state_dim, action_dim, fc1_dim, fc2_dim): super(ActorNetwork, self).__init__() self.fc1 = nn.Linear(state_dim, fc1_dim) self.ln1 = nn.LayerNorm(fc1_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....
indigoLovee/TD3
ActorNetwork
false
6,889
[ "MIT" ]
1
0e86a40c27ec376b52e9f8e0e70db28e7411276b
https://github.com/indigoLovee/TD3/tree/0e86a40c27ec376b52e9f8e0e70db28e7411276b
CriticNetwork
import torch import torch as T import torch.nn as nn import torch.optim as optim class CriticNetwork(nn.Module): def __init__(self, beta, state_dim, action_dim, fc1_dim, fc2_dim): super(CriticNetwork, self).__init__() self.fc1 = nn.Linear(state_dim + action_dim, fc1_dim) self.ln1 = nn.Lay...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
indigoLovee/TD3
CriticNetwork
false
6,890
[ "MIT" ]
1
0e86a40c27ec376b52e9f8e0e70db28e7411276b
https://github.com/indigoLovee/TD3/tree/0e86a40c27ec376b52e9f8e0e70db28e7411276b
ChannelSqueeze
import torch import torch.nn as nn def channel_squeeze(x, groups): """ Channel squeeze operation. Parameters: ---------- x : Tensor Input tensor. groups : int Number of groups. Returns ------- Tensor Resulted tensor. """ batch, channels, height, wi...
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...
iofthetiger/pkuad
ChannelSqueeze
false
6,891
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
MP
from torch.nn import Module import torch import torch.utils.data from torch.nn import MaxPool2d class MP(Module): def __init__(self, k=2): super().__init__() self.m = MaxPool2d(kernel_size=k, stride=k) def forward(self, x): return self.m(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 from torch._inductor.runtime import triton_helpers from torch.nn import Module import torch.utils.data from torch.nn import MaxPool2d assert...
ioangatop/yolo
MP
false
6,892
[ "MIT" ]
1
c65a72337369572bc07090f39123e2bf6ff5f4a3
https://github.com/ioangatop/yolo/tree/c65a72337369572bc07090f39123e2bf6ff5f4a3
BasicBlockWN
import torch import torch as t import torch.nn as nn from abc import ABC from torch.nn.utils.weight_norm import weight_norm def conv1x1(in_planes, out_planes, stride=1): """ Create a 1x1 2d convolution block """ return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ikamensh/machin
BasicBlockWN
false
6,893
[ "MIT" ]
1
af7b423c47bc1412530cf6c96c11bd3af9b3e239
https://github.com/ikamensh/machin/tree/af7b423c47bc1412530cf6c96c11bd3af9b3e239
Gated_Conv_1d
import torch import torch.nn as nn class Gated_Conv_1d(nn.Module): def __init__(self, channels, kernel_size, stride=1, padding=0, dilation =1, groups=1, bias=True): super(Gated_Conv_1d, self).__init__() self.dilation = dilation self.channels = channels self.conv_dil = 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._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
ioanvl/wavenet_classifier_torch
Gated_Conv_1d
false
6,894
[ "MIT" ]
1
de29bfce59d52ae46143f62c4d7a6158a04edf00
https://github.com/ioanvl/wavenet_classifier_torch/tree/de29bfce59d52ae46143f62c4d7a6158a04edf00
IRevInjectivePad
import torch import torch.nn as nn class IRevInjectivePad(nn.Module): """ i-RevNet channel zero padding block. Parameters: ---------- padding : int Size of the padding. """ def __init__(self, padding): super(IRevInjectivePad, self).__init__() self.padding = paddin...
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...
iofthetiger/pkuad
IRevInjectivePad
false
6,895
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
BERTIntermediate
from _paritybench_helpers import _mock_config 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...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
DAQuestionAnswering/Bert-n-Pals
BERTIntermediate
false
6,896
[ "MIT" ]
1
d5a288b9ac62259e70c249635108ba3906e19f00
https://github.com/DAQuestionAnswering/Bert-n-Pals/tree/d5a288b9ac62259e70c249635108ba3906e19f00
Decoder5
import torch import torch.nn as nn class Decoder5(nn.Module): def __init__(self): super(Decoder5, self).__init__() self.reflecPad15 = nn.ReflectionPad2d((1, 1, 1, 1)) self.conv15 = nn.Conv2d(512, 512, 3, 1, 0) self.relu15 = nn.ReLU(inplace=True) self.unpool = nn.Upsampling...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
hologerry/wct_experiment
Decoder5
false
6,897
[ "MIT" ]
1
890d885561dc8df8c4ae732aebd902aa838257e6
https://github.com/hologerry/wct_experiment/tree/890d885561dc8df8c4ae732aebd902aa838257e6
FirstLSTMAmp
import torch import torch.nn as nn class FirstLSTMAmp(nn.Module): """ First LSTM amplifier branch. Parameters: ---------- in_features : int Number of input channels. out_features : int Number of output channels. """ def __init__(self, in_features, out_features): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
iofthetiger/pkuad
FirstLSTMAmp
false
6,898
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
AlexConv
import torch import torch.nn as nn import torch.nn.functional as F from inspect import isfunction def get_activation_layer(activation): """ Create activation layer from string/function. Parameters: ---------- activation : function, or str, or nn.Module Activation function or name of activ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
iofthetiger/pkuad
AlexConv
false
6,899
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
Attention
import torch import torch.nn.functional as F class Attention(torch.nn.Module): """Scaled dot product attention.""" def __init__(self, hidden_dim, **kwargs): super(Attention, self).__init__(**kwargs) self.projection_layer = torch.nn.Linear(hidden_dim, 1) def forward(self, atten_post): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
isspek/Cross-Lingual-Cyberbullying
Attention
false
6,900
[ "MIT" ]
1
710c136b9233f0be87af72e43e25722e73158c52
https://github.com/isspek/Cross-Lingual-Cyberbullying/tree/710c136b9233f0be87af72e43e25722e73158c52
MobileNetV3Classifier
import torch import torch.nn as nn import torch.nn.functional as F def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
iofthetiger/pkuad
MobileNetV3Classifier
false
6,901
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
SPHead
import torch import torch.nn as nn import torch.nn.functional as F from inspect import isfunction def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : 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 import triton_helpers import torch.nn as nn import ...
iofthetiger/pkuad
SPHead
false
6,902
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
NTXent
import torch import torch.nn as nn import torch.nn.functional as F class NTXent(nn.Module): def forward(self, z1, z2, t): batch_size = z1.shape[0] device = z1.device z1 = F.normalize(z1, dim=-1) z2 = F.normalize(z2, dim=-1) similarity = torch.matmul(z1, z2.T) simil...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
isaaccorley/contrastive-surface-image-pretraining
NTXent
false
6,903
[ "MIT" ]
1
a918d4fd3b9cc61ec512af978fb4f086d3b46a70
https://github.com/isaaccorley/contrastive-surface-image-pretraining/tree/a918d4fd3b9cc61ec512af978fb4f086d3b46a70
VectorQuantizer
import torch import torch.nn as nn import torch.nn.functional as F class VectorQuantizer(nn.Module): def __init__(self, num_embeddings, embedding_dim, commitment_cost): super(VectorQuantizer, self).__init__() self._embedding_dim = embedding_dim self._num_embeddings = num_embeddings ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
imatge-upc/pixelcoordEDL
VectorQuantizer
false
6,904
[ "MIT" ]
1
353632feed6ac8c93758c1a2a1b7a477e7ff053c
https://github.com/imatge-upc/pixelcoordEDL/tree/353632feed6ac8c93758c1a2a1b7a477e7ff053c
NavigatorBranch
import torch import torch.nn as nn def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. stride : int or tuple/list...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
iofthetiger/pkuad
NavigatorBranch
false
6,905
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
SCLN
import torch import torch.nn as nn class LinearNorm(nn.Module): """ LinearNorm Projection """ def __init__(self, in_features, out_features, bias=False): super(LinearNorm, self).__init__() self.linear = nn.Linear(in_features, out_features, bias) nn.init.xavier_uniform_(self.linear.weig...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
ishine/Cross-Speaker-Emotion-Transfer
SCLN
false
6,906
[ "MIT" ]
1
9d38e8058f5abc06167bac244d8ace083e2a6220
https://github.com/ishine/Cross-Speaker-Emotion-Transfer/tree/9d38e8058f5abc06167bac244d8ace083e2a6220
Tile
import torch import torch.nn as nn class Tile(nn.Module): def __init__(self, max_size, dim): super(Tile, self).__init__() self.max_size = max_size self.dim = dim def forward(self, input): return input.repeat(*[(self.max_size if x == self.dim else 1) for x in range...
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...
ixaxaar/pytorch-npi
Tile
false
6,907
[ "MIT" ]
1
50b028840c00f7807fb6490ce6bb0918832dc360
https://github.com/ixaxaar/pytorch-npi/tree/50b028840c00f7807fb6490ce6bb0918832dc360
GlobalAvgPool2d
import torch import torch.nn as nn import torch.utils class GlobalAvgPool2d(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(GlobalAvgPool2d, self).__init__() def forward(self, inputs): in_size = inputs.size() inputs = inp...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
jameslong95/FasterSeg
GlobalAvgPool2d
false
6,908
[ "MIT" ]
1
872e04964ea46494a6018d9915cee5476e361c27
https://github.com/jameslong95/FasterSeg/tree/872e04964ea46494a6018d9915cee5476e361c27
Vec2ArousalNet
import torch import torch.utils.data class Vec2ArousalNet(torch.nn.Module): def __init__(self, D_in, H, D_out): super(Vec2ArousalNet, self).__init__() self.layer_1 = torch.nn.Linear(D_in, H) self.layer_2 = torch.nn.Linear(H, D_out) def forward(self, x): h = self.layer_1(x).cl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 asser...
jackvandrunen/hackuci18
Vec2ArousalNet
false
6,909
[ "BSD-2-Clause" ]
1
fff3fd7d116a6a83f19229a17377b84922145ebd
https://github.com/jackvandrunen/hackuci18/tree/fff3fd7d116a6a83f19229a17377b84922145ebd
LinearAttention2d
import torch class LinearAttention2d(torch.nn.Module): """ Linear attention based on parametrized compatibility score function with softmax normalization. """ def __init__(self, in_features, out_features): super(LinearAttention2d, self).__init__() self.in_features = in_features ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
itsfrank98/CT-COVID
LinearAttention2d
false
6,911
[ "MIT" ]
1
3f054000ca0518be2486cf00cfab695b09e39a26
https://github.com/itsfrank98/CT-COVID/tree/3f054000ca0518be2486cf00cfab695b09e39a26
UpConv2x2
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.cuda import * class UpConv2x2(nn.Module): def __init__(self, channels): super(UpConv2x2, self).__init__() self.conv = nn.Conv2d(channels, channels // 2, kernel_size=2, stride=1, paddi...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch.cuda import * assert_si...
jabae/detectEM
UpConv2x2
false
6,912
[ "MIT" ]
1
2d1a5116164d0bed0a8ea767a227d05a8970a448
https://github.com/jabae/detectEM/tree/2d1a5116164d0bed0a8ea767a227d05a8970a448
MultiheadAttention
import torch import numpy as np from typing import Optional import torch.nn as nn class MultiheadAttention(nn.Module): """Multihead scaled dot-product attention. """ def __init__(self, contexts: 'int', queries: 'int', channels: 'int', heads: 'int'): """Initializer. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ishine/torch-retriever-vc
MultiheadAttention
false
6,913
[ "MIT" ]
1
db5119d9d703ea819e2ac9185871ea3db52c14e1
https://github.com/ishine/torch-retriever-vc/tree/db5119d9d703ea819e2ac9185871ea3db52c14e1
Bilinear
import torch import torch.nn as nn class Bilinear(nn.Module): def __init__(self, size): super(Bilinear, self).__init__() self.size = size self.mat = nn.Parameter(torch.FloatTensor(self.size, self.size)) self.reset_parameters() def reset_parameters(self): params = [p 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
jalshr21/diora-1
Bilinear
false
6,914
[ "Apache-2.0" ]
1
a9b680fde6a840707340e9e8232643b0f0e637bd
https://github.com/jalshr21/diora-1/tree/a9b680fde6a840707340e9e8232643b0f0e637bd
SigmoidFocalLoss
import torch import torch.nn as nn import torch.utils class SigmoidFocalLoss(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super(SigmoidFocalLoss, self).__init__() self.ignore_label = ignore_label self.gamma = gamma self.alpha = alpha ...
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 ...
jameslong95/FasterSeg
SigmoidFocalLoss
false
6,915
[ "MIT" ]
1
872e04964ea46494a6018d9915cee5476e361c27
https://github.com/jameslong95/FasterSeg/tree/872e04964ea46494a6018d9915cee5476e361c27
ScaledDotProductAttention
import torch import numpy as np import torch.nn as nn class ScaledDotProductAttention(nn.Module): def __init__(self, dropout): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, q, k, v, mask=None, rpe_q=None, rpe_v=None): """ Args: q: query (...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jahsylla/stochastic-cslr
ScaledDotProductAttention
false
6,916
[ "MIT" ]
1
d12d48ebec34183d939917cda2d54f38593dcddb
https://github.com/jahsylla/stochastic-cslr/tree/d12d48ebec34183d939917cda2d54f38593dcddb
JSloss
import torch import torch.nn as nn import torch.nn.functional as F class JSloss(nn.Module): """ Compute the Jensen-Shannon loss using the torch native kl_div""" def __init__(self, reduction='batchmean'): super().__init__() self.red = reduction def forward(self, input, target): n...
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...
jaredaevans/UltrafastNST
JSloss
false
6,917
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
USConv2d
import torch import torch.nn as nn import torch.utils def make_divisible(v, divisor=8, min_value=1): """ forked from slim: https://github.com/tensorflow/models/blob/ 0344c5503ee55e24f0de7f37336a6e08f10976fd/ research/slim/nets/mobilenet/mobilenet.py#L62-L69 """ if min_value is None: ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynamo.g...
jameslong95/FasterSeg
USConv2d
false
6,918
[ "MIT" ]
1
872e04964ea46494a6018d9915cee5476e361c27
https://github.com/jameslong95/FasterSeg/tree/872e04964ea46494a6018d9915cee5476e361c27
GetStyleLoss
import torch import torch.nn as nn import torch.nn.functional as F def gram_matrix(input): """ gram matrix for feature assignments """ a, b, c, d = input.size() allG = [] for i in range(a): features = input[i].view(b, c * d) gram = torch.mm(features, features.t()) gram = gram.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_...
jaredaevans/UltrafastNST
GetStyleLoss
false
6,919
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
ConvBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.cuda import * def conv3x3(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True) class ConvBlock(nn.Module): def __init__(self, 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._inductor.runtime import triton_helpers from torch._inductor.runtime....
jabae/detectEM
ConvBlock
false
6,920
[ "MIT" ]
1
2d1a5116164d0bed0a8ea767a227d05a8970a448
https://github.com/jabae/detectEM/tree/2d1a5116164d0bed0a8ea767a227d05a8970a448
BertAttention
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class BertAttention(nn.Module): def __init__(self, config, ctx_dim=None): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
AsmitaBhat30/lxmert
BertAttention
false
6,921
[ "MIT" ]
1
90292dc36a25c04c4f76fe9119e3141d5dc05874
https://github.com/AsmitaBhat30/lxmert/tree/90292dc36a25c04c4f76fe9119e3141d5dc05874
TVLoss
import torch import torch.nn as nn import torch.nn.functional as F class TVLoss(nn.Module): """L2 total variation loss, as in Mahendran et al.""" def forward(self, input): input = F.pad(input, (0, 1, 0, 1), 'replicate') x_diff = input[..., :-1, 1:] - input[..., :-1, :-1] y_diff = inpu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
jayChung0302/SideProject-sudalchongbo
TVLoss
false
6,922
[ "MIT" ]
1
fb0a3d0aee53ba24d3b8ec2dd8c52d0e8f6c33d7
https://github.com/jayChung0302/SideProject-sudalchongbo/tree/fb0a3d0aee53ba24d3b8ec2dd8c52d0e8f6c33d7
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F class FocalSigmoidLossFunc(torch.autograd.Function): """ compute backward directly for better numeric stability """ @staticmethod def forward(ctx, logits, label, alpha, gamma): logits = logits.float() coeff = 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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
jaredaevans/UltrafastNST
FocalLoss
false
6,923
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
LogisticRegression
import torch import torch.nn as nn class LogisticRegression(nn.Module): """ A logistic regression model of the form P(y = 1 | x) = 1 / (1 + exp(-(mx + b))) """ def __init__(self, init_m=1.0, init_b=1.0): """ Initialize a logistic regression model by defining its initial pa...
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...
jayelm/pytorch-project-template
LogisticRegression
false
6,924
[ "MIT" ]
1
30306ce07b21c97c6993432764cbbe0a73092a0c
https://github.com/jayelm/pytorch-project-template/tree/30306ce07b21c97c6993432764cbbe0a73092a0c
DownConvBlock
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.cuda import * def conv3x3(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True) def maxpool2x2(): return nn.MaxPool2d(kernel_size=2, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jabae/detectEM
DownConvBlock
false
6,925
[ "MIT" ]
1
2d1a5116164d0bed0a8ea767a227d05a8970a448
https://github.com/jabae/detectEM/tree/2d1a5116164d0bed0a8ea767a227d05a8970a448
VariationalLoss
import torch import torch.nn as nn import torch.nn.functional as F class VariationalLoss(nn.Module): """ Variational loss to enforce continuity of images """ def forward(self, input): """ forward pass """ self.loss = F.mse_loss(input[:, :, 1:, :], input[:, :, :-1, :] ) + F.mse...
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...
jaredaevans/UltrafastNST
VariationalLoss
false
6,926
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
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_...
jasonyanglu/fedavgpy
TwoHiddenLayerFc
false
6,927
[ "MIT" ]
1
cefbe5854f02d3df1197d849872286439c86e949
https://github.com/jasonyanglu/fedavgpy/tree/cefbe5854f02d3df1197d849872286439c86e949
SoftCrossEntropyLoss2d
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils class SoftCrossEntropyLoss2d(nn.Module): def __init__(self): super(SoftCrossEntropyLoss2d, self).__init__() def forward(self, inputs, targets): loss = 0 inputs = -F.log_softmax(inputs, dim=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....
jameslong95/FasterSeg
SoftCrossEntropyLoss2d
false
6,928
[ "MIT" ]
1
872e04964ea46494a6018d9915cee5476e361c27
https://github.com/jameslong95/FasterSeg/tree/872e04964ea46494a6018d9915cee5476e361c27
StyleTrack
import torch import torch.nn as nn def gram_matrix(input): """ gram matrix for feature assignments """ a, b, c, d = input.size() allG = [] for i in range(a): features = input[i].view(b, c * d) gram = torch.mm(features, features.t()) gram = gram.div(c * d) allG.append(gr...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
jaredaevans/UltrafastNST
StyleTrack
false
6,929
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
ReflectPad2d
import torch class ReflectPad2d(torch.nn.Module): """ reflectionpad2d that can be transfered across onnx etc size : int (the size of padding) """ def __init__(self, size): super().__init__() self.size = size def forward(self, ins): size = self.size l_list, r_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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
jaredaevans/UltrafastNST
ReflectPad2d
false
6,930
[ "MIT" ]
1
6671c6b618ce6bb4920b15f782be962e484a5423
https://github.com/jaredaevans/UltrafastNST/tree/6671c6b618ce6bb4920b15f782be962e484a5423
EncoderImagePrecomp
import torch import numpy as np import torch.nn as nn from collections import OrderedDict import torch.nn.init def l2norm(x, dim=-1): return x / x.norm(2, dim=dim, keepdim=True).clamp(min=1e-06) class EncoderImagePrecomp(nn.Module): """ image encoder """ def __init__(self, img_dim, embed_size, no_imgno...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jefflai108/VGNSL
EncoderImagePrecomp
false
6,931
[ "MIT" ]
1
0edc3db3691abbad2a505b2165bd99e7a62d784f
https://github.com/jefflai108/VGNSL/tree/0edc3db3691abbad2a505b2165bd99e7a62d784f
BehlerAngular
import torch from torch import nn as nn class BehlerAngular(nn.Module): """ Compute Behler type angular contribution of the angle spanned by three atoms: :math:`2^{(1-\\zeta)} (1 + \\lambda \\cos( {\\theta}_{ijk} ) )^\\zeta` Sets of zetas with lambdas of -1 and +1 are generated automatically. 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 import nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._emp...
jduerholt/schnetpack
BehlerAngular
false
6,932
[ "MIT" ]
1
228d50fdeba4592b1de54d3a9570d766757c2ee1
https://github.com/jduerholt/schnetpack/tree/228d50fdeba4592b1de54d3a9570d766757c2ee1
Mult
import torch import torch.utils.data import torch from torch import nn class Mult(nn.Module): def __init__(self, nc): super(Mult, self).__init__() self.register_parameter(name='exp', param=torch.nn.Parameter(torch. diag(torch.ones(nc)).unsqueeze(-1).unsqueeze(-1))) """self.reg...
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...
jayin92/vae-pix2pix-terrain-generator
Mult
false
6,933
[ "BSD-3-Clause" ]
1
805ea0b053dc9d9c22301af7f536a8fb7e2118d1
https://github.com/jayin92/vae-pix2pix-terrain-generator/tree/805ea0b053dc9d9c22301af7f536a8fb7e2118d1
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...
jefflai108/Self-Supervised-Speech-Pretraining-and-Representation-Learning
VectorQuantizeLayer_GB
false
6,934
[ "MIT" ]
1
bb8df008397d5a0360ab7d4b68e91588ed648270
https://github.com/jefflai108/Self-Supervised-Speech-Pretraining-and-Representation-Learning/tree/bb8df008397d5a0360ab7d4b68e91588ed648270
Accuracy
import torch from torch import nn def accuracy(logits: 'torch.Tensor', labels: 'torch.Tensor', ignore_index: 'int'=-100) ->torch.Tensor: with torch.no_grad(): valid_mask = labels != ignore_index predictions = logits.float().argmax(-1) correct = (predictions == labels) * valid_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._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
jgoodson/TraGeC
Accuracy
false
6,935
[ "BSD-3-Clause" ]
1
3370e29ba0639745055cbee726a40181a4dd61df
https://github.com/jgoodson/TraGeC/tree/3370e29ba0639745055cbee726a40181a4dd61df
ComboLossOnlyPos
import torch import torch.nn as nn class SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super(SoftDiceLoss, self).__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.siz...
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...
jchen42703/reproducing-cloud-3rd-place
ComboLossOnlyPos
false
6,936
[ "Apache-2.0" ]
1
25571f53efd48f68735d7fe2991e3ad783cbd4b1
https://github.com/jchen42703/reproducing-cloud-3rd-place/tree/25571f53efd48f68735d7fe2991e3ad783cbd4b1
MultiLabelDiceLoss
import torch import torch.nn as nn class SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super(SoftDiceLoss, self).__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.siz...
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...
jchen42703/reproducing-cloud-3rd-place
MultiLabelDiceLoss
false
6,937
[ "Apache-2.0" ]
1
25571f53efd48f68735d7fe2991e3ad783cbd4b1
https://github.com/jchen42703/reproducing-cloud-3rd-place/tree/25571f53efd48f68735d7fe2991e3ad783cbd4b1
ConvPlus
import torch import torch.nn as nn import torch.utils.data class ConvPlus(nn.Module): def __init__(self, c1, c2, k=3, s=1, g=1, bias=True): super(ConvPlus, self).__init__() self.cv1 = nn.Conv2d(c1, c2, (k, 1), s, (k // 2, 0), groups=g, bias =bias) self.cv2 = nn.Conv2d(c1, c2, ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
jiangbestone/detect_rcnn
ConvPlus
false
6,938
[ "MIT" ]
1
41c4f4d3f8409cc146314c41a3d02ceafa9a7477
https://github.com/jiangbestone/detect_rcnn/tree/41c4f4d3f8409cc146314c41a3d02ceafa9a7477
PredictionHeadTransform
import math import torch import typing from torch import nn from torch.nn import LayerNorm def gelu(x: 'torch.Tensor') ->torch.Tensor: return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) def swish(x: 'torch.Tensor') ->torch.Tensor: return x * torch.sigmoid(x) def get_activation_fn(name: 'str') ->typing...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
jgoodson/TraGeC
PredictionHeadTransform
false
6,939
[ "BSD-3-Clause" ]
1
3370e29ba0639745055cbee726a40181a4dd61df
https://github.com/jgoodson/TraGeC/tree/3370e29ba0639745055cbee726a40181a4dd61df
AddCoords
import torch import torch.nn as nn class AddCoords(nn.Module): def __init__(self, with_r=False): super().__init__() self.with_r = with_r def forward(self, input_tensor): """ Args: input_tensor: shape(batch, channel, x_dim, y_dim) """ batch_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...
jiangxiluning/TCPN
AddCoords
false
6,940
[ "Apache-2.0" ]
1
916bd8455be5c784068b7bb5bd6226da3f2d95c7
https://github.com/jiangxiluning/TCPN/tree/916bd8455be5c784068b7bb5bd6226da3f2d95c7
NegativeCosineSimilarity
import torch import torch.nn.functional as F class NegativeCosineSimilarity(torch.nn.Module): """Implementation of the Negative Cosine Simililarity used in the SimSiam[0] paper. [0] SimSiam, 2020, https://arxiv.org/abs/2011.10566 Examples: >>> # initialize loss function >>> loss_fn ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
jianzhnie/self_supervised
NegativeCosineSimilarity
false
6,941
[ "Apache-2.0" ]
1
d1e0f31ab032150ab0ad007c1e19773135a5fb79
https://github.com/jianzhnie/self_supervised/tree/d1e0f31ab032150ab0ad007c1e19773135a5fb79
Net
import torch import torch.utils.data import torch.utils.data.distributed 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, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jesterhazy/sagemaker-pytorch-container
Net
false
6,942
[ "Apache-2.0" ]
1
2eb4ba9216e5d72cd4d61eadc173764a41dea6b9
https://github.com/jesterhazy/sagemaker-pytorch-container/tree/2eb4ba9216e5d72cd4d61eadc173764a41dea6b9
GCNModelVAE
import torch import torch.nn as nn from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): def __init__(self, input_dim, output_dim, dropout, bias=False): super(GraphConvolution, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.weig...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
jiangnanboy/gcn_for_prediction_of_protein_interactions
GCNModelVAE
false
6,943
[ "Apache-2.0" ]
1
b2a9eb06cdfe0971d0c352299db1075ec4827dd9
https://github.com/jiangnanboy/gcn_for_prediction_of_protein_interactions/tree/b2a9eb06cdfe0971d0c352299db1075ec4827dd9
GraphAttentionLayer
import torch import torch.nn as nn from torch.nn.parameter import Parameter import torch.nn.functional as F class GraphAttentionLayer(nn.Module): def __init__(self, input_dim, output_dim, dropout, alpha): super(GraphAttentionLayer, self).__init__() self.input_dim = input_dim self.output_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....
jiangnanboy/gcn_for_prediction_of_protein_interactions
GraphAttentionLayer
false
6,944
[ "Apache-2.0" ]
1
b2a9eb06cdfe0971d0c352299db1075ec4827dd9
https://github.com/jiangnanboy/gcn_for_prediction_of_protein_interactions/tree/b2a9eb06cdfe0971d0c352299db1075ec4827dd9
ComboLoss
import torch import torch.nn as nn class SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super(SoftDiceLoss, self).__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.siz...
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...
jchen42703/reproducing-cloud-3rd-place
ComboLoss
false
6,945
[ "Apache-2.0" ]
1
25571f53efd48f68735d7fe2991e3ad783cbd4b1
https://github.com/jchen42703/reproducing-cloud-3rd-place/tree/25571f53efd48f68735d7fe2991e3ad783cbd4b1
DomainCNN
import torch from torch.nn import functional as F import torch.utils.data class DomainCNN(torch.nn.Module): def __init__(self, domains): super(DomainCNN, self).__init__() self.conv1 = torch.nn.Conv1d(1, 32, kernel_size=5) self.pool1 = torch.nn.MaxPool1d(kernel_size=2) self.conv2 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jenchen1398/artistic-music-style-transfer
DomainCNN
false
6,946
[ "BSD-3-Clause" ]
1
aa02bcf9c27cb6124c6316a756f7fd77d42be11a
https://github.com/jenchen1398/artistic-music-style-transfer/tree/aa02bcf9c27cb6124c6316a756f7fd77d42be11a
GeCEmbeddings
from _paritybench_helpers import _mock_config import torch import typing from torch import nn def create_sinusoidal_embeddings(n_pos, dim, out): out.requires_grad = False positions = torch.arange(0, n_pos)[:, None] dimensions = torch.arange(0, dim) position_enc = positions / torch.pow(10000, 2 * (dime...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
jgoodson/TraGeC
GeCEmbeddings
false
6,947
[ "BSD-3-Clause" ]
1
3370e29ba0639745055cbee726a40181a4dd61df
https://github.com/jgoodson/TraGeC/tree/3370e29ba0639745055cbee726a40181a4dd61df
RoutingBase
import torch from torch.nn import functional as F import torch.nn as nn def cal_normal(v, dim=-1, keepdim=False): """ :return: """ normal = torch.sum(v ** 2, dim=dim, keepdim=keepdim) ** 0.5 return normal def squash(sr, dim=1): """ :param dim: :param sr:(bs, dim) :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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math fr...
jiangzhiwei2018/Pytorch_CapsNet
RoutingBase
false
6,948
[ "Apache-2.0" ]
1
b8931d65d5a99a4ff18fd209c16d3ff7d094d1ad
https://github.com/jiangzhiwei2018/Pytorch_CapsNet/tree/b8931d65d5a99a4ff18fd209c16d3ff7d094d1ad
MCDropout2d
import torch from torch import Tensor import torch.nn as nn from torch.functional import F import torch.nn.functional as F class MCDropout2d(nn.Dropout2d): """2D dropout that stays on during training and testing """ def forward(self, input: 'Tensor') ->Tensor: return F.dropout2d(input, self.p, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
jiwoncpark/ex-con
MCDropout2d
false
6,949
[ "MIT" ]
1
6775d11ec1c3e7005890e58d16dd07b711861cdf
https://github.com/jiwoncpark/ex-con/tree/6775d11ec1c3e7005890e58d16dd07b711861cdf
BarlowTwinLoss
import torch import torch.nn.functional as F def off_diagonal(x): """Return a flattened view of the off-diagonal elements of a square matrix. >>> x = np.array([[1,2,3],[4,5,6],[7,8,9]]) array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> x.flatten() array([1, 2, 3, 4, 5, 6, 7, 8,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jianzhnie/self_supervised
BarlowTwinLoss
false
6,950
[ "Apache-2.0" ]
1
d1e0f31ab032150ab0ad007c1e19773135a5fb79
https://github.com/jianzhnie/self_supervised/tree/d1e0f31ab032150ab0ad007c1e19773135a5fb79
SamePadConv2d
import torch from torch.nn import functional as F import torch.nn as nn class SamePadConv2d(nn.Conv2d): """ Conv with TF padding='same' https://github.com/pytorch/pytorch/issues/3867#issuecomment-349279036 """ def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
jjeamin/obJDetection
SamePadConv2d
false
6,951
[ "MIT" ]
1
eb7fbc410beb00fad1a6477e827e9ce2d8efbac5
https://github.com/jjeamin/obJDetection/tree/eb7fbc410beb00fad1a6477e827e9ce2d8efbac5
Conv2dWithConstraint
import torch import torch.nn as nn class Conv2dWithConstraint(nn.Conv2d): def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super(Conv2dWithConstraint, self).__init__(*args, **kwargs) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=2,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
jiuney/XAI606-EEGNet
Conv2dWithConstraint
false
6,952
[ "MIT" ]
1
45ff28630ed1b09d0853f2cfb148a5dd2693e5ab
https://github.com/jiuney/XAI606-EEGNet/tree/45ff28630ed1b09d0853f2cfb148a5dd2693e5ab
CrossEntropyLossSoft
import torch class CrossEntropyLossSoft(torch.nn.modules.loss._Loss): """ inplace distillation for image classification """ def forward(self, output, target): output_log_prob = torch.nn.functional.log_softmax(output, dim=1) target = target.unsqueeze(1) output_log_prob = output_log_pro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jiuyecao/Opt-CoInfer
CrossEntropyLossSoft
false
6,953
[ "MIT" ]
1
60f29a28c34d3bf9b2f23c98bb8e98caf1abc4f0
https://github.com/jiuyecao/Opt-CoInfer/tree/60f29a28c34d3bf9b2f23c98bb8e98caf1abc4f0
Selector
import torch import torch.nn as nn import torch.utils.data class Selector(nn.Module): def __init__(self): super(Selector, self).__init__() self.conv1 = nn.Conv2d(2048 + 256, 256, 3) self.relu1 = nn.ReLU(inplace=True) self.conv2 = nn.Conv2d(256, 16, 3) self.relu2 = nn.ReLU(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
hsuanchuu/maskrcnn-benchmark
Selector
false
6,954
[ "MIT" ]
1
39429eca800fb912418c34d104ff6f3f2ea07bbd
https://github.com/hsuanchuu/maskrcnn-benchmark/tree/39429eca800fb912418c34d104ff6f3f2ea07bbd
ShuffleCatChunk
import torch import torch.nn as nn class ShuffleCatChunk(nn.Module): def forward(self, a, b): assert a.size() == b.size() _n, c, _h, _w = a.size() a = torch.chunk(a, chunks=c, dim=1) b = torch.chunk(b, chunks=c, dim=1) x = [None] * (c * 2) x[::2] = a 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
jjkennedy3/PINTO_model_zoo
ShuffleCatChunk
false
6,955
[ "MIT" ]
1
a181c3015a6241873798c4ad3eadd4ce97024f70
https://github.com/jjkennedy3/PINTO_model_zoo/tree/a181c3015a6241873798c4ad3eadd4ce97024f70
ShuffleCat
import torch import torch.nn as nn class ShuffleCat(nn.Module): def forward(self, a, b): assert a.size() == b.size() n, c, h, w = a.size() a = a.permute(0, 2, 3, 1).contiguous().view(-1, c) b = b.permute(0, 2, 3, 1).contiguous().view(-1, c) x = torch.cat((a, b), dim=0).tra...
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...
jjkennedy3/PINTO_model_zoo
ShuffleCat
false
6,956
[ "MIT" ]
1
a181c3015a6241873798c4ad3eadd4ce97024f70
https://github.com/jjkennedy3/PINTO_model_zoo/tree/a181c3015a6241873798c4ad3eadd4ce97024f70
BatchNormDense
import torch import torch.nn as nn from torch.nn.parameter import Parameter class BatchNormDense(nn.Module): def __init__(self, num_features, eps=1e-08): super().__init__() self.num_features = num_features self.eps = eps self.gamma = Parameter(torch.Tensor(num_features)) s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
jkoscialkowski/dnn-exercises
BatchNormDense
false
6,957
[ "MIT" ]
1
5d1616fce1b461e39858c68279d2fafefab00a56
https://github.com/jkoscialkowski/dnn-exercises/tree/5d1616fce1b461e39858c68279d2fafefab00a56
BasicBlock
import torch import torch.nn as nn import torch.utils.data def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jinwoo1225/MichiGAN-HAiR
BasicBlock
false
6,958
[ "MIT" ]
1
dece2ad2e93de3a7c52b4a657ecc0f1a667ccc7e
https://github.com/jinwoo1225/MichiGAN-HAiR/tree/dece2ad2e93de3a7c52b4a657ecc0f1a667ccc7e
ShuffleCatAlt
import torch import torch.nn as nn class ShuffleCatAlt(nn.Module): def forward(self, a, b): assert a.size() == b.size() n, c, h, w = a.size() x = torch.zeros(n, c * 2, h, w, dtype=a.dtype, device=a.device) x[:, ::2] = a x[:, 1::2] = b return x def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
jjkennedy3/PINTO_model_zoo
ShuffleCatAlt
false
6,959
[ "MIT" ]
1
a181c3015a6241873798c4ad3eadd4ce97024f70
https://github.com/jjkennedy3/PINTO_model_zoo/tree/a181c3015a6241873798c4ad3eadd4ce97024f70
DummyMCObjective
from torch.nn import Module import torch from torch import Tensor from abc import ABC from abc import abstractmethod class AcquisitionObjective(Module, ABC): """Abstract base class for objectives.""" ... class MCAcquisitionObjective(AcquisitionObjective): """Abstract base class for MC-based objectives."...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch import Tensor from abc import ABC from abc import abstractmethod assert_size_stride = torch._C._dynam...
jmren168/botorch
DummyMCObjective
false
6,960
[ "MIT" ]
1
6c067185f56d3a244c4093393b8a97388fb1c0b3
https://github.com/jmren168/botorch/tree/6c067185f56d3a244c4093393b8a97388fb1c0b3
PolicyNetworkGridworld
import torch import torch.nn as nn import torch.nn.functional as F class PolicyNetworkGridworld(nn.Module): """ Deep neural network which represents policy network. """ def __init__(self, input_size, num_actions): super(PolicyNetworkGridworld, self).__init__() self.linear1 = 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jlebensold/flrl-ddpg
PolicyNetworkGridworld
false
6,961
[ "MIT" ]
1
d91e9f4aedf48d0614e33bd22c7f684ecda089b1
https://github.com/jlebensold/flrl-ddpg/tree/d91e9f4aedf48d0614e33bd22c7f684ecda089b1
DQNGridworld
import torch import torch.nn as nn import torch.nn.functional as F class DQNGridworld(nn.Module): """ Deep neural network with represents an agent. """ def __init__(self, input_size, num_actions): super(DQNGridworld, self).__init__() self.linear1 = nn.Linear(input_size, 50) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
jlebensold/flrl-ddpg
DQNGridworld
false
6,962
[ "MIT" ]
1
d91e9f4aedf48d0614e33bd22c7f684ecda089b1
https://github.com/jlebensold/flrl-ddpg/tree/d91e9f4aedf48d0614e33bd22c7f684ecda089b1
ProjectionHead
import torch from torch import nn as nn class ProjectionHead(nn.Module): def __init__(self, embedding_dim, projection_dim, dropout): super().__init__() self.projection = nn.Linear(embedding_dim, projection_dim) self.gelu = nn.GELU() self.fc = nn.Linear(projection_dim, projection_d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
jianzhnie/MultimodalTransformer
ProjectionHead
false
6,963
[ "Apache-2.0" ]
1
6cd4ca8034a53da361149745aecead68fbe304a0
https://github.com/jianzhnie/MultimodalTransformer/tree/6cd4ca8034a53da361149745aecead68fbe304a0
FFDNN
import torch import torch as tc import torch.nn as nn class FFDNN(nn.Module): def __init__(self, insize, action_space): super(FFDNN, self).__init__() self.input = nn.Linear(insize, 64) self.layer1 = nn.Linear(64, 32) self.layer2 = nn.Linear(32, action_space) def forward(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 ...
johan-gras/rl-camb-kaggle-connect-x
FFDNN
false
6,964
[ "Apache-2.0" ]
1
764463e556c5aea6f61390d2fec83f363510d029
https://github.com/johan-gras/rl-camb-kaggle-connect-x/tree/764463e556c5aea6f61390d2fec83f363510d029
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).sqrt() X = torch.div(X, norm.unsqueeze(1).expand_as(X)) return X class EncoderImagePrecomp(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.triton_helpers import libdevice import numpy as np ...
joannezhouyi/visual_textual_cross_retrieval
EncoderImagePrecomp
false
6,965
[ "Apache-2.0" ]
1
6d5c55a475af74bba63887fff0774d5597830a2b
https://github.com/joannezhouyi/visual_textual_cross_retrieval/tree/6d5c55a475af74bba63887fff0774d5597830a2b
BatchNormConv
import torch import torch.nn as nn from torch.nn.parameter import Parameter class BatchNormConv(nn.Module): def __init__(self, num_channels, eps=1e-08): super().__init__() self.num_channels = num_channels self.eps = eps self.gamma = Parameter(torch.Tensor(num_channels)) se...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
jkoscialkowski/dnn-exercises
BatchNormConv
false
6,966
[ "MIT" ]
1
5d1616fce1b461e39858c68279d2fafefab00a56
https://github.com/jkoscialkowski/dnn-exercises/tree/5d1616fce1b461e39858c68279d2fafefab00a56
LinearWithConstraint
import torch import torch.nn as nn class LinearWithConstraint(nn.Linear): def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super(LinearWithConstraint, self).__init__(*args, **kwargs) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=2,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
jiuney/XAI606-EEGNet
LinearWithConstraint
false
6,967
[ "MIT" ]
1
45ff28630ed1b09d0853f2cfb148a5dd2693e5ab
https://github.com/jiuney/XAI606-EEGNet/tree/45ff28630ed1b09d0853f2cfb148a5dd2693e5ab
patch_extractor
import torch from torch import nn class patch_extractor(nn.Module): """ Module for creating custom patch extractor """ def __init__(self, patch_size, pad=False, center=False, dim=2): super(patch_extractor, self).__init__() self.dim = dim self.im2pat = nn.Unfold(kernel_size=pat...
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...
johertrich/Wasserstein_Patch_Prior
patch_extractor
false
6,968
[ "MIT" ]
1
70877a6f1031e51b7868984b97027951d1d190d3
https://github.com/johertrich/Wasserstein_Patch_Prior/tree/70877a6f1031e51b7868984b97027951d1d190d3