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 |
|---|---|---|---|---|---|---|---|---|---|---|
ExtendedModel | import torch
import torch.nn as nn
class ExtendedModel(nn.Module):
def __init__(self, D_in, H, D_out):
"""
In the constructor we instantiate two nn.Linear modules and assign them as
member variables.
"""
super(ExtendedModel, self).__init__()
self.linear1 = 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
import torch.nn as nn
assert_... | SID262000/BentoML | ExtendedModel | false | 9,419 | [
"Apache-2.0"
] | 0 | 0708a6495e4d1f0ddf639026be768abf2d55410a | https://github.com/SID262000/BentoML/tree/0708a6495e4d1f0ddf639026be768abf2d55410a |
Conv2dBlock | import torch
from torch import nn
import torch.nn.functional as F
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | PredatorK9/GANwriting | Conv2dBlock | false | 9,420 | [
"MIT"
] | 0 | 246d7e87152c98f0c6af999d619dc51190fad8ae | https://github.com/PredatorK9/GANwriting/tree/246d7e87152c98f0c6af999d619dc51190fad8ae |
PreprocessAtari | import torch
from torch import nn
class PreprocessAtari(nn.Module):
def forward(self, x):
x = x.permute(0, 3, 1, 2).contiguous()
return x / 255.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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | SemyonSemenov/mipt-rl-hw-2022 | PreprocessAtari | false | 9,421 | [
"MIT"
] | 0 | 923fd0b7e3f900c1a91ddf256c9b6f53a62d1653 | https://github.com/SemyonSemenov/mipt-rl-hw-2022/tree/923fd0b7e3f900c1a91ddf256c9b6f53a62d1653 |
HardSigmoid | import torch
from torch import nn
import torch.nn.functional as F
class HardSigmoid(nn.Module):
def __init__(self, slope=0.2, offset=0.5):
super().__init__()
self.slope = slope
self.offset = offset
def forward(self, x):
x = self.slope * x + self.offset
x = F.threshold... | 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... | LDOUBLEV/DBNet.pytorch | HardSigmoid | false | 9,422 | [
"Apache-2.0"
] | 0 | 206f4a1e5cc3686284476f029a26fc69f610e898 | https://github.com/LDOUBLEV/DBNet.pytorch/tree/206f4a1e5cc3686284476f029a26fc69f610e898 |
MaskL1Loss | import torch
from torch import nn
class MaskL1Loss(nn.Module):
def __init__(self, eps=1e-06):
super(MaskL1Loss, self).__init__()
self.eps = eps
def forward(self, pred: 'torch.Tensor', gt, mask):
loss = (torch.abs(pred - gt) * mask).sum() / (mask.sum() + self.eps)
return loss
... | 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... | LDOUBLEV/DBNet.pytorch | MaskL1Loss | false | 9,423 | [
"Apache-2.0"
] | 0 | 206f4a1e5cc3686284476f029a26fc69f610e898 | https://github.com/LDOUBLEV/DBNet.pytorch/tree/206f4a1e5cc3686284476f029a26fc69f610e898 |
ResBlock | import torch
import torch.nn as nn
from torch.nn import functional as F
class ResBlock(nn.Module):
"""Residual block with upsampling/downsampling.
Args:
in_channels (int): Channel number of the input.
out_channels (int): Channel number of the output.
"""
def __init__(self, in_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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | PrimeshShamilka/GFPGAN | ResBlock | false | 9,424 | [
"BSD-3-Clause"
] | 0 | 3ba48b932d41a4faa906e5cd39794b60845db708 | https://github.com/PrimeshShamilka/GFPGAN/tree/3ba48b932d41a4faa906e5cd39794b60845db708 |
SEBlock | import torch
from torch import nn
import torch.nn.functional as F
class HardSigmoid(nn.Module):
def __init__(self, slope=0.2, offset=0.5):
super().__init__()
self.slope = slope
self.offset = offset
def forward(self, x):
x = self.slope * x + self.offset
x = F.threshold... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | LDOUBLEV/DBNet.pytorch | SEBlock | false | 9,425 | [
"Apache-2.0"
] | 0 | 206f4a1e5cc3686284476f029a26fc69f610e898 | https://github.com/LDOUBLEV/DBNet.pytorch/tree/206f4a1e5cc3686284476f029a26fc69f610e898 |
QNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=1024,
fc2_units=512):
"""Initialize parameters and build model.
Params
======
state... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | SagarRathod-TomTom/Navigation-Deep-Reinforcement-Learning-Nanodegree | QNetwork | false | 9,426 | [
"MIT"
] | 0 | a13597d5077785bd486d8ce528dc177685226b1c | https://github.com/SagarRathod-TomTom/Navigation-Deep-Reinforcement-Learning-Nanodegree/tree/a13597d5077785bd486d8ce528dc177685226b1c |
SkipLastTargetChannelWrapper | import torch
from torch import nn as nn
from torch.nn import MSELoss
class SkipLastTargetChannelWrapper(nn.Module):
"""
Loss wrapper which removes additional target channel
"""
def __init__(self, loss, squeeze_channel=False):
super(SkipLastTargetChannelWrapper, self).__init__()
self.l... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | PerceptionComputingLab/PARSE2022 | SkipLastTargetChannelWrapper | false | 9,427 | [
"Apache-2.0"
] | 0 | a34886ed9d06b424bc93953f1b2f79540ad9ebf6 | https://github.com/PerceptionComputingLab/PARSE2022/tree/a34886ed9d06b424bc93953f1b2f79540ad9ebf6 |
ToRGB | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
def make_kernel(k):
k = torch.tensor(k, dtype=torc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 math
import torch.nn as nn
import tor... | AsianZeus/Diverse-Facial-Edit | ToRGB | false | 9,428 | [
"Apache-2.0"
] | 0 | 3d4b1b41546a08a1fa3cb164ade33e319806b12b | https://github.com/AsianZeus/Diverse-Facial-Edit/tree/3d4b1b41546a08a1fa3cb164ade33e319806b12b |
BCEDiceLoss | import torch
from torch import nn as nn
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_order = (1, 0) + tuple(range(2, tensor.dim()))
transposed... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | PerceptionComputingLab/PARSE2022 | BCEDiceLoss | false | 9,430 | [
"Apache-2.0"
] | 0 | a34886ed9d06b424bc93953f1b2f79540ad9ebf6 | https://github.com/PerceptionComputingLab/PARSE2022/tree/a34886ed9d06b424bc93953f1b2f79540ad9ebf6 |
ActFirstResBlock | import torch
from torch import nn
import torch.nn.functional as F
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super(AdaptiveInstanceNorm2d, self).__init__()
self.num_features = num_features
self.eps = eps
self.momentum = mome... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | PredatorK9/GANwriting | ActFirstResBlock | false | 9,431 | [
"MIT"
] | 0 | 246d7e87152c98f0c6af999d619dc51190fad8ae | https://github.com/PredatorK9/GANwriting/tree/246d7e87152c98f0c6af999d619dc51190fad8ae |
GatedFusion | import torch
import torch.nn as nn
import torch.utils.data
import torch.multiprocessing
import torch.nn.modules.loss
from scipy.sparse import *
class GatedFusion(nn.Module):
def __init__(self, hidden_size):
super(GatedFusion, self).__init__()
"""GatedFusion module"""
self.fc_z = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.multiprocessing
impor... | LucasAPayne/graph4nlp | GatedFusion | false | 9,432 | [
"Apache-2.0"
] | 0 | 3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421 | https://github.com/LucasAPayne/graph4nlp/tree/3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421 |
Net | import torch
import torch.fft
import torch.nn.functional as torchf
class Net(torch.nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = torch.nn.Conv2d(2, 4, 3, padding=1)
self.conv2 = torch.nn.Conv2d(4, 4, 3, padding=1)
self.conv3 = torch.nn.Conv2d(4, 2, 3, pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.fft
assert_size_... | Sh0cktr4p/PhiFlow | Net | false | 9,433 | [
"MIT"
] | 0 | cc87c5887bc3abfa1ef3c03252122a06e9fd2c18 | https://github.com/Sh0cktr4p/PhiFlow/tree/cc87c5887bc3abfa1ef3c03252122a06e9fd2c18 |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.nn.functional as F
class PositionwiseFeedForward(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_in, d_hid, dropout=0.1):
super().__init__()
self.w_1 = nn.Linear(d_in, d_hid)
self.w_2 = nn.Linear(d_hid, d_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
from torch._inductor.runtime.... | PINE4PPLE/transformer-lm | PositionwiseFeedForward | false | 9,434 | [
"MIT"
] | 0 | da76a4afd29d1fd023ba866ccc21a49901ad46f2 | https://github.com/PINE4PPLE/transformer-lm/tree/da76a4afd29d1fd023ba866ccc21a49901ad46f2 |
SeparableBlock | from torch.nn import Module
import torch
from torch.nn import Linear
class SeparableBlock(Module):
def __init__(self, input_size, kernel_channels_in, kernel_channels_out,
kernel_size):
super(SeparableBlock, self).__init__()
self.input_size = input_size
self.kernel_size = kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch.nn import Linear
assert_size_stride = tor... | RoyNijhuis/FaceFormer | SeparableBlock | false | 9,435 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | 0 | 197d6598b705b988a4ad275c2333bcde6a5eaf9f | https://github.com/RoyNijhuis/FaceFormer/tree/197d6598b705b988a4ad275c2333bcde6a5eaf9f |
GlobalAvgPool2d | import torch
from torch import nn
class GlobalAvgPool2d(nn.Module):
"""Performs global average pooling over the entire height and width of a batched 2D tensor
# Arguments
input: Input tensor
"""
def forward(self, input):
return nn.functional.avg_pool2d(input, kernel_size=input.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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Shadowalker1995/few-shot | GlobalAvgPool2d | false | 9,436 | [
"MIT"
] | 0 | 68026f4d5d092b9cb7cc3b50ba8d28ca1b70ade9 | https://github.com/Shadowalker1995/few-shot/tree/68026f4d5d092b9cb7cc3b50ba8d28ca1b70ade9 |
GlobalMaxPool1d | import torch
from torch import nn
class GlobalMaxPool1d(nn.Module):
"""Performs global max pooling over the entire length of a batched 1D tensor
# Arguments
input: Input tensor
"""
def forward(self, input):
return nn.functional.max_pool1d(input, kernel_size=input.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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | Shadowalker1995/few-shot | GlobalMaxPool1d | false | 9,437 | [
"MIT"
] | 0 | 68026f4d5d092b9cb7cc3b50ba8d28ca1b70ade9 | https://github.com/Shadowalker1995/few-shot/tree/68026f4d5d092b9cb7cc3b50ba8d28ca1b70ade9 |
SpatialAttention | import torch
from torch import nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv1 = nn.Conv2d(2, 1, kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | Panpan-Chen/Attention-Block-U-net | SpatialAttention | false | 9,438 | [
"MIT"
] | 0 | 7e0cef46ea485db1bb9a9e4511eb0535e460179e | https://github.com/Panpan-Chen/Attention-Block-U-net/tree/7e0cef46ea485db1bb9a9e4511eb0535e460179e |
StdConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class StdConv2d(nn.Conv2d):
def forward(self, x):
w = self.weight
v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False)
w = (w - m) / torch.sqrt(v + 1e-05)
return F.conv2d(x, w, self.bias, self.stri... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Quallle/TransUNet | StdConv2d | false | 9,439 | [
"Apache-2.0"
] | 0 | cf62a2a021e096c105b3fc62958a1eeb231e7a8f | https://github.com/Quallle/TransUNet/tree/cf62a2a021e096c105b3fc62958a1eeb231e7a8f |
SelfAttention | import torch
import torch.nn as nn
import torch.utils.data
import torch.multiprocessing
import torch.nn.modules.loss
from scipy.sparse import *
class SelfAttention(nn.Module):
def __init__(self, input_size, hidden_size):
super(SelfAttention, self).__init__()
self.W1 = torch.Tensor(input_size, hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LucasAPayne/graph4nlp | SelfAttention | false | 9,440 | [
"Apache-2.0"
] | 0 | 3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421 | https://github.com/LucasAPayne/graph4nlp/tree/3b72308f6ed9ce04c535f78b4b21b6ae0a8f5421 |
NCESoftmaxLoss | import torch
from torch import nn
import torch.utils.data
class NCESoftmaxLoss(nn.Module):
def __init__(self):
super(NCESoftmaxLoss, self).__init__()
self.criterion = nn.CrossEntropyLoss()
def forward(self, x, label):
x.shape[0]
x = x.squeeze()
loss = self.criterion(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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
i... | Shreyas-Gururaj/Point_Contrast_ME0.5.3 | NCESoftmaxLoss | false | 9,441 | [
"MIT"
] | 0 | 72bc78001b0b4529ca96f193764dcac0c5a0ce0f | https://github.com/Shreyas-Gururaj/Point_Contrast_ME0.5.3/tree/72bc78001b0b4529ca96f193764dcac0c5a0ce0f |
Downsample | import torch
import torch.nn as nn
class Downsample(nn.Module):
def __init__(self, in_channels, with_conv):
super().__init__()
self.with_conv = with_conv
if self.with_conv:
self.conv = torch.nn.Conv2d(in_channels, in_channels,
kernel_size=3, stride=2, padding=0... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Rm1n90/SDEdit | Downsample | false | 9,442 | [
"MIT"
] | 0 | 16bfa4f5d37cd32680359db3405af4ea40a9cd1b | https://github.com/Rm1n90/SDEdit/tree/16bfa4f5d37cd32680359db3405af4ea40a9cd1b |
Upsample | import torch
import torch.nn as nn
class Upsample(nn.Module):
def __init__(self, in_channels, with_conv):
super().__init__()
self.with_conv = with_conv
if self.with_conv:
self.conv = torch.nn.Conv2d(in_channels, in_channels,
kernel_size=3, stride=1, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Rm1n90/SDEdit | Upsample | false | 9,443 | [
"MIT"
] | 0 | 16bfa4f5d37cd32680359db3405af4ea40a9cd1b | https://github.com/Rm1n90/SDEdit/tree/16bfa4f5d37cd32680359db3405af4ea40a9cd1b |
ThresholdedRelu | import torch
from torch import nn
import torch.onnx
class ThresholdedRelu(nn.Module):
def __init__(self, alpha=1.0):
self.alpha = alpha
super().__init__()
def forward(self, X: 'torch.Tensor'):
Y = torch.clamp(X, min=self.alpha)
Y[Y == self.alpha] = 0.0
return Y
def ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.asser... | Piteryo/onnx2pytorch | ThresholdedRelu | false | 9,444 | [
"Apache-2.0"
] | 0 | c25b3a5289ee7073d644d280a112c15382b7f690 | https://github.com/Piteryo/onnx2pytorch/tree/c25b3a5289ee7073d644d280a112c15382b7f690 |
Transition | import torch
import torch.nn as nn
class Transition(nn.Module):
def __init__(self, in_features, out_features, act_layer=nn.GELU):
super(Transition, self).__init__()
self.act = act_layer()
self.linear = nn.Linear(in_features, out_features)
def forward(self, x):
x = self.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.triton_helpers import libdevice
import torch.nn as ... | Roxbili/T2T-ViT | Transition | false | 9,445 | [
"BSD-3-Clause-Clear"
] | 0 | c5442bc560ea15b421130f13e31c4b68f52c1e5a | https://github.com/Roxbili/T2T-ViT/tree/c5442bc560ea15b421130f13e31c4b68f52c1e5a |
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... | OmeGaNo1/PyTorch-VAE | VectorQuantizer | false | 9,446 | [
"Apache-2.0"
] | 0 | e7b6aad70682b574c947947733794b4246a48838 | https://github.com/OmeGaNo1/PyTorch-VAE/tree/e7b6aad70682b574c947947733794b4246a48838 |
LinearZeros | import torch
import torch.nn as nn
class LinearZeros(nn.Linear):
def __init__(self, in_channels, out_channels, logscale_factor=3):
super().__init__(in_channels, out_channels)
self.logscale_factor = logscale_factor
self.register_parameter('logs', nn.Parameter(torch.zeros(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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | ShreyDixit/glow-pytorch | LinearZeros | false | 9,447 | [
"MIT"
] | 0 | a964ba181898183c41f6ec6122a71b925ac33efa | https://github.com/ShreyDixit/glow-pytorch/tree/a964ba181898183c41f6ec6122a71b925ac33efa |
PRelu | import torch
from torch import nn
import torch.onnx
class PRelu(nn.Module):
def forward(self, X: 'torch.Tensor', slope: 'torch.Tensor'):
return torch.clamp(X, min=0) + torch.clamp(X, max=0) * slope
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_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
from torch import nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.asser... | Piteryo/onnx2pytorch | PRelu | false | 9,448 | [
"Apache-2.0"
] | 0 | c25b3a5289ee7073d644d280a112c15382b7f690 | https://github.com/Piteryo/onnx2pytorch/tree/c25b3a5289ee7073d644d280a112c15382b7f690 |
FCTestNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class FCTestNN(nn.Module):
def __init__(self, class_size):
super(FCTestNN, self).__init__()
self.name = 'FCTestNN'
self.fc1 = nn.Linear(3 * 224 * 224, 256)
self.fc2 = nn.Linear(256, class_size)
def forward(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
import torch.nn as nn
assert_... | NirooshKa/APS360-Cold-Start-Problem | FCTestNN | false | 9,449 | [
"MIT"
] | 0 | 4c864737b4e6db992e99610a0ed8e82c957fd6cc | https://github.com/NirooshKa/APS360-Cold-Start-Problem/tree/4c864737b4e6db992e99610a0ed8e82c957fd6cc |
UsedIndices | import torch
from torch import nn
import torch.onnx
class UsedIndices(nn.Module):
def __init__(self):
super().__init__()
self.mp = nn.MaxPool2d(kernel_size=[3, 3], stride=[2, 2], ceil_mode
=True, return_indices=True)
def forward(self, x):
y, indices = self.mp(x)
r... | 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.onnx
assert_size_stride = torch._C._dynamo.guards.asser... | Piteryo/onnx2pytorch | UsedIndices | false | 9,450 | [
"Apache-2.0"
] | 0 | c25b3a5289ee7073d644d280a112c15382b7f690 | https://github.com/Piteryo/onnx2pytorch/tree/c25b3a5289ee7073d644d280a112c15382b7f690 |
Classification | import torch
import torch.nn as nn
class Classification(nn.Module):
"""一个最简单的一层分类模型
Parameters:
input_size:输入维度
num_classes:类别数量
return:
logists:最大概率对应的标签
"""
def __init__(self, input_size, num_classes):
super(Classification, self).__init__()
self.fc1 = 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.... | OuYangg/GNNs | Classification | false | 9,451 | [
"Apache-2.0"
] | 0 | ef5b1944490507684d603de3ae0b2aa7b5168f47 | https://github.com/OuYangg/GNNs/tree/ef5b1944490507684d603de3ae0b2aa7b5168f47 |
SigmoidFocalClassificationLoss | import torch
import torch.nn as nn
def _sigmoid_cross_entropy_with_logits(logits, labels):
loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits)
loss += torch.log1p(torch.exp(-torch.abs(logits)))
return loss
class SigmoidFocalClassificationLoss(nn.Module):
"""Sigmoid focal cross entrop... | 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... | ShashwatNigam99/PointRCNN | SigmoidFocalClassificationLoss | false | 9,452 | [
"MIT"
] | 0 | eee5f90fe4215cff0156e1f8cecf485e18dce1f8 | https://github.com/ShashwatNigam99/PointRCNN/tree/eee5f90fe4215cff0156e1f8cecf485e18dce1f8 |
MINCNet | import torch
import torch.nn as nn
import torch.utils.data
class MINCNet(nn.Module):
def __init__(self):
super(MINCNet, self).__init__()
self.ReLU = nn.ReLU(True)
self.conv11 = nn.Conv2d(3, 64, 3, 1, 1)
self.conv12 = nn.Conv2d(64, 64, 3, 1, 1)
self.maxpool1 = nn.MaxPool2d(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | NicoleDeer/optimized-super-resolution | MINCNet | false | 9,453 | [
"Apache-2.0"
] | 0 | deba8a5cff06ab3bd8bf99e207b582f4ddc1ffd1 | https://github.com/NicoleDeer/optimized-super-resolution/tree/deba8a5cff06ab3bd8bf99e207b582f4ddc1ffd1 |
UnusedIndices | import torch
from torch import nn
import torch.onnx
class UnusedIndices(nn.Module):
def __init__(self):
super().__init__()
self.mp = nn.MaxPool2d(kernel_size=[3, 3], stride=[2, 2], ceil_mode
=True)
def forward(self, x):
return self.mp(x) - 42
def get_inputs():
retur... | 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.onnx
assert_size_stride = torch._C._dynamo.guards.asser... | Piteryo/onnx2pytorch | UnusedIndices | false | 9,454 | [
"Apache-2.0"
] | 0 | c25b3a5289ee7073d644d280a112c15382b7f690 | https://github.com/Piteryo/onnx2pytorch/tree/c25b3a5289ee7073d644d280a112c15382b7f690 |
Mean | import torch
from torchvision.datasets import *
import torch.nn as nn
from torchvision.transforms import *
class Mean(nn.Module):
def __init__(self, dim, keep_dim=False):
super(Mean, self).__init__()
self.dim = dim
self.keep_dim = keep_dim
def forward(self, input):
return 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 torchvision.datasets import *
import torch.nn as nn
from torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guards.a... | JJavierga/PyTorch-Encoding | Mean | false | 9,455 | [
"MIT"
] | 0 | 207254b2a60276a31ffa24b76ae84df27c6ebf94 | https://github.com/JJavierga/PyTorch-Encoding/tree/207254b2a60276a31ffa24b76ae84df27c6ebf94 |
SageLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class SageLayer(nn.Module):
"""
一层SageLayer
"""
def __init__(self, input_size, out_size, gcn=False):
super(SageLayer, self).__init__()
self.input_size = input_size
self.out_size = out_size
self.gcn = gc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | OuYangg/GNNs | SageLayer | false | 9,456 | [
"Apache-2.0"
] | 0 | ef5b1944490507684d603de3ae0b2aa7b5168f47 | https://github.com/OuYangg/GNNs/tree/ef5b1944490507684d603de3ae0b2aa7b5168f47 |
CELoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class CELoss(nn.Module):
def __init__(self, ratio=1, weight=None, size_average=None,
ignore_index=-100, reduce=None, reduction='mean'):
super(CELoss, 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
... | Karenou/mmfashion | CELoss | false | 9,457 | [
"Apache-2.0"
] | 0 | dfc334232d1700cde18d144f983dd5b0a7f9852a | https://github.com/Karenou/mmfashion/tree/dfc334232d1700cde18d144f983dd5b0a7f9852a |
RobertaSequenceClassificationHead | import torch
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class RobertaSequenceClassificationHead(nn.Module):
"""Head for sequence-level classification tasks. Ignores the <s> vector."""
def __init__(self, input_dim, inner_dim, ke... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.onnx.operators
import... | Sanjaje/stp_llmushu | RobertaSequenceClassificationHead | false | 9,458 | [
"MIT"
] | 0 | f6652c9c0506780374b4634933b1b725e989de24 | https://github.com/Sanjaje/stp_llmushu/tree/f6652c9c0506780374b4634933b1b725e989de24 |
FeatureCorrelation | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class FeatureCorrelation(nn.Module):
def __init__(self):
super(FeatureCorrelation, self).__init__()
def forward(self, feat_a, feat_b):
bs, c, h, w = feat_a.size()
feat_a = feat_a.tr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Karenou/mmfashion | FeatureCorrelation | false | 9,459 | [
"Apache-2.0"
] | 0 | dfc334232d1700cde18d144f983dd5b0a7f9852a | https://github.com/Karenou/mmfashion/tree/dfc334232d1700cde18d144f983dd5b0a7f9852a |
FeatureNorm | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class FeatureNorm(nn.Module):
def __init__(self, eps=1e-06):
super(FeatureNorm, self).__init__()
self.eps = eps
def forward(self, feature):
norm_feat = torch.sum(torch.pow(feature, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.... | Karenou/mmfashion | FeatureNorm | false | 9,460 | [
"Apache-2.0"
] | 0 | dfc334232d1700cde18d144f983dd5b0a7f9852a | https://github.com/Karenou/mmfashion/tree/dfc334232d1700cde18d144f983dd5b0a7f9852a |
GCN | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class GCNLayer(nn.Module):
def __init__(self, input_features, output_features, bias=False):
super(GCNLayer, self).__init__()
self.input_features = input_features
self.output_features = output_features
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.... | OuYangg/GNNs | GCN | false | 9,461 | [
"Apache-2.0"
] | 0 | ef5b1944490507684d603de3ae0b2aa7b5168f47 | https://github.com/OuYangg/GNNs/tree/ef5b1944490507684d603de3ae0b2aa7b5168f47 |
Normalize | import torch
from torchvision.datasets import *
import torch.nn.functional as F
import torch.nn as nn
from torchvision.transforms import *
class Normalize(nn.Module):
"""Performs :math:`L_p` normalization of inputs over specified dimension.
Does:
.. math::
v = \\frac{v}{\\max(\\lVert v \\rVert_p... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torchvision.datasets im... | JJavierga/PyTorch-Encoding | Normalize | false | 9,462 | [
"MIT"
] | 0 | 207254b2a60276a31ffa24b76ae84df27c6ebf94 | https://github.com/JJavierga/PyTorch-Encoding/tree/207254b2a60276a31ffa24b76ae84df27c6ebf94 |
L1NormLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class L1NormLoss(nn.Module):
def __init__(self, loss_weight=0.0005, average=True):
super(L1NormLoss, self).__init__()
self.loss_weight = loss_weight
self.average = average
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
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | Karenou/mmfashion | L1NormLoss | false | 9,463 | [
"Apache-2.0"
] | 0 | dfc334232d1700cde18d144f983dd5b0a7f9852a | https://github.com/Karenou/mmfashion/tree/dfc334232d1700cde18d144f983dd5b0a7f9852a |
SmoothL1Loss | import torch
import torch.nn.functional as F
import torch.nn as nn
def smooth_l1_loss(pred, target, beta=1.0, reduction='mean'):
assert beta > 0
assert pred.size() == target.size() and target.numel() > 0
diff = torch.abs(pred - target)
loss = torch.where(diff < beta, 0.5 * diff * diff / beta, diff - 0... | 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.functi... | Sign-up-soon-after-papapa/DEA-Net | SmoothL1Loss | false | 9,464 | [
"Apache-2.0"
] | 0 | ed25f30ddedcb77eb0991aeb9e498ef2efd8c635 | https://github.com/Sign-up-soon-after-papapa/DEA-Net/tree/ed25f30ddedcb77eb0991aeb9e498ef2efd8c635 |
UpsampleConv2d | from torch.nn import Module
import math
import torch
from torchvision.datasets import *
import torch.nn.functional as F
from torch.nn import Parameter
from torch.nn.modules.utils import _pair
from torchvision.transforms import *
class UpsampleConv2d(Module):
"""
To avoid the checkerboard artifacts of standard... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 torchvision.datasets import *
from ... | JJavierga/PyTorch-Encoding | UpsampleConv2d | false | 9,465 | [
"MIT"
] | 0 | 207254b2a60276a31ffa24b76ae84df27c6ebf94 | https://github.com/JJavierga/PyTorch-Encoding/tree/207254b2a60276a31ffa24b76ae84df27c6ebf94 |
MarginRankingLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class MarginRankingLoss(nn.Module):
def __init__(self, margin=0.2, loss_weight=5e-05, size_average=None,
reduce=None, reduction='mean'):
super(MarginRankingLoss, ... | 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.optim
import torch.utils.data... | Karenou/mmfashion | MarginRankingLoss | false | 9,466 | [
"Apache-2.0"
] | 0 | dfc334232d1700cde18d144f983dd5b0a7f9852a | https://github.com/Karenou/mmfashion/tree/dfc334232d1700cde18d144f983dd5b0a7f9852a |
GlobalAvgPool1d | import torch
import torch.nn as nn
class GlobalAvgPool1d(nn.Module):
def __init__(self):
"""Global average pooling over the input's spatial dimensions"""
super(GlobalAvgPool1d, self).__init__()
def forward(self, inputs):
return nn.functional.adaptive_avg_pool1d(inputs, 1).view(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... | Neronjust2017/challenge2020_test4 | GlobalAvgPool1d | false | 9,467 | [
"BSD-2-Clause"
] | 0 | 6494107a459b563aa51f8ea75c580c17557b13af | https://github.com/Neronjust2017/challenge2020_test4/tree/6494107a459b563aa51f8ea75c580c17557b13af |
SelectiveMarginLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class SelectiveMarginLoss(nn.Module):
def __init__(self, loss_weight=5e-05, margin=0.2):
super(SelectiveMarginLoss, self).__init__()
self.margin = margin
self.loss_weight = loss_weight
... | 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.optim
import torch.utils.data... | Karenou/mmfashion | SelectiveMarginLoss | false | 9,468 | [
"Apache-2.0"
] | 0 | dfc334232d1700cde18d144f983dd5b0a7f9852a | https://github.com/Karenou/mmfashion/tree/dfc334232d1700cde18d144f983dd5b0a7f9852a |
TCB | import torch
import torch.nn as nn
from itertools import product as product
import torch.onnx.symbolic_helper
class TCB(nn.Module):
"""
Transfer Connection Block Architecture
This block
"""
def __init__(self, lateral_channels, channles, internal_channels=256,
is_batchnorm=False):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from it... | SaralaSewwandi/refinedet-onnxvalidation | TCB | false | 9,469 | [
"MIT"
] | 0 | 5b71c994fc6ca183dc6cb30b7e21d201c15da490 | https://github.com/SaralaSewwandi/refinedet-onnxvalidation/tree/5b71c994fc6ca183dc6cb30b7e21d201c15da490 |
GramMatrix | import torch
from torchvision.datasets import *
import torch.nn as nn
from torchvision.transforms import *
class GramMatrix(nn.Module):
""" Gram Matrix for a 4D convolutional featuremaps as a mini-batch
.. math::
\\mathcal{G} = \\sum_{h=1}^{H_i}\\sum_{w=1}^{W_i} \\mathcal{F}_{h,w}\\mathcal{F}_{h,w}^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
from torchvision.datasets import *
import torch.nn as nn
from torchvision.transf... | JJavierga/PyTorch-Encoding | GramMatrix | false | 9,470 | [
"MIT"
] | 0 | 207254b2a60276a31ffa24b76ae84df27c6ebf94 | https://github.com/JJavierga/PyTorch-Encoding/tree/207254b2a60276a31ffa24b76ae84df27c6ebf94 |
MSELoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class MSELoss(nn.Module):
def __init__(self, ratio=1, size_average=None, reduce=None, reduction=
'mean'):
super(MSELoss, self).__init__()
self.ratio = rat... | 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.optim
import torch.utils.data... | Karenou/mmfashion | MSELoss | false | 9,471 | [
"Apache-2.0"
] | 0 | dfc334232d1700cde18d144f983dd5b0a7f9852a | https://github.com/Karenou/mmfashion/tree/dfc334232d1700cde18d144f983dd5b0a7f9852a |
SpatialAttention | import torch
import torch.nn as nn
class SpatialAttention(nn.Module):
def __init__(self, kernel_size=7):
super(SpatialAttention, self).__init__()
assert kernel_size in (3, 7), 'kernel size must be 3 or 7'
padding = 3 if kernel_size == 7 else 1
self.conv1 = nn.Conv1d(2, 1, 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
import torch.nn as nn
assert_... | Neronjust2017/challenge2020_test4 | SpatialAttention | false | 9,472 | [
"BSD-2-Clause"
] | 0 | 6494107a459b563aa51f8ea75c580c17557b13af | https://github.com/Neronjust2017/challenge2020_test4/tree/6494107a459b563aa51f8ea75c580c17557b13af |
MultiHeadedLinerAttention | import torch
from torch import nn
class MultiHeadedLinerAttention(nn.Module):
"""Multi-Head Linear Attention layer.
Args:
n_head (int): The number of heads.
n_feat (int): The number of features.
dropout_rate (float): Dropout rate.
"""
def __init__(self, n_head, n_feat, 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.... | Shengqiang-Li/LAC | MultiHeadedLinerAttention | false | 9,473 | [
"Apache-2.0"
] | 0 | 6b549cd89e03be2fafa4ce4378e70538744b9aa3 | https://github.com/Shengqiang-Li/LAC/tree/6b549cd89e03be2fafa4ce4378e70538744b9aa3 |
SpatialTokenGen | import torch
import torch.nn as nn
class SpatialTokenGen(nn.Module):
def __init__(self, d_ffn, seq_len):
super(SpatialTokenGen, self).__init__()
self.layer_norm = nn.LayerNorm(d_ffn)
self.squeeze_layer_i = nn.Linear(d_ffn, 1)
self.squeeze_layer_ii = nn.Conv1d(seq_len, 1, 1)
d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | SeungoneKim/sgMLP_Implementation | SpatialTokenGen | false | 9,474 | [
"Apache-2.0"
] | 0 | 5c5e623577a7ada3b200d99e77dc707a10cb1195 | https://github.com/SeungoneKim/sgMLP_Implementation/tree/5c5e623577a7ada3b200d99e77dc707a10cb1195 |
ModelRegressionAdt2Gex | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class Swish(torch.autograd.Function):
@staticmethod
def forward(ctx, i):
result = i * sigmoid(i)
ctx.save_for_backward(i)
return result
@staticmethod
def backward(ctx, grad_output):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Permoment-95/neurips2021_multimodal_topmethods | ModelRegressionAdt2Gex | false | 9,475 | [
"MIT"
] | 0 | 017bc23b366a80ba9b1c2a47ea6c44124f77a7ca | https://github.com/Permoment-95/neurips2021_multimodal_topmethods/tree/017bc23b366a80ba9b1c2a47ea6c44124f77a7ca |
CrossEntropyLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
def mask_cross_entropy(pred, target, label):
num_rois = pred.size()[0]
inds = torch.arange(0, num_rois, dtype=torch.long, device=pred.device)
pred_slice = pred[inds, label].squeeze(1)
return F.binary_cross_entropy_with_logits(pred_slic... | 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.functi... | Sign-up-soon-after-papapa/DEA-Net | CrossEntropyLoss | false | 9,476 | [
"Apache-2.0"
] | 0 | ed25f30ddedcb77eb0991aeb9e498ef2efd8c635 | https://github.com/Sign-up-soon-after-papapa/DEA-Net/tree/ed25f30ddedcb77eb0991aeb9e498ef2efd8c635 |
DownsampleA | import torch
import torch.nn as nn
class DownsampleA(nn.Module):
def __init__(self, nIn, nOut, stride):
super(DownsampleA, self).__init__()
assert stride == 2
self.avg = nn.AvgPool2d(kernel_size=1, stride=stride)
def forward(self, x):
x = self.avg(x)
return torch.cat(... | 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... | QIU023/continual-learning-reproduce | DownsampleA | false | 9,477 | [
"MIT"
] | 0 | 772faa6904b3488fa5deee14f03d86f3b3664a87 | https://github.com/QIU023/continual-learning-reproduce/tree/772faa6904b3488fa5deee14f03d86f3b3664a87 |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self, in_channels, output):
super(CNN, self).__init__()
self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=20,
kernel_size=3, stride=1, padding=1)
self.pool1 = nn.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.... | Sheriff-A/CNN | CNN | false | 9,478 | [
"MIT"
] | 0 | 59fc187e7cdf92379f52c4f942424d3a5042bf3e | https://github.com/Sheriff-A/CNN/tree/59fc187e7cdf92379f52c4f942424d3a5042bf3e |
ModelRegressionGex2Adt | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class ModelRegressionGex2Adt(nn.Module):
def __init__(self, dim_mod1, dim_mod2):
super(ModelRegressionGex2Adt, self).__init__()
self.input_ = nn.Linear(dim_mod1, 512)
self.dropout1 = nn.Dropout(p=0.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Permoment-95/neurips2021_multimodal_topmethods | ModelRegressionGex2Adt | false | 9,479 | [
"MIT"
] | 0 | 017bc23b366a80ba9b1c2a47ea6c44124f77a7ca | https://github.com/Permoment-95/neurips2021_multimodal_topmethods/tree/017bc23b366a80ba9b1c2a47ea6c44124f77a7ca |
ResnetBlock | import torch
from torchvision.transforms import *
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
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)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torchvision.transforms import *
import torch.nn as nn
import torch.utils.da... | Minsoo2022/graf | ResnetBlock | false | 9,480 | [
"MIT"
] | 0 | e763dd4ef59db1695dfc4bfc7e3f716c92d480a8 | https://github.com/Minsoo2022/graf/tree/e763dd4ef59db1695dfc4bfc7e3f716c92d480a8 |
SplAtConv1d | from torch.nn import Module
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Conv1d
from torch.nn import ReLU
from torch.nn.modules.utils import _single
class DropBlock1d(object):
def __init__(self, *args, **kwargs):
raise NotImplementedError
class rSoftMax(nn.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
from torch._inductor.runtime.... | Neronjust2017/challenge2020_test4 | SplAtConv1d | false | 9,481 | [
"BSD-2-Clause"
] | 0 | 6494107a459b563aa51f8ea75c580c17557b13af | https://github.com/Neronjust2017/challenge2020_test4/tree/6494107a459b563aa51f8ea75c580c17557b13af |
CosineLinear | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class CosineLinear(nn.Module):
def __init__(self, in_features, out_features, sigma=True):
super(CosineLinear, self).__init__()
self.in_features = in_features
self.out_features = out_features
self.weight... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | QIU023/continual-learning-reproduce | CosineLinear | false | 9,482 | [
"MIT"
] | 0 | 772faa6904b3488fa5deee14f03d86f3b3664a87 | https://github.com/QIU023/continual-learning-reproduce/tree/772faa6904b3488fa5deee14f03d86f3b3664a87 |
SplitCosineLinear | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class CosineLinear(nn.Module):
def __init__(self, in_features, out_features, sigma=True):
super(CosineLinear, self).__init__()
self.in_features = in_features
self.out_features = out_features
self.weight... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | QIU023/continual-learning-reproduce | SplitCosineLinear | false | 9,483 | [
"MIT"
] | 0 | 772faa6904b3488fa5deee14f03d86f3b3664a87 | https://github.com/QIU023/continual-learning-reproduce/tree/772faa6904b3488fa5deee14f03d86f3b3664a87 |
SoftTargetCrossEntropy | import torch
from typing import *
import torch.nn.functional as F
from torch.nn.modules.loss import _WeightedLoss
class SoftTargetCrossEntropy(_WeightedLoss):
def __init__(self, weight=None, reduction='mean'):
super().__init__(weight=weight, reduction=reduction)
self.weight = weight
self.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from typing import *
f... | SuHuynh/leaf-disease-classification-kaggle | SoftTargetCrossEntropy | false | 9,484 | [
"MIT"
] | 0 | b1c15881de5a20e590a69f6b2fbb476b003bc077 | https://github.com/SuHuynh/leaf-disease-classification-kaggle/tree/b1c15881de5a20e590a69f6b2fbb476b003bc077 |
PointWiseConvolution | import torch
from torch import nn as nn
class PointWiseConvolution(nn.Module):
def __init__(self, inChannels, outChannels, stride, expansionFactor,
isNormal):
super(PointWiseConvolution, self).__init__()
if isNormal:
self.layer = nn.Conv2d(in_channels=inChannels * expansionFac... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_s... | Pranshu-Bahadur/g2net | PointWiseConvolution | false | 9,485 | [
"MIT"
] | 0 | a117df7699837c9a3ae21ec59a310d7384369601 | https://github.com/Pranshu-Bahadur/g2net/tree/a117df7699837c9a3ae21ec59a310d7384369601 |
ConvLayer | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torchvision.models._utils import IntermediateLayerGetter as IntermediateLayerGetter
from itertools import product as product
class NormLayer(nn.Module):
"""Normalization Layers.
Args:
channels: input channels, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy ... | Cospel/facexlib | ConvLayer | false | 9,486 | [
"MIT"
] | 0 | 2471ddb44b1d61306c6d7fcf56846b9e4aeea4aa | https://github.com/Cospel/facexlib/tree/2471ddb44b1d61306c6d7fcf56846b9e4aeea4aa |
SelfExpression | import torch
import torch.nn as nn
class SelfExpression(nn.Module):
def __init__(self, n):
super(SelfExpression, self).__init__()
self.Coefficient = nn.Parameter(0.0001 * torch.ones(n, n, dtype=
torch.float32), requires_grad=True)
def forward(self, x):
y = torch.matmul(se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ShulingTang/DSC-Net | SelfExpression | false | 9,487 | [
"MIT"
] | 0 | 2da1e0c654b045057c654cbcbb8a8c23fb832c9d | https://github.com/ShulingTang/DSC-Net/tree/2da1e0c654b045057c654cbcbb8a8c23fb832c9d |
ModelRegressionGex2Atac | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class ModelRegressionGex2Atac(nn.Module):
def __init__(self, dim_mod1, dim_mod2):
super(ModelRegressionGex2Atac, self).__init__()
self.input_ = nn.Linear(dim_mod1, 1024)
self.fc = nn.Linear(1024, 25... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Permoment-95/neurips2021_multimodal_topmethods | ModelRegressionGex2Atac | false | 9,488 | [
"MIT"
] | 0 | 017bc23b366a80ba9b1c2a47ea6c44124f77a7ca | https://github.com/Permoment-95/neurips2021_multimodal_topmethods/tree/017bc23b366a80ba9b1c2a47ea6c44124f77a7ca |
ModelRegressionAtac2Gex | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn as nn
class ModelRegressionAtac2Gex(nn.Module):
def __init__(self, dim_mod1, dim_mod2):
super(ModelRegressionAtac2Gex, self).__init__()
self.input_ = nn.Linear(dim_mod1, 2048)
self.fc = nn.Linear(2048, 20... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Permoment-95/neurips2021_multimodal_topmethods | ModelRegressionAtac2Gex | false | 9,489 | [
"MIT"
] | 0 | 017bc23b366a80ba9b1c2a47ea6c44124f77a7ca | https://github.com/Permoment-95/neurips2021_multimodal_topmethods/tree/017bc23b366a80ba9b1c2a47ea6c44124f77a7ca |
D_DownBlock | import torch
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_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 torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guard... | EvgeneyZ/RBPN | D_DownBlock | false | 9,490 | [
"MIT"
] | 0 | acfe636cc48a4fbfea78f934a251c32e53367659 | https://github.com/EvgeneyZ/RBPN/tree/acfe636cc48a4fbfea78f934a251c32e53367659 |
BaselineEstimator | import torch
import torch.nn.functional as F
from torch import nn
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class BaselineEstimator(nn.Module):
def __init__(self, input_size):
super(BaselineEstimator, self).__init__()
self.ff1 = 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 import nn
import t... | StDario/fairseq-rl | BaselineEstimator | false | 9,491 | [
"BSD-3-Clause"
] | 0 | 96a0ee4db1a2d1781d565a2539c20ed392dfb608 | https://github.com/StDario/fairseq-rl/tree/96a0ee4db1a2d1781d565a2539c20ed392dfb608 |
CMlp | import torch
import torch.nn as nn
class CMlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None,
act_layer=nn.GELU, drop=0.0):
super().__init__()
out_features = out_features or in_features
hidden_features = hidden_features or in_features
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | SteveTsui/DS-Net | CMlp | false | 9,492 | [
"Apache-2.0"
] | 0 | c54585e7af40002178b7e06fc3ee09160e0d775c | https://github.com/SteveTsui/DS-Net/tree/c54585e7af40002178b7e06fc3ee09160e0d775c |
HardTripletLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def _get_anchor_negative_triplet_mask(labels):
labels_equal = torch.unsqueeze(labels, 0) == torch.unsqueeze(labels, 1)
mask = labels_equal ^ 1
return mask
def _get_anchor_positive_triplet_mask(labels):
torch.device('cuda:0' if torch.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Shubodh/NetVLAD-pytorch | HardTripletLoss | false | 9,493 | [
"MIT"
] | 0 | ea45bac16dbb3e3bec4172df58715bf3526ee502 | https://github.com/Shubodh/NetVLAD-pytorch/tree/ea45bac16dbb3e3bec4172df58715bf3526ee502 |
DepthWiseConvolution | import torch
from torch import nn as nn
class DepthWiseConvolution(nn.Module):
def __init__(self, channels, kernelSize, stride, expansionFactor):
super(DepthWiseConvolution, self).__init__()
channels = channels * expansionFactor
self.layer = nn.Conv2d(channels, channels, kernelSize, 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 import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_s... | Pranshu-Bahadur/g2net | DepthWiseConvolution | false | 9,494 | [
"MIT"
] | 0 | a117df7699837c9a3ae21ec59a310d7384369601 | https://github.com/Pranshu-Bahadur/g2net/tree/a117df7699837c9a3ae21ec59a310d7384369601 |
UpBlock | import torch
import torch.nn as nn
from torch.nn import functional as F
class UpBlock(nn.Module):
"""Upsample block for DRRG and TextSnake."""
def __init__(self, in_channels, out_channels):
super().__init__()
assert isinstance(in_channels, int)
assert isinstance(out_channels, int)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | SamDM/mmocr | UpBlock | false | 9,495 | [
"Apache-2.0"
] | 0 | 4cb69141ff8d28c8b1437bf28242e368a0e6ec4f | https://github.com/SamDM/mmocr/tree/4cb69141ff8d28c8b1437bf28242e368a0e6ec4f |
Mlayer | import torch
import torch.nn as nn
class Mlayer(nn.Module):
def __init__(self, in_channel, out_channel, stride=1):
super(Mlayer, self).__init__()
m_s = torch.zeros([1, in_channel, 1, 1], requires_grad=True)
self.m_s = torch.nn.Parameter(m_s)
self.register_parameter('m_scale', 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Sharingsky/resrep | Mlayer | false | 9,496 | [
"MIT"
] | 0 | a173d1bc256b75b2c902024929e406863ce48b9b | https://github.com/Sharingsky/resrep/tree/a173d1bc256b75b2c902024929e406863ce48b9b |
ModulatedConv2d | from torch.autograd import Function
import math
import random
import torch
from torch import nn
from torch.nn import functional as F
def upsample(in_tens, out_H=64):
in_H = in_tens.shape[2]
scale_factor = 1.0 * out_H / in_H
return nn.Upsample(scale_factor=scale_factor, mode='bilinear',
align_corne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.autograd... | SavvaI/stylegan2-pytorch | ModulatedConv2d | false | 9,497 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 0 | b8e4b605bd951283ef2c9a784e7afa0a486975bb | https://github.com/SavvaI/stylegan2-pytorch/tree/b8e4b605bd951283ef2c9a784e7afa0a486975bb |
ScaledL2Norm | import torch
import torch.onnx
import torch
import torch.nn as nn
import torch.nn.functional as F
class ScaledL2Norm(nn.Module):
def __init__(self, in_channels, initial_scale):
super(ScaledL2Norm, self).__init__()
self.in_channels = in_channels
self.scale = nn.Parameter(torch.Tensor(in_ch... | 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.onnx
import tor... | SoonminHwang/pytorch-ssd | ScaledL2Norm | false | 9,498 | [
"MIT"
] | 0 | 1d6b9427a4b649bc2ce85a82511b9dd299f9d3e8 | https://github.com/SoonminHwang/pytorch-ssd/tree/1d6b9427a4b649bc2ce85a82511b9dd299f9d3e8 |
RobustScannerFusionLayer | import torch
import torch.nn as nn
class RobustScannerFusionLayer(nn.Module):
def __init__(self, dim_model, dim=-1):
super().__init__()
self.dim_model = dim_model
self.dim = dim
self.linear_layer = nn.Linear(dim_model * 2, dim_model * 2)
self.glu_layer = nn.GLU(dim=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... | SamDM/mmocr | RobustScannerFusionLayer | false | 9,499 | [
"Apache-2.0"
] | 0 | 4cb69141ff8d28c8b1437bf28242e368a0e6ec4f | https://github.com/SamDM/mmocr/tree/4cb69141ff8d28c8b1437bf28242e368a0e6ec4f |
MeanReweightLayer | import torch
import torch.nn as nn
import torch.nn.parallel
from torch.nn.parameter import Parameter
class MeanReweightLayer(nn.Module):
"""Renamed to Attention-Bias (AB) layer in paper"""
def __init__(self, channel):
super(MeanReweightLayer, self).__init__()
self.cfc = Parameter(torch.Tensor... | 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
from torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_... | SanderKlomp/channel-attention | MeanReweightLayer | false | 9,500 | [
"MIT"
] | 0 | 9dfdb28f3ad4de13b4c076d1423f21c05c907bd7 | https://github.com/SanderKlomp/channel-attention/tree/9dfdb28f3ad4de13b4c076d1423f21c05c907bd7 |
Upsampler | import math
import torch
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_si... | 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
from torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch.... | EvgeneyZ/RBPN | Upsampler | false | 9,501 | [
"MIT"
] | 0 | acfe636cc48a4fbfea78f934a251c32e53367659 | https://github.com/EvgeneyZ/RBPN/tree/acfe636cc48a4fbfea78f934a251c32e53367659 |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.sparse import *
def dropout(x, drop_prob, shared_axes=[], training=False):
"""
Apply dropout to input tensor.
Parameters
----------
input_tensor: ``torch.FloatTensor``
A tensor of shape ``(batch_size, ..., num_ti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Ononoki-Yotsugi/IDGL | GAT | false | 9,502 | [
"Apache-2.0"
] | 0 | a99f840681a4ae26c2740ed9e9302d4e15a68c7f | https://github.com/Ononoki-Yotsugi/IDGL/tree/a99f840681a4ae26c2740ed9e9302d4e15a68c7f |
MLPAttention | import torch
import torch.nn.functional as F
from torch import nn
from typing import Optional
import torch.optim
def get_activation_fn(name: 'Optional[str]'):
"""Returns a callable activation function from `torch`."""
if name in (None, 'linear'):
return lambda x: x
elif name in ('sigmoid', '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 import triton_helpers
from torch._inductor.runtime.... | Nickeilf/pysimt | MLPAttention | false | 9,503 | [
"MIT"
] | 0 | 05c8de92d0e2b930e40939ad3695d8d2c2954dda | https://github.com/Nickeilf/pysimt/tree/05c8de92d0e2b930e40939ad3695d8d2c2954dda |
ECALayer | import torch
import torch.nn as nn
import torch.nn.parallel
class ECALayer(nn.Module):
"""Constructs a ECA module.
Args:
channel: Number of channels of the input feature map
k_size: Adaptive selection of kernel size
"""
def __init__(self, channel, k_size=3):
super(ECALayer, se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
assert_size_stride = torch._C._dy... | SanderKlomp/channel-attention | ECALayer | false | 9,504 | [
"MIT"
] | 0 | 9dfdb28f3ad4de13b4c076d1423f21c05c907bd7 | https://github.com/SanderKlomp/channel-attention/tree/9dfdb28f3ad4de13b4c076d1423f21c05c907bd7 |
ConvAE | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv2dSamePad(nn.Module):
"""
Implement Tensorflow's 'SAME' padding mode in Conv2d.
When an odd number, say `m`, of pixels are need to pad, Tensorflow will pad one more column at right or one more
row at bottom. But 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 math
import torch.nn a... | ShulingTang/DSC-Net | ConvAE | false | 9,505 | [
"MIT"
] | 0 | 2da1e0c654b045057c654cbcbb8a8c23fb832c9d | https://github.com/ShulingTang/DSC-Net/tree/2da1e0c654b045057c654cbcbb8a8c23fb832c9d |
DSCNet | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv2dSamePad(nn.Module):
"""
Implement Tensorflow's 'SAME' padding mode in Conv2d.
When an odd number, say `m`, of pixels are need to pad, Tensorflow will pad one more column at right or one more
row at bottom. But 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 math
import torch.nn a... | ShulingTang/DSC-Net | DSCNet | false | 9,506 | [
"MIT"
] | 0 | 2da1e0c654b045057c654cbcbb8a8c23fb832c9d | https://github.com/ShulingTang/DSC-Net/tree/2da1e0c654b045057c654cbcbb8a8c23fb832c9d |
MultiHeadedAttention | import math
import torch
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.
"""
def __init__(se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Slyne/wenet | MultiHeadedAttention | false | 9,507 | [
"Apache-2.0"
] | 0 | de74d8acf40f47a3c503bff5cf4ed6808a9dad14 | https://github.com/Slyne/wenet/tree/de74d8acf40f47a3c503bff5cf4ed6808a9dad14 |
ZeroModule | import torch
import torch as th
from torch import nn
import torch.random
class ZeroModule(nn.Module):
"""Module that always returns zeros of same shape as input."""
def __init__(self, features_dim: 'int'):
"""Builds ZeroModule."""
super().__init__()
self.features_dim = features_dim
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.random
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyna... | TaoHuang13/imitation | ZeroModule | false | 9,508 | [
"MIT"
] | 0 | f979be0fa05106754f6d1e5a98495d0fedbea598 | https://github.com/TaoHuang13/imitation/tree/f979be0fa05106754f6d1e5a98495d0fedbea598 |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class MaxPoolStride1(nn.Module):
def __init__(self, kernel_size):
super(MaxPoolStride1, self).__init__()
self.kernel_size = kernel_size
self.pad = kernel_size - 1
def forward(self, x):
padded_x = F.pad(x, (0, ... | 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... | TCC-MonitoramentoInteligente/dev-tool | MaxPoolStride1 | false | 9,509 | [
"MIT"
] | 0 | d3a1d697c4ba7a5fff54be08541da4fc4811ab5e | https://github.com/TCC-MonitoramentoInteligente/dev-tool/tree/d3a1d697c4ba7a5fff54be08541da4fc4811ab5e |
NetVLAD | import torch
import torch.nn as nn
import torch.nn.functional as F
class NetVLAD(nn.Module):
"""NetVLAD layer implementation"""
def __init__(self, num_clusters=64, dim=128, alpha=100.0,
normalize_input=True):
"""
Args:
num_clusters : int
The number of clust... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Shubodh/NetVLAD-pytorch | NetVLAD | false | 9,510 | [
"MIT"
] | 0 | ea45bac16dbb3e3bec4172df58715bf3526ee502 | https://github.com/Shubodh/NetVLAD-pytorch/tree/ea45bac16dbb3e3bec4172df58715bf3526ee502 |
TemporalDecay | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class TemporalDecay(nn.Module):
def __init__(self, input_size, rnn_hid_size):
super(TemporalDecay, self).__init__()
self.rnn_hid_size = rnn_hid_size
self.build(input_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Sobhan1996/BRITS-master | TemporalDecay | false | 9,511 | [
"MIT"
] | 0 | 66726ec104dad43c6d8367b0c9ef8f19daf65f0e | https://github.com/Sobhan1996/BRITS-master/tree/66726ec104dad43c6d8367b0c9ef8f19daf65f0e |
GCN2 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from scipy.sparse import *
def dropout(x, drop_prob, shared_axes=[], training=False):
"""
Apply dropout to input tensor.
Parameters
----------
input_tensor: ``torch.FloatTensor``
A tensor of shape ``(batch_size,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import torch.nn a... | Ononoki-Yotsugi/IDGL | GCN2 | false | 9,512 | [
"Apache-2.0"
] | 0 | a99f840681a4ae26c2740ed9e9302d4e15a68c7f | https://github.com/Ononoki-Yotsugi/IDGL/tree/a99f840681a4ae26c2740ed9e9302d4e15a68c7f |
QNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class QNet(nn.Module):
def __init__(self, input_dim, output_dim):
super(QNet, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.fc1 = nn.Linear(input_dim, 64)
self.fc2 = 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.triton_helpers import libdevice
import torch.nn as ... | SunlightWarrior/q_learning | QNet | false | 9,513 | [
"MIT"
] | 0 | 3c5f0c700fbe84ca4859165513123f404c44937f | https://github.com/SunlightWarrior/q_learning/tree/3c5f0c700fbe84ca4859165513123f404c44937f |
TransformerEncoderLayer | import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
"""Multi-Head Attention module."""
def __init__(self, n_head=8, d_model=512, d_k=64, d_v=64, dropout=0.1,
qkv_bias=False, mask_value=0):
super().__init__()
self.mask_value = mask_value
self.n_head = n_head... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SamDM/mmocr | TransformerEncoderLayer | false | 9,514 | [
"Apache-2.0"
] | 0 | 4cb69141ff8d28c8b1437bf28242e368a0e6ec4f | https://github.com/SamDM/mmocr/tree/4cb69141ff8d28c8b1437bf28242e368a0e6ec4f |
CrossAttentionSublayer | import math
import torch
from torch import nn
import torch.optim
class ScaledDotAttention(torch.nn.Module):
def __init__(self, model_dim, n_heads, dropout=0.0):
"""
Creates a ScaledDotAttention.
:param model_dim: The model dimensions.
:param n_heads: The number of heads.
:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Nickeilf/pysimt | CrossAttentionSublayer | false | 9,515 | [
"MIT"
] | 0 | 05c8de92d0e2b930e40939ad3695d8d2c2954dda | https://github.com/Nickeilf/pysimt/tree/05c8de92d0e2b930e40939ad3695d8d2c2954dda |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 16, 3, padding=1)
self.conv2 = nn.Conv2d(16, 32, 3, padding=1)
self.conv3 = nn.Conv2d(32, 64, 3, padding=1)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | LSaldyt/laser-dog | Net | false | 9,516 | [
"MIT"
] | 0 | 168c8bfea95dcd27a499f00f191232d67ae63c1c | https://github.com/LSaldyt/laser-dog/tree/168c8bfea95dcd27a499f00f191232d67ae63c1c |
Net | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self, input_d):
super(Net, self).__init__()
self.fc1 = nn.Linear(input_d, int(input_d / 2))
def forward(self, x):
x = torch.sigmoid(self.fc1(x))
return x
def get_inputs():
return [torch.rand([4, 4, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Tenoke/models | Net | false | 9,517 | [
"Apache-2.0"
] | 0 | 84baffe34509d2f8b61689e043db2130fec8c171 | https://github.com/Tenoke/models/tree/84baffe34509d2f8b61689e043db2130fec8c171 |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
class GATLayer(nn.Module):
def __init__(self, input_feature, output_feature, dropout, alpha,
concat=True):
super(GATLayer, self).__init__()
self.input_feature = input_feature
self.output_feature = output_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._inductor.runtime.... | OuYangg/GNNs | GAT | false | 9,518 | [
"Apache-2.0"
] | 0 | ef5b1944490507684d603de3ae0b2aa7b5168f47 | https://github.com/OuYangg/GNNs/tree/ef5b1944490507684d603de3ae0b2aa7b5168f47 |
SEBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class SEBlock(nn.Module):
def __init__(self, input_channels, internal_neurons):
super(SEBlock, self).__init__()
self.down = nn.Conv2d(in_channels=input_channels, out_channels=
internal_neurons, kernel_size=1, stride=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_... | Sharingsky/resrep | SEBlock | false | 9,520 | [
"MIT"
] | 0 | a173d1bc256b75b2c902024929e406863ce48b9b | https://github.com/Sharingsky/resrep/tree/a173d1bc256b75b2c902024929e406863ce48b9b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.