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 |
|---|---|---|---|---|---|---|---|---|---|---|
MultiHeadAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadAttention(nn.Module):
def __init__(self, heads, d_model, dropout=0.1):
super().__init__()
self.d_model = d_model
self.d_k = d_model // heads
self.h = heads
self.q_linear = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CS-savvy/Transformer-for-Parkinsons-disease | MultiHeadAttention | false | 2,091 | [
"MIT"
] | 0 | 42ef54071092f4aab74c8b9ec82c52e944806a5b | https://github.com/CS-savvy/Transformer-for-Parkinsons-disease/tree/42ef54071092f4aab74c8b9ec82c52e944806a5b |
Conv2dDynamicSamePadding | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class Conv2dDynamicSamePadding(nn.Conv2d):
""" 2D Convolutions like TensorFlow, for a dynamic image size """
def __init__(self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.u... | BradleyBrown19/CustomObjectDetector | Conv2dDynamicSamePadding | false | 2,092 | [
"Apache-2.0"
] | 0 | 11c14ec6127c553ac365703c768b75dde33d9a4d | https://github.com/BradleyBrown19/CustomObjectDetector/tree/11c14ec6127c553ac365703c768b75dde33d9a4d |
WeightedCrossEntropyLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class WeightedCrossEntropyLoss(nn.Module):
"""
Transform input to fit the fomation of PyTorch offical cross entropy loss
with anchor-wise weighting.
"""
def __init__(self):
super(WeightedCrossEntropyLoss, self).__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | CSL-KU/OpenPCDet | WeightedCrossEntropyLoss | false | 2,093 | [
"Apache-2.0"
] | 0 | 2c5fca0da1521add4b40e6cdfe75d02d4285b83f | https://github.com/CSL-KU/OpenPCDet/tree/2c5fca0da1521add4b40e6cdfe75d02d4285b83f |
GHMR | import torch
import torch.nn as nn
class GHMR(nn.Module):
"""GHM Regression Loss.
Details of the theorem can be viewed in the paper
"Gradient Harmonized Single-stage Detector"
https://arxiv.org/abs/1811.05181
Args:
mu (float): The parameter for the Authentic Smooth L1 loss.
bins ... | 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... | CK-er/mmdet | GHMR | false | 2,094 | [
"Apache-2.0"
] | 0 | 9bea4068efbcf7bf739dbe41917a68d525c29868 | https://github.com/CK-er/mmdet/tree/9bea4068efbcf7bf739dbe41917a68d525c29868 |
Scale | import torch
import torch.nn as nn
class Scale(nn.Module):
def __init__(self, scale=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float))
def forward(self, x):
return x * self.scale
def get_inputs():
return [torch.rand([4, 4, 4, 4... | 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... | ChuchuHan/DMRNet | Scale | false | 2,095 | [
"MIT"
] | 0 | b933f364c56af148593d7a3b9967479c03aec398 | https://github.com/ChuchuHan/DMRNet/tree/b933f364c56af148593d7a3b9967479c03aec398 |
PSN | import torch
class PSN(torch.nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(PSN, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.output_size = output_size
self.fc = torch.nn.Linear(self.input_size, self.hidden_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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_cu... | Chay16/PortfolioOptimization | PSN | false | 2,096 | [
"Apache-2.0"
] | 0 | d8a6e7215d64038766beaf1c9325abc46ef05ffc | https://github.com/Chay16/PortfolioOptimization/tree/d8a6e7215d64038766beaf1c9325abc46ef05ffc |
FlowHead | import torch
import torch.nn as nn
class FlowHead(nn.Module):
def __init__(self, input_dim=128, hidden_dim=256, output_dim=2):
super(FlowHead, self).__init__()
self.conv1 = nn.Conv2d(input_dim, hidden_dim, 3, padding=1)
self.conv2 = nn.Conv2d(hidden_dim, output_dim, 3, padding=1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | BrianPugh/RAFT-Stereo | FlowHead | false | 2,097 | [
"MIT"
] | 0 | 494dd79545411eee56e32540bfd6f45a16c74a19 | https://github.com/BrianPugh/RAFT-Stereo/tree/494dd79545411eee56e32540bfd6f45a16c74a19 |
GramMatrix | import torch
import torch.nn as nn
class GramMatrix(nn.Module):
"""
Base Gram Matrix calculation as per Gatys et al. 2015
"""
def forward(self, input):
b, c, h, w = input.size()
F = input.view(b, c, h * w)
G = torch.bmm(F, F.transpose(1, 2))
G = G.div_(h * w)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ChuckHend/nst-zoo | GramMatrix | false | 2,098 | [
"MIT"
] | 0 | 130e485289c5a9417c3dc36980b87373f12f3697 | https://github.com/ChuckHend/nst-zoo/tree/130e485289c5a9417c3dc36980b87373f12f3697 |
NormalSampler | import torch
from torch import nn
class NormalSampler(nn.Module):
"""p(z)"""
def __init__(self):
super(NormalSampler, self).__init__()
self.register_buffer('eps', torch.tensor(1e-10))
def forward(self, mean, log_var):
epsilon = torch.randn(mean.size(), requires_grad=False, device... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
assert_size_stride = torch.... | ChengF-Lab/scGGN | NormalSampler | false | 2,099 | [
"MIT"
] | 0 | eab585219e6d3eb06c94057f0e3b276d1846e8b6 | https://github.com/ChengF-Lab/scGGN/tree/eab585219e6d3eb06c94057f0e3b276d1846e8b6 |
GlobalAvgPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class GlobalAvgPool2d(nn.Module):
def __init__(self):
super(GlobalAvgPool2d, self).__init__()
def forward(self, x):
N = x.data.size(0)
C = x.data.size(1)
H = x.data.size(2)
W = x.data.size(3)
x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | CoDaS-Lab/Contextual-Adversarial-Patches | GlobalAvgPool2d | false | 2,100 | [
"MIT"
] | 0 | ffbd897174fc381ba7c3ba1e6f827b84ccb30fd4 | https://github.com/CoDaS-Lab/Contextual-Adversarial-Patches/tree/ffbd897174fc381ba7c3ba1e6f827b84ccb30fd4 |
Attention | import torch
from torch import nn
import torch.optim
import torch.utils.data
class Attention(nn.Module):
"""
Attention Network.
"""
def __init__(self, encoder_dim, decoder_dim, attention_dim):
"""
:param encoder_dim: feature size of encoded images
:param decoder_dim: size of 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.... | CasperLindbergAtGithub/CaptionGeneration | Attention | false | 2,101 | [
"MIT"
] | 0 | a181d4e8db41e77cb2663ed10652f40f62bed482 | https://github.com/CasperLindbergAtGithub/CaptionGeneration/tree/a181d4e8db41e77cb2663ed10652f40f62bed482 |
Reorg | import torch
import torch.nn as nn
class Reorg(nn.Module):
def __init__(self, stride=2):
super(Reorg, self).__init__()
self.stride = stride
def forward(self, x):
stride = self.stride
assert x.data.dim() == 4
B = x.data.size(0)
C = x.data.size(1)
H = x.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | CoDaS-Lab/Contextual-Adversarial-Patches | Reorg | false | 2,102 | [
"MIT"
] | 0 | ffbd897174fc381ba7c3ba1e6f827b84ccb30fd4 | https://github.com/CoDaS-Lab/Contextual-Adversarial-Patches/tree/ffbd897174fc381ba7c3ba1e6f827b84ccb30fd4 |
ConvBlock | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
"""
Simple 3x3 conv with padding size 1 (to leave the input size unchanged), followed by a ReLU.
"""
def __init__(self, input_channels: 'int', output_channels: 'int',
kernel_size: 'Param2D'=3, stride: 'Param2D'=1, padding: 'Param2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | ChristianPoepselBE/fsdl-text-recognizer-2021-labs | ConvBlock | false | 2,103 | [
"MIT"
] | 0 | 161a9fa605f3fb955b1339e076248d317c881c47 | https://github.com/ChristianPoepselBE/fsdl-text-recognizer-2021-labs/tree/161a9fa605f3fb955b1339e076248d317c881c47 |
EncoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class FeedForward(nn.Module):
def __init__(self, d_model, d_ff=2048, dropout=0.1):
super().__init__()
self.linear_1 = nn.Linear(d_model, d_ff)
self.dropout = nn.Dropout(dropout)
self.linear_2 = nn.Linea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CS-savvy/Transformer-for-Parkinsons-disease | EncoderLayer | false | 2,104 | [
"MIT"
] | 0 | 42ef54071092f4aab74c8b9ec82c52e944806a5b | https://github.com/CS-savvy/Transformer-for-Parkinsons-disease/tree/42ef54071092f4aab74c8b9ec82c52e944806a5b |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim, 256)
self.l2 = nn.Linear(256, 256)
self.l3 = nn.Linear(256, action_dim)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ChristianLin0420/DeepRL | Actor | false | 2,105 | [
"MIT"
] | 0 | 143a9bfebd264229d9d26fcdc070065225774e04 | https://github.com/ChristianLin0420/DeepRL/tree/143a9bfebd264229d9d26fcdc070065225774e04 |
AlphaSlow | import torch
import torch.nn as nn
class AlphaSlow(nn.Module):
def __init__(self, n_in, n_out):
super(AlphaSlow, self).__init__()
self.fc1 = nn.Linear(n_in, 320, bias=True)
self.fc2 = nn.Linear(320, 160, bias=True)
self.fc3 = nn.Linear(160, 80, bias=True)
self.fc4 = nn.Lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CerberusLatrans/AlphaSlow | AlphaSlow | false | 2,106 | [
"MIT"
] | 0 | 6a65fabec2c87b85a8e496cb63f5cad9bc15cee0 | https://github.com/CerberusLatrans/AlphaSlow/tree/6a65fabec2c87b85a8e496cb63f5cad9bc15cee0 |
L2Norm | from torch.nn import Module
import torch
import torch.nn.functional as F
class L2Norm(Module):
def forward(self, input):
return F.normalize(input)
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._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
... | CodeLogist/Anti-Spoof_Face_recognitionV2 | L2Norm | false | 2,107 | [
"MIT"
] | 0 | ca2738f3d07442ffca92e76002ea24b26da39517 | https://github.com/CodeLogist/Anti-Spoof_Face_recognitionV2/tree/ca2738f3d07442ffca92e76002ea24b26da39517 |
PCA_layer | import torch
class PCA_layer(torch.nn.Module):
def __init__(self, n_pc=2):
"""
Compute u^T S u as the optimization problem of PCA.
Arguments:
p: original dataset feature dimension
n_pc: number of principal components or dimension of projected space,
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | CompTop/Interleaving-DR | PCA_layer | false | 2,108 | [
"MIT"
] | 0 | 479c190d9a9315038348cec115793258f067b1ca | https://github.com/CompTop/Interleaving-DR/tree/479c190d9a9315038348cec115793258f067b1ca |
PointerSwitch | import torch
import torch.nn as nn
class Linear(nn.Linear):
"""
Apply linear projection to the last dimention of a tensor.
"""
def forward(self, x):
size = x.size()
return super().forward(x.contiguous().view(-1, size[-1])).view(*
size[:-1], -1)
class ConcatAndProject(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | CrafterKolyan/TabularSemanticParsing | PointerSwitch | false | 2,109 | [
"BSD-3-Clause"
] | 0 | 2d75a3b71fa4c58f2c14ac43a33916747e8f4d1f | https://github.com/CrafterKolyan/TabularSemanticParsing/tree/2d75a3b71fa4c58f2c14ac43a33916747e8f4d1f |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 256)
self.l2 = nn.Linear(256, 256)
self.l3 = nn.Linear(256, 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 ... | ChristianLin0420/DeepRL | Critic | false | 2,110 | [
"MIT"
] | 0 | 143a9bfebd264229d9d26fcdc070065225774e04 | https://github.com/ChristianLin0420/DeepRL/tree/143a9bfebd264229d9d26fcdc070065225774e04 |
DepthwiseSeparableConv | import torch
import torch.cuda
from torch.nn import functional as F
from torch import nn
class DepthwiseSeparableConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, bias=True,
activation=F.relu):
super(DepthwiseSeparableConv, self).__init__()
self.depthwise_conv = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.cuda
from torch.... | CoyoteLeo/QANet-pytorch | DepthwiseSeparableConv | false | 2,111 | [
"MIT"
] | 0 | a2d5290915c91c4bc84db142e8ce50c47a7a37d0 | https://github.com/CoyoteLeo/QANet-pytorch/tree/a2d5290915c91c4bc84db142e8ce50c47a7a37d0 |
RegressionModel | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class RegressionModel(nn.Module):
def __init__(self, num_features_in, num_anchors=15, feature_size=256):
super(RegressionModel, self).__init__()
self.conv1 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | BradleyBrown19/CustomObjectDetector | RegressionModel | false | 2,112 | [
"Apache-2.0"
] | 0 | 11c14ec6127c553ac365703c768b75dde33d9a4d | https://github.com/BradleyBrown19/CustomObjectDetector/tree/11c14ec6127c553ac365703c768b75dde33d9a4d |
NormalizedGramMatrix | import torch
import torch.nn as nn
def normalize_by_stddev(tensor):
"""
divides channel-wise by standard deviation of channel
"""
channels = tensor.shape[1]
stddev = tensor.std(dim=(0, 2)).view(1, channels, 1) + 1e-15
return tensor.div(stddev)
class NormalizedGramMatrix(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 torch.nn as ... | ChuckHend/nst-zoo | NormalizedGramMatrix | false | 2,113 | [
"MIT"
] | 0 | 130e485289c5a9417c3dc36980b87373f12f3697 | https://github.com/ChuckHend/nst-zoo/tree/130e485289c5a9417c3dc36980b87373f12f3697 |
LinearNormalize | import torch
from torch import nn
class LinearNormalize(nn.Module):
def forward(self, x):
return (x - x.min()) / x.max()
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... | DSciLab/eye_datasets | LinearNormalize | false | 2,114 | [
"MIT"
] | 0 | 4733ce8a272fef37aa9a3dab779254ab010e97b5 | https://github.com/DSciLab/eye_datasets/tree/4733ce8a272fef37aa9a3dab779254ab010e97b5 |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MaxPoolStride1(nn.Module):
def __init__(self):
super(MaxPoolStride1, self).__init__()
def forward(self, x):
x = F.max_pool2d(F.pad(x, (0, 1, 0, 1), mode='replicate'), 2, stride=1)
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... | CoDaS-Lab/Contextual-Adversarial-Patches | MaxPoolStride1 | false | 2,115 | [
"MIT"
] | 0 | ffbd897174fc381ba7c3ba1e6f827b84ccb30fd4 | https://github.com/CoDaS-Lab/Contextual-Adversarial-Patches/tree/ffbd897174fc381ba7c3ba1e6f827b84ccb30fd4 |
PixelwiseNormalization | import torch
import torch.nn as nn
class PixelwiseNormalization(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
factor = ((x ** 2).mean(dim=1, keepdim=True) + 1e-08) ** 0.5
return x / factor
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | DannyDannyDanny/DeepPrivacy | PixelwiseNormalization | false | 2,116 | [
"MIT"
] | 0 | 749e260bdcc28a0c12d526f24e4f5315d1b447ad | https://github.com/DannyDannyDanny/DeepPrivacy/tree/749e260bdcc28a0c12d526f24e4f5315d1b447ad |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
self.smooth = 1.0
def forward(self, y_pred, y_true):
assert y_pred.size() == y_true.size()
y_pred = y_pred[:, 0].contiguous().view(-1)
y_true = y_true[:, ... | 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... | DRIP-AI-RESEARCH-JUNIOR/Medical_Unet_Dashboard | DiceLoss | false | 2,117 | [
"MIT"
] | 0 | 43b20e68ac6807b5e62771f3dcca3b9749c8c4c8 | https://github.com/DRIP-AI-RESEARCH-JUNIOR/Medical_Unet_Dashboard/tree/43b20e68ac6807b5e62771f3dcca3b9749c8c4c8 |
LogSoftmaxOutput | import torch
import torch.nn as nn
class Linear(nn.Linear):
"""
Apply linear projection to the last dimention of a tensor.
"""
def forward(self, x):
size = x.size()
return super().forward(x.contiguous().view(-1, size[-1])).view(*
size[:-1], -1)
class LogSoftmaxOutput(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.... | CrafterKolyan/TabularSemanticParsing | LogSoftmaxOutput | false | 2,118 | [
"BSD-3-Clause"
] | 0 | 2d75a3b71fa4c58f2c14ac43a33916747e8f4d1f | https://github.com/CrafterKolyan/TabularSemanticParsing/tree/2d75a3b71fa4c58f2c14ac43a33916747e8f4d1f |
OutputLayer | import torch
import torch.cuda
from torch import nn
def mask_logits(target, mask):
mask = mask.type(torch.float32)
return target + -1e+30 * (1 - mask)
class OutputLayer(nn.Module):
def __init__(self, hidden_size):
super(OutputLayer, self).__init__()
self.weight1 = torch.empty(hidden_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.cuda
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | CoyoteLeo/QANet-pytorch | OutputLayer | false | 2,119 | [
"MIT"
] | 0 | a2d5290915c91c4bc84db142e8ce50c47a7a37d0 | https://github.com/CoyoteLeo/QANet-pytorch/tree/a2d5290915c91c4bc84db142e8ce50c47a7a37d0 |
GlobalAttentionGeneral | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class GlobalAttentionGeneral(nn.Module):
def __init__(self, idf, cdf):
super(GlobalAttentionGeneral, self).__init__()
self.sm = nn.Softmax()
self.mask = None
def applyMask(self, mask):
self.ma... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Creling/DM-GAN | GlobalAttentionGeneral | false | 2,120 | [
"MIT"
] | 0 | ec2ce6d7fae4cf3ba2099b3db09926e544b2b759 | https://github.com/Creling/DM-GAN/tree/ec2ce6d7fae4cf3ba2099b3db09926e544b2b759 |
marginLoss | import torch
import torch.nn as nn
class marginLoss(nn.Module):
def __init__(self):
super(marginLoss, self).__init__()
def forward(self, pos, neg, margin):
val = pos - neg + margin
return torch.sum(torch.max(val, torch.zeros_like(val)))
def get_inputs():
return [torch.rand([4, ... | 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... | DSRnD/UMLs | marginLoss | false | 2,121 | [
"MIT"
] | 0 | a524bc45bc3f2dc8b4a90f73f69e23ee36ba8be9 | https://github.com/DSRnD/UMLs/tree/a524bc45bc3f2dc8b4a90f73f69e23ee36ba8be9 |
GCN | from torch.nn import Module
import math
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class GraphConvolution(Module):
def __init__(self, in_features, out_features, bias=True):
super(GraphConvolution, self).__init__()
self.in_features = in_feature... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | CaiYufan-sjtu/GCNOIE | GCN | false | 2,122 | [
"MIT"
] | 0 | c84afca5b66d75c7108b2719241e2907700b4111 | https://github.com/CaiYufan-sjtu/GCNOIE/tree/c84afca5b66d75c7108b2719241e2907700b4111 |
MinibatchStdLayer | import torch
import torch.nn as nn
class MinibatchStdLayer(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, group_size=4):
group_size = min(group_size, x.shape[0])
_channels, height, width = x.shape[1:]
y = x.view(group_size, -1, *x.shape[1:])
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.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | DannyDannyDanny/DeepPrivacy | MinibatchStdLayer | false | 2,123 | [
"MIT"
] | 0 | 749e260bdcc28a0c12d526f24e4f5315d1b447ad | https://github.com/DannyDannyDanny/DeepPrivacy/tree/749e260bdcc28a0c12d526f24e4f5315d1b447ad |
MLP_Attention | import torch
import torch.nn as nn
import torch.nn.init as init
class MLP_Attention(nn.Module):
def __init__(self, input_size, hidden_size):
super(MLP_Attention, self).__init__()
self.linear_X = nn.Linear(input_size, hidden_size, bias=True)
self.linear_ref = nn.Linear(input_size, hidden_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.... | Coldog2333/DGMN-pytorch | MLP_Attention | false | 2,124 | [
"Apache-2.0"
] | 0 | c34248afca516625c2ac2fc6d6f4ce8fe2988c99 | https://github.com/Coldog2333/DGMN-pytorch/tree/c34248afca516625c2ac2fc6d6f4ce8fe2988c99 |
DiceLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim as optim
def flatten(tensor):
"""Flattens a given tensor such that the channel axis is first.
The shapes are transformed as follows:
(N, C, D, H, W) -> (C, N * D * H * W)
"""
C = tensor.size(1)
axis_o... | 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
... | DarkoBomer/VCANet | DiceLoss | false | 2,125 | [
"MIT"
] | 0 | 1c76deb195a2dcb8aa4b40856d49eb6796de12bc | https://github.com/DarkoBomer/VCANet/tree/1c76deb195a2dcb8aa4b40856d49eb6796de12bc |
GlobalAttention_text | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class GlobalAttention_text(nn.Module):
def __init__(self, idf, cdf):
super(GlobalAttention_text, self).__init__()
self.conv_context = nn.Conv1d(cdf, idf, kernel_size=1, stride=1,
padding=0)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Creling/DM-GAN | GlobalAttention_text | false | 2,126 | [
"MIT"
] | 0 | ec2ce6d7fae4cf3ba2099b3db09926e544b2b759 | https://github.com/Creling/DM-GAN/tree/ec2ce6d7fae4cf3ba2099b3db09926e544b2b759 |
ClassificationModel | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class ClassificationModel(nn.Module):
def __init__(self, num_features_in, num_anchors=15, num_classes=80,
prior=0.01, feature_size=256):
super(ClassificationM... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | BradleyBrown19/CustomObjectDetector | ClassificationModel | false | 2,127 | [
"Apache-2.0"
] | 0 | 11c14ec6127c553ac365703c768b75dde33d9a4d | https://github.com/BradleyBrown19/CustomObjectDetector/tree/11c14ec6127c553ac365703c768b75dde33d9a4d |
EMLLoss | import torch
import torch.nn as nn
from torch import optim as optim
class EMLLoss(nn.Module):
def __init__(self):
super(EMLLoss, self).__init__()
def forward(self, y_pred, y_true):
gamma = 1.1
alpha = 0.48
smooth = 1.0
epsilon = 1e-07
y_true = y_true.view(-1)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | DarkoBomer/VCANet | EMLLoss | false | 2,128 | [
"MIT"
] | 0 | 1c76deb195a2dcb8aa4b40856d49eb6796de12bc | https://github.com/DarkoBomer/VCANet/tree/1c76deb195a2dcb8aa4b40856d49eb6796de12bc |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(LayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | CaptainJa/demo-torch-gpt2 | LayerNorm | false | 2,129 | [
"MIT"
] | 0 | 83d6074e8b321101e08c0aa5749c8eb988a5faa8 | https://github.com/CaptainJa/demo-torch-gpt2/tree/83d6074e8b321101e08c0aa5749c8eb988a5faa8 |
ScoreLayer | import torch
from torch import nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class ScoreLayer(nn.Module):
def __init__(self, k):
super(ScoreLayer, self).__init__()
self.score = nn.Conv2d(k, 1, 1, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.ut... | Dcasadoherraez/siamese-tracking | ScoreLayer | false | 2,130 | [
"MIT"
] | 0 | ce3a2ee32fbe3e4a84a8352be22f929a8512dd25 | https://github.com/Dcasadoherraez/siamese-tracking/tree/ce3a2ee32fbe3e4a84a8352be22f929a8512dd25 |
VectorQuantizer | import torch
from torch import Tensor
from torch import nn
from torch.nn import functional as F
class VectorQuantizer(nn.Module):
"""
Reference:
[1] https://github.com/deepmind/sonnet/blob/v2/sonnet/src/nets/vqvae.py
"""
def __init__(self, num_embeddings: 'int', embedding_dim: 'int', beta:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | ClaartjeBarkhof/PyTorch-VAE | VectorQuantizer | false | 2,131 | [
"Apache-2.0"
] | 0 | a1ac49015c306b1cfc0d4d797669b17044f0a1eb | https://github.com/ClaartjeBarkhof/PyTorch-VAE/tree/a1ac49015c306b1cfc0d4d797669b17044f0a1eb |
DeepHeadModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class DeepHeadModule(nn.Module):
def __init__(self, input_channels, output_channels):
super(DeepHeadModule, self).__init__()
self._input_channels = input_channels
self._output_channels = output_channels
self._mid_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_... | DannyDannyDanny/DeepPrivacy | DeepHeadModule | false | 2,132 | [
"MIT"
] | 0 | 749e260bdcc28a0c12d526f24e4f5315d1b447ad | https://github.com/DannyDannyDanny/DeepPrivacy/tree/749e260bdcc28a0c12d526f24e4f5315d1b447ad |
SelfAttentionLayer | import torch
import numpy as np
import torch.nn as nn
class SelfAttentionLayer(nn.Module):
def __init__(self, d_x, d_k, d_v):
super().__init__()
self.d_x = d_x
self.d_k = d_k
self.d_v = d_v
self.w_q = nn.Linear(d_x, d_k)
self.w_k = nn.Linear(d_x, d_k)
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Darg-Iztech/quote-detection | SelfAttentionLayer | false | 2,133 | [
"MIT"
] | 0 | 14a4731139db859f9672f54400d78d77cca8a008 | https://github.com/Darg-Iztech/quote-detection/tree/14a4731139db859f9672f54400d78d77cca8a008 |
AFTSimple | import torch
from torch import nn
class AFTSimple(nn.Module):
def __init__(self, max_seqlen, dim, hidden_dim=64):
super().__init__()
"""
max_seqlen: the maximum number of timesteps (sequence length) to be fed in
dim: the embedding dimension of the tokens
hidden_dim: the hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Datta0/aft-pytorch | AFTSimple | false | 2,134 | [
"MIT"
] | 0 | a0ebad01ea6616b00bde319b0c5e63bea467c400 | https://github.com/Datta0/aft-pytorch/tree/a0ebad01ea6616b00bde319b0c5e63bea467c400 |
AsymmetricLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class AsymmetricLoss(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_focal_loss=False):
super(AsymmetricLoss... | 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... | ChangeTheWorld20191008/query2labels | AsymmetricLoss | false | 2,135 | [
"MIT"
] | 0 | cdca1f3519f75cc91ef2aa166c2534691016f04f | https://github.com/ChangeTheWorld20191008/query2labels/tree/cdca1f3519f75cc91ef2aa166c2534691016f04f |
FiLM | import torch
import torch.nn as nn
class FiLM(nn.Module):
""" Feature-wise Linear Modulation (FiLM) layer"""
def __init__(self, input_size, output_size, num_film_layers=1,
layer_norm=False):
"""
:param input_size: feature size of x_cond
:param output_size: feature size of x_to... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Daupler/CA-MTL | FiLM | false | 2,136 | [
"MIT"
] | 0 | d417b039dee973e32f42ba5c1c346738cd29ab3c | https://github.com/Daupler/CA-MTL/tree/d417b039dee973e32f42ba5c1c346738cd29ab3c |
AFTFull | import torch
from torch import nn
class AFTFull(nn.Module):
def __init__(self, max_seqlen, dim, hidden_dim=64):
super().__init__()
"""
max_seqlen: the maximum number of timesteps (sequence length) to be fed in
dim: the embedding dimension of the tokens
hidden_dim: the hidd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch im... | Datta0/aft-pytorch | AFTFull | false | 2,138 | [
"MIT"
] | 0 | a0ebad01ea6616b00bde319b0c5e63bea467c400 | https://github.com/Datta0/aft-pytorch/tree/a0ebad01ea6616b00bde319b0c5e63bea467c400 |
GroupWiseLinear | import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class GroupWiseLinear(nn.Module):
def __init__(self, num_class, hidden_dim, bias=True):
super().__init__()
self.num_class = num_class
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
import math
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
as... | ChangeTheWorld20191008/query2labels | GroupWiseLinear | false | 2,139 | [
"MIT"
] | 0 | cdca1f3519f75cc91ef2aa166c2534691016f04f | https://github.com/ChangeTheWorld20191008/query2labels/tree/cdca1f3519f75cc91ef2aa166c2534691016f04f |
ConcatSquashLinear | import torch
import torch.nn as nn
class ConcatSquashLinear(nn.Module):
def __init__(self, dim_in, dim_out):
super(ConcatSquashLinear, self).__init__()
self._layer = nn.Linear(dim_in, dim_out)
self._hyper_bias = nn.Linear(1, dim_out, bias=False)
self._hyper_gate = nn.Linear(1, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | D-hash-code/ffjord-rnode-finalweek-mnist | ConcatSquashLinear | false | 2,140 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
GatedConvTranspose | import torch
import torch.nn as nn
class GatedConvTranspose(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, output_padding=0, groups=1):
super(GatedConvTranspose, self).__init__()
self.layer_f = nn.ConvTranspose2d(in_channels, out_channels,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | D-hash-code/ffjord-rnode-finalweek-mnist | GatedConvTranspose | false | 2,141 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
SpaceToDepth | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class SpaceToDepth(nn.Module):
def __init__(self, block_size=4):
super().__init__()
assert block_size == 4
self.bs = block_size
def forward(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
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
assert_size_st... | ChangeTheWorld20191008/query2labels | SpaceToDepth | false | 2,142 | [
"MIT"
] | 0 | cdca1f3519f75cc91ef2aa166c2534691016f04f | https://github.com/ChangeTheWorld20191008/query2labels/tree/cdca1f3519f75cc91ef2aa166c2534691016f04f |
BlendLinear | import torch
import torch.nn as nn
class BlendLinear(nn.Module):
def __init__(self, dim_in, dim_out, layer_type=nn.Linear, **unused_kwargs):
super(BlendLinear, self).__init__()
self._layer0 = layer_type(dim_in, dim_out)
self._layer1 = layer_type(dim_in, dim_out)
def forward(self, t, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | D-hash-code/ffjord-rnode-finalweek-mnist | BlendLinear | false | 2,143 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
AsymmetricLossOptimized | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class AsymmetricLossOptimized(nn.Module):
""" Notice - optimized version, minimizes memory allocation and gpu uploading,
favors inplace operations"""
def __init__(sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | ChangeTheWorld20191008/query2labels | AsymmetricLossOptimized | false | 2,144 | [
"MIT"
] | 0 | cdca1f3519f75cc91ef2aa166c2534691016f04f | https://github.com/ChangeTheWorld20191008/query2labels/tree/cdca1f3519f75cc91ef2aa166c2534691016f04f |
SEModule | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class FastAvgPool2d(nn.Module):
def __init__(self, flatten=False):
super(FastAvgPool2d, self).__init__()
self.flatten = flatten
def forward(self, 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
import ... | ChangeTheWorld20191008/query2labels | SEModule | false | 2,145 | [
"MIT"
] | 0 | cdca1f3519f75cc91ef2aa166c2534691016f04f | https://github.com/ChangeTheWorld20191008/query2labels/tree/cdca1f3519f75cc91ef2aa166c2534691016f04f |
BasicBlock | import torch
import torch.nn as nn
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, dim):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1, bias=False)
self.bn1 = nn.GroupNorm(2, dim, eps=0.0001)
self.relu = nn.ReLU(inpl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | D-hash-code/ffjord-rnode-finalweek-mnist | BasicBlock | false | 2,146 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
Net | import torch
import torch.nn as nn
import torch.utils.data
class Net(nn.Module):
def __init__(self, input_size, hidden_size, num_out):
super(Net, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.sigmoid = nn.Sigmoid()
self.fc2 = nn.Linear(hidden_size, num_out)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | DerekGloudemans/3D-detector-trials | Net | false | 2,147 | [
"MIT"
] | 0 | 480274567eaa84c5c883260ef62f150c7a23ffd3 | https://github.com/DerekGloudemans/3D-detector-trials/tree/480274567eaa84c5c883260ef62f150c7a23ffd3 |
GatedConv | import torch
import torch.nn as nn
class GatedConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1):
super(GatedConv, self).__init__()
self.layer_f = nn.Conv2d(in_channels, out_channels, kernel_size,
stride=stride, padding=p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | D-hash-code/ffjord-rnode-finalweek-mnist | GatedConv | false | 2,148 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
HyperConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1 or classname.find('Conv') != -1:
nn.init.constant_(m.weight, 0)
nn.init.normal_(m.bias, 0, 0.01)
class HyperConv2d(nn.Module):
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
import torch.nn.functional as F
assert_size_stride = torch... | D-hash-code/ffjord-rnode-finalweek-mnist | HyperConv2d | false | 2,149 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
BlendConv2d | import torch
import torch.nn as nn
class BlendConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False, **unused_kwargs):
super(BlendConv2d, self).__init__()
module = nn.ConvTranspose2d if transpose else nn.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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | D-hash-code/ffjord-rnode-finalweek-mnist | BlendConv2d | false | 2,150 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
GatedLinear | import torch
import torch.nn as nn
class GatedLinear(nn.Module):
def __init__(self, in_features, out_features):
super(GatedLinear, self).__init__()
self.layer_f = nn.Linear(in_features, out_features)
self.layer_g = nn.Linear(in_features, out_features)
def forward(self, x):
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... | D-hash-code/ffjord-rnode-finalweek-mnist | GatedLinear | false | 2,151 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLayer, self).__init__(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CxzPink/polyGAT | GAT | false | 2,153 | [
"MIT"
] | 0 | 95ee1414dd721567f321a7a6271ce518964688ac | https://github.com/CxzPink/polyGAT/tree/95ee1414dd721567f321a7a6271ce518964688ac |
Highway | import torch
from torch import nn
import torch.nn.functional as F
class Highway(nn.Module):
def __init__(self, size):
super(Highway, self).__init__()
self.one = nn.Linear(size, size)
self.two = nn.Linear(size, size)
def forward(self, x):
x0 = F.relu(self.one(x))
x1 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | DennisMagnusson/voice2voice | Highway | false | 2,154 | [
"MIT"
] | 0 | cee95b3eda8c2159f6b85e1733652ff8b7a537ce | https://github.com/DennisMagnusson/voice2voice/tree/cee95b3eda8c2159f6b85e1733652ff8b7a537ce |
ConcatSquashConv2d | import torch
import torch.nn as nn
class ConcatSquashConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False):
super(ConcatSquashConv2d, self).__init__()
module = nn.ConvTranspose2d if transpose else nn.Conv2d
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | D-hash-code/ffjord-rnode-finalweek-mnist | ConcatSquashConv2d | false | 2,155 | [
"MIT"
] | 0 | 4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 | https://github.com/D-hash-code/ffjord-rnode-finalweek-mnist/tree/4cabcbadda79c68df53ec25f1f8fe03cfeee78f9 |
TripletLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class TripletLoss(nn.Module):
def __init__(self, device, margin):
super(TripletLoss, self).__init__()
self.margin = margin
self.device = device
self.loss = nn.TripletMarginLoss(margin)
def forward(self, anchor... | 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
import... | Devanshu-singh-VR/FaceRecognition | TripletLoss | false | 2,156 | [
"MIT"
] | 0 | f596d1964f4f43174ffe5bac6d6437a7d22c3593 | https://github.com/Devanshu-singh-VR/FaceRecognition/tree/f596d1964f4f43174ffe5bac6d6437a7d22c3593 |
ConLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConLoss(nn.Module):
def __init__(self, device, margin=2):
super(ConLoss, self).__init__()
self.margin = margin
self.device = device
def forward(self, output1, output2, label):
diff = F.pairwise_distance(... | 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
import... | Devanshu-singh-VR/FaceRecognition | ConLoss | false | 2,157 | [
"MIT"
] | 0 | f596d1964f4f43174ffe5bac6d6437a7d22c3593 | https://github.com/Devanshu-singh-VR/FaceRecognition/tree/f596d1964f4f43174ffe5bac6d6437a7d22c3593 |
CNN | import torch
import torch.nn as nn
class CNN(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(in_channels=1, out_channels=32, kernel_size=
3, padding=1)
self.conv2 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size
=3, padding=1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | DavidCarlyn/cnn_visualize | CNN | false | 2,158 | [
"MIT"
] | 0 | 6b4e554e1a6ac3b4951f0e914e0414cfa8bd3686 | https://github.com/DavidCarlyn/cnn_visualize/tree/6b4e554e1a6ac3b4951f0e914e0414cfa8bd3686 |
MyLoss | import torch
from torch import nn
import torch.utils.data
class MyLoss(nn.Module):
def __init__(self):
super(MyLoss, self).__init__()
def forward(self, pred, truth):
return torch.sum((pred - truth) ** 2)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
de... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards... | Dora-The-Kid/culture_network | MyLoss | false | 2,159 | [
"Apache-2.0"
] | 0 | bc2bac86e821faa797eeb2670d179395724f7922 | https://github.com/Dora-The-Kid/culture_network/tree/bc2bac86e821faa797eeb2670d179395724f7922 |
ConvNorm | import torch
class ConvNorm(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=None, dilation=1, bias=True, w_init_gain='linear'):
super(ConvNorm, self).__init__()
if padding is None:
assert kernel_size % 2 == 1
padding... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
reinterpret_tens... | Dannynis/NeMo | ConvNorm | false | 2,160 | [
"Apache-2.0"
] | 0 | 0d703d2c48158ec271d84cca76c3f423195327b2 | https://github.com/Dannynis/NeMo/tree/0d703d2c48158ec271d84cca76c3f423195327b2 |
Generator | import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
class Generator(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(Generator, self).__init__()
self.map1 = nn.Linear(input_size, hidden_size)
self.map2 = nn.Linear(hidde... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Dora-The-Kid/culture_network | Generator | false | 2,161 | [
"Apache-2.0"
] | 0 | bc2bac86e821faa797eeb2670d179395724f7922 | https://github.com/Dora-The-Kid/culture_network/tree/bc2bac86e821faa797eeb2670d179395724f7922 |
IOU | import torch
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
IoU1 = Iand1 / Ior1
IoU... | 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... | DoJing/BASNet | IOU | false | 2,162 | [
"MIT"
] | 0 | 46bd3462326e6c7a02c90273c15da6fa71cec0e2 | https://github.com/DoJing/BASNet/tree/46bd3462326e6c7a02c90273c15da6fa71cec0e2 |
Max2d | import torch
import torch as T
class Max2d(T.nn.Module):
def forward(self, x):
return x.view(*x.shape[:-2], -1).max(-1)[0]
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch as T
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_s... | DouglasOrr/Snippets | Max2d | false | 2,163 | [
"MIT"
] | 0 | 026e15a422b518ee7d9ce4849f971c4403ad9fe8 | https://github.com/DouglasOrr/Snippets/tree/026e15a422b518ee7d9ce4849f971c4403ad9fe8 |
Avg2d | import torch
import torch as T
class Avg2d(T.nn.Module):
def forward(self, x):
return x.mean((-2, -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
import torch as T
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_stride... | DouglasOrr/Snippets | Avg2d | false | 2,164 | [
"MIT"
] | 0 | 026e15a422b518ee7d9ce4849f971c4403ad9fe8 | https://github.com/DouglasOrr/Snippets/tree/026e15a422b518ee7d9ce4849f971c4403ad9fe8 |
LocationLayer | import torch
import torch.nn as nn
class LinearNorm(torch.nn.Module):
def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
super(LinearNorm, self).__init__()
self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias)
torch.nn.init.xavier_uniform_(self.linear_layer.we... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Dannynis/NeMo | LocationLayer | false | 2,165 | [
"Apache-2.0"
] | 0 | 0d703d2c48158ec271d84cca76c3f423195327b2 | https://github.com/Dannynis/NeMo/tree/0d703d2c48158ec271d84cca76c3f423195327b2 |
Conv2d | from torch.nn import Module
import math
import torch
from torch.nn import functional as F
import torch.utils.data
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
from torch.nn.modules.utils import _pair
def conv2d_same_padding(input, weight, bias=None, stride=[1], padding=1,
dilation=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import math
from torch.nn import functional as F
imp... | Dora-The-Kid/culture_network | Conv2d | false | 2,166 | [
"Apache-2.0"
] | 0 | bc2bac86e821faa797eeb2670d179395724f7922 | https://github.com/Dora-The-Kid/culture_network/tree/bc2bac86e821faa797eeb2670d179395724f7922 |
FEM | import torch
import torch.nn as nn
import torch.nn.functional as F
class FEM(nn.Module):
def __init__(self, channel_size):
super(FEM, self).__init__()
self.cs = channel_size
self.cpm1 = nn.Conv2d(self.cs, 256, kernel_size=3, dilation=1,
stride=1, padding=1)
self.cpm2 =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | DannyDannyDanny/DeepPrivacy | FEM | false | 2,167 | [
"MIT"
] | 0 | 749e260bdcc28a0c12d526f24e4f5315d1b447ad | https://github.com/DannyDannyDanny/DeepPrivacy/tree/749e260bdcc28a0c12d526f24e4f5315d1b447ad |
Conv1d | import torch
import numpy as np
from torch import nn
import torch.utils.data
class Conv1d(nn.Module):
"""
inputs: tensor of shape (batch size, num channels, height, width)
returns: tensor of shape (batch size, num channels, height, width)
"""
def __init__(self, in_channels, out_channel, kernal_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 numpy as np
from torch import nn
import torch.utils.data
assert_size_stri... | Dora-The-Kid/culture_network | Conv1d | false | 2,168 | [
"Apache-2.0"
] | 0 | bc2bac86e821faa797eeb2670d179395724f7922 | https://github.com/Dora-The-Kid/culture_network/tree/bc2bac86e821faa797eeb2670d179395724f7922 |
RegressionModel | import torch
import torch.nn as nn
import torch.utils.data
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)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | DerekGloudemans/3D-detector-trials | RegressionModel | false | 2,169 | [
"MIT"
] | 0 | 480274567eaa84c5c883260ef62f150c7a23ffd3 | https://github.com/DerekGloudemans/3D-detector-trials/tree/480274567eaa84c5c883260ef62f150c7a23ffd3 |
ResnetBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
def actvn(x):
out = F.leaky_relu(x, 0.2)
return out
class ResnetBlock(nn.Module):
def __init__(self, fin, fout, fhidden=None, is_bias=True):
super().__init__()
self.is_bias = is_bias
self.learned_shortcut = fin !... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | DrLSimon/precision-recall-distributions-icml19 | ResnetBlock | false | 2,170 | [
"Apache-2.0"
] | 0 | 364188eaa26ac1bf39ebf038136c79aeee97da3a | https://github.com/DrLSimon/precision-recall-distributions-icml19/tree/364188eaa26ac1bf39ebf038136c79aeee97da3a |
InnerProductNetwork | import torch
import torch.utils.data
class InnerProductNetwork(torch.nn.Module):
def forward(self, x):
"""
:param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
"""
num_fields = x.shape[1]
row, col = list(), list()
for i in range(num_fields - 1):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | Drone-Banks/pytorch-fm | InnerProductNetwork | false | 2,171 | [
"MIT"
] | 0 | 3e41b4fe1dfcd9e768af02b6a8365fe46de2df78 | https://github.com/Drone-Banks/pytorch-fm/tree/3e41b4fe1dfcd9e768af02b6a8365fe46de2df78 |
ConvTranspose | import torch
import torch.nn as nn
class ConvTranspose(nn.Module):
"""Convolution Module with transposes of last two dimensions."""
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1,
padding=0, dilation=1, bias=True, w_init='relu'):
super(ConvTranspose, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Dannynis/NeMo | ConvTranspose | false | 2,172 | [
"Apache-2.0"
] | 0 | 0d703d2c48158ec271d84cca76c3f423195327b2 | https://github.com/Dannynis/NeMo/tree/0d703d2c48158ec271d84cca76c3f423195327b2 |
h_sigmoid | import torch
import torch.nn as nn
class h_sigmoid(nn.Module):
def __init__(self, inplace=True):
super(h_sigmoid, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
def forward(self, x):
return self.relu(x + 3) / 6
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def g... | 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... | EileenWang90/mmpose | h_sigmoid | false | 2,173 | [
"Apache-2.0"
] | 0 | 3fa1328a3b6351bf9b35df60d4d959973a6f8a71 | https://github.com/EileenWang90/mmpose/tree/3fa1328a3b6351bf9b35df60d4d959973a6f8a71 |
TransformerBasicHead | import torch
from itertools import chain as chain
import torch.utils.data
import torch.nn as nn
class TransformerBasicHead(nn.Module):
"""
BasicHead. No pool.
"""
def __init__(self, dim_in, num_classes, dropout_rate=0.0, act_func=
'softmax'):
"""
Perform linear projection and ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Drill-D/SlowFast | TransformerBasicHead | false | 2,174 | [
"Apache-2.0"
] | 0 | d55ae1cf30a9415858a9bd5da983790a2b418653 | https://github.com/Drill-D/SlowFast/tree/d55ae1cf30a9415858a9bd5da983790a2b418653 |
h_swish | import torch
import torch.nn as nn
class h_sigmoid(nn.Module):
def __init__(self, inplace=True):
super(h_sigmoid, self).__init__()
self.relu = nn.ReLU6(inplace=inplace)
def forward(self, x):
return self.relu(x + 3) / 6
class h_swish(nn.Module):
def __init__(self, inplace=True)... | 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... | EileenWang90/mmpose | h_swish | false | 2,175 | [
"Apache-2.0"
] | 0 | 3fa1328a3b6351bf9b35df60d4d959973a6f8a71 | https://github.com/EileenWang90/mmpose/tree/3fa1328a3b6351bf9b35df60d4d959973a6f8a71 |
LeNet300 | import torch
from torch import nn
class LeNet300(nn.Module):
def __init__(self):
super(LeNet300, self).__init__()
self.fc1 = nn.Linear(784, 300, bias=True)
self.r1 = nn.ReLU()
self.fc2 = nn.Linear(300, 100, bias=True)
self.r2 = nn.ReLU()
self.fc3 = nn.Linear(100, 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 import nn
assert_s... | EIDOSlab/pruning-validation | LeNet300 | false | 2,176 | [
"BSD-3-Clause"
] | 0 | bd8e83cf6f564def0e193a4be0f753c768fe9e75 | https://github.com/EIDOSlab/pruning-validation/tree/bd8e83cf6f564def0e193a4be0f753c768fe9e75 |
TreeLSTM | import torch
import torch.nn as nn
class TreeLSTM(nn.Module):
"""
Implementation of the Tree-LSTM model:
https://arxiv.org/pdf/1503.00075.pdf
"""
def __init__(self, num_units):
super(TreeLSTM, self).__init__()
self.left = nn.Linear(num_units, 5 * num_units)
self.right = 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.triton_helpers import libdevice
import torch.nn as ... | Devin-Taylor/pytorch-dynamic-batching-benchmark | TreeLSTM | false | 2,177 | [
"Apache-2.0"
] | 0 | aaf913b13a77a2898dfdf8d92cd25b01789a548a | https://github.com/Devin-Taylor/pytorch-dynamic-batching-benchmark/tree/aaf913b13a77a2898dfdf8d92cd25b01789a548a |
SequenceBias | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
from torch.nn.parameter import Parameter
class SequenceBias(nn.Module):
"""
Adds one bias element to the end of the sequence.
so if the input has a shape ``(L, N, E)``, where
``L`` 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
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
from torch.nn.parameter import Pa... | EXAPPAI/opacus | SequenceBias | false | 2,178 | [
"Apache-2.0"
] | 0 | 11e188a2f03a8a08be51fdf2367cc1387879312a | https://github.com/EXAPPAI/opacus/tree/11e188a2f03a8a08be51fdf2367cc1387879312a |
SE | import torch
from itertools import chain as chain
import torch.utils.data
import torch.nn as nn
class SwishEfficient(torch.autograd.Function):
"""Swish activation function: x * sigmoid(x)."""
@staticmethod
def forward(ctx, x):
result = x * torch.sigmoid(x)
ctx.save_for_backward(x)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from itertools import chain a... | Drill-D/SlowFast | SE | false | 2,180 | [
"Apache-2.0"
] | 0 | d55ae1cf30a9415858a9bd5da983790a2b418653 | https://github.com/Drill-D/SlowFast/tree/d55ae1cf30a9415858a9bd5da983790a2b418653 |
Discriminator | import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
class Discriminator(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(Discriminator, self).__init__()
self.map1 = nn.Linear(input_size, hidden_size)
self.map2 = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Dora-The-Kid/culture_network | Discriminator | false | 2,182 | [
"Apache-2.0"
] | 0 | bc2bac86e821faa797eeb2670d179395724f7922 | https://github.com/Dora-The-Kid/culture_network/tree/bc2bac86e821faa797eeb2670d179395724f7922 |
AbsoluteRelativeErrorLoss | import torch
from torch import nn
class AbsoluteRelativeErrorLoss(nn.Module):
def __init__(self, epsilon=0.0001):
super().__init__()
self.epsilon = epsilon
def forward(self, pred, target):
error = (pred - target) / (target + self.epsilon)
return torch.abs(error)
def get_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
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_... | ElectronicElephant/openpilot-reimplementation | AbsoluteRelativeErrorLoss | false | 2,183 | [
"MIT"
] | 0 | 063a9f5c6bbbf02c03dadc59e236e8f7c253a350 | https://github.com/ElectronicElephant/openpilot-reimplementation/tree/063a9f5c6bbbf02c03dadc59e236e8f7c253a350 |
MultiLayerPerceptron | import torch
import torch.nn as nn
class MultiLayerPerceptron(nn.Module):
"""
A simple MLP that can either be used independently or put on top
of pretrained models (such as BERT) and act as a classifier.
Args:
hidden_size (int): the size of each layer
num_classes (int): number of outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Dannynis/NeMo | MultiLayerPerceptron | false | 2,184 | [
"Apache-2.0"
] | 0 | 0d703d2c48158ec271d84cca76c3f423195327b2 | https://github.com/Dannynis/NeMo/tree/0d703d2c48158ec271d84cca76c3f423195327b2 |
SqueezeExcite | import torch
import torch.nn as nn
import torch.nn.functional as F
def _make_divisible(v, divisor, min_value=None):
"""
This function is taken from the original tf repo.
It ensures that all layers have a channel number that is divisible by 8
It can be seen here:
https://github.com/tensorflow/model... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | EileenWang90/mmpose | SqueezeExcite | false | 2,185 | [
"Apache-2.0"
] | 0 | 3fa1328a3b6351bf9b35df60d4d959973a6f8a71 | https://github.com/EileenWang90/mmpose/tree/3fa1328a3b6351bf9b35df60d4d959973a6f8a71 |
ClassificationModel | import torch
import torch.nn as nn
import torch.utils.data
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_an... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | DerekGloudemans/3D-detector-trials | ClassificationModel | false | 2,186 | [
"MIT"
] | 0 | 480274567eaa84c5c883260ef62f150c7a23ffd3 | https://github.com/DerekGloudemans/3D-detector-trials/tree/480274567eaa84c5c883260ef62f150c7a23ffd3 |
PA | import torch
from torch import nn
class PA(nn.Module):
def __init__(self, dim):
super().__init__()
self.pa_conv = nn.Conv2d(dim, dim, 3, 1, 1, groups=dim)
def forward(self, x):
return x * self.pa_conv(x).sigmoid()
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | EmanuelNk/semantic-segmentation | PA | false | 2,187 | [
"MIT"
] | 0 | 20ff16da49691fb407724909d9c7e84b47e2fee0 | https://github.com/EmanuelNk/semantic-segmentation/tree/20ff16da49691fb407724909d9c7e84b47e2fee0 |
BasicBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
"""
BasicBlock implementation for ResNet
reference: https://github.com/kuangliu/pytorch-cifar/blob/master/models/resnet.py
"""
expansion = 1
def __init__(self, device, in_planes, planes, strid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | EgonFerri/Final_project_Aml_ARC | BasicBlock | false | 2,188 | [
"MIT"
] | 0 | d5290a0bfef5e1aa0feb5988cdfe6de704180485 | https://github.com/EgonFerri/Final_project_Aml_ARC/tree/d5290a0bfef5e1aa0feb5988cdfe6de704180485 |
Attention | import torch
class Attention(torch.nn.Module):
"""
attention_size_1: Number of neurons in 1st attention layer.
attention_size_2: Number of neurons in 2nd attention layer.
"""
def __init__(self, attention_size_1, attention_size_2):
super(Attention, self).__init__()
self.att... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | EgemenGuray/Subgraph-Classifier | Attention | false | 2,189 | [
"MIT"
] | 0 | b85d28c521701f41dcd698aed40d4c80d454e893 | https://github.com/EgemenGuray/Subgraph-Classifier/tree/b85d28c521701f41dcd698aed40d4c80d454e893 |
NonLocalEncoder | import torch
from torch import Tensor
from torch import nn
import torch.utils.data
from typing import Optional
from abc import ABCMeta
class _NonLocalNd(nn.Module, metaclass=ABCMeta):
"""Basic Non-local module.
This module is proposed in
"Non-local Neural Networks"
Paper reference: https://arxiv.org/... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Dwrety/detr | NonLocalEncoder | false | 2,190 | [
"Apache-2.0"
] | 0 | b369c4c12354f18e9e66d56fcfda6fc058d6d593 | https://github.com/Dwrety/detr/tree/b369c4c12354f18e9e66d56fcfda6fc058d6d593 |
Envelope | import torch
import torch.utils.data
class Envelope(torch.nn.Module):
def __init__(self, exponent):
super(Envelope, self).__init__()
self.p = exponent + 1
self.a = -(self.p + 1) * (self.p + 2) / 2
self.b = self.p * (self.p + 2)
self.c = -self.p * (self.p + 1) / 2
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
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | EricAlcaide/pytorch_geometric | Envelope | false | 2,191 | [
"MIT"
] | 0 | 31cef566cfe22602459155fdf91e9b6ce398bfe7 | https://github.com/EricAlcaide/pytorch_geometric/tree/31cef566cfe22602459155fdf91e9b6ce398bfe7 |
Multi_Head_Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scaled_Dot_Product_Attention(nn.Module):
"""Scaled Dot-Product Attention """
def __init__(self):
super(Scaled_Dot_Product_Attention, self).__init__()
def forward(self, Q, K, V, scale=None):
"""
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.triton_helpers import libdevice, math as tl_math
im... | Ergtou/TextWord | Multi_Head_Attention | false | 2,192 | [
"MIT"
] | 0 | f05cc5a630fc8d05357b8a9bc0da3ec5cc255a30 | https://github.com/Ergtou/TextWord/tree/f05cc5a630fc8d05357b8a9bc0da3ec5cc255a30 |
Downsample | import torch
from torch import Tensor
from torch import nn
class Downsample(nn.Module):
"""Downsample transition stage"""
def __init__(self, c1, c2):
super().__init__()
self.proj = nn.Conv2d(c1, c2, 3, 2, 1)
def forward(self, x: 'Tensor') ->Tensor:
x = x.permute(0, 3, 1, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | EmanuelNk/semantic-segmentation | Downsample | false | 2,193 | [
"MIT"
] | 0 | 20ff16da49691fb407724909d9c7e84b47e2fee0 | https://github.com/EmanuelNk/semantic-segmentation/tree/20ff16da49691fb407724909d9c7e84b47e2fee0 |
Scaled_Dot_Product_Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scaled_Dot_Product_Attention(nn.Module):
"""Scaled Dot-Product Attention """
def __init__(self):
super(Scaled_Dot_Product_Attention, self).__init__()
def forward(self, Q, K, V, scale=None):
"""
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.... | Ergtou/TextWord | Scaled_Dot_Product_Attention | false | 2,194 | [
"MIT"
] | 0 | f05cc5a630fc8d05357b8a9bc0da3ec5cc255a30 | https://github.com/Ergtou/TextWord/tree/f05cc5a630fc8d05357b8a9bc0da3ec5cc255a30 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.