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 |
|---|---|---|---|---|---|---|---|---|---|---|
Concat | import torch
from torch import nn
from typing import *
class Concat(nn.Module):
def __init__(self):
super(Concat, self).__init__()
def forward(self, modalities):
flattened = []
for modality in modalities:
flattened.append(torch.flatten(modality, start_dim=1))
retu... | 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 typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | HughMun/MultiBench | Concat | false | 13,772 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
TransformerDecoderLayer | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
def _normalize(tensor, norm_layer):
"""
Broadcast layer norm
"""
size = tensor.size()
return norm_layer(tensor.view(-1, size[-1])).view(size)
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, 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.... | Guaguago/Persona-Dialogue-Generation | TransformerDecoderLayer | false | 13,773 | [
"MIT"
] | 258 | 0d4526ec8eddff62751a70666e14d72103906f44 | https://github.com/Guaguago/Persona-Dialogue-Generation/tree/0d4526ec8eddff62751a70666e14d72103906f44 |
StdConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class StdConv2d(nn.Conv2d):
def forward(self, x):
w = self.weight
v, m = torch.var_mean(w, dim=[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.triton_helpers import libdevice
import torch.nn as ... | HelenR6/imagenet-r | StdConv2d | false | 13,774 | [
"MIT"
] | 155 | 0bf04f2bf5d60d1098fc9a78f4e8c042e434eb69 | https://github.com/HelenR6/imagenet-r/tree/0bf04f2bf5d60d1098fc9a78f4e8c042e434eb69 |
MLP | import torch
import torch.nn.functional as F
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, n_in, n_units, n_out):
super(MLP, self).__init__()
self.l1 = nn.Linear(n_in, n_units)
self.l2 = nn.Linear(n_units, n_units)
self.l3 = nn.Linear(n_units, n_out)
def forw... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Hiroshiba/pytorch-trainer | MLP | false | 13,775 | [
"MIT"
] | 45 | b4b3d648868e4cec33c69e18fc3877c103a8d438 | https://github.com/Hiroshiba/pytorch-trainer/tree/b4b3d648868e4cec33c69e18fc3877c103a8d438 |
FeedForwardNeuralNetModel | import torch
from torch import nn
class FeedForwardNeuralNetModel(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim):
super(FeedForwardNeuralNetModel, self).__init__()
self.linearA = nn.Linear(input_dim, hidden_dim)
self.sigmoid = nn.Sigmoid()
self.linearB = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Hedingber/demos | FeedForwardNeuralNetModel | false | 13,776 | [
"Apache-2.0"
] | 64 | 6d1433ada6d44166cfcd11646276f2fffeff2fc0 | https://github.com/Hedingber/demos/tree/6d1433ada6d44166cfcd11646276f2fffeff2fc0 |
ChannelSpatialSELayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelSELayer(nn.Module):
"""
Re-implementation of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
"""
def __init__(self, num_channels, reduction_ratio=2):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | HiLab-git/PyMIC | ChannelSpatialSELayer | false | 13,777 | [
"Apache-2.0"
] | 147 | abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 | https://github.com/HiLab-git/PyMIC/tree/abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 |
ATT | import torch
import torch.nn as nn
import torch.nn.functional as F
class ATT(nn.Module):
def __init__(self, din):
super(ATT, self).__init__()
self.fc1 = nn.Linear(din, 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, 1)
def forward(self, x):
y = F.relu(self.f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | HuangHaoyu1997/pytorch_DGN | ATT | false | 13,778 | [
"MIT"
] | 48 | f1b1a157a9b1678f9238f64458f44412b796d00e | https://github.com/HuangHaoyu1997/pytorch_DGN/tree/f1b1a157a9b1678f9238f64458f44412b796d00e |
ToRGB | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
import torch.nn as nn
import tor... | HappyBelief/ContraD | ToRGB | false | 13,779 | [
"MIT"
] | 168 | abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f | https://github.com/HappyBelief/ContraD/tree/abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f |
StyleLayer | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def make_kernel(k):
k = torch.tensor(k, dtype=torch.float32)
if k.ndim == 1:
k = k[None, :] * k[:, None]
k /= k.sum()
return k
def upfirdn2d_native(input... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd... | HappyBelief/ContraD | StyleLayer | false | 13,780 | [
"MIT"
] | 168 | abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f | https://github.com/HappyBelief/ContraD/tree/abb72562ddac8d8ab37fe9af6ac4c44c61e8ea0f |
SpatialSELayer3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpatialSELayer3D(nn.Module):
"""
3D Re-implementation of SE block -- squeezing spatially and exciting channel-wise described in:
*Roy et al., Concurrent Spatial and Channel Squeeze & Excitation in Fully Convolutional Networks, M... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | HiLab-git/PyMIC | SpatialSELayer3D | false | 13,781 | [
"Apache-2.0"
] | 147 | abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 | https://github.com/HiLab-git/PyMIC/tree/abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 |
MultiHeadAttention | import math
import torch
import torch.nn.functional as F
from torch import nn
class MultiHeadAttention(nn.Module):
def __init__(self, heads, d_model, dropout=0.1):
super().__init__()
self.d_model = d_model
self.d_k = d_model // heads
self.h = heads
self.q_linear = nn.Linea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HebatallaTarek/Empathy-Mental-Health | MultiHeadAttention | false | 13,782 | [
"BSD-3-Clause"
] | 66 | 16e2a5f93aabd22803bb39805f8e76c8bea0ccf2 | https://github.com/HebatallaTarek/Empathy-Mental-Health/tree/16e2a5f93aabd22803bb39805f8e76c8bea0ccf2 |
CenConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class CenConv2d(nn.Module):
"""Conv2d layer with Weight Centralization.
The args is exactly same as torch.nn.Conv2d. It's suggested to set bias=False when
using CenConv2d with MABN.
"""
def __init__(self, in_planes, out_planes, ke... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Hsuxu/vnet_attention | CenConv2d | false | 13,783 | [
"MIT"
] | 45 | 6958932f3974d268e93bd6443369a3f43c497ed3 | https://github.com/Hsuxu/vnet_attention/tree/6958932f3974d268e93bd6443369a3f43c497ed3 |
ChannelWiseDivergence | import torch
from torch import nn
import torch.nn.functional as F
class ChannelWiseDivergence(nn.Module):
"""PyTorch version of `Channel-wise Distillation for Semantic Segmentation.
<https://arxiv.org/abs/2011.13256>`_.
Args:
tau (float): Temperature coefficient. Defaults to 1.0.
loss_we... | 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... | HIT-cwh/mmrazor | ChannelWiseDivergence | false | 13,784 | [
"Apache-2.0"
] | 553 | 2dad24044d7f1dad88f20221f8fc071dd40fdd4f | https://github.com/HIT-cwh/mmrazor/tree/2dad24044d7f1dad88f20221f8fc071dd40fdd4f |
ChannelSpatialSELayer3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelSELayer3D(nn.Module):
"""
3D implementation of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
"""
def __init__(self, num_channels, reduction_ratio=2)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | HiLab-git/PyMIC | ChannelSpatialSELayer3D | false | 13,785 | [
"Apache-2.0"
] | 147 | abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 | https://github.com/HiLab-git/PyMIC/tree/abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 |
Attention | import math
import torch
from torch import nn
from torch.nn import functional as F
from typing import *
class Attention(nn.Module):
def __init__(self, hidden_size):
super(Attention, self).__init__()
self.hidden_size = hidden_size
self.attn = nn.Linear(self.hidden_size * 2, hidden_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
from torch._inductor.runtime.... | HughMun/MultiBench | Attention | false | 13,786 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
AlphaScalarMultiplication | import torch
import numpy as np
from torch import nn
from typing import *
class AlphaScalarMultiplication(nn.Module):
def __init__(self, size_alpha_x, size_alpha_y):
super(AlphaScalarMultiplication, self).__init__()
self.size_alpha_x = size_alpha_x
self.size_alpha_y = size_alpha_y
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
from torch import nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | HughMun/MultiBench | AlphaScalarMultiplication | false | 13,787 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
ChannelSELayer3D | import torch
import torch.nn as nn
class ChannelSELayer3D(nn.Module):
"""
3D implementation of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
"""
def __init__(self, num_channels, reduction_ratio=2):
"""
:param num... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | HiLab-git/PyMIC | ChannelSELayer3D | false | 13,788 | [
"Apache-2.0"
] | 147 | abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 | https://github.com/HiLab-git/PyMIC/tree/abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 |
ChannelSELayer3D | import torch
import torch.nn as nn
class ChannelSELayer3D(nn.Module):
"""
3D extension of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
*Zhu et al., AnatomyNet, arXiv:arXiv:1808.05238*
"""
def __init__(self, num_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
assert_... | Hsuxu/vnet_attention | ChannelSELayer3D | false | 13,789 | [
"MIT"
] | 45 | 6958932f3974d268e93bd6443369a3f43c497ed3 | https://github.com/Hsuxu/vnet_attention/tree/6958932f3974d268e93bd6443369a3f43c497ed3 |
AttModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttModel(nn.Module):
def __init__(self, din, hidden_dim, dout):
super(AttModel, self).__init__()
self.fcv = nn.Linear(din, hidden_dim)
self.fck = nn.Linear(din, hidden_dim)
self.fcq = nn.Linear(din, hidden_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HuangHaoyu1997/pytorch_DGN | AttModel | false | 13,790 | [
"MIT"
] | 48 | f1b1a157a9b1678f9238f64458f44412b796d00e | https://github.com/HuangHaoyu1997/pytorch_DGN/tree/f1b1a157a9b1678f9238f64458f44412b796d00e |
AlphaVectorMultiplication | import torch
import numpy as np
from torch import nn
from typing import *
class AlphaVectorMultiplication(nn.Module):
def __init__(self, size_alpha):
super(AlphaVectorMultiplication, self).__init__()
self.size_alpha = size_alpha
self.alpha = nn.Parameter(torch.from_numpy(np.zeros((1, 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 numpy as np
from torch import nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | HughMun/MultiBench | AlphaVectorMultiplication | false | 13,791 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
CenConv3d | import torch
import torch.nn as nn
import torch.nn.functional as F
class CenConv3d(nn.Module):
"""Conv2d layer with Weight Centralization.
The args is exactly same as torch.nn.Conv2d. It's suggested to set bias=False when
using CenConv2d with MABN.
"""
def __init__(self, in_planes, out_planes, ke... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Hsuxu/vnet_attention | CenConv3d | false | 13,792 | [
"MIT"
] | 45 | 6958932f3974d268e93bd6443369a3f43c497ed3 | https://github.com/Hsuxu/vnet_attention/tree/6958932f3974d268e93bd6443369a3f43c497ed3 |
SpatialGate | import torch
import torch.nn as nn
import torch.utils.model_zoo
class BasicConv(nn.Module):
def __init__(self, in_planes, out_planes, kernel_size, stride=1,
padding=0, dilation=1, groups=1, relu=True, bn=False, bias=True):
super(BasicConv, self).__init__()
self.out_channels = out_planes
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | HolmesShuan/OISR-PyTorch | SpatialGate | false | 13,793 | [
"BSD-2-Clause"
] | 141 | bbe0c88f71fe565a2842df7971b62a9bc5a56c48 | https://github.com/HolmesShuan/OISR-PyTorch/tree/bbe0c88f71fe565a2842df7971b62a9bc5a56c48 |
SpatialChannelSELayer3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelSELayer3D(nn.Module):
"""
3D extension of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
*Zhu et al., AnatomyNet, arXiv:arXiv:1808.05238*
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | Hsuxu/vnet_attention | SpatialChannelSELayer3D | false | 13,794 | [
"MIT"
] | 45 | 6958932f3974d268e93bd6443369a3f43c497ed3 | https://github.com/Hsuxu/vnet_attention/tree/6958932f3974d268e93bd6443369a3f43c497ed3 |
Analysis_net_17 | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.utils.data
class LowerBound(Function):
@staticmethod
def forward(ctx, inputs, bound):
b = torch.ones_like(inputs) * bound
ctx.save_for_backward(inputs, b)
return torch.max(inputs, 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.... | Geunwoo-Jeon/iclr_17_compression | Analysis_net_17 | false | 13,795 | [
"MIT"
] | 56 | a28746b1f1c518d91125d8f289d9511cde488c77 | https://github.com/Geunwoo-Jeon/iclr_17_compression/tree/a28746b1f1c518d91125d8f289d9511cde488c77 |
Grouping | import torch
from torch import nn
from typing import *
class Grouping(nn.Module):
def __init__(self, n_groups):
super().__init__()
self.n_groups = n_groups
def forward(self, x):
x = x.permute(2, 0, 1)
n_modalities = len(x)
out = []
for i in range(self.n_groups... | 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 typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | HughMun/MultiBench | Grouping | false | 13,796 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
GlobalPooling2D | import torch
from torch import nn
from typing import *
class GlobalPooling2D(nn.Module):
def __init__(self):
super(GlobalPooling2D, self).__init__()
def forward(self, x):
x = x.view(x.size(0), x.size(1), -1)
x = torch.mean(x, 2)
x = x.view(x.size(0), -1)
return x
de... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | HughMun/MultiBench | GlobalPooling2D | false | 13,797 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
AdaptiveAvgMaxPool2d | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torchvision.transforms.functional as F
import torch.nn.functional as F
from torch import optim as optim
def adaptive_avgmax_pool2d(x, output_size=1):
x_avg = F.adaptive... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data... | BarneyQiao/CondenseNetV2 | AdaptiveAvgMaxPool2d | false | 13,798 | [
"MIT"
] | 80 | c771957cb8fe466d0ecbafe9060e4c342a33fc4d | https://github.com/BarneyQiao/CondenseNetV2/tree/c771957cb8fe466d0ecbafe9060e4c342a33fc4d |
_DualSpanningAvgPool | import torch
from torch import nn
from typing import *
class _DualSpanningAvgPool(nn.Module):
"""Module with two average pools: one that spans the full height of the image and
another the spans the full width. Outputs are flattened and concatenated.
Args:
rows (int): Number of rows in image.
... | 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 typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | HughMun/MultiBench | _DualSpanningAvgPool | false | 13,799 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
GlobalPooling1D | import torch
from torch import nn
from typing import *
class GlobalPooling1D(nn.Module):
def __init__(self):
super(GlobalPooling1D, self).__init__()
def forward(self, x):
x = torch.mean(x, 2)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | HughMun/MultiBench | GlobalPooling1D | false | 13,800 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
DGN | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttModel(nn.Module):
def __init__(self, din, hidden_dim, dout):
super(AttModel, self).__init__()
self.fcv = nn.Linear(din, hidden_dim)
self.fck = nn.Linear(din, hidden_dim)
self.fcq = nn.Linear(din, hidden_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HuangHaoyu1997/pytorch_DGN | DGN | false | 13,801 | [
"MIT"
] | 48 | f1b1a157a9b1678f9238f64458f44412b796d00e | https://github.com/HuangHaoyu1997/pytorch_DGN/tree/f1b1a157a9b1678f9238f64458f44412b796d00e |
SigmaL1SmoothLoss | import torch
import torch.nn as nn
from torchvision.models import *
class SigmaL1SmoothLoss(nn.Module):
def forward(self, pred, targ):
reg_diff = torch.abs(targ - pred)
reg_loss = torch.where(torch.le(reg_diff, 1 / 9), 4.5 * torch.pow(
reg_diff, 2), reg_diff - 1 / 18)
return r... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Cdk29/fastai | SigmaL1SmoothLoss | false | 13,802 | [
"Apache-2.0"
] | 87 | 974677ad9d63fd4fa642a62583a5ae8b1610947b | https://github.com/Cdk29/fastai/tree/974677ad9d63fd4fa642a62583a5ae8b1610947b |
Stack | import torch
from torch import nn
from typing import *
class Stack(nn.Module):
def __init__(self):
super().__init__()
def forward(self, modalities):
flattened = []
for modality in modalities:
flattened.append(torch.flatten(modality, start_dim=1))
return torch.stac... | 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 typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dyn... | HughMun/MultiBench | Stack | false | 13,803 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
MultiheadAttention | import torch
from torch import nn
from torch.nn import functional as F
from typing import *
from torch.nn.parameter import Parameter
from torch.nn import Parameter
class MultiheadAttention(nn.Module):
"""Multi-headed attention.
See "Attention Is All You Need" for more details.
"""
def __init__(self, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | HughMun/MultiBench | MultiheadAttention | false | 13,804 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
DDPGConvBody | import torch
import torch.nn as nn
import torch.nn.functional as F
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class DDPGConvBody(nn.Module):
def __init__(self, in_channels=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.triton_helpers import libdevice
import torch.nn as ... | GoingMyWay/DeepRL | DDPGConvBody | false | 13,805 | [
"MIT"
] | 2,857 | 78df98a8eeccc41dacd952932435a5ecc42e1c67 | https://github.com/GoingMyWay/DeepRL/tree/78df98a8eeccc41dacd952932435a5ecc42e1c67 |
ChamferLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.utils
class ChamferLoss(nn.Module):
def __init__(self):
super(ChamferLoss, self).__init__()
self.use_cuda = torch.cuda.is_available()
def forward(self, preds, gts):
P = self.batch_pairwis... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | BossunWang/soft-intro-vae-pytorch | ChamferLoss | false | 13,806 | [
"Apache-2.0"
] | 144 | 10841fe2ae1aea12dbf43347dea63ee25d951864 | https://github.com/BossunWang/soft-intro-vae-pytorch/tree/10841fe2ae1aea12dbf43347dea63ee25d951864 |
SkipConnection | import torch
from torch import nn
class SkipConnection(nn.Module):
"""
Skip-connection over the sequence of layers in the constructor.
The module passes input data sequentially through these layers
and then adds original data to the result.
"""
def __init__(self, *args):
super().__ini... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | HugoSenetaire/vaeac | SkipConnection | false | 13,807 | [
"MIT"
] | 70 | 451d34dd4986c52f2f37c508f03ee3db9e7408d3 | https://github.com/HugoSenetaire/vaeac/tree/451d34dd4986c52f2f37c508f03ee3db9e7408d3 |
PlusBottleneck | import torch
from torch import nn
import torch.nn.parallel
class PlusBottleneck(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
def forward(self, dec, enc):
return enc + dec
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
de... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
import torch.nn.parallel
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | Hulihrach/RoadDetector | PlusBottleneck | false | 13,808 | [
"Apache-2.0"
] | 180 | 9fedd537d7d3a5c81a60562a185fc13370af9a99 | https://github.com/Hulihrach/RoadDetector/tree/9fedd537d7d3a5c81a60562a185fc13370af9a99 |
PointLoss | import torch
import torch.nn.parallel
import torch.utils.data
import torch.nn as nn
def array2samples_distance(array1, array2):
"""
arguments:
array1: the array, size: (num_point, num_feature)
array2: the samples, size: (num_point, num_feature)
returns:
distances: each entry is th... | 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.parallel
import torch.utils.data
import torch.nn as nn
assert_size_stride... | HeunSeungLim/hl_point | PointLoss | false | 13,809 | [
"MIT"
] | 204 | 866f9e216d1f47517093720f6ff70ef2f0338bbe | https://github.com/HeunSeungLim/hl_point/tree/866f9e216d1f47517093720f6ff70ef2f0338bbe |
Maxout | import torch
from torch import nn
from typing import *
class Maxout(nn.Module):
def __init__(self, d, m, k):
super(Maxout, self).__init__()
self.d_in, self.d_out, self.pool_size = d, m, k
self.lin = nn.Linear(d, m * k)
def forward(self, inputs):
shape = list(inputs.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
from torch import nn
from typ... | HughMun/MultiBench | Maxout | false | 13,810 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
MLPEncoder | import torch
from torch import nn
from torch.nn import functional as F
from typing import *
class MLPEncoder(torch.nn.Module):
def __init__(self, indim, hiddim, outdim):
super(MLPEncoder, self).__init__()
self.fc = nn.Linear(indim, hiddim)
self.fc2 = nn.Linear(hiddim, 2 * outdim)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 typ... | HughMun/MultiBench | MLPEncoder | false | 13,811 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
NLgate | import torch
from torch import nn
from typing import *
class NLgate(torch.nn.Module):
def __init__(self, thw_dim, c_dim, tf_dim, q_linear=None, k_linear=None,
v_linear=None):
super(NLgate, self).__init__()
self.qli = None
if q_linear is not None:
self.qli = nn.Linear(q... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HughMun/MultiBench | NLgate | false | 13,812 | [
"MIT"
] | 148 | d5712a0815a9486b0e0c76b54cd63c880188fc8e | https://github.com/HughMun/MultiBench/tree/d5712a0815a9486b0e0c76b54cd63c880188fc8e |
AttentionGateBlock | import torch
import torch.nn as nn
class AttentionGateBlock(nn.Module):
def __init__(self, chns_l, chns_h):
"""
chns_l: channel number of low-level features from the encoder
chns_h: channel number of high-level features from the decoder
"""
super(AttentionGateBlock, self).... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | HiLab-git/PyMIC | AttentionGateBlock | false | 13,813 | [
"Apache-2.0"
] | 147 | abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 | https://github.com/HiLab-git/PyMIC/tree/abf5c43de43668b85f4c049c95a8f1b7cf1d9f16 |
AdaptiveCatAvgMaxPool2d | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torchvision.transforms.functional as F
import torch.nn.functional as F
from torch import optim as optim
def adaptive_catavgmax_pool2d(x, output_size=1):
x_avg = F.adapt... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data... | BarneyQiao/CondenseNetV2 | AdaptiveCatAvgMaxPool2d | false | 13,814 | [
"MIT"
] | 80 | c771957cb8fe466d0ecbafe9060e4c342a33fc4d | https://github.com/BarneyQiao/CondenseNetV2/tree/c771957cb8fe466d0ecbafe9060e4c342a33fc4d |
fromImageToTensor | import torch
class fromImageToTensor(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, tensor):
tensor = tensor.float() / 255.0
return tensor
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | HugoSenetaire/vaeac | fromImageToTensor | false | 13,815 | [
"MIT"
] | 70 | 451d34dd4986c52f2f37c508f03ee3db9e7408d3 | https://github.com/HugoSenetaire/vaeac/tree/451d34dd4986c52f2f37c508f03ee3db9e7408d3 |
AvgConsensus | import torch
from torch import nn as nn
class AvgConsensus(nn.Module):
"""Average consensus module.
Args:
dim (int): Decide which dim consensus function to apply.
Default: 1.
"""
def __init__(self, dim=1):
super().__init__()
self.dim = dim
def forward(self, i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._emp... | HypnosXC/mmaction2 | AvgConsensus | false | 13,816 | [
"Apache-2.0"
] | 549 | a26d5f981449445a5e22a0a60d8b285e06c3dd6e | https://github.com/HypnosXC/mmaction2/tree/a26d5f981449445a5e22a0a60d8b285e06c3dd6e |
LINEAR_LOGSOFTMAX | import torch
import torch.nn as nn
class LINEAR_LOGSOFTMAX(nn.Module):
def __init__(self, input_dim, nclass):
super(LINEAR_LOGSOFTMAX, self).__init__()
self.fc = nn.Linear(input_dim, nclass)
self.logic = nn.LogSoftmax(dim=1)
def forward(self, x):
o = self.logic(self.fc(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.... | Huihui-z/CE-GZSL | LINEAR_LOGSOFTMAX | false | 13,817 | [
"MIT"
] | 58 | 7bf5358ac4727ea1dc2dc9dec2f453b014500bd8 | https://github.com/Huihui-z/CE-GZSL/tree/7bf5358ac4727ea1dc2dc9dec2f453b014500bd8 |
QuantizableHSigmoid | import torch
import torch.nn as nn
import torch.quantization
class QuantizableHSigmoid(nn.Module):
"""Hard Sigmoid for quantization."""
def __init__(self, inplace: 'bool'=True) ->None:
"""Initialize."""
super(QuantizableHSigmoid, self).__init__()
self.relu6 = nn.ReLU6(inplace=inplace)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.quantization
assert_size_stride = torch._C._dynamo.gua... | HwangJohn/model_compression | QuantizableHSigmoid | false | 13,818 | [
"MIT"
] | 216 | 1df40c8a531313cc9e79255f4477f39d66d9b849 | https://github.com/HwangJohn/model_compression/tree/1df40c8a531313cc9e79255f4477f39d66d9b849 |
WeightNet | import torch
from torch import nn as nn
class WeightNet(nn.Module):
"""WeightNet in Temporal interlace module.
The WeightNet consists of two parts: one convolution layer
and a sigmoid function. Following the convolution layer, the sigmoid
function and rescale module can scale our output to the range ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_s... | HypnosXC/mmaction2 | WeightNet | false | 13,819 | [
"Apache-2.0"
] | 549 | a26d5f981449445a5e22a0a60d8b285e06c3dd6e | https://github.com/HypnosXC/mmaction2/tree/a26d5f981449445a5e22a0a60d8b285e06c3dd6e |
Accuracy | import torch
from torch import 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.sum().float() / valid_mask.sum()... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | IC-hub/ProteinLM | Accuracy | false | 13,820 | [
"Apache-2.0"
] | 59 | 58fbf1f674569cf814becf32f71dd0d8f0c592fa | https://github.com/IC-hub/ProteinLM/tree/58fbf1f674569cf814becf32f71dd0d8f0c592fa |
BinaryLogisticRegressionLoss | import torch
from torch import nn as nn
def binary_logistic_regression_loss(reg_score, label, threshold=0.5,
ratio_range=(1.05, 21), eps=1e-05):
"""Binary Logistic Regression Loss."""
label = label.view(-1)
reg_score = reg_score.contiguous().view(-1)
pmask = (label > threshold).float()
num_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 math as tl_math
from torch import nn a... | HypnosXC/mmaction2 | BinaryLogisticRegressionLoss | false | 13,821 | [
"Apache-2.0"
] | 549 | a26d5f981449445a5e22a0a60d8b285e06c3dd6e | https://github.com/HypnosXC/mmaction2/tree/a26d5f981449445a5e22a0a60d8b285e06c3dd6e |
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.... | Fanxingye/DeepRS | AFMLayer | false | 13,822 | [
"Apache-2.0"
] | 1,770 | 06b98cf2cb2781656805eafc577fbd088f37d17d | https://github.com/Fanxingye/DeepRS/tree/06b98cf2cb2781656805eafc577fbd088f37d17d |
Module_CharbonnierLoss | import torch
import torch.nn as nn
class Module_CharbonnierLoss(nn.Module):
def __init__(self, epsilon=0.001):
super(Module_CharbonnierLoss, self).__init__()
self.epsilon = epsilon
def forward(self, output, gt):
return torch.mean(torch.sqrt((output - gt) ** 2 + self.epsilon ** 2))
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | HyeongminLEE/AdaCoF-pytorch | Module_CharbonnierLoss | false | 13,823 | [
"MIT"
] | 149 | f121ee0e8cb403216c7bd5183154dbd1cf6966f4 | https://github.com/HyeongminLEE/AdaCoF-pytorch/tree/f121ee0e8cb403216c7bd5183154dbd1cf6966f4 |
L2Norm | import torch
import torch.nn as nn
from torchvision.models.quantization import *
class L2Norm(nn.Module):
"""
Scale shall be learnable according to original paper
scale: initial scale number
chan_num: L2Norm channel number (norm over all channels)
"""
def __init__(self, scale=20, cha... | 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
from t... | CaoZhongZ/inference | L2Norm | false | 13,824 | [
"Apache-2.0"
] | 388 | 58025f8fde679ea864d34f96ecc9f14bf70ece53 | https://github.com/CaoZhongZ/inference/tree/58025f8fde679ea864d34f96ecc9f14bf70ece53 |
BinaryCrossEntropyLoss | from torch.nn import Module
import torch
class BinaryCrossEntropyLoss(Module):
def __init__(self):
super().__init__()
def forward(self, groundtruth, distr_params, mask):
groundtruth = (groundtruth - groundtruth.min()) / (groundtruth.max(
) - groundtruth.min())
loss = mask... | 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 import M... | HugoSenetaire/vaeac | BinaryCrossEntropyLoss | false | 13,825 | [
"MIT"
] | 70 | 451d34dd4986c52f2f37c508f03ee3db9e7408d3 | https://github.com/HugoSenetaire/vaeac/tree/451d34dd4986c52f2f37c508f03ee3db9e7408d3 |
BMNLoss | import torch
from torch import nn as nn
import torch.nn.functional as F
def binary_logistic_regression_loss(reg_score, label, threshold=0.5,
ratio_range=(1.05, 21), eps=1e-05):
"""Binary Logistic Regression Loss."""
label = label.view(-1)
reg_score = reg_score.contiguous().view(-1)
pmask = (label ... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_ma... | HypnosXC/mmaction2 | BMNLoss | false | 13,826 | [
"Apache-2.0"
] | 549 | a26d5f981449445a5e22a0a60d8b285e06c3dd6e | https://github.com/HypnosXC/mmaction2/tree/a26d5f981449445a5e22a0a60d8b285e06c3dd6e |
OffsetNet | import torch
from torch import nn as nn
class OffsetNet(nn.Module):
"""OffsetNet in Temporal interlace module.
The OffsetNet consists of one convolution layer and two fc layers
with a relu activation following with a sigmoid function. Following
the convolution layer, two fc layers and relu are applie... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 as nn
as... | HypnosXC/mmaction2 | OffsetNet | false | 13,827 | [
"Apache-2.0"
] | 549 | a26d5f981449445a5e22a0a60d8b285e06c3dd6e | https://github.com/HypnosXC/mmaction2/tree/a26d5f981449445a5e22a0a60d8b285e06c3dd6e |
XOR | import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.utils.data
class XOR(nn.Module):
def __init__(self, input_dim, output_dim):
super(XOR, self).__init__()
self.lin1 = nn.Linear(input_dim, 8)
self.lin2 = nn.Linear(8, output_dim)
def forward(self, featu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Infi-zc/horovod | XOR | false | 13,828 | [
"Apache-2.0"
] | 5,089 | 94cd8561a21d449fc8c80c8fef422025b84dfc22 | https://github.com/Infi-zc/horovod/tree/94cd8561a21d449fc8c80c8fef422025b84dfc22 |
TimeEncoding | import torch
import torch.nn as nn
class TimeEncoding(nn.Module):
def __init__(self, d_model, dropout=0.1, max_len=5000):
super(TimeEncoding, self).__init__()
self.dropout = nn.Dropout(p=dropout)
def forward(self, x, mask, lengths):
time = mask * 1 / (lengths[..., None] - 1)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Immocat/ACTOR | TimeEncoding | false | 13,829 | [
"MIT"
] | 164 | c7237e82e333bf2c57f7d8e12f27d0831233befc | https://github.com/Immocat/ACTOR/tree/c7237e82e333bf2c57f7d8e12f27d0831233befc |
InstanceNormalization | import torch
import torch.nn as nn
class InstanceNormalization(torch.nn.Module):
"""InstanceNormalization
Improves convergence of neural-style.
ref: https://arxiv.org/pdf/1607.08022.pdf
"""
def __init__(self, dim, eps=1e-09):
super(InstanceNormalization, self).__init__()
self.scal... | 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_... | ImageProcessingCentraleLille2021/fast-neural-style | InstanceNormalization | false | 13,830 | [
"MIT"
] | 350 | e77456c35c2a49f90227119d158828a0964c7e13 | https://github.com/ImageProcessingCentraleLille2021/fast-neural-style/tree/e77456c35c2a49f90227119d158828a0964c7e13 |
ConvTemporalGraphical | import torch
import torch.nn as nn
class ConvTemporalGraphical(nn.Module):
"""The basic module for applying a graph convolution.
Args:
in_channels (int): Number of channels in the input sequence data
out_channels (int): Number of channels produced by the convolution
kernel_size (int): ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Immocat/ACTOR | ConvTemporalGraphical | false | 13,831 | [
"MIT"
] | 164 | c7237e82e333bf2c57f7d8e12f27d0831233befc | https://github.com/Immocat/ACTOR/tree/c7237e82e333bf2c57f7d8e12f27d0831233befc |
GreedyCTCDecoder | import torch
import torch.utils.data
import torch.hub
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class GreedyCTCDecoder(nn.Module):
""" Greedy CTC Decoder
"""
def __init__(self, **kwargs):
nn.Module.__init__(self)
def forward(self, lo... | 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
import torch.hub
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distribute... | IntelAI/models | GreedyCTCDecoder | false | 13,832 | [
"Apache-2.0"
] | 357 | 1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c | https://github.com/IntelAI/models/tree/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c |
T2A | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
class T2A(nn.Module):
def __init__(self, dim):
super().__init__()
self.W = nn.Linear(dim, dim, bias=False)
self.U = nn.Linear(dim, dim, bias=False)
self.b = 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
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_size_str... | InitialBug/BiSET | T2A | false | 13,833 | [
"MIT"
] | 47 | a697a3c61014281bbd83cd37ede29b1263c8832f | https://github.com/InitialBug/BiSET/tree/a697a3c61014281bbd83cd37ede29b1263c8832f |
QuantizableHSwish | import torch
import torch.nn as nn
import torch.quantization
class QuantizableHSigmoid(nn.Module):
"""Hard Sigmoid for quantization."""
def __init__(self, inplace: 'bool'=True) ->None:
"""Initialize."""
super(QuantizableHSigmoid, self).__init__()
self.relu6 = nn.ReLU6(inplace=inplace)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.quantization
assert_size_stride = torch._C._dynamo.gua... | HwangJohn/model_compression | QuantizableHSwish | false | 13,834 | [
"MIT"
] | 216 | 1df40c8a531313cc9e79255f4477f39d66d9b849 | https://github.com/HwangJohn/model_compression/tree/1df40c8a531313cc9e79255f4477f39d66d9b849 |
SoftArgmax2D | import torch
import torch.nn as nn
from typing import Optional
def create_meshgrid(x: 'torch.Tensor', normalized_coordinates: 'Optional[bool]'
) ->torch.Tensor:
assert len(x.shape) == 4, x.shape
_, _, height, width = x.shape
_device, _dtype = x.device, x.dtype
if normalized_coordinates:
xs... | 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
... | InnovationLab-Top/Human-Path-Prediction | SoftArgmax2D | false | 13,835 | [
"MIT"
] | 120 | 5da0e2bcfcfc59bf246a781be4fc3033a3855ef7 | https://github.com/InnovationLab-Top/Human-Path-Prediction/tree/5da0e2bcfcfc59bf246a781be4fc3033a3855ef7 |
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... | Fanxingye/DeepRS | BiInteractionPooling | false | 13,836 | [
"Apache-2.0"
] | 1,770 | 06b98cf2cb2781656805eafc577fbd088f37d17d | https://github.com/Fanxingye/DeepRS/tree/06b98cf2cb2781656805eafc577fbd088f37d17d |
ExponentialEnvelope | import torch
class ExponentialEnvelope(torch.nn.Module):
"""
Exponential envelope function that ensures a smooth cutoff,
as proposed in Unke, Chmiela, Gastegger, Schütt, Sauceda, Müller 2021.
SpookyNet: Learning Force Fields with Electronic Degrees of Freedom
and Nonlocal Effects
"""
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 math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | Irlirion/ocp | ExponentialEnvelope | false | 13,837 | [
"MIT",
"BSD-3-Clause"
] | 242 | 6fb3e794eef31559db990300198eca20f41d8f37 | https://github.com/Irlirion/ocp/tree/6fb3e794eef31559db990300198eca20f41d8f37 |
DimReduce | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
def GLU(input):
out_dim = input.shape[2] // 2
a, b = torch.split(input, out_dim, dim=2)
return a * F.sigmoid(b)
class DimReduce(nn.Module):
def __init__(self, input_dim, out_dim, kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import t... | InitialBug/BiSET | DimReduce | false | 13,838 | [
"MIT"
] | 47 | a697a3c61014281bbd83cd37ede29b1263c8832f | https://github.com/InitialBug/BiSET/tree/a697a3c61014281bbd83cd37ede29b1263c8832f |
PolynomialEnvelope | import torch
class PolynomialEnvelope(torch.nn.Module):
"""
Polynomial envelope function that ensures a smooth cutoff.
Parameters
----------
exponent: int
Exponent of the envelope function.
"""
def __init__(self, exponent):
super().__init__()
assert expone... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Irlirion/ocp | PolynomialEnvelope | false | 13,839 | [
"MIT",
"BSD-3-Clause"
] | 242 | 6fb3e794eef31559db990300198eca20f41d8f37 | https://github.com/Irlirion/ocp/tree/6fb3e794eef31559db990300198eca20f41d8f37 |
Sine | import torch
import torch.nn as nn
class Sine(nn.Module):
def __init__(self, w0: 'float'=30.0):
super(Sine, self).__init__()
self.w0 = w0
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
return torch.sin(self.w0 * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | Irlirion/ocp | Sine | false | 13,840 | [
"MIT",
"BSD-3-Clause"
] | 242 | 6fb3e794eef31559db990300198eca20f41d8f37 | https://github.com/Irlirion/ocp/tree/6fb3e794eef31559db990300198eca20f41d8f37 |
ScaledSiLU | import torch
class ScaledSiLU(torch.nn.Module):
def __init__(self):
super().__init__()
self.scale_factor = 1 / 0.6
self._activation = torch.nn.SiLU()
def forward(self, x):
return self._activation(x) * self.scale_factor
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Irlirion/ocp | ScaledSiLU | false | 13,841 | [
"MIT",
"BSD-3-Clause"
] | 242 | 6fb3e794eef31559db990300198eca20f41d8f37 | https://github.com/Irlirion/ocp/tree/6fb3e794eef31559db990300198eca20f41d8f37 |
SiQU | import torch
class SiQU(torch.nn.Module):
def __init__(self):
super().__init__()
self._activation = torch.nn.SiLU()
def forward(self, x):
return x * self._activation(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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Irlirion/ocp | SiQU | false | 13,842 | [
"MIT",
"BSD-3-Clause"
] | 242 | 6fb3e794eef31559db990300198eca20f41d8f37 | https://github.com/Irlirion/ocp/tree/6fb3e794eef31559db990300198eca20f41d8f37 |
SphericalBesselBasis | import math
import torch
import numpy as np
class SphericalBesselBasis(torch.nn.Module):
"""
1D spherical Bessel basis
Parameters
----------
num_radial: int
Controls maximum frequency.
cutoff: float
Cutoff distance in Angstrom.
"""
def __init__(self, num_radial: 'int'... | 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 math
import numpy as np
assert_size_stride = torch._C._dynamo.guar... | Irlirion/ocp | SphericalBesselBasis | false | 13,843 | [
"MIT",
"BSD-3-Clause"
] | 242 | 6fb3e794eef31559db990300198eca20f41d8f37 | https://github.com/Irlirion/ocp/tree/6fb3e794eef31559db990300198eca20f41d8f37 |
Quant_Distribution_Loss | import torch
import torch.nn as nn
class Quant_Distribution_Loss(nn.Module):
def __init__(self):
super(Quant_Distribution_Loss, self).__init__()
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor'
) ->torch.Tensor:
m = input * target
n = target * target
k ... | 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
... | Ironteen/model-quantization | Quant_Distribution_Loss | false | 13,844 | [
"BSD-2-Clause"
] | 66 | 74115eaf33668207124254f2b2145209f7ab70fe | https://github.com/Ironteen/model-quantization/tree/74115eaf33668207124254f2b2145209f7ab70fe |
GaussianSmearing | import torch
import torch.nn as nn
class GaussianSmearing(nn.Module):
def __init__(self, in_features, start=0, end=1, num_freqs=50):
super(GaussianSmearing, self).__init__()
self.num_freqs = num_freqs
offset = torch.linspace(start, end, num_freqs)
self.coeff = -0.5 / (offset[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
assert_size_stride = torch._C._dynamo.guards.assert... | Irlirion/ocp | GaussianSmearing | false | 13,845 | [
"MIT",
"BSD-3-Clause"
] | 242 | 6fb3e794eef31559db990300198eca20f41d8f37 | https://github.com/Irlirion/ocp/tree/6fb3e794eef31559db990300198eca20f41d8f37 |
ResidualBlock | import torch
import numpy as np
import torch.nn as nn
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = int(np.floor(kernel_size / 2))
self.reflection_pad = nn.ReflectionPad2d(reflec... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ImageProcessingCentraleLille2021/fast-neural-style | ResidualBlock | false | 13,846 | [
"MIT"
] | 350 | e77456c35c2a49f90227119d158828a0964c7e13 | https://github.com/ImageProcessingCentraleLille2021/fast-neural-style/tree/e77456c35c2a49f90227119d158828a0964c7e13 |
BareLoss | import torch
import torch.nn as nn
class BareLoss(nn.Module):
def __init__(self, loss_weight=1.0):
super().__init__()
self.loss_weight = loss_weight
def forward(self, pre_loss):
loss = self.loss_weight * pre_loss.mean()
return loss
def get_inputs():
return [torch.rand([... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | JDAI-CV/LIO | BareLoss | false | 13,847 | [
"Apache-2.0"
] | 105 | 7bcd4d5e2990db5c8a7ec6ecc76a23c2e913e523 | https://github.com/JDAI-CV/LIO/tree/7bcd4d5e2990db5c8a7ec6ecc76a23c2e913e523 |
QREmbeddingBag | import torch
import numpy as np
import torch.utils.data
import torch.hub
from torch import nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
import torch.nn.functional as F
from torch.nn import Parameter
from torchvision.transforms import functional as F
from torch.nn import functional ... | 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 numpy as np
import torch.utils.data
import torch.hub
from torch import n... | IntelAI/models | QREmbeddingBag | false | 13,848 | [
"Apache-2.0"
] | 357 | 1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c | https://github.com/IntelAI/models/tree/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c |
Symmetric | import torch
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class Symmetric(nn.Module):
def forward(self, X):
return X.triu() + X.triu(1).transpose(-1, -2)
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
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import to... | Ismail-Mustapha/tutorials | Symmetric | false | 13,849 | [
"BSD-3-Clause"
] | 6,424 | 0ccfbf0047db855e93e2aadb43c89c92e89f52b8 | https://github.com/Ismail-Mustapha/tutorials/tree/0ccfbf0047db855e93e2aadb43c89c92e89f52b8 |
StackTime | import torch
from torchvision.models.quantization import *
class StackTime(torch.nn.Module):
__constants__ = ['factor']
def __init__(self, factor):
super().__init__()
self.factor = int(factor)
def forward(self, x, x_lens):
seq = [x]
for i in range(1, self.factor):
... | 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 torchvision.models.quantization import *
assert_size_stride = torch._C._dy... | CaoZhongZ/inference | StackTime | false | 13,850 | [
"Apache-2.0"
] | 388 | 58025f8fde679ea864d34f96ecc9f14bf70ece53 | https://github.com/CaoZhongZ/inference/tree/58025f8fde679ea864d34f96ecc9f14bf70ece53 |
Skew | import torch
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class Skew(nn.Module):
def forward(self, X):
A = X.triu(1)
return A - A.transpose(-1, -2)
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
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import to... | Ismail-Mustapha/tutorials | Skew | false | 13,851 | [
"BSD-3-Clause"
] | 6,424 | 0ccfbf0047db855e93e2aadb43c89c92e89f52b8 | https://github.com/Ismail-Mustapha/tutorials/tree/0ccfbf0047db855e93e2aadb43c89c92e89f52b8 |
Concat | import logging
import torch
import numpy as np
import torch.nn as nn
class Concat(nn.Module):
def __init__(self, args=None):
super(Concat, self).__init__()
self.index = -1
self.verbose = print
self.enable = False
self.input_index = ''
self.tag = 'fm'
self.a... | 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 logging
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.g... | Ironteen/model-quantization | Concat | false | 13,852 | [
"BSD-2-Clause"
] | 66 | 74115eaf33668207124254f2b2145209f7ab70fe | https://github.com/Ironteen/model-quantization/tree/74115eaf33668207124254f2b2145209f7ab70fe |
TokenEmbedding | import math
import torch
from torch import Tensor
import torch.nn as nn
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class TokenEmbedding(nn.Module):
def __init__(self, vocab_size: 'int', emb_... | 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.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import to... | Ismail-Mustapha/tutorials | TokenEmbedding | false | 13,853 | [
"BSD-3-Clause"
] | 6,424 | 0ccfbf0047db855e93e2aadb43c89c92e89f52b8 | https://github.com/Ismail-Mustapha/tutorials/tree/0ccfbf0047db855e93e2aadb43c89c92e89f52b8 |
HighLightLayer | import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size=1, stride=1, paddin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
assert... | IsaacChanghau/VSLNet | HighLightLayer | false | 13,854 | [
"MIT"
] | 62 | 3793c625f2e251a5f19a0d59f0c83b12e386f808 | https://github.com/IsaacChanghau/VSLNet/tree/3793c625f2e251a5f19a0d59f0c83b12e386f808 |
Classifier | import torch
import torch.nn as nn
class Classifier(nn.Module):
def __init__(self, in_dim, num_classes):
super(Classifier, self).__init__()
self.classifier = nn.Linear(in_dim, num_classes)
self.avgpool = nn.AdaptiveAvgPool2d(output_size=1)
def forward(self, x):
x = self.avgpo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | JDAI-CV/LIO | Classifier | false | 13,855 | [
"Apache-2.0"
] | 105 | 7bcd4d5e2990db5c8a7ec6ecc76a23c2e913e523 | https://github.com/JDAI-CV/LIO/tree/7bcd4d5e2990db5c8a7ec6ecc76a23c2e913e523 |
TracedModule | import torch
import torch.quantization
import torch.onnx
import torch.nn.parallel
import torch.utils.data
import torch.fx
import torch.nn
import torch.optim
import torch.profiler
class TracedModule(torch.nn.Module):
def forward(self, x):
x = x.type(torch.float32)
return torch.floor(torch.sqrt(x) ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.quantization
import torch.onnx
import torch.nn.parallel
import tor... | Ismail-Mustapha/tutorials | TracedModule | false | 13,856 | [
"BSD-3-Clause"
] | 6,424 | 0ccfbf0047db855e93e2aadb43c89c92e89f52b8 | https://github.com/Ismail-Mustapha/tutorials/tree/0ccfbf0047db855e93e2aadb43c89c92e89f52b8 |
FCLayer | import torch
import torch.nn as nn
class FCLayer(nn.Module):
def __init__(self, input_dim, output_dim, dropout_rate=0.0,
use_activation=True):
super(FCLayer, self).__init__()
self.use_activation = use_activation
self.dropout = nn.Dropout(dropout_rate)
self.linear = nn.Line... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | JaeheeRyu/R-BERT | FCLayer | false | 13,857 | [
"Apache-2.0"
] | 246 | 0f9048a1612a77a0a920e6fe2349430c7f608d77 | https://github.com/JaeheeRyu/R-BERT/tree/0f9048a1612a77a0a920e6fe2349430c7f608d77 |
WeightedPool | import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class WeightedPool(nn.Module):
def __init__(self, dim):
super(WeightedPool, self).__... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | IsaacChanghau/VSLNet | WeightedPool | false | 13,858 | [
"MIT"
] | 62 | 3793c625f2e251a5f19a0d59f0c83b12e386f808 | https://github.com/IsaacChanghau/VSLNet/tree/3793c625f2e251a5f19a0d59f0c83b12e386f808 |
PredictionHead | import torch
import torch.nn as nn
from torchvision.models.quantization import *
class PredictionHead(nn.Module):
def __init__(self, in_channels, num_classes, num_anchors):
super(PredictionHead, self).__init__()
self.classification = nn.Conv2d(in_channels, num_classes *
num_anchors, k... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 torchvision.models.quantization import *
assert_size_... | CaoZhongZ/inference | PredictionHead | false | 13,859 | [
"Apache-2.0"
] | 388 | 58025f8fde679ea864d34f96ecc9f14bf70ece53 | https://github.com/CaoZhongZ/inference/tree/58025f8fde679ea864d34f96ecc9f14bf70ece53 |
LWSLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
class LWSLinear(nn.Linear):
__constants__ = ['bias', 'in_features', 'out_features']
def __init__(self, in_features, out_features, bias=True):
super(nn.Linear, self).__init__()
self.in_features = in_features
self.out_fe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | IssacCyj/eqlv2 | LWSLinear | false | 13,860 | [
"Apache-2.0"
] | 95 | b2b218339040cad85e37601b0c1339db52f2fb8e | https://github.com/IssacCyj/eqlv2/tree/b2b218339040cad85e37601b0c1339db52f2fb8e |
expandEncoder | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.utils.data
class LowerBound(Function):
@staticmethod
def forward(ctx, inputs, bound):
b = torch.ones_like(inputs) * bound
ctx.save_for_backward(inputs, b)
return torch.max(inputs, 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.... | Geunwoo-Jeon/iclr_17_compression | expandEncoder | false | 13,861 | [
"MIT"
] | 56 | a28746b1f1c518d91125d8f289d9511cde488c77 | https://github.com/Geunwoo-Jeon/iclr_17_compression/tree/a28746b1f1c518d91125d8f289d9511cde488c77 |
ConvDownsample | import torch
from torch import nn
class ConvDownsample(nn.Module):
"""Convolutional Downsampling of ConvMLP."""
def __init__(self, embed_dim_in, embed_dim_out):
super().__init__()
self.downsample = nn.Conv2d(embed_dim_in, embed_dim_out, 3, stride=
2, padding=1)
def forward(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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | Jack-Hu-2001/UniverseNet | ConvDownsample | false | 13,862 | [
"Apache-2.0"
] | 314 | 03e7b8442286f951c65fe730ec86b9441005ac1b | https://github.com/Jack-Hu-2001/UniverseNet/tree/03e7b8442286f951c65fe730ec86b9441005ac1b |
Pooling | import torch
from torch import nn
class Pooling(nn.Module):
"""Implementation of pooling for PoolFormer."""
def __init__(self, pool_size=3):
super().__init__()
self.pool = nn.AvgPool2d(pool_size, stride=1, padding=pool_size //
2, count_include_pad=False)
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Jack-Hu-2001/UniverseNet | Pooling | false | 13,863 | [
"Apache-2.0"
] | 314 | 03e7b8442286f951c65fe730ec86b9441005ac1b | https://github.com/Jack-Hu-2001/UniverseNet/tree/03e7b8442286f951c65fe730ec86b9441005ac1b |
CBAM_Module | import torch
from torch import nn
from torchvision.transforms import *
class CBAM_Module(nn.Module):
def __init__(self, channels, reduction):
super(CBAM_Module, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.max_pool = nn.AdaptiveMaxPool2d(1)
self.fc1 = nn.Conv2d(ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 tor... | IrvingShu/batch-feature-erasing-network | CBAM_Module | false | 13,864 | [
"MIT"
] | 152 | 534616c09dade92561a0203797892a63a072b1b4 | https://github.com/IrvingShu/batch-feature-erasing-network/tree/534616c09dade92561a0203797892a63a072b1b4 |
CQConcatenate | import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
def mask_logits(inputs, mask, mask_value=-1e+30):
mask = mask.type(torch.float32)
return inputs + (1.0 - mask) * mask_value
class Conv1D(nn.Module):
def __init__(self, in_dim, out_dim, kernel_size=1, stride=1, paddin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | IsaacChanghau/VSLNet | CQConcatenate | false | 13,865 | [
"MIT"
] | 62 | 3793c625f2e251a5f19a0d59f0c83b12e386f808 | https://github.com/IsaacChanghau/VSLNet/tree/3793c625f2e251a5f19a0d59f0c83b12e386f808 |
ThreeLayerCNN | import torch
import torch.utils.data
class ThreeLayerCNN(torch.nn.Module):
"""
Input: 128x128 face image (eye aligned).
Output: 1-D tensor with 2 elements. Used for binary classification.
Parameters:
Number of conv layers: 3
Number of fully connected layers: 2
"""
def __init__... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
asser... | Iuiu1234/pipelines | ThreeLayerCNN | false | 13,866 | [
"Apache-2.0"
] | 2,860 | 1e032f550ce23cd40bfb6827b995248537b07d08 | https://github.com/Iuiu1234/pipelines/tree/1e032f550ce23cd40bfb6827b995248537b07d08 |
LayerNormChannel | import torch
from torch import nn
class LayerNormChannel(nn.Module):
"""LayerNorm only for channel dimension."""
def __init__(self, num_channels, eps=1e-05):
super().__init__()
self.weight = nn.Parameter(torch.ones(num_channels))
self.bias = nn.Parameter(torch.zeros(num_channels))
... | 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... | Jack-Hu-2001/UniverseNet | LayerNormChannel | false | 13,867 | [
"Apache-2.0"
] | 314 | 03e7b8442286f951c65fe730ec86b9441005ac1b | https://github.com/Jack-Hu-2001/UniverseNet/tree/03e7b8442286f951c65fe730ec86b9441005ac1b |
ConvKernel | from torch.nn import Module
import math
import torch
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class _ConvNdKernel(Module):
def __init__(self, in_channels, out_channels, kernel_size, stride,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import math
from torch.nn.modules.utils import _pair... | JannerM/spatial-reasoning | ConvKernel | false | 13,868 | [
"MIT"
] | 54 | e163003a33177e41ca02d5feefee3fdfca5ba154 | https://github.com/JannerM/spatial-reasoning/tree/e163003a33177e41ca02d5feefee3fdfca5ba154 |
InnerProductNetwork | import torch
import torch.utils.data
class InnerProductNetwork(torch.nn.Module):
def forward(self, x):
"""
:param x: Float tensor of size ``(batch_size, num_fields, embed_dim)``
"""
num_fields = x.shape[1]
row, col = list(), list()
for i in range(num_fields - 1):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_... | JazonJiao/pytorch-fm | InnerProductNetwork | false | 13,869 | [
"MIT"
] | 734 | 7192e7861fa54341d5b2df995f92858f583ea09e | https://github.com/JazonJiao/pytorch-fm/tree/7192e7861fa54341d5b2df995f92858f583ea09e |
MLP | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self, input_dim, output_dim):
super().__init__()
self.input_fc = nn.Linear(input_dim, 250)
self.hidden_fc = nn.Linear(250, 100)
self.output_fc = nn.Linear(100, output_dim)
de... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | JanSKowalski/ese440-ese441 | MLP | false | 13,870 | [
"MIT"
] | 54 | 90d7b7afc34aa062aad23dd23813284f66bf1f4d | https://github.com/JanSKowalski/ese440-ese441/tree/90d7b7afc34aa062aad23dd23813284f66bf1f4d |
FCDiscriminator | import torch
from torch import nn
class FCDiscriminator(nn.Module):
def __init__(self, num_classes, ndf=64):
super(FCDiscriminator, self).__init__()
self.conv1 = nn.Conv2d(num_classes, ndf, kernel_size=4, stride=2,
padding=1)
self.conv2 = nn.Conv2d(ndf, ndf * 2, kernel_size=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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | JDAI-CV/FADA | FCDiscriminator | false | 13,871 | [
"Apache-2.0"
] | 120 | a1c6403963184a3427eda68cc94b03ff6143368a | https://github.com/JDAI-CV/FADA/tree/a1c6403963184a3427eda68cc94b03ff6143368a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.