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 |
|---|---|---|---|---|---|---|---|---|---|---|
IoULoss | import torch
import torch.nn as nn
class IoULoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super(IoULoss, self).__init__()
def forward(self, inputs: 'torch.Tensor', targets: 'torch.Tensor',
smooth: 'int'=1):
inputs = torch.sigmoid(inputs)
inputs = 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... | Latterlig96/DCUnet | IoULoss | false | 8,489 | [
"MIT"
] | 11 | 87d1c137a60177d6daf1dfff0483678d5580fda0 | https://github.com/Latterlig96/DCUnet/tree/87d1c137a60177d6daf1dfff0483678d5580fda0 |
AdaILN | import torch
import torch.utils.data
import torch.utils.data.distributed
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class AdaILN(nn.Module):
def __init__(self, num_features, eps=1e-05):
super(AdaILN, self).__init__()
self.eps = eps
self.rho = Parameter(tor... | 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.utils.data
import torch.utils.data.distributed
import torch
import... | Lornatang/UGATIT_PyTorch | AdaILN | false | 8,490 | [
"Apache-2.0"
] | 25 | 03519e4829b85ceee67c031a28d5a9318ac932b5 | https://github.com/Lornatang/UGATIT_PyTorch/tree/03519e4829b85ceee67c031a28d5a9318ac932b5 |
AttentionHead | import torch
from torch import Tensor
import torch.optim.lr_scheduler
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.onnx.operators
def scaled_dot_product_attention(query: 'Tensor', key: 'Tensor', value:
'Tensor') ->Tensor:
temp = query.bmm(key.transpose(1, 2))
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
from torch._inductor.runtime.... | LogIntelligence/LogADEmpirical | AttentionHead | false | 8,491 | [
"MIT"
] | 11 | 48458aee65c1c84466b04dd4092fae79a7f341fd | https://github.com/LogIntelligence/LogADEmpirical/tree/48458aee65c1c84466b04dd4092fae79a7f341fd |
PatchToPatchEdgeConvolution | import math
import torch
import torch.nn as nn
import torch.sparse as sp
class PatchToPatchEdgeConvolution(nn.Module):
def __init__(self, in_features, out_features):
super(PatchToPatchEdgeConvolution, self).__init__()
self.weight = nn.parameter.Parameter(torch.FloatTensor(in_features,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | Lujian-123321/gcn- | PatchToPatchEdgeConvolution | false | 8,492 | [
"MIT"
] | 12 | 8f3a0a1d979bc7f075352e194e1e39687f0b12ab | https://github.com/Lujian-123321/gcn-/tree/8f3a0a1d979bc7f075352e194e1e39687f0b12ab |
PositionwiseFeedForward | import math
import torch
import torch.optim.lr_scheduler
import torch.nn as nn
import torch.optim
import torch.onnx.operators
class GELU(nn.Module):
"""
Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU
"""
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | LogIntelligence/LogADEmpirical | PositionwiseFeedForward | false | 8,493 | [
"MIT"
] | 11 | 48458aee65c1c84466b04dd4092fae79a7f341fd | https://github.com/LogIntelligence/LogADEmpirical/tree/48458aee65c1c84466b04dd4092fae79a7f341fd |
LeastSquaresGenerativeAdversarialLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
class LeastSquaresGenerativeAdversarialLoss(nn.Module):
"""
Loss for `Least Squares Generative Adversarial Network (LSGAN) <https://arxiv.org/abs/1611.04076>`_
Args:
reduction (... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.utils... | Liuhong99/CST | LeastSquaresGenerativeAdversarialLoss | false | 8,494 | [
"MIT"
] | 20 | f6653a4ee7968fa3ba875a182670636f648be783 | https://github.com/Liuhong99/CST/tree/f6653a4ee7968fa3ba875a182670636f648be783 |
FastGuidedFilter | import torch
from torchvision.transforms import functional as F
from torch import nn
from torch.nn import functional as F
class BoxFilter(nn.Module):
def __init__(self, r):
super(BoxFilter, self).__init__()
self.r = r
def forward(self, x):
kernel_size = 2 * self.r + 1
kernel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 torchvision.transforms i... | LightTwist/RobustVideoMatting | FastGuidedFilter | false | 8,495 | [
"Apache-2.0"
] | 11 | 79eb143fef3a4c58b4857c1a5a927a318f528093 | https://github.com/LightTwist/RobustVideoMatting/tree/79eb143fef3a4c58b4857c1a5a927a318f528093 |
AdaptiveFeatureNorm | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
class AdaptiveFeatureNorm(nn.Module):
"""
The `Stepwise Adaptive Feature Norm loss (ICCV 2019) <https://arxiv.org/pdf/1811.07456v2.pdf>`_
Instead of using restrictive scalar R to match ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import t... | Liuhong99/CST | AdaptiveFeatureNorm | false | 8,496 | [
"MIT"
] | 20 | f6653a4ee7968fa3ba875a182670636f648be783 | https://github.com/Liuhong99/CST/tree/f6653a4ee7968fa3ba875a182670636f648be783 |
FeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
class FeedForward(nn.Module):
def __init__(self, d_model, d_ff=512, dropout=0.5):
super().__init__()
self.linear_1 = nn.Linear(d_model, d_ff)
self.dropout = nn.Dropout(dropout)
self.linear_2 = nn.Linear(d_ff, d_mod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | MadanMl/PyTorch-Transformer-for-RUL-Prediction | FeedForward | false | 8,497 | [
"Apache-2.0"
] | 25 | 5bf0a4739abdecbbc88118ea413393997bdc1e24 | https://github.com/MadanMl/PyTorch-Transformer-for-RUL-Prediction/tree/5bf0a4739abdecbbc88118ea413393997bdc1e24 |
UpsampleConvLayer | import torch
import torch.nn as nn
class UpsampleConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(UpsampleConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = torch.nn.ReflectionPad2d(reflection_paddin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MKFMIKU/PFFNet | UpsampleConvLayer | false | 8,498 | [
"MIT"
] | 41 | e506010a7cf00a32e77681845bdaf78ba88b027d | https://github.com/MKFMIKU/PFFNet/tree/e506010a7cf00a32e77681845bdaf78ba88b027d |
MeanPoolConv | import torch
from torch import nn
class IWConv2d(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size, he_init=True,
stride=1, bias=True):
super(IWConv2d, self).__init__()
self.he_init = he_init
self.padding = int((kernel_size - 1) / 2)
self.conv = nn.Conv2d(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | MIC-DKFZ/mood | MeanPoolConv | false | 8,499 | [
"Apache-2.0"
] | 42 | a01303adb4256653b133e2f7cd4741d366b681f7 | https://github.com/MIC-DKFZ/mood/tree/a01303adb4256653b133e2f7cd4741d366b681f7 |
Sobelxy | import torch
import torch.nn as nn
import torch.nn.functional as F
class Sobelxy(nn.Module):
def __init__(self):
super(Sobelxy, self).__init__()
kernelx = [[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]
kernely = [[1, 2, 1], [0, 0, 0], [-1, -2, -1]]
kernelx = torch.FloatTensor(kernelx).unsqu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Linfeng-Tang/SeAFusion | Sobelxy | false | 8,500 | [
"MIT"
] | 18 | 54cf7ee116da3f726941560279bf12fedd0d434d | https://github.com/Linfeng-Tang/SeAFusion/tree/54cf7ee116da3f726941560279bf12fedd0d434d |
ConvMeanPool | import torch
from torch import nn
class IWConv2d(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size, he_init=True,
stride=1, bias=True):
super(IWConv2d, self).__init__()
self.he_init = he_init
self.padding = int((kernel_size - 1) / 2)
self.conv = nn.Conv2d(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | MIC-DKFZ/mood | ConvMeanPool | false | 8,501 | [
"Apache-2.0"
] | 42 | a01303adb4256653b133e2f7cd4741d366b681f7 | https://github.com/MIC-DKFZ/mood/tree/a01303adb4256653b133e2f7cd4741d366b681f7 |
Theta | from torch.autograd import Function
import torch
import torch.nn as nn
from typing import Tuple
from typing import Optional
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
from typing import Any
class GradientReverseFunction(Function):
@staticmethod
def forward(ctx: 'Any'... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import torch.nn as nn
from typing import Tup... | Liuhong99/CST | Theta | false | 8,502 | [
"MIT"
] | 20 | f6653a4ee7968fa3ba875a182670636f648be783 | https://github.com/Liuhong99/CST/tree/f6653a4ee7968fa3ba875a182670636f648be783 |
ResidualBlock | import torch
import torch.nn as nn
class ConvLayer(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = nn.ReflectionPad2d(reflection_padding)
self.conv2d = 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 math as tl_math
import torch.... | MKFMIKU/PFFNet | ResidualBlock | false | 8,503 | [
"MIT"
] | 41 | e506010a7cf00a32e77681845bdaf78ba88b027d | https://github.com/MKFMIKU/PFFNet/tree/e506010a7cf00a32e77681845bdaf78ba88b027d |
Spatial_Attention | import torch
import torch.nn as nn
class Spatial_Attention(nn.Module):
def __init__(self, input_dim):
super(Spatial_Attention, self).__init__()
self.att_conv1 = nn.Conv2d(input_dim, 1, kernel_size=(1, 1),
padding=0, stride=1, bias=False)
self.att_act2 = nn.Softplus(beta=1, thr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | MCC-WH/Token | Spatial_Attention | false | 8,504 | [
"MIT"
] | 30 | eadc301f2df9e1851633be1b63c273659af0da49 | https://github.com/MCC-WH/Token/tree/eadc301f2df9e1851633be1b63c273659af0da49 |
region_levelset | import torch
import torch.nn as nn
class region_levelset(nn.Module):
"""
the mian of leveset function
"""
def __init__(self):
super(region_levelset, self).__init__()
def forward(self, mask_score, norm_img, class_weight):
"""
mask_score: predcited mask scores tensor:(N,C,W... | 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... | LiWentomng/boxlevelset | region_levelset | false | 8,505 | [
"Apache-2.0"
] | 25 | 8cc40bf6ae4a343c482c676c72259cc12c29d31c | https://github.com/LiWentomng/boxlevelset/tree/8cc40bf6ae4a343c482c676c72259cc12c29d31c |
DenseBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvLeakyRelu2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, padding=1,
stride=1, dilation=1, groups=1):
super(ConvLeakyRelu2d, self).__init__()
self.conv = nn.Conv2d(in_channels, out_chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Linfeng-Tang/SeAFusion | DenseBlock | false | 8,506 | [
"MIT"
] | 18 | 54cf7ee116da3f726941560279bf12fedd0d434d | https://github.com/Linfeng-Tang/SeAFusion/tree/54cf7ee116da3f726941560279bf12fedd0d434d |
UpSampleConv | import torch
from torch import nn
class IWConv2d(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size, he_init=True,
stride=1, bias=True):
super(IWConv2d, self).__init__()
self.he_init = he_init
self.padding = int((kernel_size - 1) / 2)
self.conv = nn.Conv2d(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | MIC-DKFZ/mood | UpSampleConv | false | 8,507 | [
"Apache-2.0"
] | 42 | a01303adb4256653b133e2f7cd4741d366b681f7 | https://github.com/MIC-DKFZ/mood/tree/a01303adb4256653b133e2f7cd4741d366b681f7 |
BoxFilter | import torch
from torchvision.transforms import functional as F
from torch import nn
from torch.nn import functional as F
class BoxFilter(nn.Module):
def __init__(self, r):
super(BoxFilter, self).__init__()
self.r = r
def forward(self, x):
kernel_size = 2 * self.r + 1
kernel_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | LightTwist/RobustVideoMatting | BoxFilter | false | 8,508 | [
"Apache-2.0"
] | 11 | 79eb143fef3a4c58b4857c1a5a927a318f528093 | https://github.com/LightTwist/RobustVideoMatting/tree/79eb143fef3a4c58b4857c1a5a927a318f528093 |
SingleHiddenLayer | import torch
class SingleHiddenLayer(torch.nn.Module):
def __init__(self, input_channels, hidden_channels):
super(SingleHiddenLayer, self).__init__()
self.input_channels = input_channels
self.hidden_channels = hidden_channels
self.linear1 = torch.nn.Linear(hidden_channels, 128)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | MLforHealth/state_representations_for_RLinHealth | SingleHiddenLayer | false | 8,509 | [
"MIT"
] | 24 | aa8dbb7d56caa95bf4380e3e745e134996291b66 | https://github.com/MLforHealth/state_representations_for_RLinHealth/tree/aa8dbb7d56caa95bf4380e3e745e134996291b66 |
dnn_encoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class dnn_encoder(nn.Module):
def __init__(self, G_in, G_out, w1, w2, w3):
super(dnn_encoder, self).__init__()
self.fc1 = nn.Linear(G_in, w1)
self.fc2 = nn.Linear(w1, w2)
self.fc3 = nn.Linear(w2, w3)
self.o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Maitreyapatel/speech-conversion-between-different-modalities | dnn_encoder | false | 8,510 | [
"MIT"
] | 23 | f757b487d9e6c20aa4f7d37247ba16f9a967f573 | https://github.com/Maitreyapatel/speech-conversion-between-different-modalities/tree/f757b487d9e6c20aa4f7d37247ba16f9a967f573 |
_ImpalaCNN | import torch
from typing import Tuple
from torch import nn
class _ImpalaResBlock(nn.Module):
def __init__(self, n_channels: 'int'):
super().__init__()
self.n_channels = n_channels
kernel_size = 3
padding = 1
self.relu = nn.ReLU()
self.relu_inplace = 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
from typing import Tuple
from... | IBM/vsrl-framework | _ImpalaCNN | false | 8,511 | [
"MIT"
] | 44 | 42e0853bffb5efbb66cd97178aff9e10ad18c5a9 | https://github.com/IBM/vsrl-framework/tree/42e0853bffb5efbb66cd97178aff9e10ad18c5a9 |
FinalTanh | import torch
class FinalTanh(torch.nn.Module):
def __init__(self, input_channels, hidden_channels,
hidden_hidden_channels, num_hidden_layers):
super(FinalTanh, self).__init__()
self.input_channels = input_channels
self.hidden_channels = hidden_channels
self.hidden_hidden_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MLforHealth/state_representations_for_RLinHealth | FinalTanh | false | 8,512 | [
"MIT"
] | 24 | aa8dbb7d56caa95bf4380e3e745e134996291b66 | https://github.com/MLforHealth/state_representations_for_RLinHealth/tree/aa8dbb7d56caa95bf4380e3e745e134996291b66 |
Simple224Upsample | import torch
import torch.nn as nn
class Simple224Upsample(nn.Module):
def __init__(self, arch=''):
super(Simple224Upsample, self).__init__()
self.upsample = nn.Upsample(mode='nearest', scale_factor=7)
self.arch = arch
def forward(self, x):
return self.upsample(x)
def get_i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | MadryLab/smoothed-vit | Simple224Upsample | false | 8,513 | [
"MIT"
] | 16 | a4327542e519e010764821716b64b944d458d1c1 | https://github.com/MadryLab/smoothed-vit/tree/a4327542e519e010764821716b64b944d458d1c1 |
MultiHeadAttention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = F.softmax(scores, dim=-1)
if dropout is not... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MadanMl/PyTorch-Transformer-for-RUL-Prediction | MultiHeadAttention | false | 8,514 | [
"Apache-2.0"
] | 25 | 5bf0a4739abdecbbc88118ea413393997bdc1e24 | https://github.com/MadanMl/PyTorch-Transformer-for-RUL-Prediction/tree/5bf0a4739abdecbbc88118ea413393997bdc1e24 |
DDM_Decoder | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
weight_shape = list(m.weight.data.size())
fan_in = np.prod(weight_shape[1:4])
fan_ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | MLforHealth/state_representations_for_RLinHealth | DDM_Decoder | false | 8,515 | [
"MIT"
] | 24 | aa8dbb7d56caa95bf4380e3e745e134996291b66 | https://github.com/MLforHealth/state_representations_for_RLinHealth/tree/aa8dbb7d56caa95bf4380e3e745e134996291b66 |
_GRU_ODE | import torch
class _GRU_ODE(torch.nn.Module):
def __init__(self, input_channels, hidden_channels):
super(_GRU_ODE, self).__init__()
self.input_channels = input_channels
self.hidden_channels = hidden_channels
self.W_r = torch.nn.Linear(input_channels, hidden_channels, 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.triton_helpers import libdevice
assert_size_stride ... | MLforHealth/state_representations_for_RLinHealth | _GRU_ODE | false | 8,516 | [
"MIT"
] | 24 | aa8dbb7d56caa95bf4380e3e745e134996291b66 | https://github.com/MLforHealth/state_representations_for_RLinHealth/tree/aa8dbb7d56caa95bf4380e3e745e134996291b66 |
L2Conv2D | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.utils.data
class L2Conv2D(nn.Module):
"""
Convolutional layer that computes the squared L2 distance instead of the conventional inner product.
"""
def __init__(self, num_prototypes, num_features, w_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.... | M-Nauta/ProtoTree | L2Conv2D | false | 8,517 | [
"MIT"
] | 35 | 72cad5e42b0eb05c1312e5496f36b842726e081a | https://github.com/M-Nauta/ProtoTree/tree/72cad5e42b0eb05c1312e5496f36b842726e081a |
Encoder | import torch
import torch.utils.data
from torch import nn
from torch.nn import functional
class Encoder(nn.Module):
def __init__(self, input_dim, hidden_dim, z_dim):
"""
Args:
input_dim: A integer indicating the size of input.
hidden_dim: A integer indicating the s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | MaurizioFD/recsys-challenge-2020-twitter | Encoder | false | 8,518 | [
"Apache-2.0"
] | 44 | 95dc024fb4f8777aa62e1304536daece640428de | https://github.com/MaurizioFD/recsys-challenge-2020-twitter/tree/95dc024fb4f8777aa62e1304536daece640428de |
BasicBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
"""Basic residual block class"""
expansion = 1
def __init__(self, in_planes, planes, stride=1):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv1d(in_planes, planes, kernel_size=3, 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
assert_... | Maosef/easy-to-hard | BasicBlock | false | 8,519 | [
"MIT"
] | 44 | 711ec0965229444a6c51b1b06a4e2cad3e32d02e | https://github.com/Maosef/easy-to-hard/tree/711ec0965229444a6c51b1b06a4e2cad3e32d02e |
FC_Q | import torch
import torch.nn as nn
import torch.nn.functional as F
class FC_Q(nn.Module):
def __init__(self, state_dim, num_actions, num_nodes=128):
super(FC_Q, self).__init__()
self.q1 = nn.Linear(state_dim, num_nodes)
self.q2 = nn.Linear(num_nodes, num_nodes)
self.q3 = 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.... | MLforHealth/state_representations_for_RLinHealth | FC_Q | false | 8,520 | [
"MIT"
] | 24 | aa8dbb7d56caa95bf4380e3e745e134996291b66 | https://github.com/MLforHealth/state_representations_for_RLinHealth/tree/aa8dbb7d56caa95bf4380e3e745e134996291b66 |
gem | import torch
import torch.nn as nn
import torch.nn.functional as F
class gem(nn.Module):
def __init__(self, p=3.0, eps=1e-06):
super(gem, self).__init__()
self.p = p
self.eps = eps
def forward(self, x):
return F.avg_pool2d(x.clamp(min=self.eps).pow(self.p), (x.size(-2),
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | MCC-WH/Token | gem | false | 8,521 | [
"MIT"
] | 30 | eadc301f2df9e1851633be1b63c273659af0da49 | https://github.com/MCC-WH/Token/tree/eadc301f2df9e1851633be1b63c273659af0da49 |
FFNN1 | import torch
import torch.utils.data
from torch import nn
class FFNN1(nn.Module):
def __init__(self, input_size, hidden_size, hidden_dropout_prob):
super(FFNN1, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.hidden_dropout_prob = hidden_dropout_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
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | MaurizioFD/recsys-challenge-2020-twitter | FFNN1 | false | 8,522 | [
"Apache-2.0"
] | 44 | 95dc024fb4f8777aa62e1304536daece640428de | https://github.com/MaurizioFD/recsys-challenge-2020-twitter/tree/95dc024fb4f8777aa62e1304536daece640428de |
DDM_Encoder | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
weight_shape = list(m.weight.data.size())
fan_in = np.prod(weight_shape[1:4])
fan_ou... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
... | MLforHealth/state_representations_for_RLinHealth | DDM_Encoder | false | 8,523 | [
"MIT"
] | 24 | aa8dbb7d56caa95bf4380e3e745e134996291b66 | https://github.com/MLforHealth/state_representations_for_RLinHealth/tree/aa8dbb7d56caa95bf4380e3e745e134996291b66 |
FFNNDual | import torch
import torch.utils.data
from torch import nn
class FFNNDual(nn.Module):
def __init__(self, input_size, hidden_size_1, hidden_size_2,
hidden_dropout_prob_1, hidden_dropout_prob_2):
super(FFNNDual, self).__init__()
self.input_size = input_size
self.hidden_size_1 = 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 import triton_helpers
import torch.utils.data
from ... | MaurizioFD/recsys-challenge-2020-twitter | FFNNDual | false | 8,524 | [
"Apache-2.0"
] | 44 | 95dc024fb4f8777aa62e1304536daece640428de | https://github.com/MaurizioFD/recsys-challenge-2020-twitter/tree/95dc024fb4f8777aa62e1304536daece640428de |
FFNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class FFNet(nn.Module):
"""Modified ResidualNetworkSegment model class"""
def __init__(self, block, num_blocks, width, depth):
super(FFNet, self).__init__()
assert (depth - 4
) % 4 == 0, 'Depth not compatible with ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Maosef/easy-to-hard | FFNet | false | 8,525 | [
"MIT"
] | 44 | 711ec0965229444a6c51b1b06a4e2cad3e32d02e | https://github.com/Maosef/easy-to-hard/tree/711ec0965229444a6c51b1b06a4e2cad3e32d02e |
Net | import torch
import torch.nn as nn
import torch.utils
class Net(nn.Module):
def __init__(self, n_inputs, n_units=50):
super(Net, self).__init__()
self.fc = nn.Linear(n_inputs, n_units)
self.out = nn.Linear(n_units, 1)
def forward(self, x):
x = torch.tanh(self.fc(x))
r... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | MSU-MLSys-Lab/CATE | Net | false | 8,526 | [
"Apache-2.0"
] | 15 | 654c393d7df888d2c3f3b90f9e6752faa061157e | https://github.com/MSU-MLSys-Lab/CATE/tree/654c393d7df888d2c3f3b90f9e6752faa061157e |
VGGOutputBlock | import torch
import torch.nn as nn
class VGGDense(nn.Module):
def __init__(self, in_channels, out_channels):
super(VGGDense, self).__init__()
self.fc = nn.Linear(in_features=in_channels, out_features=out_channels)
self.activ = nn.ReLU(inplace=True)
self.dropout = nn.Dropout(p=0.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
import torch.nn as nn
assert_... | MarioMZhang/HAP-tryout | VGGOutputBlock | false | 8,527 | [
"MIT"
] | 24 | 9a423f35b50766533a0d2cab8069316ccb21954b | https://github.com/MarioMZhang/HAP-tryout/tree/9a423f35b50766533a0d2cab8069316ccb21954b |
GlobalAttentionGeneral | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.onnx
def conv1x1(in_planes, out_planes, bias=False):
"""1x1 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=1,
padding=0, bias=bias)
class GlobalAttentionGeneral(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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MaxyLee/Style-AttnGAN | GlobalAttentionGeneral | false | 8,528 | [
"MIT"
] | 36 | d33d0df061c94b75ad4af5c750b8d6f37ee1a35a | https://github.com/MaxyLee/Style-AttnGAN/tree/d33d0df061c94b75ad4af5c750b8d6f37ee1a35a |
FFModule | import torch
import torch.nn as nn
def swish(x):
return x * torch.sigmoid(x)
class FFModule(nn.Module):
def __init__(self, d_model, h_size, dropout=0.2):
super(FFModule, self).__init__()
self.layer_norm = nn.LayerNorm(d_model)
self.layer1 = nn.Linear(d_model, h_size)
self.sw... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Masao-Someki/Conformer | FFModule | false | 8,529 | [
"MIT"
] | 18 | 866da9ae05a6d07304775c592caac8d516f67c92 | https://github.com/Masao-Someki/Conformer/tree/866da9ae05a6d07304775c592caac8d516f67c92 |
BasicBlock | import torch
import torch.nn as nn
from abc import ABC
import torch.utils.data
import torch.nn.functional as F
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
class BasicBlock(nn.Module, ABC):
expansion = 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
from ab... | Mattdl/RehearsalRevealed | BasicBlock | false | 8,530 | [
"MIT"
] | 12 | f9cd2548f6c6d3ff119b40fecdb0df6fcd1525f6 | https://github.com/Mattdl/RehearsalRevealed/tree/f9cd2548f6c6d3ff119b40fecdb0df6fcd1525f6 |
EncoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def attention(q, k, v, d_k, mask=None, dropout=None):
scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k)
if mask is not None:
mask = mask.unsqueeze(1)
scores = F.softmax(scores, dim=-1)
if dropout is not... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MadanMl/PyTorch-Transformer-for-RUL-Prediction | EncoderLayer | false | 8,531 | [
"Apache-2.0"
] | 25 | 5bf0a4739abdecbbc88118ea413393997bdc1e24 | https://github.com/MadanMl/PyTorch-Transformer-for-RUL-Prediction/tree/5bf0a4739abdecbbc88118ea413393997bdc1e24 |
MultiHeadedAttention | import math
import torch
from typing import Optional
from typing import Tuple
from torch import nn
class MultiHeadedAttention(nn.Module):
"""Multi-Head Attention layer.
Args:
n_head (int): The number of heads.
n_feat (int): The number of features.
dropout_rate (float): Dropout rate.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Mashiro083/wenet-onnx | MultiHeadedAttention | false | 8,532 | [
"Apache-2.0"
] | 18 | ae8f8451d73fa9ceac6f7738194543e83959ca86 | https://github.com/Mashiro083/wenet-onnx/tree/ae8f8451d73fa9ceac6f7738194543e83959ca86 |
SMAPE | import torch
class SMAPE(torch.nn.Module):
"""Symmetric Mean Absolute error.
:math:`\\frac{|x - y|} {|x| + |y| + \\epsilon}`
Args:
eps(float): small number to avoid division by 0.
"""
def __init__(self, eps=0.01):
super(SMAPE, self).__init__()
self.eps = eps
def forwa... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | Mephisto405/WCMC-Public | SMAPE | false | 8,533 | [
"BSD-2-Clause"
] | 19 | bd54f218d5239db84f404fbe1b465f9497bcf9e4 | https://github.com/Mephisto405/WCMC-Public/tree/bd54f218d5239db84f404fbe1b465f9497bcf9e4 |
baseRNN_predict | import torch
import numpy as np
import torch.nn as nn
import torch.nn.init as init
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
weight_shape = list(m.weight.data.size())
fan_in = np.prod(weight_shape[1:4])
fan_out = np.prod(weight_shape[2:4]) *... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | MLforHealth/state_representations_for_RLinHealth | baseRNN_predict | false | 8,534 | [
"MIT"
] | 24 | aa8dbb7d56caa95bf4380e3e745e134996291b66 | https://github.com/MLforHealth/state_representations_for_RLinHealth/tree/aa8dbb7d56caa95bf4380e3e745e134996291b66 |
LocalStatisticsNetwork | import torch
import torch.nn as nn
class LocalStatisticsNetwork(nn.Module):
def __init__(self, img_feature_channels: 'int'):
"""Local statistique nerwork
Args:
img_feature_channels (int): [Number of input channels]
"""
super().__init__()
self.conv1 = 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MehdiZouitine/Learning-Disentangled-Representations-via-Mutual-Information-Estimation | LocalStatisticsNetwork | false | 8,535 | [
"MIT"
] | 25 | 52952aff647a33b749b709cd7f0c3cd059c66b54 | https://github.com/MehdiZouitine/Learning-Disentangled-Representations-via-Mutual-Information-Estimation/tree/52952aff647a33b749b709cd7f0c3cd059c66b54 |
AdaFM | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
class AdaFM(nn.Module):
def __init__(self, in_channel, out_channel, style_dim=0):
super().__init__()
self.style_gama = nn.Parameter(torch.ones(in_channel, out_channel,
1, 1))
self.st... | 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
import torch.utils.data
import torch.utils.data.distributed
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | MiaoyunZhao/GANTransferLimitedData | AdaFM | false | 8,536 | [
"MIT"
] | 41 | 5545bc37a1d7d4f28a9c3588aaa12a616bbddd88 | https://github.com/MiaoyunZhao/GANTransferLimitedData/tree/5545bc37a1d7d4f28a9c3588aaa12a616bbddd88 |
Decoder | import torch
import torch.utils.data
from torch import nn
from torch.nn import functional
class Decoder(nn.Module):
def __init__(self, z_dim, hidden_dim, output_dim):
"""
Args:
z_dim: A integer indicating the latent size.
hidden_dim: A integer indicating the size o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
from ... | MaurizioFD/recsys-challenge-2020-twitter | Decoder | false | 8,537 | [
"Apache-2.0"
] | 44 | 95dc024fb4f8777aa62e1304536daece640428de | https://github.com/MaurizioFD/recsys-challenge-2020-twitter/tree/95dc024fb4f8777aa62e1304536daece640428de |
ClampModule | import torch
import torch as th
class ClampModule(th.nn.Module):
"""Why is this not a thing in the main library?"""
def __init__(self, min_v, max_v):
super().__init__()
self.min_v = min_v
self.max_v = max_v
def forward(self, x):
return th.clamp(x, self.min_v, self.max_v)
... | 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 th
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_... | Miffyli/policy-supervectors | ClampModule | false | 8,538 | [
"MIT"
] | 17 | 358284805e5bc96b95cae15e9741571e46d84bc9 | https://github.com/Miffyli/policy-supervectors/tree/358284805e5bc96b95cae15e9741571e46d84bc9 |
ResnetBlock | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.utils.data.distributed
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__()
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 import nn
import torch.nn.functional as F
import torch.utils.data
imp... | MiaoyunZhao/GANTransferLimitedData | ResnetBlock | false | 8,539 | [
"MIT"
] | 41 | 5545bc37a1d7d4f28a9c3588aaa12a616bbddd88 | https://github.com/MiaoyunZhao/GANTransferLimitedData/tree/5545bc37a1d7d4f28a9c3588aaa12a616bbddd88 |
RelativeMSE | import torch
class RelativeMSE(torch.nn.Module):
"""Relative Mean-Squared Error.
:math:`0.5 * \\frac{(x - y)^2}{y^2 + \\epsilon}`
Args:
eps(float): small number to avoid division by 0.
"""
def __init__(self, eps=0.01):
super(RelativeMSE, self).__init__()
self.eps = eps
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Mephisto405/WCMC-Public | RelativeMSE | false | 8,540 | [
"BSD-2-Clause"
] | 19 | bd54f218d5239db84f404fbe1b465f9497bcf9e4 | https://github.com/Mephisto405/WCMC-Public/tree/bd54f218d5239db84f404fbe1b465f9497bcf9e4 |
MLP | import torch
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, in_dim, out_dim):
super(MLP, self).__init__()
out = max(8, in_dim * 2)
self.input = nn.Linear(in_dim, out)
self.fc = nn.Linear(out, out)
self.fc2 = nn.Linear(out, out)
self.output = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Malta-Lab/IUPE | MLP | false | 8,541 | [
"MIT"
] | 10 | 44ddf119917538f02bb69509fec7a8314eed419f | https://github.com/Malta-Lab/IUPE/tree/44ddf119917538f02bb69509fec7a8314eed419f |
FFChessNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class FFChessNet(nn.Module):
"""Modified ResidualNetworkSegment model class"""
def __init__(self, block, num_blocks, width, depth):
super(FFChessNet, self).__init__()
assert (depth - 4
) % 4 == 0, 'Depth not compat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Maosef/easy-to-hard | FFChessNet | false | 8,542 | [
"MIT"
] | 44 | 711ec0965229444a6c51b1b06a4e2cad3e32d02e | https://github.com/Maosef/easy-to-hard/tree/711ec0965229444a6c51b1b06a4e2cad3e32d02e |
RelPositionMultiHeadedAttention | import math
import numpy
import torch
import torch.nn as nn
class RelPositionMultiHeadedAttention(nn.Module):
"""Multi-Head Attention layer with relative position encoding.
This class is aquired from
https://github.com/espnet/espnet/blob/master/espnet/nets/pytorch_backend/transformer/attention.py
(Ap... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Masao-Someki/Conformer | RelPositionMultiHeadedAttention | false | 8,543 | [
"MIT"
] | 18 | 866da9ae05a6d07304775c592caac8d516f67c92 | https://github.com/Masao-Someki/Conformer/tree/866da9ae05a6d07304775c592caac8d516f67c92 |
SuperPointNet | import torch
class SuperPointNet(torch.nn.Module):
""" Pytorch definition of SuperPoint Network. """
def __init__(self):
super(SuperPointNet, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.pool = torch.nn.MaxPool2d(kernel_size=2, stride=2)
self.numberOfClasses =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MamonaAwan/UnsupervisedLandmarks | SuperPointNet | false | 8,544 | [
"MIT"
] | 26 | 89180755b891fd28e0199560d628dc8b0d2b3e68 | https://github.com/MamonaAwan/UnsupervisedLandmarks/tree/89180755b891fd28e0199560d628dc8b0d2b3e68 |
TonemappedRelativeMSE | import torch
def _tonemap(im):
"""Helper Reinhards tonemapper.
Args:
im(torch.Tensor): image to tonemap.
Returns:
(torch.Tensor) tonemaped image.
"""
im = torch.clamp(im, min=0)
return im / (1 + im)
class TonemappedRelativeMSE(torch.nn.Module):
"""Relative mean-squared er... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Mephisto405/WCMC-Public | TonemappedRelativeMSE | false | 8,545 | [
"BSD-2-Clause"
] | 19 | bd54f218d5239db84f404fbe1b465f9497bcf9e4 | https://github.com/Mephisto405/WCMC-Public/tree/bd54f218d5239db84f404fbe1b465f9497bcf9e4 |
RelPositionMultiHeadedAttention | import math
import torch
from typing import Optional
from typing import Tuple
from torch import nn
class MultiHeadedAttention(nn.Module):
"""Multi-Head Attention layer.
Args:
n_head (int): The number of heads.
n_feat (int): The number of features.
dropout_rate (float): Dropout rate.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Mashiro083/wenet-onnx | RelPositionMultiHeadedAttention | false | 8,546 | [
"Apache-2.0"
] | 18 | ae8f8451d73fa9ceac6f7738194543e83959ca86 | https://github.com/Mashiro083/wenet-onnx/tree/ae8f8451d73fa9ceac6f7738194543e83959ca86 |
IRW_L1_Loss | import torch
import torch.utils.data
import torch
import torch.nn as nn
class IRW_L1_Loss(nn.Module):
def __init__(self, threshold):
super(IRW_L1_Loss, self).__init__()
self.threshold = threshold
def forward(self, x, y, beta):
beta = beta.view(len(x), 1, 1, 1)
beta = torch.nn... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.dat... | Mid-Push/IrwGAN | IRW_L1_Loss | false | 8,547 | [
"BSD-3-Clause"
] | 31 | f56e7274cf7de3362459549dd807b66b93dc5e89 | https://github.com/Mid-Push/IrwGAN/tree/f56e7274cf7de3362459549dd807b66b93dc5e89 |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data.distributed
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class Atte... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MichiganCOG/Video-Grounding | Attention | false | 8,548 | [
"MIT"
] | 41 | 3e0ec0b69578a59be583911590354fe77d357cab | https://github.com/MichiganCOG/Video-Grounding/tree/3e0ec0b69578a59be583911590354fe77d357cab |
MultiHead | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data.distributed
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class 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.... | MichiganCOG/Video-Grounding | MultiHead | false | 8,549 | [
"MIT"
] | 41 | 3e0ec0b69578a59be583911590354fe77d357cab | https://github.com/MichiganCOG/Video-Grounding/tree/3e0ec0b69578a59be583911590354fe77d357cab |
FeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data.distributed
class Linear(nn.Linear):
def forward(self, x):
size = x.size()
return super().forward(x.contiguous().view(-1, size[-1])).view(*
size[:-1], -1)
class FeedForward(nn.Module):
de... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | MichiganCOG/Video-Grounding | FeedForward | false | 8,550 | [
"MIT"
] | 41 | 3e0ec0b69578a59be583911590354fe77d357cab | https://github.com/MichiganCOG/Video-Grounding/tree/3e0ec0b69578a59be583911590354fe77d357cab |
TonemappedMSE | import torch
def _tonemap(im):
"""Helper Reinhards tonemapper.
Args:
im(torch.Tensor): image to tonemap.
Returns:
(torch.Tensor) tonemaped image.
"""
im = torch.clamp(im, min=0)
return im / (1 + im)
class TonemappedMSE(torch.nn.Module):
"""Mean-squared error on tonemaped ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Mephisto405/WCMC-Public | TonemappedMSE | false | 8,551 | [
"BSD-2-Clause"
] | 19 | bd54f218d5239db84f404fbe1b465f9497bcf9e4 | https://github.com/Mephisto405/WCMC-Public/tree/bd54f218d5239db84f404fbe1b465f9497bcf9e4 |
EncoderLayer | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data.distributed
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class 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.... | MichiganCOG/Video-Grounding | EncoderLayer | false | 8,552 | [
"MIT"
] | 41 | 3e0ec0b69578a59be583911590354fe77d357cab | https://github.com/MichiganCOG/Video-Grounding/tree/3e0ec0b69578a59be583911590354fe77d357cab |
A | import torch
import torch.nn
class A(torch.nn.Module):
def forward(self, x):
return x + 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.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_... | ModECI/MDF | A | false | 8,553 | [
"Apache-2.0"
] | 12 | 76d5db6a1c9f691ca5be36d60d28e6e529762e7e | https://github.com/ModECI/MDF/tree/76d5db6a1c9f691ca5be36d60d28e6e529762e7e |
TripletMarginLoss | from torch.autograd import Function
import torch
class PairwiseDistance(Function):
def __init__(self, p):
super(PairwiseDistance, self).__init__()
self.norm = p
def forward(self, x1, x2):
assert x1.size() == x2.size()
eps = 0.0001 / x1.size(1)
diff = torch.abs(x1 - x2... | 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.autograd import Function
assert_size_stride = torch._C._dynamo.guards.assert_s... | Mikexu007/AS_CAL | TripletMarginLoss | false | 8,554 | [
"MIT"
] | 14 | 966328ae65bb16ba9b7aab153d8150c08c26c81f | https://github.com/Mikexu007/AS_CAL/tree/966328ae65bb16ba9b7aab153d8150c08c26c81f |
ResNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResNet(nn.Module):
"""Modified ResNet model class"""
def __init__(self, block, num_blocks, depth, width=1):
super(ResNet, self).__init__()
self.iters = int((depth - 4) // 4)
self.in_planes = int(width * 64)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Maosef/easy-to-hard | ResNet | false | 8,555 | [
"MIT"
] | 44 | 711ec0965229444a6c51b1b06a4e2cad3e32d02e | https://github.com/Maosef/easy-to-hard/tree/711ec0965229444a6c51b1b06a4e2cad3e32d02e |
CA_Block | import torch
import torch.nn as nn
class CA_Block(nn.Module):
def __init__(self, in_dim):
super(CA_Block, self).__init__()
self.chanel_in = in_dim
self.gamma = nn.Parameter(torch.ones(1))
self.softmax = nn.Softmax(dim=-1)
def forward(self, x):
"""
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Mhaiyang/CVPR2021_PFNet | CA_Block | false | 8,556 | [
"BSD-3-Clause"
] | 24 | 2c4cab0730e6a0619fad79092f0b34f71c3b56c4 | https://github.com/Mhaiyang/CVPR2021_PFNet/tree/2c4cab0730e6a0619fad79092f0b34f71c3b56c4 |
MlpAttention | import torch
import torch.nn as nn
class Self_Attn1D(nn.Module):
""" Self attention Layer """
def __init__(self, in_dim, activation, k=8):
super(Self_Attn1D, self).__init__()
self.chanel_in = in_dim
self.activation = activation
self.query_conv = nn.Conv1d(in_channels=in_dim, o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | Malta-Lab/IUPE | MlpAttention | false | 8,557 | [
"MIT"
] | 10 | 44ddf119917538f02bb69509fec7a8314eed419f | https://github.com/Malta-Lab/IUPE/tree/44ddf119917538f02bb69509fec7a8314eed419f |
SquadDiscriminator | import torch
import torch.nn as nn
class SquadDiscriminator(nn.Module):
def __init__(self, feature_size):
super(SquadDiscriminator, self).__init__()
self.bilinear = nn.Bilinear(feature_size, feature_size, 1)
for m in self.modules():
self.weights_init(m)
def weights_init(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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | MiuLab/QAInfomax | SquadDiscriminator | false | 8,558 | [
"MIT"
] | 19 | 0985bc1df68d21c93de1bd6038d69f9792a9f62a | https://github.com/MiuLab/QAInfomax/tree/0985bc1df68d21c93de1bd6038d69f9792a9f62a |
IOU | import torch
class IOU(torch.nn.Module):
def __init__(self):
super(IOU, self).__init__()
def _iou(self, pred, target):
pred = torch.sigmoid(pred)
inter = (pred * target).sum(dim=(2, 3))
union = (pred + target).sum(dim=(2, 3)) - inter
iou = 1 - inter / union
re... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Mhaiyang/CVPR2021_PFNet | IOU | false | 8,559 | [
"BSD-3-Clause"
] | 24 | 2c4cab0730e6a0619fad79092f0b34f71c3b56c4 | https://github.com/Mhaiyang/CVPR2021_PFNet/tree/2c4cab0730e6a0619fad79092f0b34f71c3b56c4 |
GaussianGenerator | import torch
import numpy as np
import torch.nn as nn
class GaussianGenerator(nn.Module):
def __init__(self, dims):
super(GaussianGenerator, self).__init__()
self.z_dim = dims[0]
self.linear_var = nn.Parameter(1.0 * torch.ones([self.z_dim]))
self.bias = nn.Parameter(torch.zeros([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
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyna... | MichaelArbel/GeneralizedEBM | GaussianGenerator | false | 8,560 | [
"BSD-3-Clause"
] | 40 | b2fb244bacef23a7347aecc0e8ff4863153f94f0 | https://github.com/MichaelArbel/GeneralizedEBM/tree/b2fb244bacef23a7347aecc0e8ff4863153f94f0 |
ResBlock | import torch
import torch.nn as nn
class ResBlock(nn.Module):
def __init__(self, in_c):
super(ResBlock, self).__init__()
self.conv1 = nn.Conv2d(in_c, in_c, kernel_size=3, stride=1, padding
=1, bias=True)
self.relu = nn.ReLU(inplace=True)
self.conv2 = nn.Conv2d(in_c, 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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MohitLamba94/LLPackNet | ResBlock | false | 8,561 | [
"MIT"
] | 15 | 440e20ac48aed0beca5f473358ec85d24d477575 | https://github.com/MohitLamba94/LLPackNet/tree/440e20ac48aed0beca5f473358ec85d24d477575 |
Summarize | import torch
import torch.nn as nn
class Summarize(nn.Module):
def __init__(self):
super(Summarize, self).__init__()
self.sigmoid = nn.Sigmoid()
def forward(self, vec):
return self.sigmoid(torch.mean(vec, dim=1))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_ini... | 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... | MiuLab/QAInfomax | Summarize | false | 8,562 | [
"MIT"
] | 19 | 0985bc1df68d21c93de1bd6038d69f9792a9f62a | https://github.com/MiuLab/QAInfomax/tree/0985bc1df68d21c93de1bd6038d69f9792a9f62a |
make_dense | import torch
import torch.nn as nn
import torch.nn.functional as F
class make_dense(nn.Module):
def __init__(self, nChannels=64, growthRate=32, kernel_size=3):
super(make_dense, self).__init__()
self.conv = nn.Conv2d(nChannels, growthRate, kernel_size=
kernel_size, padding=(kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MohitLamba94/LLPackNet | make_dense | false | 8,563 | [
"MIT"
] | 15 | 440e20ac48aed0beca5f473358ec85d24d477575 | https://github.com/MohitLamba94/LLPackNet/tree/440e20ac48aed0beca5f473358ec85d24d477575 |
ScaledDotProductAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MinkiJ/SnaTCHer | ScaledDotProductAttention | false | 8,564 | [
"MIT"
] | 12 | 335c42469f0a7ad72c5c3480c8effc8c293823e0 | https://github.com/MinkiJ/SnaTCHer/tree/335c42469f0a7ad72c5c3480c8effc8c293823e0 |
SafeLog | import torch
import torch.nn as nn
class SafeLog(nn.Module):
def __init__(self, eps=1e-06):
super(SafeLog, self).__init__()
self.eps = eps
def forward(self, X):
return torch.log(torch.clamp(X, min=self.eps))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Mrswolf/brainda | SafeLog | false | 8,565 | [
"MIT"
] | 24 | cbd2fa6334d9e6243324dbaf086be4eb4047e801 | https://github.com/Mrswolf/brainda/tree/cbd2fa6334d9e6243324dbaf086be4eb4047e801 |
ScaledTanh | import torch
from torch import Tensor
import torch.nn as nn
from torch import tanh
class ScaledTanh(nn.Module):
def __init__(self, factor):
super(ScaledTanh, self).__init__()
self.factor = factor
def forward(self, inputs: 'Tensor') ->Tensor:
return tanh(inputs) * self.factor
def ge... | 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_... | MhmdSyd/celldetection | ScaledTanh | false | 8,566 | [
"Apache-2.0"
] | 26 | 93e706953dc32eb694345179d5dcca5cfd9ff41b | https://github.com/MhmdSyd/celldetection/tree/93e706953dc32eb694345179d5dcca5cfd9ff41b |
MaxNormConstraintLinear | import torch
import torch.nn as nn
class MaxNormConstraintLinear(nn.Linear):
def __init__(self, *args, max_norm_value=1, norm_axis=0, **kwargs):
self.max_norm_value = max_norm_value
self.norm_axis = norm_axis
super().__init__(*args, **kwargs)
def forward(self, input):
self.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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Mrswolf/brainda | MaxNormConstraintLinear | false | 8,567 | [
"MIT"
] | 24 | cbd2fa6334d9e6243324dbaf086be4eb4047e801 | https://github.com/Mrswolf/brainda/tree/cbd2fa6334d9e6243324dbaf086be4eb4047e801 |
CNN3dModel | import torch
class CNN3dModel(torch.nn.ModuleDict):
def __init__(self, D_in=1, D_out=1):
super(CNN3dModel, self).__init__()
self.conv3d = torch.nn.Conv3d(D_in, D_in * 2, kernel_size=2, stride
=2, padding=1)
self.conv3d2 = torch.nn.Conv3d(D_in * 2, D_in * 2, 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
assert_size_stride = torch._C... | MilesCranmer/Sapsan | CNN3dModel | false | 8,568 | [
"BSD-3-Clause"
] | 11 | 4d21954baf196ede2d4dafc765aed98a0cfca21b | https://github.com/MilesCranmer/Sapsan/tree/4d21954baf196ede2d4dafc765aed98a0cfca21b |
LabelSmoothingCrossEntropy | import torch
import torch._C
import torch.serialization
from torch import nn
import torch.nn.functional as F
class LabelSmoothingCrossEntropy(nn.Module):
""" NLL loss with label smoothing.
"""
def __init__(self, smoothing=0.1, loss_weight=1.0, loss_name='loss_ce'):
super(LabelSmoothingCrossEntrop... | 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._C
import... | Molly6/segmentation_shengteng2021 | LabelSmoothingCrossEntropy | false | 8,569 | [
"Apache-2.0"
] | 21 | 33dfefa80193586f504069793d9e141944549e99 | https://github.com/Molly6/segmentation_shengteng2021/tree/33dfefa80193586f504069793d9e141944549e99 |
ResidualBlock | import torch
from torch import nn
import torch.nn.functional as F
class ResidualBlock(nn.Module):
"""
Residual block from R2D3/IMPALA
Taken from [1,2]
"""
def __init__(self, num_channels, first_conv_weight_scale):
super().__init__()
self.conv1 = nn.Conv2d(num_channels, num_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Miffyli/minecraft-bc-2020 | ResidualBlock | false | 8,570 | [
"MIT"
] | 11 | 94f8706e547474a2ed8cacd41bb20e59f672215f | https://github.com/Miffyli/minecraft-bc-2020/tree/94f8706e547474a2ed8cacd41bb20e59f672215f |
Square | import torch
import torch.nn as nn
class Square(nn.Module):
def __init__(self):
super(Square, self).__init__()
def forward(self, X):
return torch.square(X)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Mrswolf/brainda | Square | false | 8,571 | [
"MIT"
] | 24 | cbd2fa6334d9e6243324dbaf086be4eb4047e801 | https://github.com/Mrswolf/brainda/tree/cbd2fa6334d9e6243324dbaf086be4eb4047e801 |
SpatialAttention | import torch
import torch.nn as nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
self.conv1 = nn.Conv1d(2, 1, kernel_size, padding=kernel_size // 2,
bias=False)
self.sigmoid = nn.Sigmoid()
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 import triton_helpers
import torch.nn as nn
assert_... | Ming-er/NeuralNILM_Pytorch | SpatialAttention | false | 8,572 | [
"MIT"
] | 22 | 90123a3cf7d8dedc7f513ff784a45f178aa10a9d | https://github.com/Ming-er/NeuralNILM_Pytorch/tree/90123a3cf7d8dedc7f513ff784a45f178aa10a9d |
weightedLoss | import torch
from torch import nn
class weightedLoss(nn.Module):
def __init__(self):
super().__init__()
self.thresholds = [0.5, 2, 5, 10, 30]
self.weights = [1, 1, 2, 5, 10, 30]
def forward(self, pred, label):
weights = torch.ones_like(pred) * 3
for i, threshold in en... | 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_... | Mikubill/GAN-ConvLSTM | weightedLoss | false | 8,573 | [
"MIT"
] | 16 | 943525f62a3ab462a625c72534b3188cd583d839 | https://github.com/Mikubill/GAN-ConvLSTM/tree/943525f62a3ab462a625c72534b3188cd583d839 |
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.... | NTDXYG/Text-Classify-based-pytorch | Scaled_Dot_Product_Attention | false | 8,574 | [
"Apache-2.0"
] | 20 | b12a264a0ea64b2f8b46fafd5383ef0a8025ef2f | https://github.com/NTDXYG/Text-Classify-based-pytorch/tree/b12a264a0ea64b2f8b46fafd5383ef0a8025ef2f |
ResBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResBlock(nn.Module):
def __init__(self, in_channel, out_channel, ker_size, stri, pad):
super(ResBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channel, out_channel, 3, 1, 1)
self.conv2 = nn.Conv2d(out_channel, 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | NJUVISION/AWnet | ResBlock | false | 8,575 | [
"MIT"
] | 16 | f47a1692819a778b513b882d36ed727f7732d37b | https://github.com/NJUVISION/AWnet/tree/f47a1692819a778b513b882d36ed727f7732d37b |
AdaptiveInstanceNorm_H | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
class AdaptiveInstanceNorm_H(nn.Module):
def __init__(self, in_channel, map_size):
super().__init__()
self.norm = nn.LayerNorm([map_size, map_size])
self.weight = nn.Parameter(1000.0 + torch.rand... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import torch.utils.data
import torch.utils.data.distribute... | MiaoyunZhao/GANTransferLimitedData | AdaptiveInstanceNorm_H | false | 8,576 | [
"MIT"
] | 41 | 5545bc37a1d7d4f28a9c3588aaa12a616bbddd88 | https://github.com/MiaoyunZhao/GANTransferLimitedData/tree/5545bc37a1d7d4f28a9c3588aaa12a616bbddd88 |
Position_wise_Feed_Forward | import torch
import torch.nn as nn
import torch.nn.functional as F
class Position_wise_Feed_Forward(nn.Module):
def __init__(self, dim_model, hidden, dropout=0.0):
super(Position_wise_Feed_Forward, self).__init__()
self.fc1 = nn.Linear(dim_model, hidden)
self.fc2 = nn.Linear(hidden, dim_m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | NTDXYG/Text-Classify-based-pytorch | Position_wise_Feed_Forward | false | 8,577 | [
"Apache-2.0"
] | 20 | b12a264a0ea64b2f8b46fafd5383ef0a8025ef2f | https://github.com/NTDXYG/Text-Classify-based-pytorch/tree/b12a264a0ea64b2f8b46fafd5383ef0a8025ef2f |
CopyChannels | import torch
class CopyChannels(torch.nn.Module):
def __init__(self, multiple=3, dim=1):
super(CopyChannels, self).__init__()
self.multiple = multiple
self.dim = dim
def forward(self, x):
return torch.cat([x for _ in range(self.multiple)], dim=self.dim)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
reinterpret... | NehzUx/autodl | CopyChannels | false | 8,578 | [
"Apache-2.0"
] | 25 | c80fdc4b297ed1ec2b9e6911d313f1fe31d83cb9 | https://github.com/NehzUx/autodl/tree/c80fdc4b297ed1ec2b9e6911d313f1fe31d83cb9 |
BBoxTransform | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class BBoxTransform(nn.Module):
def forward(self, anchors, regression):
"""
decode_box_outputs adapted from https://github.com/google/automl/blob/master/effic... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import ... | NHERI-SimCenter/BRAILS | BBoxTransform | false | 8,579 | [
"BSD-3-Clause"
] | 22 | ec17bcd000b15cb8c2933728fe2fd1fb190cd852 | https://github.com/NHERI-SimCenter/BRAILS/tree/ec17bcd000b15cb8c2933728fe2fd1fb190cd852 |
BinaryCrossEntropyLabelSmooth | import torch
class BinaryCrossEntropyLabelSmooth(torch.nn.BCEWithLogitsLoss):
def __init__(self, num_classes, epsilon=0.1, weight=None, size_average=
None, reduce=None, reduction='mean', pos_weight=None):
super(BinaryCrossEntropyLabelSmooth, self).__init__(weight,
size_average, reduce... | 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
assert_size... | NehzUx/autodl | BinaryCrossEntropyLabelSmooth | false | 8,580 | [
"Apache-2.0"
] | 25 | c80fdc4b297ed1ec2b9e6911d313f1fe31d83cb9 | https://github.com/NehzUx/autodl/tree/c80fdc4b297ed1ec2b9e6911d313f1fe31d83cb9 |
Conv2dStaticSamePadding | import math
import torch
from torch import nn
from torch.nn import functional as F
from torchvision.transforms import functional as F
class Conv2dStaticSamePadding(nn.Module):
"""
created by Zylo117
The real keras/tensorflow conv2d with same padding
"""
def __init__(self, in_channels, out_channel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | NaCl-Ocean/Anchor_free_detection_rotation | Conv2dStaticSamePadding | false | 8,581 | [
"MIT"
] | 12 | 358d9f5df1beabc7a05a352d2cfa2283b17825a9 | https://github.com/NaCl-Ocean/Anchor_free_detection_rotation/tree/358d9f5df1beabc7a05a352d2cfa2283b17825a9 |
TestTimeIN | import torch
import torch.nn as nn
import torch.optim
import torch.nn.parallel
import torch.utils.data
import torch.utils.data.distributed
class TestTimeIN(nn.BatchNorm2d):
def __init__(self, num_features: 'int', eps: 'float'=1e-05, momentum:
'float'=1, affine: 'bool'=True, track_running_stats: 'bool'=Tr... | 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... | MosyMosy/Pytorch_ImaneNet_With_wandb | TestTimeIN | false | 8,582 | [
"MIT"
] | 30 | b7b6e245e29ec342212025b8164e5053d4197fa1 | https://github.com/MosyMosy/Pytorch_ImaneNet_With_wandb/tree/b7b6e245e29ec342212025b8164e5053d4197fa1 |
MaxNormConstraintConv2d | import torch
import torch.nn as nn
class MaxNormConstraintConv2d(nn.Conv2d):
def __init__(self, *args, max_norm_value=1, norm_axis=2, **kwargs):
self.max_norm_value = max_norm_value
self.norm_axis = norm_axis
super().__init__(*args, **kwargs)
def forward(self, input):
self.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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Mrswolf/brainda | MaxNormConstraintConv2d | false | 8,583 | [
"MIT"
] | 24 | cbd2fa6334d9e6243324dbaf086be4eb4047e801 | https://github.com/Mrswolf/brainda/tree/cbd2fa6334d9e6243324dbaf086be4eb4047e801 |
FeedForwardBlock | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
class PositionwiseFeedForward(nn.Module):
def __init__(self, config):
super(PositionwiseFeedForward, self).__init__()
self.w_1 = nn.Linear(config.d_model, config.d_f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MSU-MLSys-Lab/CATE | FeedForwardBlock | false | 8,584 | [
"Apache-2.0"
] | 15 | 654c393d7df888d2c3f3b90f9e6752faa061157e | https://github.com/MSU-MLSys-Lab/CATE/tree/654c393d7df888d2c3f3b90f9e6752faa061157e |
SmoothL1loss_with_weight | import torch
from torch import nn
class SmoothL1loss_with_weight(nn.Module):
def __init__(self):
super(SmoothL1loss_with_weight, self).__init__()
def forward(self, pred, targets, weights):
assert pred.shape[0] == targets.shape[0] == weights.shape[0]
loss = nn.SmoothL1Loss(reduction='... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | NaCl-Ocean/Anchor_free_detection_rotation | SmoothL1loss_with_weight | false | 8,585 | [
"MIT"
] | 12 | 358d9f5df1beabc7a05a352d2cfa2283b17825a9 | https://github.com/NaCl-Ocean/Anchor_free_detection_rotation/tree/358d9f5df1beabc7a05a352d2cfa2283b17825a9 |
SoftHistogram | import torch
class SoftHistogram(torch.nn.Module):
"""
Motivated by https://discuss.pytorch.org/t/differentiable-torch-histc/25865/3
"""
def __init__(self, bins, min_bin_edge, max_bin_edge, sigma):
super(SoftHistogram, self).__init__()
self.sigma = sigma
self.delta = float(max... | 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... | NiallJeffrey/DeepMass | SoftHistogram | false | 8,586 | [
"MIT"
] | 13 | 6bf11bd08082562161a2f91cd40dc57abba12396 | https://github.com/NiallJeffrey/DeepMass/tree/6bf11bd08082562161a2f91cd40dc57abba12396 |
FocalLoss | import torch
import torch.utils.data
import torch
import torch._utils
import torch.nn as nn
class FocalLoss(nn.Module):
def __init__(self, gamma=0, eps=1e-07):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.eps = eps
self.ce = torch.nn.CrossEntropyLoss()
def forwar... | 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.utils.dat... | Mukosame/AODA | FocalLoss | false | 8,587 | [
"BSD-3-Clause"
] | 43 | c187e5ff0a6502a9166da37a213ee259afa60903 | https://github.com/Mukosame/AODA/tree/c187e5ff0a6502a9166da37a213ee259afa60903 |
ConvEncoder | import torch
from torch import nn
import torch.nn.functional as F
class ConvEncoder(nn.Module):
def __init__(self, input_dim=512, output_dim=512, kernel_size=1,
init_scale=1.0, no_weight_init=False):
super(ConvEncoder, self).__init__()
self.conv = nn.Conv1d(input_dim, output_dim, kernel_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 import nn
assert_s... | KH-Kyle/rmp_nav | ConvEncoder | false | 8,588 | [
"MIT"
] | 30 | d598fe70664a4cdc0e9b9dd4b52e84aa3de1b551 | https://github.com/KH-Kyle/rmp_nav/tree/d598fe70664a4cdc0e9b9dd4b52e84aa3de1b551 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.