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 |
|---|---|---|---|---|---|---|---|---|---|---|
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... | Vivianyzw/Dual.DBNet.pytorch | MaskL1Loss | false | 1,179 | [
"Apache-2.0",
"MIT"
] | 0 | 19d823ed7c05076c087a3f7ad1127c71c1c0d692 | https://github.com/Vivianyzw/Dual.DBNet.pytorch/tree/19d823ed7c05076c087a3f7ad1127c71c1c0d692 |
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... | Vivianyzw/Dual.DBNet.pytorch | HardSigmoid | false | 1,180 | [
"Apache-2.0",
"MIT"
] | 0 | 19d823ed7c05076c087a3f7ad1127c71c1c0d692 | https://github.com/Vivianyzw/Dual.DBNet.pytorch/tree/19d823ed7c05076c087a3f7ad1127c71c1c0d692 |
MLP | import torch
import torch.nn as nn
from torch.autograd import *
class FullyConnectedLayer(nn.Module):
def __init__(self, in_size, out_size, dropout_r=0.0, use_relu=True):
super(FullyConnectedLayer, self).__init__()
self.dropout_r = dropout_r
self.use_relu = use_relu
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 import triton_helpers
import torch.nn as nn
from to... | VISLANG-Lab/MGCL | MLP | false | 1,181 | [
"MIT"
] | 0 | 22da06ffa7410d9632bfda8eefb1b79e4f660de0 | https://github.com/VISLANG-Lab/MGCL/tree/22da06ffa7410d9632bfda8eefb1b79e4f660de0 |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
"""
Loss function from https://arxiv.org/abs/1707.03237,
where iou computation is introduced heatmap manner to measure the
diversity bwtween tow heatmaps.
"""
def __init__(self, eps=1e-06):
super(DiceLoss, 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Vivianyzw/Dual.DBNet.pytorch | DiceLoss | false | 1,182 | [
"Apache-2.0",
"MIT"
] | 0 | 19d823ed7c05076c087a3f7ad1127c71c1c0d692 | https://github.com/Vivianyzw/Dual.DBNet.pytorch/tree/19d823ed7c05076c087a3f7ad1127c71c1c0d692 |
AFMLayer | import itertools
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class AFMLayer(nn.Module):
"""Attentonal Factorization Machine models pairwise (order-2) feature
interactions without linear term and bias.
Input shape
- A list of 3D tensor with sha... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Sunmyunghan/Final_Project | AFMLayer | false | 1,183 | [
"MIT"
] | 0 | 28cde293dc6d07521b2e1c5613b20444aea91d21 | https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21 |
Discriminator | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class Discriminator(nn.Module):
def __init__(self, outputs_size, K=2):
super(Discriminator, self).__init__()
self.fc1 = nn.Linear(outputs_size, outputs_size // K, bias=True)
outputs_size = out... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from sk... | Ulian7/DeepCTR | Discriminator | false | 1,184 | [
"Apache-2.0"
] | 0 | d8f519a722a4d6a4f1fe18e04af54cfd1369c9a5 | https://github.com/Ulian7/DeepCTR/tree/d8f519a722a4d6a4f1fe18e04af54cfd1369c9a5 |
APL | import torch
from torch import nn
from torch.nn.parameter import Parameter
class APL(nn.Module):
"""
Implementation of APL (ADAPTIVE PIECEWISE LINEAR UNITS) unit:
.. math::
APL(x_i) = max(0,x) + \\sum_{s=1}^{S}{a_i^s * max(0, -x + b_i^s)}
with trainable parameters a and b, parameter... | 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 torch.nn.parameter import Parameter
assert_size_stride = torch.... | Venkateshwar2506/Echo | APL | false | 1,185 | [
"MIT"
] | 0 | 5d236b25ee4900754f48e0a865e1bf1ae9183875 | https://github.com/Venkateshwar2506/Echo/tree/5d236b25ee4900754f48e0a865e1bf1ae9183875 |
ClipLoss | import torch
import torch.nn.functional as F
from torch import nn
import torch.distributed as dist
import torch.distributed.nn
def gather_features(image_features, text_features, aug1_embed=None,
aug2_embed=None, local_loss=False, gather_with_grad=False, rank=0,
world_size=1, horovod=False):
if horovod:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Vaishaal/open_clip | ClipLoss | false | 1,186 | [
"MIT"
] | 0 | 8877c4036dacde022da90769c64006d9f2c82e84 | https://github.com/Vaishaal/open_clip/tree/8877c4036dacde022da90769c64006d9f2c82e84 |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self):
super(Encoder, self).__init__()
self.Conv1 = nn.Conv2d(1, 16, 3, 1, 1)
self.Relu = nn.ReLU(inplace=True)
self.layers = nn.ModuleDict({'DenseConv1': nn.Conv2d(16, 16, 3, 1,
1), 'DenseConv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | VarunBabbar/Image_Compressor | Encoder | false | 1,187 | [
"MIT"
] | 0 | 254d8d411f7cd16f3ce242275532c9fca537269c | https://github.com/VarunBabbar/Image_Compressor/tree/254d8d411f7cd16f3ce242275532c9fca537269c |
architecture | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self):
super(Decoder, self).__init__()
self.layers = nn.Sequential()
self.layers.add_module('Conv3', nn.Conv2d(64, 32, 3, 1, 1))
self.layers.add_module('Act3', nn.ReLU(inplace=True))
self.layers.add_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | VarunBabbar/Image_Compressor | architecture | false | 1,188 | [
"MIT"
] | 0 | 254d8d411f7cd16f3ce242275532c9fca537269c | https://github.com/VarunBabbar/Image_Compressor/tree/254d8d411f7cd16f3ce242275532c9fca537269c |
SReLU | import torch
from torch import nn
from torch.nn.parameter import Parameter
class SReLU(nn.Module):
"""
SReLU (S-shaped Rectified Linear Activation Unit): a combination of three linear functions, which perform mapping R → R with the following formulation:
.. math::
h(x_i) = \\left\\{\\begin{matri... | 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 torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_... | Venkateshwar2506/Echo | SReLU | false | 1,189 | [
"MIT"
] | 0 | 5d236b25ee4900754f48e0a865e1bf1ae9183875 | https://github.com/Venkateshwar2506/Echo/tree/5d236b25ee4900754f48e0a865e1bf1ae9183875 |
ResnetBlock | import torch
import torch.nn as nn
class ResnetBlock(nn.Module):
def __init__(self, in_channels, out_channels, use_bn=False):
super(ResnetBlock, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.use_bn = use_bn
self.relu = nn.ReLU(inplac... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | VashishtMadhavan/pytorch-maml-rl | ResnetBlock | false | 1,190 | [
"MIT"
] | 0 | d8821b8374d973869bb6a1393f1b2c369c9a664b | https://github.com/VashishtMadhavan/pytorch-maml-rl/tree/d8821b8374d973869bb6a1393f1b2c369c9a664b |
ODEfunc | import torch
import torch.nn as nn
def norm(dim):
return nn.GroupNorm(min(32, dim), dim)
class ConcatConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False):
super(ConcatConv2d, self).__init__()
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 import triton_helpers
from torch._inductor.runtime.... | TylerChoi1224/torchdiffeq | ODEfunc | false | 1,191 | [
"MIT"
] | 0 | 72f74d9651a58ab11cdadd60682f1b61e625ef53 | https://github.com/TylerChoi1224/torchdiffeq/tree/72f74d9651a58ab11cdadd60682f1b61e625ef53 |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self):
super(Decoder, self).__init__()
self.layers = nn.Sequential()
self.layers.add_module('Conv3', nn.Conv2d(64, 32, 3, 1, 1))
self.layers.add_module('Act3', nn.ReLU(inplace=True))
self.layers.add_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | VarunBabbar/Image_Compressor | Decoder | false | 1,192 | [
"MIT"
] | 0 | 254d8d411f7cd16f3ce242275532c9fca537269c | https://github.com/VarunBabbar/Image_Compressor/tree/254d8d411f7cd16f3ce242275532c9fca537269c |
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... | Vivianyzw/Dual.DBNet.pytorch | SEBlock | false | 1,193 | [
"Apache-2.0",
"MIT"
] | 0 | 19d823ed7c05076c087a3f7ad1127c71c1c0d692 | https://github.com/Vivianyzw/Dual.DBNet.pytorch/tree/19d823ed7c05076c087a3f7ad1127c71c1c0d692 |
CELoss | import torch
import torch.nn as nn
class CELoss(nn.Module):
""" Cross Entorpy Loss Wrapper
Args:
loss_weight (float): Weight of the loss. Default: 1.0.
"""
def __init__(self, loss_weight=1.0):
super().__init__()
self.loss_weight = loss_weight
self.criterion = nn.Cross... | 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
... | WangXin93/mmpose | CELoss | false | 1,194 | [
"Apache-2.0"
] | 0 | 28b6e9ac2f6ed195ab27fb04da2213fc885a5994 | https://github.com/WangXin93/mmpose/tree/28b6e9ac2f6ed195ab27fb04da2213fc885a5994 |
AttentionPool2d | import torch
import torch.nn.functional as F
from torch import nn
import torch.distributed.nn
class AttentionPool2d(nn.Module):
def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads:
'int', output_dim: 'int'=None):
super().__init__()
self.positional_embedding = nn.Parameter(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 torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Vaishaal/open_clip | AttentionPool2d | false | 1,195 | [
"MIT"
] | 0 | 8877c4036dacde022da90769c64006d9f2c82e84 | https://github.com/Vaishaal/open_clip/tree/8877c4036dacde022da90769c64006d9f2c82e84 |
TemperatureScaleTrainer | import torch
import torch.nn as nn
class TemperatureScaleTrainer(nn.Module):
def __init__(self):
super(TemperatureScaleTrainer, self).__init__()
self._temperature = nn.Parameter(torch.ones(1), requires_grad=True)
if torch.cuda.is_available():
self._temperature
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... | Kageshimasu/temperature-scaling-optimizer | TemperatureScaleTrainer | false | 1,196 | [
"MIT"
] | 0 | 3af562e6c3fefef97aec0431d08b8e8275d275c7 | https://github.com/Kageshimasu/temperature-scaling-optimizer/tree/3af562e6c3fefef97aec0431d08b8e8275d275c7 |
ELUPlus | import torch
from torch import nn
import torch.nn
class ELUPlus(nn.Module):
def __init__(self):
super().__init__()
self.elu = nn.ELU()
def forward(self, x):
return self.elu(x) + 1.0
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import torch.nn
assert_size_stride = torch._C._dynamo.guar... | UzTak/nflows | ELUPlus | false | 1,197 | [
"MIT"
] | 0 | 7211b129bfd60fabed199a1d2a3272b2aac8bbda | https://github.com/UzTak/nflows/tree/7211b129bfd60fabed199a1d2a3272b2aac8bbda |
InteractingLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class InteractingLayer(nn.Module):
"""A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism.
Input shape
- A 3D tensor with shape... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Ulian7/DeepCTR | InteractingLayer | false | 1,198 | [
"Apache-2.0"
] | 0 | d8f519a722a4d6a4f1fe18e04af54cfd1369c9a5 | https://github.com/Ulian7/DeepCTR/tree/d8f519a722a4d6a4f1fe18e04af54cfd1369c9a5 |
CombinedTargetMSELoss | import torch
import torch.nn as nn
class CombinedTargetMSELoss(nn.Module):
"""MSE loss for combined target.
CombinedTarget: The combination of classification target
(response map) and regression target (offset map).
Paper ref: Huang et al. The Devil is in the Details: Delving into
... | 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... | WangXin93/mmpose | CombinedTargetMSELoss | false | 1,199 | [
"Apache-2.0"
] | 0 | 28b6e9ac2f6ed195ab27fb04da2213fc885a5994 | https://github.com/WangXin93/mmpose/tree/28b6e9ac2f6ed195ab27fb04da2213fc885a5994 |
AUGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class AUGRUCell(nn.Module):
""" Effect of GRU with attentional update gate (AUGRU)
Reference:
- Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Sunmyunghan/Final_Project | AUGRUCell | false | 1,200 | [
"MIT"
] | 0 | 28cde293dc6d07521b2e1c5613b20444aea91d21 | https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21 |
BiInteractionPooling | import torch
import torch.nn as nn
from sklearn.metrics import *
class BiInteractionPooling(nn.Module):
"""Bi-Interaction Layer used in Neural FM,compress the
pairwise element-wise product of features into one single vector.
Input shape
- A 3D tensor with shape:``(batch_size,field_size,embeddi... | 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
from sklearn.metrics import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = tor... | Sunmyunghan/Final_Project | BiInteractionPooling | false | 1,201 | [
"MIT"
] | 0 | 28cde293dc6d07521b2e1c5613b20444aea91d21 | https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21 |
AGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class AGRUCell(nn.Module):
""" Attention based GRU (AGRU)
Reference:
- Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, 2018.
"""
def __... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Sunmyunghan/Final_Project | AGRUCell | false | 1,202 | [
"MIT"
] | 0 | 28cde293dc6d07521b2e1c5613b20444aea91d21 | https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21 |
cha_loss | import torch
import torch.nn as nn
import torch.optim
import torch.cuda
class cha_loss(nn.Module):
def __init__(self, eps=0.001):
super(cha_loss, self).__init__()
self.eps = eps
return
def forward(self, inp, target):
diff = torch.abs(inp - target) ** 2 + self.eps ** 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, math as tl_math
import torc... | Weepingchestnut/OVSR | cha_loss | false | 1,203 | [
"Apache-2.0"
] | 0 | 11554a3b1072d50a8c88cf59b4b986df1fda73f9 | https://github.com/Weepingchestnut/OVSR/tree/11554a3b1072d50a8c88cf59b4b986df1fda73f9 |
AvgReducePool1d | import torch
from torch import nn
class AvgReducePool1d(nn.Module):
"""A subclass of :torch_nn:`Module`.
Avg Pool layer for 1D inputs. The same as :torch_nn:`AvgPool1d` except that
the pooling dimension is entirely reduced (i.e., `pool_size=input_length`).
"""
def forward(self, input: '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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | WangXinglin/BIT_framework | AvgReducePool1d | false | 1,204 | [
"MIT"
] | 0 | 1484874fcd00d052c7536789dec95050b480b25d | https://github.com/WangXinglin/BIT_framework/tree/1484874fcd00d052c7536789dec95050b480b25d |
T5LayerNorm | import torch
from torch import nn
class T5LayerNorm(nn.Module):
""" Custom LayerNorm for T5 with no mean subtraction and no bias.
"""
def __init__(self, input_size: 'int', eps: 'float'=1e-05):
super().__init__()
self.w = nn.Parameter(torch.ones(input_size))
self.eps = eps
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.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | WangXinglin/BIT_framework | T5LayerNorm | false | 1,205 | [
"MIT"
] | 0 | 1484874fcd00d052c7536789dec95050b480b25d | https://github.com/WangXinglin/BIT_framework/tree/1484874fcd00d052c7536789dec95050b480b25d |
GraphConvolution | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
import torch.nn.modules.loss
import torch.utils.data
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __init__(self, 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.nn import Module
i... | WanyuGroup/CVPR2022-OrphicX | GraphConvolution | false | 1,206 | [
"MIT"
] | 0 | 98d8d8259439c45661573e575cf956331df16abc | https://github.com/WanyuGroup/CVPR2022-OrphicX/tree/98d8d8259439c45661573e575cf956331df16abc |
Normalize | import torch
import torch.nn as nn
from torch.nn import functional as F
class Normalize(nn.Module):
"""Performs :math:`L_p` normalization of inputs over specified dimension.
Does:
.. math::
v = \\frac{v}{\\max(\\lVert v \\rVert_p, \\epsilon)}
for each subtensor v over dimension dim of 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
import torch.nn as nn
assert... | WillyChen123/CDFNet | Normalize | false | 1,207 | [
"MIT"
] | 0 | 12d6b288aa2a8301683395a75bd44a7be44b7f2a | https://github.com/WillyChen123/CDFNet/tree/12d6b288aa2a8301683395a75bd44a7be44b7f2a |
InnerProductDecoder | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.modules.loss
import torch.utils.data
class InnerProductDecoder(nn.Module):
"""Decoder for using inner product for prediction."""
def __init__(self, dropout, act=torch.sigmoid):
super(InnerProductDecoder, self).__init__... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.modules.loss
import torch.utils.data
asser... | WanyuGroup/CVPR2022-OrphicX | InnerProductDecoder | false | 1,208 | [
"MIT"
] | 0 | 98d8d8259439c45661573e575cf956331df16abc | https://github.com/WanyuGroup/CVPR2022-OrphicX/tree/98d8d8259439c45661573e575cf956331df16abc |
InnerProductDecoderMLP | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.nn.modules.loss
import torch.utils.data
class InnerProductDecoderMLP(nn.Module):
"""Decoder for using inner product for prediction."""
def __init__(self, input_dim, hidden_dim1, hidden_dim2, dropout, act=
torch.sigmoid):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | WanyuGroup/CVPR2022-OrphicX | InnerProductDecoderMLP | false | 1,209 | [
"MIT"
] | 0 | 98d8d8259439c45661573e575cf956331df16abc | https://github.com/WanyuGroup/CVPR2022-OrphicX/tree/98d8d8259439c45661573e575cf956331df16abc |
Accuracy | import torch
from sklearn.metrics import *
import torch.nn as nn
def accuracy(logits, labels, ignore_index: 'int'=-100):
with torch.no_grad():
valid_mask = labels != ignore_index
predictions = logits.float().argmax(-1)
correct = (predictions == labels) * valid_mask
return correct.s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from sklearn.metrics import *
import torch.nn as nn
assert_size_stride = torch._C._dynamo... | Vasyka/DeepGQuad | Accuracy | false | 1,210 | [
"Apache-2.0"
] | 0 | 772a461732fc4044a1dee84d2688bf16960e272c | https://github.com/Vasyka/DeepGQuad/tree/772a461732fc4044a1dee84d2688bf16960e272c |
InteractingLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class InteractingLayer(nn.Module):
"""A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism.
Input shape
- A 3D tensor with shape... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Sunmyunghan/Final_Project | InteractingLayer | false | 1,211 | [
"MIT"
] | 0 | 28cde293dc6d07521b2e1c5613b20444aea91d21 | https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21 |
SoftDiceLoss | import torch
from torch.nn.modules.loss import _Loss
class SoftDiceLoss(_Loss):
def __init__(self, size_average=None, reduce=None, reduction='mean'):
super(SoftDiceLoss, self).__init__(size_average, reduce, reduction)
def forward(self, y_pred, y_gt):
numerator = torch.sum(y_pred * y_gt)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn.modules.loss import _Loss
assert_size_stride = torch._C._dynamo.guards.asse... | Will3577/Medical-Transformer | SoftDiceLoss | false | 1,212 | [
"MIT"
] | 0 | e72bfe68fcd55268f57bc7c27b4cbce8029d1b81 | https://github.com/Will3577/Medical-Transformer/tree/e72bfe68fcd55268f57bc7c27b4cbce8029d1b81 |
VGAE | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules.module import Module
import torch.nn as nn
import torch.nn.modules.loss
import torch.utils.data
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __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.nn import Module
i... | WanyuGroup/CVPR2022-OrphicX | VGAE | false | 1,213 | [
"MIT"
] | 0 | 98d8d8259439c45661573e575cf956331df16abc | https://github.com/WanyuGroup/CVPR2022-OrphicX/tree/98d8d8259439c45661573e575cf956331df16abc |
SeparableConv1d | import torch
import torch.nn as nn
class SeparableConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding='same', bias=False):
super(SeparableConv1d, self).__init__()
if stride > 1:
padding = 0
self.depthwise = nn.Conv1d(in_chann... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | WhiteTeaDragon/hw-asr | SeparableConv1d | false | 1,214 | [
"MIT"
] | 0 | 78a767ab00a743b8d28d1fdad795f066fc0795da | https://github.com/WhiteTeaDragon/hw-asr/tree/78a767ab00a743b8d28d1fdad795f066fc0795da |
GetMask | import torch
import torch.multiprocessing
import torch.utils.data
class GetMask(torch.nn.Module):
"""
inputs: x: any size
outputs:mask: same size as input x
"""
def __init__(self, pad_idx=0):
super(GetMask, self).__init__()
self.pad_idx = pad_idx
def forward(se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.multiprocessing
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = to... | WuDiDaBinGe/TAKG | GetMask | false | 1,215 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
SmoothCrossEntropyLoss | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _WeightedLoss
import torch.utils.tensorboard
class SmoothCrossEntropyLoss(_WeightedLoss):
def __init__(self, weight=None, reduction='mean', smoothing=0.0):
super().__init__(weight=weight, reduction=reduction)
self.smoo... | 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.nn.modules.... | Dieg0Alejandr0/3D-Generative-SBDD | SmoothCrossEntropyLoss | false | 1,216 | [
"MIT"
] | 0 | 51ffd36a6cf5048eeff6e68186a4608048feea4c | https://github.com/Dieg0Alejandr0/3D-Generative-SBDD/tree/51ffd36a6cf5048eeff6e68186a4608048feea4c |
StandardNLL | import torch
import torch.multiprocessing
import torch.utils.data
class StandardNLL(torch.nn.modules.loss._Loss):
"""
Shape:
log_prob: batch x time x class
y_true: batch x time
mask: batch x time
output: batch
"""
def forward(self, log_prob, y_true, mas... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.multiprocessing
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = to... | WuDiDaBinGe/TAKG | StandardNLL | false | 1,217 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
MLP_model | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP_model(nn.Module):
"""Feedfoward neural network with 6 hidden layer"""
def __init__(self, in_size, out_size):
super().__init__()
self.linear1 = nn.Linear(in_size, 4096)
self.linear2 = nn.Linear(4096, 2048)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | WeihengXia0123/Machine_Learning_Service | MLP_model | false | 1,218 | [
"MIT"
] | 0 | 516d64ff780317ee96e18584001b77165ce6531c | https://github.com/WeihengXia0123/Machine_Learning_Service/tree/516d64ff780317ee96e18584001b77165ce6531c |
MaskedSoftmax | import torch
from torch.nn import functional as F
import torch.multiprocessing
from torch import nn
import torch.utils.data
class MaskedSoftmax(nn.Module):
def __init__(self, dim):
super(MaskedSoftmax, self).__init__()
self.dim = dim
def forward(self, logit, mask=None):
if mask is No... | 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.multiproc... | WuDiDaBinGe/TAKG | MaskedSoftmax | false | 1,219 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
ShiftedSoftplus | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.tensorboard
class ShiftedSoftplus(nn.Module):
def __init__(self):
super().__init__()
self.shift = torch.log(torch.tensor(2.0)).item()
def forward(self, x):
return F.softplus(x) - self.shift
def ge... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
import torch.utils.tensorboard
assert_si... | Dieg0Alejandr0/3D-Generative-SBDD | ShiftedSoftplus | false | 1,220 | [
"MIT"
] | 0 | 51ffd36a6cf5048eeff6e68186a4608048feea4c | https://github.com/Dieg0Alejandr0/3D-Generative-SBDD/tree/51ffd36a6cf5048eeff6e68186a4608048feea4c |
InnerProductLayer | import torch
import torch.nn as nn
from sklearn.metrics import *
class InnerProductLayer(nn.Module):
"""InnerProduct Layer used in PNN that compute the element-wise
product or inner product between feature vectors.
Input shape
- a list of 3D tensor with shape: ``(batch_size,1,embedding_size)``.
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from sklearn.metrics import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = tor... | Sunmyunghan/Final_Project | InnerProductLayer | false | 1,221 | [
"MIT"
] | 0 | 28cde293dc6d07521b2e1c5613b20444aea91d21 | https://github.com/Sunmyunghan/Final_Project/tree/28cde293dc6d07521b2e1c5613b20444aea91d21 |
TransferNet | import torch
import torch.nn as nn
class GenericLayer(nn.Module):
def __init__(self, layer, out_channels, padding=(0, 0, 0, 0),
activation=None):
super(GenericLayer, self).__init__()
self._act = activation
self._layer = layer
self._norm = nn.InstanceNorm2d(out_channels, af... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ThomasRanvier/cnn_style_transfer | TransferNet | false | 1,222 | [
"MIT"
] | 0 | 90b6c76c20263c22f4e45184d572284726ecbd7b | https://github.com/ThomasRanvier/cnn_style_transfer/tree/90b6c76c20263c22f4e45184d572284726ecbd7b |
MSE_Loss | import torch
import torch.nn as nn
class MSE_Loss(nn.Module):
def __init__(self, sum_dim=None, sqrt=False, dimension_warn=0):
super().__init__()
self.sum_dim = sum_dim
self.sqrt = sqrt
self.dimension_warn = dimension_warn
def forward(self, x, y):
assert x.shape == y.s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | WorksApplications/omni_torch | MSE_Loss | false | 1,223 | [
"Apache-2.0"
] | 0 | 10b689d794c8f485e38c765303ef018da17bc641 | https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641 |
KL_Divergence | import torch
import torch.nn as nn
class KL_Divergence(nn.Module):
def __init__(self, sum_dim=None, sqrt=False, dimension_warn=0):
super().__init__()
self.sum_dim = sum_dim
self.sqrt = sqrt
self.dimension_warn = dimension_warn
def forward(self, x, y):
x = x.view(x.siz... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | WorksApplications/omni_torch | KL_Divergence | false | 1,224 | [
"Apache-2.0"
] | 0 | 10b689d794c8f485e38c765303ef018da17bc641 | https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641 |
FC_Layer | import torch
import torch.nn as nn
def standardize(param, assert_length):
if type(param) is not list and type(param) is not tuple:
param = [param] * assert_length
assert len(param
) == assert_length, 'expect %s input params, got %s input parameter' % (
assert_length, len(param))
re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | WorksApplications/omni_torch | FC_Layer | false | 1,225 | [
"Apache-2.0"
] | 0 | 10b689d794c8f485e38c765303ef018da17bc641 | https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641 |
JS_Divergence | import torch
import torch.nn as nn
class JS_Divergence(nn.Module):
def __init__(self):
super().__init__()
self.engine = nn.KLDivLoss()
def forward(self, x, y):
return self.engine(x, y) + self.engine(y, x)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | WorksApplications/omni_torch | JS_Divergence | false | 1,226 | [
"Apache-2.0"
] | 0 | 10b689d794c8f485e38c765303ef018da17bc641 | https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641 |
ContextGate | import torch
import torch.multiprocessing
from torch import nn
import torch.utils.data
class ContextGate(nn.Module):
def __init__(self, vector_dim, topic_dim):
super().__init__()
assert vector_dim == topic_dim
self.fusion_linear = nn.Linear(vector_dim + topic_dim, vector_dim)
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.multip... | WuDiDaBinGe/TAKG | ContextGate | false | 1,227 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
ClassicMixtureDensityModule | import torch
from torch import nn
class ClassicMixtureDensityModule(nn.Module):
def __init__(self, dim_input, dim_output, num_components):
super(ClassicMixtureDensityModule, self).__init__()
self.dim_input = dim_input
self.dim_output = dim_output
self.M = num_components
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.... | Woodenonez/MultimodalMotionPred_SamplingWTACGF_Pytorch | ClassicMixtureDensityModule | false | 1,228 | [
"MIT"
] | 0 | 2be4f8aaaebb9ec80b29d4ff86146010a0192573 | https://github.com/Woodenonez/MultimodalMotionPred_SamplingWTACGF_Pytorch/tree/2be4f8aaaebb9ec80b29d4ff86146010a0192573 |
EncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class SPA(nn.Module):
""" Selective parallel attention """
def __init__(self, n_head: 'int'=8, d_v: 'int'=64):
super().__init__()
self.gap = nn.AdaptiveAvgPool1d(1)
self.sk = nn.Linear(d_v, n_head * d_v)
self.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.... | WOMMOW/AIT | EncoderLayer | false | 1,229 | [
"MIT"
] | 0 | 305fe7962bf9c5c24b6854e3ff0b7e2e669bf5a5 | https://github.com/WOMMOW/AIT/tree/305fe7962bf9c5c24b6854e3ff0b7e2e669bf5a5 |
Mean | import torch
import torch.nn as nn
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 input.mean(self.dim, self.keep_dim)
def get_inputs():
return [torch.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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | WillyChen123/CDFNet | Mean | false | 1,230 | [
"MIT"
] | 0 | 12d6b288aa2a8301683395a75bd44a7be44b7f2a | https://github.com/WillyChen123/CDFNet/tree/12d6b288aa2a8301683395a75bd44a7be44b7f2a |
CLeakyReLU | import torch
import torch.nn as nn
import torch.nn.functional as F
class CLeakyReLU(nn.LeakyReLU):
def forward(self, xr, xi):
return F.leaky_relu(xr, self.negative_slope, self.inplace
), F.leaky_relu(xi, self.negative_slope, self.inplace)
def get_inputs():
return [torch.rand([4, 4, 4, 4... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | X-CCS/TensorFlowTTS | CLeakyReLU | false | 1,231 | [
"Apache-2.0"
] | 0 | 157fab4cbcf11a68ff62f6ec364af43447247c76 | https://github.com/X-CCS/TensorFlowTTS/tree/157fab4cbcf11a68ff62f6ec364af43447247c76 |
KL_Triplet_Loss | import torch
import torch.nn as nn
class KL_Triplet_Loss(nn.Module):
def __init__(self, symmetric=True):
"""
:param symmetric: if symmetric, we will use JS Divergence, if not KL Divergence will be used.
"""
super().__init__()
self.symmetric = symmetric
self.engine ... | 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... | WorksApplications/omni_torch | KL_Triplet_Loss | false | 1,232 | [
"Apache-2.0"
] | 0 | 10b689d794c8f485e38c765303ef018da17bc641 | https://github.com/WorksApplications/omni_torch/tree/10b689d794c8f485e38c765303ef018da17bc641 |
DecoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class SPA(nn.Module):
""" Selective parallel attention """
def __init__(self, n_head: 'int'=8, d_v: 'int'=64):
super().__init__()
self.gap = nn.AdaptiveAvgPool1d(1)
self.sk = nn.Linear(d_v, n_head * d_v)
self.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.... | WOMMOW/AIT | DecoderLayer | false | 1,233 | [
"MIT"
] | 0 | 305fe7962bf9c5c24b6854e3ff0b7e2e669bf5a5 | https://github.com/WOMMOW/AIT/tree/305fe7962bf9c5c24b6854e3ff0b7e2e669bf5a5 |
DocumentTopicDecoder | import torch
import torch.multiprocessing
from torch import nn
import torch.utils.data
class DocumentTopicDecoder(nn.Module):
def __init__(self, dim_h, num_topics):
super(DocumentTopicDecoder, self).__init__()
self.decoder = nn.GRUCell(input_size=dim_h, hidden_size=dim_h)
self.out_linear ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | WuDiDaBinGe/TAKG | DocumentTopicDecoder | false | 1,234 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
LinearMultiplicationComposition | import torch
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class CompositionFunction(torch.nn.Module):
def __init__(self, representation_size: 'int'):
super().__init__()
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
raise NotImplemented... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.parallel
import torch.utils.data
import torch.distributions
asse... | XeniaOhmer/SystematicRepresentations | LinearMultiplicationComposition | false | 1,235 | [
"MIT"
] | 0 | 825208d1be659dc820e61f577cdb53afc47302f4 | https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4 |
LinearComposition | import torch
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class CompositionFunction(torch.nn.Module):
def __init__(self, representation_size: 'int'):
super().__init__()
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
raise NotImplemented... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.parallel
import torch.utils.data
import torch.distributions
asse... | XeniaOhmer/SystematicRepresentations | LinearComposition | false | 1,236 | [
"MIT"
] | 0 | 825208d1be659dc820e61f577cdb53afc47302f4 | https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4 |
LinearAdditionComposition | import torch
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class CompositionFunction(torch.nn.Module):
def __init__(self, representation_size: 'int'):
super().__init__()
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
raise NotImplemented... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.parallel
import torch.utils.data
import torch.distributions
asse... | XeniaOhmer/SystematicRepresentations | LinearAdditionComposition | false | 1,237 | [
"MIT"
] | 0 | 825208d1be659dc820e61f577cdb53afc47302f4 | https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4 |
SingleGate | import torch
import torch.multiprocessing
from torch import nn
import torch.utils.data
class SingleGate(nn.Module):
def __init__(self, vector_dim, topic_dim):
super().__init__()
assert vector_dim == topic_dim
self.fusion_linear = nn.Linear(vector_dim + topic_dim, 1)
self.sigmoid =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.multiprocessing
from torch import nn
import torch.utils.data
assert... | WuDiDaBinGe/TAKG | SingleGate | false | 1,238 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
AvgReadout | import torch
import torch.nn as nn
class AvgReadout(nn.Module):
"""
Considering the efficiency of the method, we simply employ average pooling, computing the average of the set of embedding matrices
.. math::
\\begin{equation}
\\mathbf{H}=\\mathcal{Q}\\left(\\left\\{\\mathbf{H}^{(r)} \\mid ... | 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... | Xinstein3033/OpenHGNN | AvgReadout | false | 1,239 | [
"Apache-2.0"
] | 0 | a9ca499834523419ecdaaa09e4b42f640486f262 | https://github.com/Xinstein3033/OpenHGNN/tree/a9ca499834523419ecdaaa09e4b42f640486f262 |
F_fully_connected | import torch
import torch.nn as nn
class F_fully_connected(nn.Module):
"""Fully connected tranformation, not reversible, but used below."""
def __init__(self, size_in, size, internal_size=None, dropout=0.0):
super(F_fully_connected, self).__init__()
if not internal_size:
internal_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Xenovortex/INN_Embedding_Classification | F_fully_connected | false | 1,240 | [
"MIT"
] | 0 | df31ec3dcf70780cae5140a69ffafdd64f218e5f | https://github.com/Xenovortex/INN_Embedding_Classification/tree/df31ec3dcf70780cae5140a69ffafdd64f218e5f |
ReinforcedReceiver | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
from torch.distributions import Bernoulli
import torch.distributions
class ReinforcedReceiver(nn.Module):
def __init__(self, n_bits, n_hidden):
super(ReinforcedReceiver, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import to... | XeniaOhmer/SystematicRepresentations | ReinforcedReceiver | false | 1,241 | [
"MIT"
] | 0 | 825208d1be659dc820e61f577cdb53afc47302f4 | https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4 |
MLPComposition | import torch
import torch.nn.parallel
import torch.utils.data
import torch.distributions
class CompositionFunction(torch.nn.Module):
def __init__(self, representation_size: 'int'):
super().__init__()
def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor:
raise NotImplemented... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.par... | XeniaOhmer/SystematicRepresentations | MLPComposition | false | 1,242 | [
"MIT"
] | 0 | 825208d1be659dc820e61f577cdb53afc47302f4 | https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4 |
TopicEmbeddingAttention | import torch
from torch.nn import functional as F
import torch.multiprocessing
from torch import nn
import torch.utils.data
class TopicEmbeddingAttention(nn.Module):
"""
query: encoder的隐藏状态 key value:主题嵌入向量
计算每个时间步t 对于加权topic embedding向量
"""
def __init__(self, encoder_hidden_size, topic_num, topi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | WuDiDaBinGe/TAKG | TopicEmbeddingAttention | false | 1,243 | [
"MIT"
] | 0 | 83e608e677a4ee74722d18cb5ef430f4f6c6ad31 | https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31 |
MultiHeadedAttention | import math
import torch
from typing import Optional
from typing import Tuple
from torch import nn
class MultiHeadedAttention(nn.Module):
"""Multi-Head Attention layer.
Args:
n_head (int): The number of heads.
n_feat (int): The number of features.
dropout_rate (float): Dropout rate.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | WenjingXia/wenet | MultiHeadedAttention | false | 1,244 | [
"Apache-2.0"
] | 0 | 9a1fd005cd06be16518a5476076b2ae6af2ec41a | https://github.com/WenjingXia/wenet/tree/9a1fd005cd06be16518a5476076b2ae6af2ec41a |
F_conv | import torch
import warnings
import torch.nn as nn
import torch.nn.functional as F
class F_conv(nn.Module):
"""ResNet transformation, not itself reversible, just used below"""
def __init__(self, in_channels, channels, channels_hidden=None, stride=
None, kernel_size=3, leaky_slope=0.1, batch_norm=Fals... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 warnings
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guar... | Xenovortex/INN_Embedding_Classification | F_conv | false | 1,245 | [
"MIT"
] | 0 | df31ec3dcf70780cae5140a69ffafdd64f218e5f | https://github.com/Xenovortex/INN_Embedding_Classification/tree/df31ec3dcf70780cae5140a69ffafdd64f218e5f |
Discriminator | import torch
import torch.nn as nn
class Discriminator(nn.Module):
"""
The discriminator
.. math::
\\begin{equation}
\\mathcal{D}\\left(\\mathbf{h}_{i}^{(r)}, \\mathbf{s}^{(r)}\\right)=\\sigma\\left(\\mathbf{h}_{i}^{(r) T} \\mathbf{M}^{(r)} \\mathbf{s}^{(r)}\\right)
\\end{equation}
... | 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... | Xinstein3033/OpenHGNN | Discriminator | false | 1,246 | [
"Apache-2.0"
] | 0 | a9ca499834523419ecdaaa09e4b42f640486f262 | https://github.com/Xinstein3033/OpenHGNN/tree/a9ca499834523419ecdaaa09e4b42f640486f262 |
WavePool | import torch
import numpy as np
from torch import nn
def getWavelet(in_channels, pool=True):
"""wavelet decomposition using conv2d"""
harr_wav_L = 1 / np.sqrt(2) * np.ones((1, 2))
harr_wav_H = 1 / np.sqrt(2) * np.ones((1, 2))
harr_wav_H[0, 0] = -1 * harr_wav_H[0, 0]
harr_wav_LL = np.transpose(harr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
assert_size_stride = torch._C._dynamo.gu... | XHChen0528/ConditionalGAN_Develop | WavePool | false | 1,247 | [
"MIT"
] | 0 | 4ea6d8ea130589bc3ff8f3117660050ba41cdd0f | https://github.com/XHChen0528/ConditionalGAN_Develop/tree/4ea6d8ea130589bc3ff8f3117660050ba41cdd0f |
RelPositionMultiHeadedAttention | import math
import torch
from typing import Optional
from typing import Tuple
from torch import nn
class MultiHeadedAttention(nn.Module):
"""Multi-Head Attention layer.
Args:
n_head (int): The number of heads.
n_feat (int): The number of features.
dropout_rate (float): Dropout rate.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | WenjingXia/wenet | RelPositionMultiHeadedAttention | false | 1,248 | [
"Apache-2.0"
] | 0 | 9a1fd005cd06be16518a5476076b2ae6af2ec41a | https://github.com/WenjingXia/wenet/tree/9a1fd005cd06be16518a5476076b2ae6af2ec41a |
ActivationQuantizer | from torch.autograd import Function
import torch
import torch.nn as nn
class Round(Function):
@staticmethod
def forward(self, input):
sign = torch.sign(input)
output = sign * torch.floor(torch.abs(input) + 0.5)
return output
@staticmethod
def backward(self, grad_output):
... | 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.... | XueYue404/QNN | ActivationQuantizer | false | 1,249 | [
"MIT"
] | 0 | 43cea970404156b591088d77672df58261edf1eb | https://github.com/XueYue404/QNN/tree/43cea970404156b591088d77672df58261edf1eb |
ChannelReplicate | import torch
import torch.nn as nn
class ChannelReplicate(nn.Module):
def __init__(self, factor=3):
super(ChannelReplicate, self).__init__()
self.factor = factor
def forward(self, input):
template = input
for i in range(0, self.factor - 1):
input = torch.cat((temp... | 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... | YingqiLiulll/scrips_for_SR | ChannelReplicate | false | 1,250 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
HFM | import torch
import torch.nn as nn
class HFM(nn.Module):
def __init__(self, k=2):
super().__init__()
self.k = k
self.net = nn.Sequential(nn.AvgPool2d(kernel_size=self.k, stride=
self.k), nn.Upsample(scale_factor=self.k, mode='nearest'))
def forward(self, tL):
asse... | 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... | YingqiLiulll/scrips_for_SR | HFM | false | 1,251 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
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.... | XeniaOhmer/SystematicRepresentations | InformedSender | false | 1,252 | [
"MIT"
] | 0 | 825208d1be659dc820e61f577cdb53afc47302f4 | https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4 |
ScaledDotProductAttention | import torch
from torch import nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, temperature, dropout=0.1):
super(ScaledDotProductAttention, self).__init__()
self.temperature = temperature
self.dropout = nn.Dropout(p=dropout)
def forward(self, q, k, v, mask=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.... | YacobBY/vedastr | ScaledDotProductAttention | false | 1,253 | [
"Apache-2.0"
] | 0 | 2353780489b58d2398b9af49d238ef0df3f45f2a | https://github.com/YacobBY/vedastr/tree/2353780489b58d2398b9af49d238ef0df3f45f2a |
RelationCrossing | import torch
import torch.nn as nn
import torch.nn.functional as F
class RelationCrossing(nn.Module):
def __init__(self, in_feats: 'int', out_feats: 'int', num_heads: 'int',
dropout: 'float'=0.0, negative_slope: 'float'=0.2):
"""
Description
----------
Relation crossing 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._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Xinstein3033/OpenHGNN | RelationCrossing | false | 1,254 | [
"Apache-2.0"
] | 0 | a9ca499834523419ecdaaa09e4b42f640486f262 | https://github.com/Xinstein3033/OpenHGNN/tree/a9ca499834523419ecdaaa09e4b42f640486f262 |
WeightQuantizer | from torch.autograd import Function
import torch
import torch.nn as nn
class Round(Function):
@staticmethod
def forward(self, input):
sign = torch.sign(input)
output = sign * torch.floor(torch.abs(input) + 0.5)
return output
@staticmethod
def backward(self, grad_output):
... | 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.... | XueYue404/QNN | WeightQuantizer | false | 1,255 | [
"MIT"
] | 0 | 43cea970404156b591088d77672df58261edf1eb | https://github.com/XueYue404/QNN/tree/43cea970404156b591088d77672df58261edf1eb |
LogisticRegression | import torch
from torch import nn
import torch.utils.data
class LogisticRegression(nn.Module):
def __init__(self, input_units: 'int', output_units: 'int'):
super().__init__()
self._weights = nn.Parameter(torch.randn((input_units, output_units
)), requires_grad=True)
self._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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Yalfoosh/DUBUCE | LogisticRegression | false | 1,256 | [
"Apache-2.0"
] | 0 | 3f53923c27b1bce0ac592b20c5bb98649cb7fb75 | https://github.com/Yalfoosh/DUBUCE/tree/3f53923c27b1bce0ac592b20c5bb98649cb7fb75 |
QuantLinear | from torch.autograd import Function
import torch
import torch.nn as nn
import torch.nn.functional as F
class Round(Function):
@staticmethod
def forward(self, input):
sign = torch.sign(input)
output = sign * torch.floor(torch.abs(input) + 0.5)
return output
@staticmethod
def b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | XueYue404/QNN | QuantLinear | false | 1,257 | [
"MIT"
] | 0 | 43cea970404156b591088d77672df58261edf1eb | https://github.com/XueYue404/QNN/tree/43cea970404156b591088d77672df58261edf1eb |
PointwiseFeedForward | import torch
import torch.nn as nn
class PointwiseFeedForward(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_hid, d_inner_hid=None, d_out=None, dropout=0):
super(PointwiseFeedForward, self).__init__()
if d_inner_hid is None:
d_inner_hid = d_hid
if... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | XuMayi/PyABSA | PointwiseFeedForward | false | 1,258 | [
"MIT"
] | 0 | 3d71c0cdaea7ea1eff600d9091c3c63f61c111e5 | https://github.com/XuMayi/PyABSA/tree/3d71c0cdaea7ea1eff600d9091c3c63f61c111e5 |
ConcatenateLinear | import torch
import torch.utils.tensorboard
import torch.utils.data
import torch.distributed
class ConcatenateLinear(torch.nn.Module):
"""A torch module which concatenates several inputs and mixes them using a linear layer. """
def __init__(self, left_size, right_size, output_size):
"""Creates a new ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.tensorboard
import torch.utils.data
import torch.distributed
... | JoeLambourne/SketchGraphs | ConcatenateLinear | false | 1,259 | [
"MIT"
] | 0 | 183c65f82d71d82c62b253092e9b7fa65846a3e6 | https://github.com/JoeLambourne/SketchGraphs/tree/183c65f82d71d82c62b253092e9b7fa65846a3e6 |
SqueezeEmbedding | import torch
import torch.nn as nn
class SqueezeEmbedding(nn.Module):
"""
Squeeze sequence embedding length to the longest one in the batch
"""
def __init__(self, batch_first=True):
super(SqueezeEmbedding, self).__init__()
self.batch_first = batch_first
def forward(self, x, x_len... | 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... | XuMayi/PyABSA | SqueezeEmbedding | false | 1,260 | [
"MIT"
] | 0 | 3d71c0cdaea7ea1eff600d9091c3c63f61c111e5 | https://github.com/XuMayi/PyABSA/tree/3d71c0cdaea7ea1eff600d9091c3c63f61c111e5 |
QuantConv2d | from torch.autograd import Function
import torch
import torch.nn as nn
import torch.nn.functional as F
class Round(Function):
@staticmethod
def forward(self, input):
sign = torch.sign(input)
output = sign * torch.floor(torch.abs(input) + 0.5)
return output
@staticmethod
def b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | XueYue404/QNN | QuantConv2d | false | 1,261 | [
"MIT"
] | 0 | 43cea970404156b591088d77672df58261edf1eb | https://github.com/XueYue404/QNN/tree/43cea970404156b591088d77672df58261edf1eb |
PA | import torch
import torch.nn as nn
class PA(nn.Module):
"""PA is pixel attention"""
def __init__(self, nf):
super(PA, self).__init__()
self.conv = nn.Conv2d(nf, nf, 1)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
y = self.conv(x)
y = self.sigmoid(y)
o... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | YingqiLiulll/scrips_for_SR | PA | false | 1,262 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
BSConvU | import torch
class BSConvU(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, dilation=1, bias=True, padding_mode='zeros', with_norm=
True, bn_kwargs=None):
super().__init__()
self.with_norm = with_norm
if bn_kwargs is None:... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride ... | YingqiLiulll/scrips_for_SR | BSConvU | false | 1,263 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
aeEncoder | import torch
from torch import nn
import torch.nn.functional as F
class aeEncoder(nn.Module):
def __init__(self, capacity, channel):
super(aeEncoder, self).__init__()
self.c = capacity
self.channel = channel
self.conv1 = nn.Conv2d(in_channels=self.channel, out_channels=self.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | XiaoyuanGuo/TEND_MedicalNoveltyDetection | aeEncoder | false | 1,264 | [
"MIT"
] | 0 | 5c2144f0592373d814540cc0fa8e60197ea51756 | https://github.com/XiaoyuanGuo/TEND_MedicalNoveltyDetection/tree/5c2144f0592373d814540cc0fa8e60197ea51756 |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1,
score_function='dot_product', dropout=0):
""" Attention Mechanism
:param embed_dim:
:param hidden_dim:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | XuMayi/PyABSA | Attention | false | 1,265 | [
"MIT"
] | 0 | 3d71c0cdaea7ea1eff600d9091c3c63f61c111e5 | https://github.com/XuMayi/PyABSA/tree/3d71c0cdaea7ea1eff600d9091c3c63f61c111e5 |
F_fully_convolutional | import torch
import torch.nn as nn
import torch.nn.functional as F
class F_fully_convolutional(nn.Module):
def __init__(self, in_channels, out_channels, internal_size=256,
kernel_size=3, leaky_slope=0.02):
super().__init__()
pad = kernel_size // 2
self.leaky_slope = leaky_slope
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Xenovortex/INN_Embedding_Classification | F_fully_convolutional | false | 1,266 | [
"MIT"
] | 0 | df31ec3dcf70780cae5140a69ffafdd64f218e5f | https://github.com/Xenovortex/INN_Embedding_Classification/tree/df31ec3dcf70780cae5140a69ffafdd64f218e5f |
PAConv | import torch
import torch.nn as nn
class PAConv(nn.Module):
def __init__(self, nf, k_size=3):
super(PAConv, self).__init__()
self.k2 = nn.Conv2d(nf, nf, 1)
self.sigmoid = nn.Sigmoid()
self.k3 = nn.Conv2d(nf, nf, kernel_size=k_size, padding=(k_size - 1
) // 2, bias=Fals... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | YingqiLiulll/scrips_for_SR | PAConv | false | 1,267 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
PVABlock | import torch
from torch import nn
def constant_init(module, val, bias=0):
nn.init.constant_(module.weight, val)
if hasattr(module, 'bias') and module.bias is not None:
nn.init.constant_(module.bias, bias)
def kaiming_init(module, a=0, is_rnn=False, mode='fan_in', nonlinearity=
'leaky_relu', 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | YacobBY/vedastr | PVABlock | false | 1,268 | [
"Apache-2.0"
] | 0 | 2353780489b58d2398b9af49d238ef0df3f45f2a | https://github.com/YacobBY/vedastr/tree/2353780489b58d2398b9af49d238ef0df3f45f2a |
MyModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class MyModel(nn.Module):
def __init__(self, state_size, action_size):
super(MyModel, self).__init__()
self.fc1 = nn.Linear(state_size, 120)
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, action_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 torch.nn as nn
assert_... | Yaphetsf75/slimevolleygym | MyModel | false | 1,269 | [
"Apache-2.0"
] | 0 | 39882c2c8c86c974c9b1083e8d93b2b0fdeecb56 | https://github.com/Yaphetsf75/slimevolleygym/tree/39882c2c8c86c974c9b1083e8d93b2b0fdeecb56 |
GumbelSoftmaxLayer | import torch
import torch.nn as nn
from torch.distributions import RelaxedOneHotCategorical
import torch.nn.parallel
import torch.utils.data
import torch.distributions
def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0,
training: 'bool'=True, straight_through: 'bool'=False):
size = log... | 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
from torch.distributions import RelaxedOneHotCategorical
import torch.nn.parallel
import torch.utils.data
import torch... | XeniaOhmer/SystematicRepresentations | GumbelSoftmaxLayer | false | 1,270 | [
"MIT"
] | 0 | 825208d1be659dc820e61f577cdb53afc47302f4 | https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4 |
ChannelRate | import torch
import torch.nn as nn
class ChannelRate(nn.Module):
rates: 'torch.Tensor'
def __init__(self, num_channels: 'int', device=None, dtype=None):
super().__init__()
kw = {'device': device, 'dtype': dtype}
self.rates = nn.Parameter(torch.ones(num_channels, **kw))
def forwar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | YodaEmbedding/deep-compression | ChannelRate | false | 1,271 | [
"MIT"
] | 0 | cc1ea691921fbe2e5cffeb30a02b777dadd08700 | https://github.com/YodaEmbedding/deep-compression/tree/cc1ea691921fbe2e5cffeb30a02b777dadd08700 |
TransformerEncoderLayer | 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 TransformerEncoderLayer(nn.Module):
def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0,
attention_dropout=0.0, activation_dropout=0.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 import triton_helpers
from torch._inductor.runtime.... | XeniaOhmer/SystematicRepresentations | TransformerEncoderLayer | false | 1,272 | [
"MIT"
] | 0 | 825208d1be659dc820e61f577cdb53afc47302f4 | https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4 |
ARFB | import torch
import torch.nn as nn
def defaultConv(inChannels, outChannels, kernelSize, bias=True):
return nn.Conv2d(inChannels, outChannels, kernelSize, padding=
kernelSize // 2, bias=bias)
class ResidualUnit(nn.Module):
def __init__(self, inChannel, outChannel, reScale, kernelSize=1, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | YingqiLiulll/scrips_for_SR | ARFB | false | 1,273 | [
"MIT"
] | 0 | 04fa6fdaf157e913d3e2521cd80315a10a2ccedc | https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc |
MultiHeadAttention | import torch
from torch import nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, temperature, dropout=0.1):
super(ScaledDotProductAttention, self).__init__()
self.temperature = temperature
self.dropout = nn.Dropout(p=dropout)
def forward(self, q, k, v, mask=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.... | YacobBY/vedastr | MultiHeadAttention | false | 1,274 | [
"Apache-2.0"
] | 0 | 2353780489b58d2398b9af49d238ef0df3f45f2a | https://github.com/YacobBY/vedastr/tree/2353780489b58d2398b9af49d238ef0df3f45f2a |
DrugDrugAttentionLayer | import torch
import torch.nn.functional
class DrugDrugAttentionLayer(torch.nn.Module):
"""Co-attention layer for drug pairs."""
def __init__(self, feature_number: 'int'):
"""Initialize the co-attention layer.
:param feature_number: Number of input features.
"""
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
import torch.nn.fun... | YuWVandy/chemicalx | DrugDrugAttentionLayer | false | 1,275 | [
"Apache-2.0"
] | 0 | c02f979a502409c26700e6d5a1b2e6c0aa77e64c | https://github.com/YuWVandy/chemicalx/tree/c02f979a502409c26700e6d5a1b2e6c0aa77e64c |
Highway | import torch
from torch import nn
from torch.nn import functional as F
import torch.nn.functional
class Highway(nn.Module):
"""The Highway update layer from [srivastava2015]_.
.. [srivastava2015] Srivastava, R. K., *et al.* (2015).
`Highway Networks <http://arxiv.org/abs/1505.00387>`_.
*arXiv*,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | YuWVandy/chemicalx | Highway | false | 1,276 | [
"Apache-2.0"
] | 0 | c02f979a502409c26700e6d5a1b2e6c0aa77e64c | https://github.com/YuWVandy/chemicalx/tree/c02f979a502409c26700e6d5a1b2e6c0aa77e64c |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, eps: 'float'=1e-09):
super(DiceLoss, self).__init__()
self.smooth = 1.0
self.eps = eps
def forward(self, y_pred, y_true):
num = y_true.size(0)
probability = torch.sigmoid(y_pred)
... | 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... | Yukei7/Multimodal-Segmentation-Network | DiceLoss | false | 1,277 | [
"MIT"
] | 0 | 0a38aa8bbd2eb87e28209c810438248c0464a240 | https://github.com/Yukei7/Multimodal-Segmentation-Network/tree/0a38aa8bbd2eb87e28209c810438248c0464a240 |
RegressionModel | import torch
import torch.nn as nn
import torch.utils.data.distributed
class RegressionModel(nn.Module):
def __init__(self, num_features_in, num_anchors=1, feature_size=256):
super(RegressionModel, self).__init__()
self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3,
p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | YuBeomGon/pytorch_retina | RegressionModel | false | 1,278 | [
"Apache-2.0"
] | 0 | a1713ecbf99e3cf2f8f5edce3329b808b4f9dee8 | https://github.com/YuBeomGon/pytorch_retina/tree/a1713ecbf99e3cf2f8f5edce3329b808b4f9dee8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.