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 |
|---|---|---|---|---|---|---|---|---|---|---|
PixelNormLayer | import torch
import torch.nn as nn
class PixelNormLayer(nn.Module):
def __init__(self):
super(PixelNormLayer, self).__init__()
def forward(self, x):
return x / torch.sqrt(torch.mean(x ** 2, dim=1, keepdim=True) + 1e-08)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_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.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | ChandreyeeB/Blind-Image-Deconvolution-using-Deep-Generative-Priors | PixelNormLayer | false | 7,884 | [
"MIT"
] | 24 | 4198bd2d325a32ffc4e714c486540e63440ab110 | https://github.com/ChandreyeeB/Blind-Image-Deconvolution-using-Deep-Generative-Priors/tree/4198bd2d325a32ffc4e714c486540e63440ab110 |
HardSigmoid | import torch
import torch.nn as nn
class HardSigmoid(nn.Module):
def __init__(self, bias=1.0, divisor=2.0, min_value=0.0, max_value=1.0):
super(HardSigmoid, self).__init__()
assert divisor != 0, 'divisor is not allowed to be equal to zero'
self.bias = bias
self.divisor = divisor
... | 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... | CharlesPikachu/mcibi | HardSigmoid | false | 7,885 | [
"MIT"
] | 41 | 6ce453504741c2eed1d290306055258a377a4094 | https://github.com/CharlesPikachu/mcibi/tree/6ce453504741c2eed1d290306055258a377a4094 |
TripletLoss | import torch
from torch import nn
from torch.nn import functional as F
class TripletLoss(nn.Module):
"""
Triplet loss
Takes embeddings of an anchor sample, a postive sample and a negative sample
"""
def __init__(self):
super(TripletLoss, self).__init__()
def forward(self, anchor, pos... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_... | CV-ZMH/human-action-recognition | TripletLoss | false | 7,886 | [
"MIT"
] | 36 | 009bd1da71c087c3071173b325e34ed342599581 | https://github.com/CV-ZMH/human-action-recognition/tree/009bd1da71c087c3071173b325e34ed342599581 |
Fire | import torch
from torch import nn
class Fire(nn.Module):
def __init__(self, inplanes, squeeze_planes, expand1x1_planes,
expand3x3_planes):
super(Fire, self).__init__()
self.inplanes = inplanes
self.squeeze = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1)
self.squeeze_a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | BloodAxe/segmentation-networks-benchmark | Fire | false | 7,887 | [
"MIT"
] | 34 | 2e3feb560102230be9369ab442b4a59cc86dff61 | https://github.com/BloodAxe/segmentation-networks-benchmark/tree/2e3feb560102230be9369ab442b4a59cc86dff61 |
ChannelAttentionModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class Scale(nn.Module):
def __init__(self, scale=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float))
"""forward"""
def forward(self, x):
return x * self.scale
cl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CharlesPikachu/mcibi | ChannelAttentionModule | false | 7,888 | [
"MIT"
] | 41 | 6ce453504741c2eed1d290306055258a377a4094 | https://github.com/CharlesPikachu/mcibi/tree/6ce453504741c2eed1d290306055258a377a4094 |
SpatialGatherModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpatialGatherModule(nn.Module):
def __init__(self, scale=1, **kwargs):
super(SpatialGatherModule, self).__init__()
self.scale = scale
"""forward"""
def forward(self, features, probs):
batch_size, num_classes... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CharlesPikachu/mcibi | SpatialGatherModule | false | 7,889 | [
"MIT"
] | 41 | 6ce453504741c2eed1d290306055258a377a4094 | https://github.com/CharlesPikachu/mcibi/tree/6ce453504741c2eed1d290306055258a377a4094 |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def __init__(self, channels, scale=10, eps=1e-10):
super(L2Norm, self).__init__()
self.channels, self.eps = channels, eps
self.weight = nn.Parameter(torch.Tensor(channels))
nn.init.constant_(self.weight, scale)
"""for... | 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_... | CharlesPikachu/mcibi | L2Norm | false | 7,890 | [
"MIT"
] | 41 | 6ce453504741c2eed1d290306055258a377a4094 | https://github.com/CharlesPikachu/mcibi/tree/6ce453504741c2eed1d290306055258a377a4094 |
MINCNet | import torch
import torch.utils.data
from torch import nn
import torch.jit
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... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | BlueAmulet/BasicSR | MINCNet | false | 7,891 | [
"Apache-2.0"
] | 12 | 7040913d8659a05af4c2428feb71c260efbf1e9c | https://github.com/BlueAmulet/BasicSR/tree/7040913d8659a05af4c2428feb71c260efbf1e9c |
ScaleExp | import torch
import torch.nn as nn
class ScaleExp(nn.Module):
def __init__(self, init_value=1.0):
super(ScaleExp, self).__init__()
self.scale = nn.Parameter(torch.FloatTensor([init_value]))
def forward(self, input):
return torch.exp(input * self.scale)
def get_inputs():
return ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | Cogito2012/OpenTAL | ScaleExp | false | 7,892 | [
"BSD-3-Clause"
] | 16 | a7ab938a52b3fb82163eb1ba5403888359eb7e6a | https://github.com/Cogito2012/OpenTAL/tree/a7ab938a52b3fb82163eb1ba5403888359eb7e6a |
Lookahead | import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.nn.functional as F
class Lookahead(nn.Module):
def __init__(self, n_features, context):
super(Lookahead, self).__init__()
assert context > 0
self.context = context
self.n_features = n_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
import torch.utils.data.distributed
import torch.nn as nn
assert_size_stride = t... | Chudbrochil/deepspeech.pytorch-2.1 | Lookahead | false | 7,893 | [
"MIT"
] | 13 | d5d01e33ef383edb79c6a5b1584c134587108deb | https://github.com/Chudbrochil/deepspeech.pytorch-2.1/tree/d5d01e33ef383edb79c6a5b1584c134587108deb |
AdptivePaddingConv2d | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import BatchNorm1d
from torch.nn import BatchNorm2d
from torch.nn import BatchNorm3d
from torch.nn import Identity
from torch.nn import GroupNorm
from torch.nn import InstanceNorm1d
from torch.nn import InstanceNorm2d
from 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
import torch.nn as nn
from torch.nn import BatchNorm1d
from torch.nn import Batc... | CharlesPikachu/mcibi | AdptivePaddingConv2d | false | 7,894 | [
"MIT"
] | 41 | 6ce453504741c2eed1d290306055258a377a4094 | https://github.com/CharlesPikachu/mcibi/tree/6ce453504741c2eed1d290306055258a377a4094 |
Encoding | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch._C
import torch.serialization
class Encoding(nn.Module):
"""Encoding Layer: a learnable residual encoder.
Input is of shape (batch_size, channels, height, width).
Output is of shape (batch_size, num_codes, channels).
Ar... | 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
... | CarnoZhao/mmsegmentation | Encoding | false | 7,895 | [
"Apache-2.0"
] | 18 | bdaf3d93c4d33c3f0c15f95879fdd7ab78290c1c | https://github.com/CarnoZhao/mmsegmentation/tree/bdaf3d93c4d33c3f0c15f95879fdd7ab78290c1c |
TransposedConv1d | import torch
import torch.nn as nn
import torch.nn.functional as F
class TransposedConv1d(nn.Module):
def __init__(self, in_channels, output_channels, kernel_shape=3, stride
=2, padding=1, output_padding=1, activation_fn=F.relu,
use_batch_norm=False, use_bias=True):
super(TransposedConv1d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Cogito2012/OpenTAL | TransposedConv1d | false | 7,896 | [
"BSD-3-Clause"
] | 16 | a7ab938a52b3fb82163eb1ba5403888359eb7e6a | https://github.com/Cogito2012/OpenTAL/tree/a7ab938a52b3fb82163eb1ba5403888359eb7e6a |
Unit3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class Unit3D(nn.Module):
def __init__(self, in_channels, output_channels, kernel_shape=(1, 1, 1),
stride=(1, 1, 1), padding='spatial_valid', activation_fn=F.relu,
use_batch_norm=False, use_bias=False):
"""Initializes Unit3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Cogito2012/OpenTAL | Unit3D | false | 7,897 | [
"BSD-3-Clause"
] | 16 | a7ab938a52b3fb82163eb1ba5403888359eb7e6a | https://github.com/Cogito2012/OpenTAL/tree/a7ab938a52b3fb82163eb1ba5403888359eb7e6a |
TransposedConv3d | import torch
import torch.nn as nn
import torch.nn.functional as F
class TransposedConv3d(nn.Module):
def __init__(self, in_channels, output_channels, kernel_shape=(3, 3, 3),
stride=(2, 1, 1), padding=(1, 1, 1), output_padding=(1, 0, 0),
activation_fn=F.relu, use_batch_norm=False, use_bias=True):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Cogito2012/OpenTAL | TransposedConv3d | false | 7,898 | [
"BSD-3-Clause"
] | 16 | a7ab938a52b3fb82163eb1ba5403888359eb7e6a | https://github.com/Cogito2012/OpenTAL/tree/a7ab938a52b3fb82163eb1ba5403888359eb7e6a |
Fp32LayerNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class Fp32LayerNorm(nn.LayerNorm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def forward(self, input)... | 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.utils.data
import torch.onnx.operators
impor... | CUMLSec/stateformer | Fp32LayerNorm | false | 7,899 | [
"MIT"
] | 41 | 87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c | https://github.com/CUMLSec/stateformer/tree/87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c |
Unit1D | import torch
import torch.nn as nn
import torch.nn.functional as F
class Unit1D(nn.Module):
def __init__(self, in_channels, output_channels, kernel_shape=1, stride
=1, padding='same', activation_fn=F.relu, use_bias=True):
super(Unit1D, self).__init__()
self.conv1d = nn.Conv1d(in_channels,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Cogito2012/OpenTAL | Unit1D | false | 7,900 | [
"BSD-3-Clause"
] | 16 | a7ab938a52b3fb82163eb1ba5403888359eb7e6a | https://github.com/Cogito2012/OpenTAL/tree/a7ab938a52b3fb82163eb1ba5403888359eb7e6a |
HingeGANLossDiscriminator | import torch
import torch.nn as nn
class HingeGANLossDiscriminator(nn.Module):
"""
This class implements the Hinge discriminator GAN loss proposed in:
https://arxiv.org/pdf/1705.02894.pdf
"""
def __init__(self) ->None:
"""
Constructor method.
"""
super(HingeGANLoss... | 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... | ChristophReich1996/Mode_Collapse | HingeGANLossDiscriminator | false | 7,901 | [
"MIT"
] | 14 | 937ee8bf96510fbf4070fc7e14b78276ab036b8c | https://github.com/ChristophReich1996/Mode_Collapse/tree/937ee8bf96510fbf4070fc7e14b78276ab036b8c |
Fp32GroupNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class Fp32GroupNorm(nn.GroupNorm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def forward(self, input)... | 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.utils.data
import torch.onnx.operators
impor... | CUMLSec/stateformer | Fp32GroupNorm | false | 7,902 | [
"MIT"
] | 41 | 87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c | https://github.com/CUMLSec/stateformer/tree/87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c |
MultiheadAttention | import torch
import torch.nn as nn
def BuildDropout(dropout_type, **kwargs):
supported_dropouts = {'droppath': DropPath, 'dropout': nn.Dropout,
'dropout2d': nn.Dropout2d, 'dropout3d': nn.Dropout3d}
assert dropout_type in supported_dropouts, 'unsupport dropout type %s...' % dropout_type
return supp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CharlesPikachu/mcibi | MultiheadAttention | false | 7,903 | [
"MIT"
] | 41 | 6ce453504741c2eed1d290306055258a377a4094 | https://github.com/CharlesPikachu/mcibi/tree/6ce453504741c2eed1d290306055258a377a4094 |
DirichletLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class DirichletLayer(nn.Module):
def __init__(self, evidence='exp', dim=-1):
super(DirichletLayer, self).__init__()
self.evidence = evidence
self.dim = dim
def evidence_func(self, logit):
if self.evidence == '... | 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
... | Cogito2012/OpenTAL | DirichletLayer | false | 7,904 | [
"BSD-3-Clause"
] | 16 | a7ab938a52b3fb82163eb1ba5403888359eb7e6a | https://github.com/Cogito2012/OpenTAL/tree/a7ab938a52b3fb82163eb1ba5403888359eb7e6a |
WassersteinGANLossDiscriminator | import torch
import torch.nn as nn
class WassersteinGANLossDiscriminator(nn.Module):
"""
This class implements the Wasserstein generator GAN loss proposed in:
http://proceedings.mlr.press/v70/arjovsky17a/arjovsky17a.pdf
"""
def __init__(self) ->None:
"""
Constructor method.
... | 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... | ChristophReich1996/Mode_Collapse | WassersteinGANLossDiscriminator | false | 7,905 | [
"MIT"
] | 14 | 937ee8bf96510fbf4070fc7e14b78276ab036b8c | https://github.com/ChristophReich1996/Mode_Collapse/tree/937ee8bf96510fbf4070fc7e14b78276ab036b8c |
Generator | import torch
import torch.nn as nn
import torch.nn.functional as F
class Generator(nn.Module):
def __init__(self, embed_size, max_size, nlayers=0, activation_type='tanh'
):
super(Generator, self).__init__()
hidden = max_size * embed_size
if activation_type == 'tanh':
a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ConstantineLignos/ersatz | Generator | false | 7,906 | [
"Apache-2.0"
] | 16 | 7d1b8f2e0904503a24615777520837bc8633cd0c | https://github.com/ConstantineLignos/ersatz/tree/7d1b8f2e0904503a24615777520837bc8633cd0c |
GCN | from torch.nn import Module
import math
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __ini... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CVIR/CoMix | GCN | false | 7,907 | [
"Apache-2.0"
] | 13 | 593b5b3ba6e060018e4b55ab288dab71c2ee2e18 | https://github.com/CVIR/CoMix/tree/593b5b3ba6e060018e4b55ab288dab71c2ee2e18 |
IdentityPadding | import torch
import torch.nn as nn
import torch.utils.data.distributed
import torch.nn.functional as F
class IdentityPadding(nn.Module):
def __init__(self, in_channels, out_channels, stride=1):
super(IdentityPadding, self).__init__()
if stride == 2:
self.pooling = nn.AvgPool2d(kernel_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data.distributed
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda... | Crisescode/Distributed-DL-Example | IdentityPadding | false | 7,908 | [
"Apache-2.0"
] | 19 | a7ff2b4a6c07a126c30eaa886cc6e8cd02a83949 | https://github.com/Crisescode/Distributed-DL-Example/tree/a7ff2b4a6c07a126c30eaa886cc6e8cd02a83949 |
RPLHead | import torch
import torch.nn as nn
class RPLHead(nn.Module):
def __init__(self, in_channels, num_classes, num_centers=1, init='random'):
super(RPLHead, self).__init__()
self.feat_dim = in_channels
self.num_classes = num_classes
self.num_centers = num_centers
if init == 'ra... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Cogito2012/OpenTAL | RPLHead | false | 7,909 | [
"BSD-3-Clause"
] | 16 | a7ab938a52b3fb82163eb1ba5403888359eb7e6a | https://github.com/Cogito2012/OpenTAL/tree/a7ab938a52b3fb82163eb1ba5403888359eb7e6a |
GANLossGenerator | import torch
import torch.nn as nn
import torch.nn.functional as F
class GANLossGenerator(nn.Module):
"""
This class implements the standard generator GAN loss proposed in:
https://papers.nips.cc/paper/2014/file/5ca3e9b122f61f8f06494c97b1afccf3-Paper.pdf
"""
def __init__(self) ->None:
"""... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | ChristophReich1996/Mode_Collapse | GANLossGenerator | false | 7,910 | [
"MIT"
] | 14 | 937ee8bf96510fbf4070fc7e14b78276ab036b8c | https://github.com/ChristophReich1996/Mode_Collapse/tree/937ee8bf96510fbf4070fc7e14b78276ab036b8c |
GELU_ | import math
import torch
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class GELU_(nn.Module):
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x +
0.044715 * torch.pow(x, 3))))
d... | 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.utils.data
import torch.onnx.operators
impor... | CUMLSec/stateformer | GELU_ | false | 7,911 | [
"MIT"
] | 41 | 87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c | https://github.com/CUMLSec/stateformer/tree/87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c |
NSGANLossGenerator | import torch
import torch.nn as nn
import torch.nn.functional as F
class NSGANLossGenerator(nn.Module):
"""
This class implements the non-saturating generator GAN loss proposed in:
https://papers.nips.cc/paper/2014/file/5ca3e9b122f61f8f06494c97b1afccf3-Paper.pdf
"""
def __init__(self) ->None:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | ChristophReich1996/Mode_Collapse | NSGANLossGenerator | false | 7,912 | [
"MIT"
] | 14 | 937ee8bf96510fbf4070fc7e14b78276ab036b8c | https://github.com/ChristophReich1996/Mode_Collapse/tree/937ee8bf96510fbf4070fc7e14b78276ab036b8c |
LSGANLossDiscriminator | import torch
import torch.nn as nn
class LSGANLossDiscriminator(nn.Module):
"""
This class implements the least squares discriminator GAN loss proposed in:
https://openaccess.thecvf.com/content_ICCV_2017/papers/Mao_Least_Squares_Generative_ICCV_2017_paper.pdf
"""
def __init__(self) ->None:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ChristophReich1996/Mode_Collapse | LSGANLossDiscriminator | false | 7,913 | [
"MIT"
] | 14 | 937ee8bf96510fbf4070fc7e14b78276ab036b8c | https://github.com/ChristophReich1996/Mode_Collapse/tree/937ee8bf96510fbf4070fc7e14b78276ab036b8c |
HardSwish | import torch
import torch.nn as nn
import torch.nn.functional as F
class HardSwish(nn.Module):
def __init__(self, inplace=True):
super(HardSwish, self).__init__()
self.inplace = inplace
def forward(self, x):
return x * F.relu6(x + 3.0, inplace=self.inplace) / 6.0
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Culturenotes/Network-Slimming | HardSwish | false | 7,914 | [
"Apache-2.0"
] | 12 | 9004ab4c1f6bcbf8f317a37984ed3f8db39ecbe2 | https://github.com/Culturenotes/Network-Slimming/tree/9004ab4c1f6bcbf8f317a37984ed3f8db39ecbe2 |
LSGANLossGenerator | import torch
import torch.nn as nn
class LSGANLossGenerator(nn.Module):
"""
This class implements the least squares generator GAN loss proposed in:
https://openaccess.thecvf.com/content_ICCV_2017/papers/Mao_Least_Squares_Generative_ICCV_2017_paper.pdf
"""
def __init__(self) ->None:
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ChristophReich1996/Mode_Collapse | LSGANLossGenerator | false | 7,915 | [
"MIT"
] | 14 | 937ee8bf96510fbf4070fc7e14b78276ab036b8c | https://github.com/ChristophReich1996/Mode_Collapse/tree/937ee8bf96510fbf4070fc7e14b78276ab036b8c |
ImageLinearAttention | import torch
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class ImageLinearAttention(nn.Module):
def __init__(self, chan, chan_out=None, kernel_size=1, padding=0,
stride=1, key_dim=64, value_dim=64, heads=8):
super().... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CUMLSec/stateformer | ImageLinearAttention | false | 7,916 | [
"MIT"
] | 41 | 87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c | https://github.com/CUMLSec/stateformer/tree/87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c |
NormalizationLayer | import torch
import torch.utils.data
class NormalizationLayer(torch.nn.Module):
"""Class for normalization layer.
"""
def __init__(self, normalize_scale=1.0, learn_scale=True):
super(NormalizationLayer, self).__init__()
self.norm_s = float(normalize_scale)
if learn_scale:
... | 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
assert_size_stride = torch._C._dynamo.guards.assert_siz... | Cuberick-Orion/CIRPLANT | NormalizationLayer | false | 7,917 | [
"MIT"
] | 13 | 4592c979eb8638ccd0d8590a68507df26c27cb89 | https://github.com/Cuberick-Orion/CIRPLANT/tree/4592c979eb8638ccd0d8590a68507df26c27cb89 |
Conv1dBlock | import torch
from torch import nn
class Conv1dBlock(nn.Module):
def __init__(self, input_dim, output_dim, kernel_size, stride, padding=
0, norm='none', activation='relu', pad_type='zero'):
super(Conv1dBlock, self).__init__()
self.use_bias = True
if pad_type == 'reflect':
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | DK-Jang/human_motion_manifold | Conv1dBlock | false | 7,918 | [
"MIT"
] | 23 | dd3b603b892d66685204909c8818f3e1621ab7dc | https://github.com/DK-Jang/human_motion_manifold/tree/dd3b603b892d66685204909c8818f3e1621ab7dc |
ReRegualizedLinearNACLayer | import math
import torch
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class ReRegualizedLinearNACLayer(torch.nn.Module):
def __init__(self, in_features, out_features, **kwargs):
super().__init__()
self.in_features = in_features
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 math
import torch.util... | CUMLSec/stateformer | ReRegualizedLinearNACLayer | false | 7,919 | [
"MIT"
] | 41 | 87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c | https://github.com/CUMLSec/stateformer/tree/87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c |
GANLossDiscriminator | import torch
import torch.nn as nn
import torch.nn.functional as F
class GANLossDiscriminator(nn.Module):
"""
This class implements the standard discriminator GAN loss proposed in:
https://papers.nips.cc/paper/2014/file/5ca3e9b122f61f8f06494c97b1afccf3-Paper.pdf
"""
def __init__(self) ->None:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | ChristophReich1996/Mode_Collapse | GANLossDiscriminator | false | 7,920 | [
"MIT"
] | 14 | 937ee8bf96510fbf4070fc7e14b78276ab036b8c | https://github.com/ChristophReich1996/Mode_Collapse/tree/937ee8bf96510fbf4070fc7e14b78276ab036b8c |
PixelDynamicsLoss | import torch
from torch import nn
class PixelDynamicsLoss(nn.Module):
def __init__(self, diff_pp=False):
super().__init__()
self.diff_pp = diff_pp
def forward(self, target_t, target_tk, pred_t, pred_tk):
if self.diff_pp:
loss = ((target_t - target_tk).abs() - (pred_t.deta... | 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... | CompVis/interactive-image2video-synthesis | PixelDynamicsLoss | false | 7,921 | [
"MIT"
] | 20 | 05ea449d3a2704b6d79a5f08683035220d615576 | https://github.com/CompVis/interactive-image2video-synthesis/tree/05ea449d3a2704b6d79a5f08683035220d615576 |
Accuracy | import torch
import torch.nn as nn
class Accuracy(nn.Module):
"""
This class implements the accuracy metric.
"""
def __init__(self) ->None:
"""
Constructor method
"""
super(Accuracy, self).__init__()
def forward(self, prediction: 'torch.Tensor', label: 'torch.Tens... | 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... | ChristophReich1996/Swin-Transformer-V2 | Accuracy | false | 7,922 | [
"MIT"
] | 43 | d71c1b412cd0fe13dc2557ad090cf0f027e54d47 | https://github.com/ChristophReich1996/Swin-Transformer-V2/tree/d71c1b412cd0fe13dc2557ad090cf0f027e54d47 |
PatchEmbedding | import torch
import torch.nn as nn
def bchw_to_bhwc(input: 'torch.Tensor') ->torch.Tensor:
"""
Permutes a tensor to the shape [batch size, height, width, channels]
:param input: (torch.Tensor) Input tensor of the shape [batch size, height, width, channels]
:return: (torch.Tensor) Output tensor of the ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ChristophReich1996/Swin-Transformer-V2 | PatchEmbedding | false | 7,923 | [
"MIT"
] | 43 | d71c1b412cd0fe13dc2557ad090cf0f027e54d47 | https://github.com/ChristophReich1996/Swin-Transformer-V2/tree/d71c1b412cd0fe13dc2557ad090cf0f027e54d47 |
Conv2dBlock | import torch
from torch.nn import functional as F
from torch import nn
from torch.nn.utils import spectral_norm
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super().__init__()
self.num_features = num_features
self.eps = eps
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.triton_helpers import libdevice
from torch.nn impor... | CompVis/interactive-image2video-synthesis | Conv2dBlock | false | 7,924 | [
"MIT"
] | 20 | 05ea449d3a2704b6d79a5f08683035220d615576 | https://github.com/CompVis/interactive-image2video-synthesis/tree/05ea449d3a2704b6d79a5f08683035220d615576 |
focal_BCELoss | import torch
import torch.nn as nn
class focal_BCELoss(nn.Module):
def __init__(self, alpha=10, gamma=2):
super(focal_BCELoss, self).__init__()
self.alpha = alpha
self.gamma = gamma
def forward(self, input, target, eps=1e-07):
input = torch.clamp(input, eps, 1 - 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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | DRL-CASIA/Perception | focal_BCELoss | false | 7,925 | [
"MIT"
] | 39 | a0e7d3957267ce92a82b03ab3eca96916d22c4f2 | https://github.com/DRL-CASIA/Perception/tree/a0e7d3957267ce92a82b03ab3eca96916d22c4f2 |
NeuralAccumulatorCell | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.nn import Parameter
import torch.nn.init as init
from torch.nn.parameter import Parameter
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class NeuralAccumulatorCell(nn.Module):
"""... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | CUMLSec/stateformer | NeuralAccumulatorCell | false | 7,926 | [
"MIT"
] | 41 | 87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c | https://github.com/CUMLSec/stateformer/tree/87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c |
channel_selection | import torch
import torch.nn as nn
class channel_selection(nn.Module):
def __init__(self, num_channels):
"""
Initialize the `indexes` with all one vector with the length same as the number of channels.
During pruning, the places in `indexes` which correpond to the channels to be pruned wi... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Cydia2018/ViT-cifar10-pruning | channel_selection | false | 7,927 | [
"MIT"
] | 18 | 7de250edb8639094355b86e19c8303e635ade026 | https://github.com/Cydia2018/ViT-cifar10-pruning/tree/7de250edb8639094355b86e19c8303e635ade026 |
Conv2dTransposeBlock | import torch
from torch.nn import functional as F
from torch import nn
from torch.nn.utils import spectral_norm
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super().__init__()
self.num_features = num_features
self.eps = eps
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.nn import function... | CompVis/interactive-image2video-synthesis | Conv2dTransposeBlock | false | 7,928 | [
"MIT"
] | 20 | 05ea449d3a2704b6d79a5f08683035220d615576 | https://github.com/CompVis/interactive-image2video-synthesis/tree/05ea449d3a2704b6d79a5f08683035220d615576 |
PatchMerging | import torch
import torch.nn as nn
def bchw_to_bhwc(input: 'torch.Tensor') ->torch.Tensor:
"""
Permutes a tensor to the shape [batch size, height, width, channels]
:param input: (torch.Tensor) Input tensor of the shape [batch size, height, width, channels]
:return: (torch.Tensor) Output tensor of the ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ChristophReich1996/Swin-Transformer-V2 | PatchMerging | false | 7,929 | [
"MIT"
] | 43 | d71c1b412cd0fe13dc2557ad090cf0f027e54d47 | https://github.com/ChristophReich1996/Swin-Transformer-V2/tree/d71c1b412cd0fe13dc2557ad090cf0f027e54d47 |
MapNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class MapNet(nn.Module):
def __init__(self):
super(MapNet, self).__init__()
self.fc1 = nn.Linear(4, 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, 2)
nn.init.normal_(self.fc3.weight, std=0.001)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | DRL-CASIA/Perception | MapNet | false | 7,930 | [
"MIT"
] | 39 | a0e7d3957267ce92a82b03ab3eca96916d22c4f2 | https://github.com/DRL-CASIA/Perception/tree/a0e7d3957267ce92a82b03ab3eca96916d22c4f2 |
Mutan | import torch
from torch import nn
from torch.nn import functional as F
class Mutan(nn.Module):
def __init__(self, input_dims, output_dim, mm_dim=1600, rank=15, shared
=False, normalize=False, dropout_input=0.0, dropout_pre_lin=0.0,
dropout_output=0.0):
super(Mutan, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | AndresPMD/GCN_classification | Mutan | false | 7,931 | [
"MIT"
] | 39 | b005c4256d68f1f90a7f73e7fdb3d066448de28c | https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c |
ByteCombine | import math
import torch
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class ReRegualizedLinearNACLayer(torch.nn.Module):
def __init__(self, in_features, out_features, **kwargs):
super().__init__()
self.in_features = i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CUMLSec/stateformer | ByteCombine | false | 7,932 | [
"MIT"
] | 41 | 87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c | https://github.com/CUMLSec/stateformer/tree/87cb3c906c43fcff42b2ca820eb6e7fd918d0a1c |
MultiHeadAttention | from torch.nn import Module
import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimen... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | CurryYuan/X-Trans2Cap | MultiHeadAttention | false | 7,933 | [
"Apache-2.0"
] | 11 | c78a27209f14fcbbec74fe8b5edc06faea2e7d44 | https://github.com/CurryYuan/X-Trans2Cap/tree/c78a27209f14fcbbec74fe8b5edc06faea2e7d44 |
NormConv2d | import torch
from torch import nn
from torch.nn.utils import weight_norm
class NormConv2d(nn.Module):
"""
Convolutional layer with l2 weight normalization and learned scaling parameters
"""
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0):
super().__init... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | CompVis/interactive-image2video-synthesis | NormConv2d | false | 7,934 | [
"MIT"
] | 20 | 05ea449d3a2704b6d79a5f08683035220d615576 | https://github.com/CompVis/interactive-image2video-synthesis/tree/05ea449d3a2704b6d79a5f08683035220d615576 |
Upsample | import torch
import torch.nn as nn
import torch.nn.functional as F
class Upsample(nn.Module):
""" nn.Upsample is deprecated """
def __init__(self, scale_factor, mode='nearest'):
super(Upsample, self).__init__()
self.scale_factor = scale_factor
self.mode = mode
def forward(self, x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | DRL-CASIA/Perception | Upsample | false | 7,935 | [
"MIT"
] | 39 | a0e7d3957267ce92a82b03ab3eca96916d22c4f2 | https://github.com/DRL-CASIA/Perception/tree/a0e7d3957267ce92a82b03ab3eca96916d22c4f2 |
Conv2dNormActiv | import torch
import torch.nn as nn
class Conv2dNormActiv(nn.Module):
"""
Module for one Conv2d + an Activation (e.g. ReLU, leakyReLU)
Assumption: odd kernel_size
"""
def __init__(self, in_ch, out_ch, k_size=3, stride=1, norm=nn.GroupNorm,
activation=nn.ReLU, dilation=1, padding=None):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DLR-RM/instr | Conv2dNormActiv | false | 7,936 | [
"MIT"
] | 22 | ec1461cd4f31bbc1e692a45925e5dbaeed54843f | https://github.com/DLR-RM/instr/tree/ec1461cd4f31bbc1e692a45925e5dbaeed54843f |
ScaledDotProductAttention | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
"""
Scaled dot-product attention
"""
def __init__(self, d_model, d_k, d_v, h):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimensionality of queries and key... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CurryYuan/X-Trans2Cap | ScaledDotProductAttention | false | 7,937 | [
"Apache-2.0"
] | 11 | c78a27209f14fcbbec74fe8b5edc06faea2e7d44 | https://github.com/CurryYuan/X-Trans2Cap/tree/c78a27209f14fcbbec74fe8b5edc06faea2e7d44 |
DenseAtt | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.nn.modules.loss
class DenseAtt(nn.Module):
def __init__(self, in_features, dropout):
super(DenseAtt, self).__init__()
self.dropout = dropout
self.linear = nn.Linear(2 * in_features, 1, bias=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.optim
import torch.nn.modules.loss
assert_siz... | Dee-chen/scGCN | DenseAtt | false | 7,938 | [
"MIT"
] | 24 | 604818fbaf32ef2fd6ee7bd601f4fe8eff26ac94 | https://github.com/Dee-chen/scGCN/tree/604818fbaf32ef2fd6ee7bd601f4fe8eff26ac94 |
Discriminator | import math
import torch
from torch import nn
import torch.utils.data
def uniform(size, tensor):
stdv = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-stdv, stdv)
class Discriminator(nn.Module):
def __init__(self, hidden_dim):
super(Discriminator, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
import torch.utils.data
assert_size_stride = to... | Cyanogenoid/fspool | Discriminator | false | 7,939 | [
"MIT"
] | 41 | 7525cb17992ec7a1bb7f92996c2b31a65aa8eba2 | https://github.com/Cyanogenoid/fspool/tree/7525cb17992ec7a1bb7f92996c2b31a65aa8eba2 |
Scale | import torch
import torch.nn as nn
import torch.onnx
class Scale(torch.nn.Module):
def __init__(self, value=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.tensor(value, dtype=torch.float32))
def forward(self, input):
return self.scale * input
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
import torch.nn as nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | DDGRCF/YOLOX_OBB | Scale | false | 7,940 | [
"Apache-2.0"
] | 39 | 27b80953306492b8bc83b86b1353d8cee01ef9b6 | https://github.com/DDGRCF/YOLOX_OBB/tree/27b80953306492b8bc83b86b1353d8cee01ef9b6 |
FermiDiracDecoder | from torch.nn import Module
import torch
from torch.nn.modules.module import Module
import torch.optim
import torch.nn.modules.loss
class FermiDiracDecoder(Module):
"""Fermi Dirac to compute edge probabilities based on distances."""
def __init__(self, r, t):
super(FermiDiracDecoder, 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.triton_helpers import math as tl_math
from torch.nn import Module
from torch.nn.modules.module import Module
im... | Dee-chen/scGCN | FermiDiracDecoder | false | 7,941 | [
"MIT"
] | 24 | 604818fbaf32ef2fd6ee7bd601f4fe8eff26ac94 | https://github.com/Dee-chen/scGCN/tree/604818fbaf32ef2fd6ee7bd601f4fe8eff26ac94 |
F1_Loss | import torch
import torch.nn as nn
class F1_Loss(nn.Module):
"""Calculate F1 score. Can work with gpu tensors
The original implmentation is written by Michal Haltuf on Kaggle.
Returns
-------
torch.Tensor
`ndim` == 1. epsilon <= val <= 1
Reference
---------
- htt... | 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... | Darkgaja/edGNN | F1_Loss | false | 7,942 | [
"MIT"
] | 44 | a7d6bce2f84fccdc2e09b642afe584aa0fb96d81 | https://github.com/Darkgaja/edGNN/tree/a7d6bce2f84fccdc2e09b642afe584aa0fb96d81 |
Expand | import torch
import torch.nn as nn
import torch.onnx
class Expand(nn.Module):
def __init__(self, gain=2):
super().__init__()
self.gain = gain
def forward(self, x):
b, c, h, w = x.size()
s = self.gain
x = x.view(b, s, s, c // s ** 2, h, w)
x = x.permute(0, 3, 4... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | DDGRCF/YOLOX_OBB | Expand | false | 7,943 | [
"Apache-2.0"
] | 39 | 27b80953306492b8bc83b86b1353d8cee01ef9b6 | https://github.com/DDGRCF/YOLOX_OBB/tree/27b80953306492b8bc83b86b1353d8cee01ef9b6 |
ResBlock | import torch
from torch.nn import functional as F
from torch import nn
from torch.nn.utils import spectral_norm
class AdaptiveInstanceNorm2d(nn.Module):
def __init__(self, num_features, eps=1e-05, momentum=0.1):
super().__init__()
self.num_features = num_features
self.eps = eps
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.triton_helpers import libdevice
from torch.nn impor... | CompVis/interactive-image2video-synthesis | ResBlock | false | 7,944 | [
"MIT"
] | 20 | 05ea449d3a2704b6d79a5f08683035220d615576 | https://github.com/CompVis/interactive-image2video-synthesis/tree/05ea449d3a2704b6d79a5f08683035220d615576 |
ContrastiveLoss | import torch
import torch.optim
from typing import Any
from typing import NoReturn
import torch
import torch.nn as nn
class ContrastiveLoss(nn.Module):
""" 对比损失函数"""
def __init__(self) ->NoReturn:
super(ContrastiveLoss, self).__init__()
def forward(self, ew: 'Any', label: 'Any', m: 'float'):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.optim
from typing import NoReturn
import torch
import torch.nn as nn
assert_... | DengBoCong/text-sim | ContrastiveLoss | false | 7,945 | [
"MIT"
] | 21 | 2c6c323649aa259a7b3d5c6d3714bd1860114826 | https://github.com/DengBoCong/text-sim/tree/2c6c323649aa259a7b3d5c6d3714bd1860114826 |
Conv | import torch
import torch.nn as nn
def spectral_norm(module, mode=True):
if mode:
return nn.utils.spectral_norm(module)
return module
class Conv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, transpose=False, use_spectral_norm=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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | DQiaole/ZITS | Conv | false | 7,946 | [
"Apache-2.0"
] | 40 | 5f7a060167790789d5e29a3d14d3c2ef8a34e765 | https://github.com/DQiaole/ZITS/tree/5f7a060167790789d5e29a3d14d3c2ef8a34e765 |
MaxLayer | import torch
import torch.nn as nn
class MaxLayer(nn.Module):
def __init__(self):
super(MaxLayer, self).__init__()
def forward(self, a, b):
return torch.max(a, b)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | DingXiaoH/Centripetal-SGD | MaxLayer | false | 7,947 | [
"Apache-2.0"
] | 35 | 992dd0fb31ee47a79cb0891f4f231707abd0c5c6 | https://github.com/DingXiaoH/Centripetal-SGD/tree/992dd0fb31ee47a79cb0891f4f231707abd0c5c6 |
BinaryCrossEntropyLoss | import torch
import torch.nn as nn
class BinaryCrossEntropyLoss(nn.Module):
def __init__(self, pos_weight=None, reduction='mean'):
super(BinaryCrossEntropyLoss, self).__init__()
self.BCE_loss = nn.BCEWithLogitsLoss(pos_weight=pos_weight,
reduction=reduction)
def forward(self, 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 libdevice, math as tl_math
import torc... | DerekRay/2020-instanceSeg | BinaryCrossEntropyLoss | false | 7,948 | [
"MIT"
] | 25 | a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3 | https://github.com/DerekRay/2020-instanceSeg/tree/a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3 |
GateConv | import torch
import torch.nn as nn
class GateConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, transpose=False):
super(GateConv, self).__init__()
self.out_channels = out_channels
if transpose:
self.gate_conv = nn.ConvTra... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | DQiaole/ZITS | GateConv | false | 7,949 | [
"Apache-2.0"
] | 40 | 5f7a060167790789d5e29a3d14d3c2ef8a34e765 | https://github.com/DQiaole/ZITS/tree/5f7a060167790789d5e29a3d14d3c2ef8a34e765 |
GELU | import math
import torch
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT's gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3))))
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.... | DQiaole/ZITS | GELU | false | 7,950 | [
"Apache-2.0"
] | 40 | 5f7a060167790789d5e29a3d14d3c2ef8a34e765 | https://github.com/DQiaole/ZITS/tree/5f7a060167790789d5e29a3d14d3c2ef8a34e765 |
ScaledDotProductAttentionMemory | import torch
import numpy as np
import torch.nn as nn
class ScaledDotProductAttentionMemory(nn.Module):
"""
Scaled dot-product attention with memory
"""
def __init__(self, d_model, d_k, d_v, h, m):
"""
:param d_model: Output dimensionality of the model
:param d_k: Dimensionali... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | CurryYuan/X-Trans2Cap | ScaledDotProductAttentionMemory | false | 7,951 | [
"Apache-2.0"
] | 11 | c78a27209f14fcbbec74fe8b5edc06faea2e7d44 | https://github.com/CurryYuan/X-Trans2Cap/tree/c78a27209f14fcbbec74fe8b5edc06faea2e7d44 |
BinaryLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def adjust_smooth_l1_loss(y_pred, theta=0.1):
less_grad_factor = 1.0 / (2 * theta)
less_loss_bias = less_grad_factor * theta ** 2
less_than_theta = (y_pred < theta).float()
loss = less_than_theta * y_pred ** 2 * less_grad_factor + (1 -... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride ... | DerekRay/2020-instanceSeg | BinaryLoss | false | 7,952 | [
"MIT"
] | 25 | a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3 | https://github.com/DerekRay/2020-instanceSeg/tree/a08ad95e64726db53cc32a5f90aaa13ae3cdb6a3 |
BCEDiceLoss | import torch
import torch.nn as nn
from torch.nn import functional as F
class BCEDiceLoss(nn.Module):
def __init__(self):
super(BCEDiceLoss, self).__init__()
def forward(self, input, target):
bce = F.binary_cross_entropy_with_logits(input, target)
input = torch.sigmoid(input)
... | 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... | DLWK/EANet | BCEDiceLoss | false | 7,953 | [
"MIT"
] | 14 | 3680e099dd815117d4a54f928fb8247aa2f0b71a | https://github.com/DLWK/EANet/tree/3680e099dd815117d4a54f928fb8247aa2f0b71a |
PointerAttention | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), 'Not all arguments have the same valu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | DenDen047/data2text-macro-plan-py | PointerAttention | false | 7,954 | [
"MIT"
] | 20 | bb01ec6e23dab28c1e969f23bd55776b597fb995 | https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995 |
PolicyNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class PolicyNetwork(nn.Module):
def __init__(self):
super(PolicyNetwork, self).__init__()
self.fc1 = nn.Linear(4, 256)
self.fc2 = nn.Linear(256, 256)
self.fc3 = nn.Linear(256, 2)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DensoITLab/spinningup_in_pytorch | PolicyNetwork | false | 7,955 | [
"MIT"
] | 11 | 612d8c4c6593c8c5ecb5a939bf43085daac9e552 | https://github.com/DensoITLab/spinningup_in_pytorch/tree/612d8c4c6593c8c5ecb5a939bf43085daac9e552 |
InformedSender | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class InformedSender(nn.Module):
def __init__(self, game_size, feat_size, embedding_size, hidden_size,
vocab_size=100, temp=1.0):
super(InformedSender, 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.... | Daetheys/Lazimpa | InformedSender | false | 7,956 | [
"MIT"
] | 15 | 21f4f4ebcdfa8b6a775b64673dd3001763c91cf1 | https://github.com/Daetheys/Lazimpa/tree/21f4f4ebcdfa8b6a775b64673dd3001763c91cf1 |
PositionwiseFeedForward | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
d_model (int): the size of input for the first-layer of the FFN.
d_ff (int): the hidden layer size of th... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | DenDen047/data2text-macro-plan-py | PositionwiseFeedForward | false | 7,957 | [
"MIT"
] | 20 | bb01ec6e23dab28c1e969f23bd55776b597fb995 | https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995 |
GELU2 | import torch
import torch.nn as nn
class GELU2(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return x * torch.sigmoid(1.702 * 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... | DQiaole/ZITS | GELU2 | false | 7,958 | [
"Apache-2.0"
] | 40 | 5f7a060167790789d5e29a3d14d3c2ef8a34e765 | https://github.com/DQiaole/ZITS/tree/5f7a060167790789d5e29a3d14d3c2ef8a34e765 |
GlobalAttentionContext | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), '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.... | DenDen047/data2text-macro-plan-py | GlobalAttentionContext | false | 7,959 | [
"MIT"
] | 20 | bb01ec6e23dab28c1e969f23bd55776b597fb995 | https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995 |
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_... | DingXiaoH/GSM-SGD | SEBlock | false | 7,960 | [
"MIT"
] | 40 | ffc605651c4c5115dfb8659ebe48ccf71d3955a0 | https://github.com/DingXiaoH/GSM-SGD/tree/ffc605651c4c5115dfb8659ebe48ccf71d3955a0 |
Contract | import torch
import torch.nn as nn
import torch.onnx
class Contract(nn.Module):
def __init__(self, gain=2):
super().__init__()
self.gain = gain
def forward(self, x):
b, c, h, w = x.size()
s = self.gain
x = x.view(b, c, h // s, s, w // s, s)
x = x.permute(0, 3,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | DDGRCF/YOLOX_OBB | Contract | false | 7,961 | [
"Apache-2.0"
] | 39 | 27b80953306492b8bc83b86b1353d8cee01ef9b6 | https://github.com/DDGRCF/YOLOX_OBB/tree/27b80953306492b8bc83b86b1353d8cee01ef9b6 |
ValueNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class ValueNetwork(nn.Module):
def __init__(self):
super(ValueNetwork, self).__init__()
self.fc1 = nn.Linear(4, 256)
self.fc2 = nn.Linear(256, 256)
self.fc3 = nn.Linear(256, 1)
def forward(self, x):
x ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | DensoITLab/spinningup_in_pytorch | ValueNetwork | false | 7,962 | [
"MIT"
] | 11 | 612d8c4c6593c8c5ecb5a939bf43085daac9e552 | https://github.com/DensoITLab/spinningup_in_pytorch/tree/612d8c4c6593c8c5ecb5a939bf43085daac9e552 |
Sum | import torch
import torch.nn as nn
import torch.onnx
class Sum(nn.Module):
def __init__(self, n, weight=False):
super().__init__()
self.weight = weight
self.iter = range(n - 1)
if weight:
self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=True
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.onnx
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynam... | DDGRCF/YOLOX_OBB | Sum | false | 7,963 | [
"Apache-2.0"
] | 39 | 27b80953306492b8bc83b86b1353d8cee01ef9b6 | https://github.com/DDGRCF/YOLOX_OBB/tree/27b80953306492b8bc83b86b1353d8cee01ef9b6 |
DenseSAGEConv | import math
import torch
import torch.nn.functional as F
import torch.utils.data
from torch.nn import Parameter
def uniform(size, tensor):
stdv = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-stdv, stdv)
class DenseSAGEConv(torch.nn.Module):
"""See :class:`torch_geometric.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.... | Cyanogenoid/fspool | DenseSAGEConv | false | 7,964 | [
"MIT"
] | 41 | 7525cb17992ec7a1bb7f92996c2b31a65aa8eba2 | https://github.com/Cyanogenoid/fspool/tree/7525cb17992ec7a1bb7f92996c2b31a65aa8eba2 |
MultiplicationComposition | import torch
from torch import nn
from abc import abstractmethod
import torch.utils.data
class Composition(nn.Module):
"""A base class for compositions."""
@abstractmethod
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
"""
Compose two batches vectors.
..... | 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
from abc import abstractmethod
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
... | DimitrisAlivas/StarQE | MultiplicationComposition | false | 7,965 | [
"MIT"
] | 11 | c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 | https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 |
Cutout | import random
import torch
def _gen_cutout_coord(height, width, size):
height_loc = random.randint(0, height - 1)
width_loc = random.randint(0, width - 1)
upper_coord = max(0, height_loc - size // 2), max(0, width_loc - size // 2)
lower_coord = min(height, height_loc + size // 2), min(width, width_loc... | 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 random
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cu... | DensoITLab/TeachAugment | Cutout | false | 7,966 | [
"BSD-2-Clause"
] | 20 | 66ec099a0afab99e18531c5437182cfe17dc30c8 | https://github.com/DensoITLab/TeachAugment/tree/66ec099a0afab99e18531c5437182cfe17dc30c8 |
GlobalSelfAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), '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.... | DenDen047/data2text-macro-plan-py | GlobalSelfAttention | false | 7,967 | [
"MIT"
] | 20 | bb01ec6e23dab28c1e969f23bd55776b597fb995 | https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995 |
AverageAttention | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
d_model (int): the size of input for the first-layer of the FFN.
d_ff (int): the hidden layer size of th... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_size_str... | DenDen047/data2text-macro-plan-py | AverageAttention | false | 7,968 | [
"MIT"
] | 20 | bb01ec6e23dab28c1e969f23bd55776b597fb995 | https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995 |
ComplexRotationComposition | import torch
from torch import nn
from abc import abstractmethod
import torch.utils.data
def _to_complex(x: 'torch.Tensor') ->torch.Tensor:
"""View real tensor as complex."""
return torch.view_as_complex(x.view(*x.shape[:-1], -1, 2))
def _to_real(x: 'torch.Tensor') ->torch.Tensor:
"""View complex 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
from torch._inductor.runtime import triton_helpers
from torch import nn
from abc import abstractmethod
import torch.utils.data
assert_size_s... | DimitrisAlivas/StarQE | ComplexRotationComposition | false | 7,969 | [
"MIT"
] | 11 | c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 | https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 |
FocalLoss | import torch
import torch.nn as nn
class FocalLoss(nn.Module):
def __init__(self, gamma=2, eps=1e-07, size_average=True):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.eps = eps
self.size_average = size_average
def forward(self, prob, labels):
p_t = prob *... | 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
... | Dong-JinKim/ActionCooccurrencePriors | FocalLoss | false | 7,970 | [
"MIT"
] | 27 | 110dbeecf4c25955b5b0160bd7d31d25c759ef21 | https://github.com/Dong-JinKim/ActionCooccurrencePriors/tree/110dbeecf4c25955b5b0160bd7d31d25c759ef21 |
ScalarMix | import torch
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
class ScalarMix(nn.Module):
def __init__(self, n_layers, dropout=0):
super(ScalarMix, self).__init__()
self.n_layers = n_layers
self.dropout = dropout
self.weights = nn.Parameter(torch.zeros(n_la... | 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.utils.data.dataloader
import torch.nn as nn
import torch.nn
... | Dadmatech/DadmaTools | ScalarMix | false | 7,971 | [
"Apache-2.0"
] | 25 | c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 | https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 |
CosineSimilarity | import torch
from torch import nn
from abc import abstractmethod
import torch.utils.data
from torch.nn import functional
class Similarity(nn.Module):
"""Base class for similarity functions."""
@abstractmethod
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
"""
Comp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | DimitrisAlivas/StarQE | CosineSimilarity | false | 7,972 | [
"MIT"
] | 11 | c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 | https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 |
Biaffine | import torch
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
class Biaffine(nn.Module):
def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True, diagonal=False
):
super(Biaffine, self).__init__()
self.n_in = n_in
self.n_out = n_out
self.bias_x =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
assert_... | Dadmatech/DadmaTools | Biaffine | false | 7,973 | [
"Apache-2.0"
] | 25 | c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 | https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 |
BiaffineScorer | import torch
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
class BiaffineScorer(nn.Module):
def __init__(self, input1_size, input2_size, output_size):
super().__init__()
self.W_bilin = nn.Bilinear(input1_size + 1, input2_size + 1,
output_size)
self.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
import torch.utils.data.dataloader
import torch.nn as nn
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Dadmatech/DadmaTools | BiaffineScorer | false | 7,974 | [
"Apache-2.0"
] | 25 | c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 | https://github.com/Dadmatech/DadmaTools/tree/c1b7add5c33544f69c1ba1c5250a5ea07caf9aa2 |
MsgNorm | import torch
from torch.nn import functional as F
class MsgNorm(torch.nn.Module):
def __init__(self, learn_msg_scale=False):
super(MsgNorm, self).__init__()
self.msg_scale = torch.nn.Parameter(torch.Tensor([1.0]),
requires_grad=learn_msg_scale)
def forward(self, x, msg, p=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
assert_size_stride = torch._... | Dianezzy/YOLaT-VectorGraphicsRecognition | MsgNorm | false | 7,975 | [
"MIT"
] | 44 | ae21ad5850a49048f639d9b283ded927c3b367f7 | https://github.com/Dianezzy/YOLaT-VectorGraphicsRecognition/tree/ae21ad5850a49048f639d9b283ded927c3b367f7 |
NegativeLpSimilarity | import torch
from torch import nn
from abc import abstractmethod
import torch.utils.data
class Similarity(nn.Module):
"""Base class for similarity functions."""
@abstractmethod
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
"""
Compute pair-wise similarities.
... | 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
from abc import abstractmethod
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
... | DimitrisAlivas/StarQE | NegativeLpSimilarity | false | 7,976 | [
"MIT"
] | 11 | c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 | https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 |
Classifier | import torch
from torch import nn
import torch.nn.functional as F
class Classifier(nn.Module):
def __init__(self, input_size):
super().__init__()
self.hidden_1 = nn.Linear(input_size, 100)
self.hidden_2 = nn.Linear(100, 100)
self.hidden_3 = nn.Linear(100, 50)
self.hidden_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
from torch._inductor.runtime.... | Develop-Packt/Solving-a-Classification-Problem-with-DNNs-Using-PyTorch | Classifier | false | 7,977 | [
"MIT"
] | 16 | d0fe33c71242da256e3727bb49417a08de39c85c | https://github.com/Develop-Packt/Solving-a-Classification-Problem-with-DNNs-Using-PyTorch/tree/d0fe33c71242da256e3727bb49417a08de39c85c |
NegativePowerNormSimilarity | import torch
from torch import nn
from abc import abstractmethod
from typing import Union
import torch.utils.data
class Similarity(nn.Module):
"""Base class for similarity functions."""
@abstractmethod
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
"""
Compute pai... | 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
from abc import abstractmethod
from typing import Union
import torch.utils.data
assert_size_stride = torch._C._dynamo.g... | DimitrisAlivas/StarQE | NegativePowerNormSimilarity | false | 7,978 | [
"MIT"
] | 11 | c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 | https://github.com/DimitrisAlivas/StarQE/tree/c17676e5f1e3f19c0c4c117a50abe2ce22ffef28 |
StableBCELoss | import torch
class StableBCELoss(torch.nn.modules.Module):
def __init__(self):
super(StableBCELoss, self).__init__()
def forward(self, input, target):
neg_abs = -input.abs()
loss = input.clamp(min=0) - input * target + (1 + neg_abs.exp()).log()
return loss.mean()
def get_in... | 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... | Diyago/Automatic-salt-deposits-segmentation | StableBCELoss | false | 7,979 | [
"MIT"
] | 20 | fedfc7f1d9878674382eeb16a820b5f16791f4ab | https://github.com/Diyago/Automatic-salt-deposits-segmentation/tree/fedfc7f1d9878674382eeb16a820b5f16791f4ab |
NormalizeLinear | import math
import torch
from torch.nn import functional as F
import torch.nn as nn
import torch.nn.init as init
class NormalizeLinear(nn.Module):
def __init__(self, in_features, num_class):
super(NormalizeLinear, self).__init__()
self.weight = nn.Parameter(torch.Tensor(num_class, in_features))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DoubtedSteam/MPANet | NormalizeLinear | false | 7,980 | [
"MIT"
] | 25 | fe4f3f1d83c45485b1498786f89ace96c634f187 | https://github.com/DoubtedSteam/MPANet/tree/fe4f3f1d83c45485b1498786f89ace96c634f187 |
MatrixTree | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class MatrixTree(nn.Module):
"""Implementation of the matrix-tree theorem for computing marginals
of non-projective dependency parsing. This attention layer is used
in the paper "Learning Structured Text Representations"
:ci... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_s... | DenDen047/data2text-macro-plan-py | MatrixTree | false | 7,981 | [
"MIT"
] | 20 | bb01ec6e23dab28c1e969f23bd55776b597fb995 | https://github.com/DenDen047/data2text-macro-plan-py/tree/bb01ec6e23dab28c1e969f23bd55776b597fb995 |
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.conv = 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
import torch.nn as nn
assert_... | DoubtedSteam/MPANet | SpatialAttention | false | 7,982 | [
"MIT"
] | 25 | fe4f3f1d83c45485b1498786f89ace96c634f187 | https://github.com/DoubtedSteam/MPANet/tree/fe4f3f1d83c45485b1498786f89ace96c634f187 |
NonSaturatingLoss | import torch
import torch.nn.functional as F
def non_saturating_loss(logits, targets):
probs = logits.softmax(1)
log_prob = torch.log(1 - probs + 1e-12)
if targets.ndim == 2:
return -(targets * log_prob).sum(1).mean()
else:
return F.nll_loss(log_prob, targets)
class NonSaturatingLoss... | 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... | DensoITLab/TeachAugment | NonSaturatingLoss | false | 7,983 | [
"BSD-2-Clause"
] | 20 | 66ec099a0afab99e18531c5437182cfe17dc30c8 | https://github.com/DensoITLab/TeachAugment/tree/66ec099a0afab99e18531c5437182cfe17dc30c8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.