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 |
|---|---|---|---|---|---|---|---|---|---|---|
CriterionCWD | import torch
import torch.nn as nn
import torch._utils
import torch.optim
class ChannelNorm(nn.Module):
def __init__(self):
super(ChannelNorm, self).__init__()
def forward(self, featmap):
n, c, _h, _w = featmap.shape
featmap = featmap.reshape((n, c, -1))
featmap = featmap.sof... | 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... | yubin1219/Semantic-Seg | CriterionCWD | false | 4,642 | [
"BSD-2-Clause"
] | 0 | c40bd43d3d7e44bc995b8d041736580dec084251 | https://github.com/yubin1219/Semantic-Seg/tree/c40bd43d3d7e44bc995b8d041736580dec084251 |
SelfAttentionGated | import torch
import torch.utils.data
import torch.nn.functional as F
def masked_softmax(x, m=None, dim=-1):
"""
Softmax with mask
:param x:
:param m:
:param dim:
:return:
"""
if m is not None:
m = m.float()
x = x * m
e_x = torch.exp(x - torch.max(x, dim=dim, keepdim... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xdong73S/Match_LSTM_v2.0 | SelfAttentionGated | false | 4,643 | [
"MIT"
] | 0 | dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 | https://github.com/xdong73S/Match_LSTM_v2.0/tree/dfb8cfbc2a5dafc6655eecf151a7dbcf808cd729 |
Normalize | import torch
import torch.nn as nn
class Normalize(nn.Module):
def __init__(self, features, epsilon=1e-06):
super(Normalize, self).__init__()
self.gain = nn.Parameter(torch.ones(features))
self.bias = nn.Parameter(torch.zeros(features))
self.epsilon = epsilon
def forward(self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | yuri20198/neurips19-graph-protein-design | Normalize | false | 4,644 | [
"MIT"
] | 0 | 068e8cdfcbba629f996e99d3765cc2f3233f71a3 | https://github.com/yuri20198/neurips19-graph-protein-design/tree/068e8cdfcbba629f996e99d3765cc2f3233f71a3 |
PixelWiseBias | import torch
import torch.nn as nn
class PixelWiseBias(nn.Module):
"""Some Information about PixelWiseBias"""
def __init__(self, channels):
super(PixelWiseBias, self).__init__()
self.channels = channels
self.bias = nn.Parameter(torch.zeros(channels))
def forward(self, x):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | uthree/gan-image-generator2 | PixelWiseBias | false | 4,645 | [
"MIT"
] | 0 | 63a9f458f1f78fe13311157a219a5637a59afee4 | https://github.com/uthree/gan-image-generator2/tree/63a9f458f1f78fe13311157a219a5637a59afee4 |
CausalConv1d | import torch
from torch import nn
class CausalConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2):
super(CausalConv1d, self).__init__()
self.padding = dilation
self.causal_conv = nn.Conv1d(in_channels, out_channels, kernel_size,
padding=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | yuwl798180/FewRel | CausalConv1d | false | 4,646 | [
"MIT"
] | 0 | 8126e440b5d5d178e221cfb4a97a69cabd771fa4 | https://github.com/yuwl798180/FewRel/tree/8126e440b5d5d178e221cfb4a97a69cabd771fa4 |
DenseBlock | import torch
from torch import nn
from torch.nn import functional as F
class CausalConv1d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2):
super(CausalConv1d, self).__init__()
self.padding = dilation
self.causal_conv = nn.Conv1d(in_channels, out_channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | yuwl798180/FewRel | DenseBlock | false | 4,647 | [
"MIT"
] | 0 | 8126e440b5d5d178e221cfb4a97a69cabd771fa4 | https://github.com/yuwl798180/FewRel/tree/8126e440b5d5d178e221cfb4a97a69cabd771fa4 |
UnStackDelta | import torch
import torch.nn as nn
class UnStackDelta(nn.Module):
"""Reverse of StackDelta"""
def __init__(self):
super().__init__()
def forward(self, x: 'torch.Tensor'):
assert x.dim() == 4
if x.requires_grad:
out = x.transpose(1, 2).contiguous()
else:
... | 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... | wenjie-p/CAT | UnStackDelta | false | 4,648 | [
"Apache-2.0"
] | 0 | 0e6904658dd3d14afe51faf1d0141ae95fef44e8 | https://github.com/wenjie-p/CAT/tree/0e6904658dd3d14afe51faf1d0141ae95fef44e8 |
ToRGB | import torch
import torch.nn as nn
class ToRGB(nn.Module):
"""Some Information about ToRGB"""
def __init__(self, input_channels):
super(ToRGB, self).__init__()
self.conv = nn.Conv2d(input_channels, 3, kernel_size=1, stride=1,
padding=0)
self.tanh = nn.Tanh()
def forwa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | uthree/gan-image-generator2 | ToRGB | false | 4,649 | [
"MIT"
] | 0 | 63a9f458f1f78fe13311157a219a5637a59afee4 | https://github.com/uthree/gan-image-generator2/tree/63a9f458f1f78fe13311157a219a5637a59afee4 |
MinibatchStdDev | import torch
import torch.nn as nn
class MinibatchStdDev(nn.Module):
"""
Minibatch standard deviation layer for the discriminator
"""
def __init__(self):
"""
derived class constructor
"""
super().__init__()
def forward(self, x, alpha=1e-08):
"""
fo... | 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_... | zd-daniel/GANs-ZOO | MinibatchStdDev | false | 4,650 | [
"MIT"
] | 0 | fe72391e1db46616f97d1dec62441a299aa9c636 | https://github.com/zd-daniel/GANs-ZOO/tree/fe72391e1db46616f97d1dec62441a299aa9c636 |
EncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class ScaledDotProductAttention(nn.Module):
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropout)
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.... | yuanweining/DTI | EncoderLayer | false | 4,651 | [
"Apache-2.0"
] | 0 | 11eacb46a221da04d0e9b01d41c89c7ce51ea302 | https://github.com/yuanweining/DTI/tree/11eacb46a221da04d0e9b01d41c89c7ce51ea302 |
FFModule | import torch
import torch.nn as nn
class FFModule(nn.Module):
"""Feed-forward module
default output dimension = idim
x0 -> LayerNorm -> FC -> Swish -> Dropout -> FC -> Dropout -> x1
x0 + res_factor * x1 -> output
"""
def __init__(self, idim: 'int', res_factor: 'float'=0.5, dropout:
'... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | wenjie-p/CAT | FFModule | false | 4,652 | [
"Apache-2.0"
] | 0 | 0e6904658dd3d14afe51faf1d0141ae95fef44e8 | https://github.com/wenjie-p/CAT/tree/0e6904658dd3d14afe51faf1d0141ae95fef44e8 |
MultiHeadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class ScaledDotProductAttention(nn.Module):
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout(attn_dropout)
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.... | yuanweining/DTI | MultiHeadAttention | false | 4,653 | [
"Apache-2.0"
] | 0 | 11eacb46a221da04d0e9b01d41c89c7ce51ea302 | https://github.com/yuanweining/DTI/tree/11eacb46a221da04d0e9b01d41c89c7ce51ea302 |
Lookahead | import torch
import torch.nn as nn
import torch.nn.functional as F
class Lookahead(nn.Module):
def __init__(self, n_features, context):
super(Lookahead, self).__init__()
assert context > 0
self.context = context
self.n_features = n_features
self.pad = 0, self.context - 1
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | wenjie-p/CAT | Lookahead | false | 4,654 | [
"Apache-2.0"
] | 0 | 0e6904658dd3d14afe51faf1d0141ae95fef44e8 | https://github.com/wenjie-p/CAT/tree/0e6904658dd3d14afe51faf1d0141ae95fef44e8 |
PositionGenerator | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, hidden_size, variance_epsilon=1e-12):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(hidden_size))
self.beta = nn.Parameter(torch.zeros(hidden_size))
self.variance_epsilon = v... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | zhandand/MolRep | PositionGenerator | false | 4,655 | [
"MIT"
] | 0 | d81de22000f1245e1d9280af0cb329e745ce4bde | https://github.com/zhandand/MolRep/tree/d81de22000f1245e1d9280af0cb329e745ce4bde |
EnergyEstimateWidthRescale | import torch
from torch import nn as nn
from torch.nn.parameter import Parameter
class EnergyEstimateWidthRescale(nn.Module):
def __init__(self, scales):
super(EnergyEstimateWidthRescale, self).__init__()
self.scales = Parameter(torch.tensor(scales, dtype=torch.float32),
requires_grad... | 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
from torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_st... | zhanhuijing/ECC_PYCHARM | EnergyEstimateWidthRescale | false | 4,656 | [
"MIT"
] | 0 | c5e8fb747d70a2548e9866356f8dacc8df26a077 | https://github.com/zhanhuijing/ECC_PYCHARM/tree/c5e8fb747d70a2548e9866356f8dacc8df26a077 |
Actor | import torch
from torch import nn
import torch.nn.functional as F
class Actor(nn.Module):
"""Actor model
Parameters:
args (object): Parameter class
"""
def __init__(self, state_dim, action_dim, wwid):
super(Actor, self).__init__()
self.wwid = torch.Tensor([wwid])
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zhan0903/cerl | Actor | false | 4,657 | [
"Apache-2.0"
] | 0 | 6fb8aca9cb78b72947237edf2b9ed8362bd43829 | https://github.com/zhan0903/cerl/tree/6fb8aca9cb78b72947237edf2b9ed8362bd43829 |
Encoder | import torch
from torch import nn
class Encoder(nn.Module):
def __init__(self, embedding_dim, nhead, dropout, k=4):
super(Encoder, self).__init__()
self.transformer = nn.TransformerEncoderLayer(embedding_dim, nhead,
dim_feedforward=k * embedding_dim, dropout=dropout, activation=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yukiar/distil_wic | Encoder | false | 4,658 | [
"MIT"
] | 0 | 1f9c5c7252105dd9f4f264f8533753f0cd08ca5b | https://github.com/yukiar/distil_wic/tree/1f9c5c7252105dd9f4f264f8533753f0cd08ca5b |
GCN | from torch.nn import Module
import math
import torch
from torchvision.transforms import functional as F
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class GraphConvolution(Module):
"""
Simple G... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | zhanwenchen/Scene-Graph-Benchmark.pytorch | GCN | false | 4,659 | [
"MIT"
] | 0 | c86475bcbdaefcc1656a2890194355c2b32aa694 | https://github.com/zhanwenchen/Scene-Graph-Benchmark.pytorch/tree/c86475bcbdaefcc1656a2890194355c2b32aa694 |
ApplySingleAttention | import torch
import torch.utils.data
import torch.nn as nn
from torch.nn.utils import weight_norm
class FCNet(nn.Module):
def __init__(self, in_size, out_size, activate=None, drop=0.0):
super(FCNet, self).__init__()
self.lin = weight_norm(nn.Linear(in_size, out_size), dim=None)
self.drop_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zhanwenchen/Scene-Graph-Benchmark.pytorch | ApplySingleAttention | false | 4,660 | [
"MIT"
] | 0 | c86475bcbdaefcc1656a2890194355c2b32aa694 | https://github.com/zhanwenchen/Scene-Graph-Benchmark.pytorch/tree/c86475bcbdaefcc1656a2890194355c2b32aa694 |
Fcn8s | import torch
import numpy as np
import torch.nn as nn
def _upsampling_weights(in_channels, out_channels, kernel_size):
factor = (kernel_size + 1) // 2
if kernel_size % 2 == 1:
center = factor - 1
else:
center = factor - 0.5
og = np.ogrid[:kernel_size, :kernel_size]
filt = (1 - abs(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | jgibson2/crfasrnn_pytorch | Fcn8s | false | 4,661 | [
"MIT"
] | 0 | 04c8477343bc1a186b3712f876b497f00e43ae72 | https://github.com/jgibson2/crfasrnn_pytorch/tree/04c8477343bc1a186b3712f876b497f00e43ae72 |
BiaffineAttention | import torch
import torch.nn as nn
from torch.nn import Module as Layer
class BiaffineAttention(Layer):
"""Implements a biaffine attention operator for binary relation classification."""
def __init__(self, in_features, out_features):
super(BiaffineAttention, self).__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
import torch.nn as nn
from torch.nn import Module as Layer
assert_size_stride = ... | verages/PaddleOCR2Pytorch | BiaffineAttention | false | 4,662 | [
"Apache-2.0"
] | 0 | 201f0d5d6007f49620c49af7d222c3b220eb3e70 | https://github.com/verages/PaddleOCR2Pytorch/tree/201f0d5d6007f49620c49af7d222c3b220eb3e70 |
StateAttention | import torch
import torch.nn as nn
class StateAttention(nn.Module):
def __init__(self):
super(StateAttention, self).__init__()
self.sm = nn.Softmax(dim=1)
def forward(self, a_t, r_t, input_embedding, padded_mask):
new_a_t = torch.zeros_like(a_t)
for i in range(a_t.shape[1]):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | zhangyuejoslin/selfmonitoring-agent | StateAttention | false | 4,663 | [
"MIT"
] | 0 | 9401ceb492f6c4576d62404b62e815d184136b24 | https://github.com/zhangyuejoslin/selfmonitoring-agent/tree/9401ceb492f6c4576d62404b62e815d184136b24 |
C1 | import torch
import torch.nn as nn
from collections import OrderedDict
class C1(nn.Module):
def __init__(self):
super(C1, self).__init__()
self.c1 = nn.Sequential(OrderedDict([('c1', nn.Conv2d(1, 6,
kernel_size=(5, 5))), ('relu1', nn.ReLU()), ('s1', nn.MaxPool2d
(kernel_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from co... | zjgbz/img_cls | C1 | false | 4,664 | [
"MIT"
] | 0 | 513d5ae423d95e008a82a6ffe443db49f8ed9ac2 | https://github.com/zjgbz/img_cls/tree/513d5ae423d95e008a82a6ffe443db49f8ed9ac2 |
SEModule | import torch
import torch.nn as nn
import torch.nn.functional as F
def hard_sigmoid(x, slope=0.1666667, offset=0.5):
return torch.clamp(slope * x + offset, 0.0, 1.0)
class SEModule(nn.Module):
def __init__(self, in_channels, reduction=4, name=''):
super(SEModule, self).__init__()
self.avg_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
assert_... | verages/PaddleOCR2Pytorch | SEModule | false | 4,665 | [
"Apache-2.0"
] | 0 | 201f0d5d6007f49620c49af7d222c3b220eb3e70 | https://github.com/verages/PaddleOCR2Pytorch/tree/201f0d5d6007f49620c49af7d222c3b220eb3e70 |
BiAttention | import torch
from torchvision.transforms import functional as F
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import weight_norm
class FCNet(nn.Module):
def __init__(self, in_size, out_size, activate=None, drop=0.0):
super(FCNet, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | zhanwenchen/Scene-Graph-Benchmark.pytorch | BiAttention | false | 4,666 | [
"MIT"
] | 0 | c86475bcbdaefcc1656a2890194355c2b32aa694 | https://github.com/zhanwenchen/Scene-Graph-Benchmark.pytorch/tree/c86475bcbdaefcc1656a2890194355c2b32aa694 |
RSELayer | import torch
import torch.nn as nn
import torch.nn.functional as F
def hard_sigmoid(x, slope=0.1666667, offset=0.5):
return torch.clamp(slope * x + offset, 0.0, 1.0)
class SEModule(nn.Module):
def __init__(self, in_channels, reduction=4, name=''):
super(SEModule, self).__init__()
self.avg_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 ... | verages/PaddleOCR2Pytorch | RSELayer | false | 4,667 | [
"Apache-2.0"
] | 0 | 201f0d5d6007f49620c49af7d222c3b220eb3e70 | https://github.com/verages/PaddleOCR2Pytorch/tree/201f0d5d6007f49620c49af7d222c3b220eb3e70 |
F_fully_connected | import torch
import torch.nn as nn
import torch.optim
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().__init__()
if not internal_size:
internal_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
import ... | zimmerrol/FrEIA | F_fully_connected | false | 4,668 | [
"MIT"
] | 0 | 73d01ab8c90e0deb5e242d66405bd168db06dc19 | https://github.com/zimmerrol/FrEIA/tree/73d01ab8c90e0deb5e242d66405bd168db06dc19 |
C2 | import torch
import torch.nn as nn
from collections import OrderedDict
class C2(nn.Module):
def __init__(self):
super(C2, self).__init__()
self.c2 = nn.Sequential(OrderedDict([('c2', nn.Conv2d(6, 16,
kernel_size=(5, 5))), ('relu2', nn.ReLU()), ('s2', nn.MaxPool2d
(kernel_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from co... | zjgbz/img_cls | C2 | false | 4,669 | [
"MIT"
] | 0 | 513d5ae423d95e008a82a6ffe443db49f8ed9ac2 | https://github.com/zjgbz/img_cls/tree/513d5ae423d95e008a82a6ffe443db49f8ed9ac2 |
SubSample | import torch
import torch.nn as nn
class SubSample(nn.Module):
def __init__(self, in_channels, out_channels, types='Pool', stride=[2,
1], sub_norm='nn.LayerNorm', act=None):
super().__init__()
self.types = types
if types == 'Pool':
self.avgpool = nn.AvgPool2d(kernel_s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | verages/PaddleOCR2Pytorch | SubSample | false | 4,670 | [
"Apache-2.0"
] | 0 | 201f0d5d6007f49620c49af7d222c3b220eb3e70 | https://github.com/verages/PaddleOCR2Pytorch/tree/201f0d5d6007f49620c49af7d222c3b220eb3e70 |
Critic | import torch
from torch import nn
import torch.nn.functional as F
class Critic(nn.Module):
"""Critic model
Parameters:
args (object): Parameter class
"""
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
l1 = 400
l2 = 300
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | zhan0903/cerl | Critic | false | 4,671 | [
"Apache-2.0"
] | 0 | 6fb8aca9cb78b72947237edf2b9ed8362bd43829 | https://github.com/zhan0903/cerl/tree/6fb8aca9cb78b72947237edf2b9ed8362bd43829 |
F_conv | import torch
import warnings
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
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... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.optim
assert_size_stride = to... | zimmerrol/FrEIA | F_conv | false | 4,672 | [
"MIT"
] | 0 | 73d01ab8c90e0deb5e242d66405bd168db06dc19 | https://github.com/zimmerrol/FrEIA/tree/73d01ab8c90e0deb5e242d66405bd168db06dc19 |
LR_PAD | import torch
import torch.nn as nn
def lr_pad(x, padding=1):
""" Pad left/right-most to each other instead of zero padding """
return torch.cat([x[..., -padding:], x, x[..., :padding]], dim=3)
class LR_PAD(nn.Module):
""" Pad left/right-most to each other instead of zero padding """
def __init__(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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | zokin/HorizonNet | LR_PAD | false | 4,673 | [
"MIT"
] | 0 | a93a76ec7fdc76a5ba023adaed869e34f7f3cea4 | https://github.com/zokin/HorizonNet/tree/a93a76ec7fdc76a5ba023adaed869e34f7f3cea4 |
MLPLayer | import torch
from torch import nn
class MLPLayer(nn.Module):
def __init__(self, input_size, output_size, non_linearity=torch.sigmoid):
super().__init__()
self.lin1 = nn.Linear(input_size, input_size // 2)
self.lin2 = nn.Linear(input_size // 2, output_size)
self.non_lin = non_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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | zoranmedic/LCR-design | MLPLayer | false | 4,674 | [
"MIT"
] | 0 | b722e4e9d00e8aaae36dd51ddc8131477ee805fd | https://github.com/zoranmedic/LCR-design/tree/b722e4e9d00e8aaae36dd51ddc8131477ee805fd |
MultiheadAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn.init import xavier_uniform_
class MultiheadAttention(nn.Module):
"""Allows the model to jointly attend to information
from different representation subspaces.
See reference: Attention Is All You Ne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | verages/PaddleOCR2Pytorch | MultiheadAttention | false | 4,675 | [
"Apache-2.0"
] | 0 | 201f0d5d6007f49620c49af7d222c3b220eb3e70 | https://github.com/verages/PaddleOCR2Pytorch/tree/201f0d5d6007f49620c49af7d222c3b220eb3e70 |
ReadUnit | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.init import xavier_uniform_
def linear(in_dim, out_dim, bias=True):
lin = nn.Linear(in_dim, out_dim, bias=bias)
xavier_uniform_(lin.weight)
if bias:
lin.bias.data.zero_()
return lin
class ReadUnit(nn.Module):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | zorache/mac-network-pytorch-gqa | ReadUnit | false | 4,676 | [
"MIT"
] | 0 | 5de0a906410af0596f7b5dc159ce7db82bd37418 | https://github.com/zorache/mac-network-pytorch-gqa/tree/5de0a906410af0596f7b5dc159ce7db82bd37418 |
CriterionKD | import torch
import torch.nn as nn
from torch.nn import functional as F
import torch._utils
import torch.optim
class CriterionKD(nn.Module):
"""
knowledge distillation loss
"""
def __init__(self, upsample=False, temperature=4):
super(CriterionKD, self).__init__()
self.upsample = upsam... | 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... | yubin1219/Semantic-Seg | CriterionKD | false | 4,677 | [
"BSD-2-Clause"
] | 0 | c40bd43d3d7e44bc995b8d041736580dec084251 | https://github.com/yubin1219/Semantic-Seg/tree/c40bd43d3d7e44bc995b8d041736580dec084251 |
SiaLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data.distributed
class SiaLoss(nn.Module):
"""
Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin=2.0):
super(SiaLoss, 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import... | zwzhang121/OpenUnReID | SiaLoss | false | 4,678 | [
"Apache-2.0"
] | 0 | 4f399efca3d560c608fb4c9c2ed43f522b17596a | https://github.com/zwzhang121/OpenUnReID/tree/4f399efca3d560c608fb4c9c2ed43f522b17596a |
F_fully_convolutional | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
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_slo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.optim
assert_size_stride = torch._C._dynamo.g... | zimmerrol/FrEIA | F_fully_convolutional | false | 4,679 | [
"MIT"
] | 0 | 73d01ab8c90e0deb5e242d66405bd168db06dc19 | https://github.com/zimmerrol/FrEIA/tree/73d01ab8c90e0deb5e242d66405bd168db06dc19 |
C3 | import torch
import torch.nn as nn
from collections import OrderedDict
class C3(nn.Module):
def __init__(self):
super(C3, self).__init__()
self.c3 = nn.Sequential(OrderedDict([('c3', nn.Conv2d(16, 120,
kernel_size=(5, 5))), ('relu3', nn.ReLU())]))
def forward(self, img):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 co... | zjgbz/img_cls | C3 | false | 4,680 | [
"MIT"
] | 0 | 513d5ae423d95e008a82a6ffe443db49f8ed9ac2 | https://github.com/zjgbz/img_cls/tree/513d5ae423d95e008a82a6ffe443db49f8ed9ac2 |
AngleSimpleLinear | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
from torch.nn import Parameter
from torch.nn.parameter import Parameter
import torch.onnx
import torch.nn
class AngleSimpleLinear(nn.Module):
"""Computes cos of angles between input vectors and weights ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ygnn123/training_extensions | AngleSimpleLinear | false | 4,681 | [
"Apache-2.0"
] | 0 | c3aeba9359b0d4e0ef9c054de777d3ec081a9892 | https://github.com/ygnn123/training_extensions/tree/c3aeba9359b0d4e0ef9c054de777d3ec081a9892 |
TKipfGCN | import math
import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn import Parameter
class BaseModel(nn.Module):
@staticmethod
def add_args(parser):
"""Add model-specific arguments to the parser."""
pass... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zxhhh97/cogdl | TKipfGCN | false | 4,682 | [
"MIT"
] | 0 | de21c78d9bbbf0c6cafbc72ff241cda35693ec37 | https://github.com/zxhhh97/cogdl/tree/de21c78d9bbbf0c6cafbc72ff241cda35693ec37 |
FCDiscriminator_Local | import torch
import torch.nn as nn
class FCDiscriminator_Local(nn.Module):
def __init__(self, num_classes, ndf=64):
super(FCDiscriminator_Local, self).__init__()
self.conv1 = nn.Conv2d(num_classes + 2048, ndf, kernel_size=4,
stride=2, padding=1)
self.conv2 = nn.Conv2d(ndf, ndf... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | shiyutang/CLAN | FCDiscriminator_Local | false | 4,683 | [
"MIT"
] | 0 | 920bd7cb592ba79ee5058f8cd662d20eda50457e | https://github.com/shiyutang/CLAN/tree/920bd7cb592ba79ee5058f8cd662d20eda50457e |
VAE | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class VAE(nn.Module):
def __init__(self, z_dim):
super().__init__()
self.z_dim = z_dim
self.fc1 = nn.Linear(784, 500)
self.fc21 = nn.Linear(500, self.z_dim)
self.fc22 = nn.Linear(500... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | zyzisyz/torch-practice | VAE | false | 4,684 | [
"Apache-2.0"
] | 0 | 92f2b7f1a01bbabd1a2cf2a4dd9099a0eeb9cf00 | https://github.com/zyzisyz/torch-practice/tree/92f2b7f1a01bbabd1a2cf2a4dd9099a0eeb9cf00 |
Greedy | import torch
import torch.nn as nn
from matplotlib.font_manager import *
class Greedy(nn.Module):
def __init__(self):
super().__init__()
def forward(self, log_p):
return torch.argmax(log_p, dim=1).long()
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
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
from matplotlib.font_manager import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | zifeiyu0531/TSP_DRL_PtrNet | Greedy | false | 4,685 | [
"MIT"
] | 0 | c62fab73347556173d301c1561edf927e6fbe1d7 | https://github.com/zifeiyu0531/TSP_DRL_PtrNet/tree/c62fab73347556173d301c1561edf927e6fbe1d7 |
Categorical | import torch
import torch.nn as nn
from matplotlib.font_manager import *
class Categorical(nn.Module):
def __init__(self):
super().__init__()
def forward(self, log_p):
return torch.multinomial(log_p.exp(), 1).long().squeeze(1)
def get_inputs():
return [torch.rand([4, 4])]
def get_ini... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
from matplotlib.font_manager import *
assert_size_s... | zifeiyu0531/TSP_DRL_PtrNet | Categorical | false | 4,686 | [
"MIT"
] | 0 | c62fab73347556173d301c1561edf927e6fbe1d7 | https://github.com/zifeiyu0531/TSP_DRL_PtrNet/tree/c62fab73347556173d301c1561edf927e6fbe1d7 |
ScaledDotProductAttention | import math
import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, dropout_ratio=0):
super().__init__()
self.dropout = nn.Dropout(dropout_ratio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ygnn123/training_extensions | ScaledDotProductAttention | false | 4,687 | [
"Apache-2.0"
] | 0 | c3aeba9359b0d4e0ef9c054de777d3ec081a9892 | https://github.com/ygnn123/training_extensions/tree/c3aeba9359b0d4e0ef9c054de777d3ec081a9892 |
SageConv | from torch.nn import Module
import torch
import torch.nn as nn
from torch.nn.modules.module import Module
class SageConv(Module):
"""
Simple Graphsage layer
"""
def __init__(self, in_features, out_features, bias=False):
super(SageConv, self).__init__()
self.proj = nn.Linear(in_feature... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import torch.nn as nn
from torch.nn.modules.module i... | yutaoming/Rare-Category-Detection | SageConv | false | 4,688 | [
"MIT"
] | 0 | 76cf023dff44eef3ecc17f0ebf2b11a08cd63a73 | https://github.com/yutaoming/Rare-Category-Detection/tree/76cf023dff44eef3ecc17f0ebf2b11a08cd63a73 |
LogitKLDivLoss | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class LogitKLDivLoss(nn.Module):
"""Kullback–Leibler divergence loss. Inputs predicted and ground truth logits.
Args:
T (float): Softmax temperature.
"... | 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 ... | ygnn123/training_extensions | LogitKLDivLoss | false | 4,689 | [
"Apache-2.0"
] | 0 | c3aeba9359b0d4e0ef9c054de777d3ec081a9892 | https://github.com/ygnn123/training_extensions/tree/c3aeba9359b0d4e0ef9c054de777d3ec081a9892 |
TransformerEncoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn.init import xavier_uniform_
from torch.nn import Dropout
from torch.nn import LayerNorm
class MultiheadAttention(nn.Module):
"""Allows the model to jointly attend to information
from different represen... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | verages/PaddleOCR2Pytorch | TransformerEncoderLayer | false | 4,690 | [
"Apache-2.0"
] | 0 | 201f0d5d6007f49620c49af7d222c3b220eb3e70 | https://github.com/verages/PaddleOCR2Pytorch/tree/201f0d5d6007f49620c49af7d222c3b220eb3e70 |
GaussianKernel | import torch
import torch.nn as nn
class GaussianKernel(nn.Module):
"""
Gaussian kernel module.
:param mu: Float, mean of the kernel.
:param sigma: Float, sigma of the kernel.
Examples:
>>> import torch
>>> kernel = GaussianKernel()
>>> x = torch.randn(4, 5, 10)
>... | 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... | zfjsail/MatchZoo-py | GaussianKernel | false | 4,691 | [
"Apache-2.0"
] | 0 | c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 | https://github.com/zfjsail/MatchZoo-py/tree/c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 |
Pointwise | import torch
import torch.nn as nn
import torch.nn.functional as F
class Pointwise(nn.Module):
def __init__(self, Cin=4, K=1, Cout=10):
super(Pointwise, self).__init__()
self.conv1 = nn.Conv2d(Cin, Cout, kernel_size=K, bias=False,
padding=0, stride=1)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | sfu-arch/TensorBricks | Pointwise | false | 4,692 | [
"MIT"
] | 0 | c46c60d0939b7deb65f103bf34961d47419ce571 | https://github.com/sfu-arch/TensorBricks/tree/c46c60d0939b7deb65f103bf34961d47419ce571 |
GCN | from torch.nn import Module
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
def __in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | yutaoming/Rare-Category-Detection | GCN | false | 4,693 | [
"MIT"
] | 0 | 76cf023dff44eef3ecc17f0ebf2b11a08cd63a73 | https://github.com/yutaoming/Rare-Category-Detection/tree/76cf023dff44eef3ecc17f0ebf2b11a08cd63a73 |
Sage | from torch.nn import Module
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.module import Module
class SageConv(Module):
"""
Simple Graphsage layer
"""
def __init__(self, in_features, out_features, bias=False):
super(SageConv, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | yutaoming/Rare-Category-Detection | Sage | false | 4,694 | [
"MIT"
] | 0 | 76cf023dff44eef3ecc17f0ebf2b11a08cd63a73 | https://github.com/yutaoming/Rare-Category-Detection/tree/76cf023dff44eef3ecc17f0ebf2b11a08cd63a73 |
RankCrossEntropyLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class RankCrossEntropyLoss(nn.Module):
"""Creates a criterion that measures rank cross entropy loss."""
__constants__ = ['num_neg']
def __init__(self, num_neg: 'int'=1):
"""
:class:`RankCrossEntropyLoss` constructor.
... | 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
... | zfjsail/MatchZoo-py | RankCrossEntropyLoss | false | 4,695 | [
"Apache-2.0"
] | 0 | c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 | https://github.com/zfjsail/MatchZoo-py/tree/c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 |
TransformerDecoderLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn.init import xavier_uniform_
from torch.nn import Dropout
from torch.nn import LayerNorm
class MultiheadAttention(nn.Module):
"""Allows the model to jointly attend to information
from different represen... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | verages/PaddleOCR2Pytorch | TransformerDecoderLayer | false | 4,696 | [
"Apache-2.0"
] | 0 | 201f0d5d6007f49620c49af7d222c3b220eb3e70 | https://github.com/verages/PaddleOCR2Pytorch/tree/201f0d5d6007f49620c49af7d222c3b220eb3e70 |
ReLU | import torch
import torch.nn as nn
from abc import abstractmethod
import torch.utils.data
import torch.nn
class EfficientBlockBase(nn.Module):
"""
PyTorchVideo/accelerator provides a set of efficient blocks
that have optimal efficiency for each target hardware device.
Each efficient block has two for... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from abc import abstractmethod
import torch.utils.data
import torch... | zijian-hu/pytorchvideo | ReLU | false | 4,697 | [
"Apache-2.0"
] | 0 | 51589b100437af2285c56ce2ccc7ccecb7f9b18b | https://github.com/zijian-hu/pytorchvideo/tree/51589b100437af2285c56ce2ccc7ccecb7f9b18b |
Depthwise | import torch
import torch.nn as nn
import torch.nn.functional as F
class Depthwise(nn.Module):
def __init__(self, Cin=10, K=3, depth_multiplier=1):
super(Depthwise, self).__init__()
self.conv1 = nn.Conv2d(Cin, depth_multiplier * Cin, kernel_size=K,
groups=Cin, bias=False, padding=0, s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | sfu-arch/TensorBricks | Depthwise | false | 4,698 | [
"MIT"
] | 0 | c46c60d0939b7deb65f103bf34961d47419ce571 | https://github.com/sfu-arch/TensorBricks/tree/c46c60d0939b7deb65f103bf34961d47419ce571 |
LearnMaskedDefault | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn
class LearnMaskedDefault(nn.Module):
"""
Learns default values to fill invalid entries within input tensors. The
invalid entries are represented by a mask which is passed into forward alongside
the input tensor. Note the defaul... | 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.utils.data
import torch.nn
assert_size_stride = torch.... | zijian-hu/pytorchvideo | LearnMaskedDefault | false | 4,699 | [
"Apache-2.0"
] | 0 | 51589b100437af2285c56ce2ccc7ccecb7f9b18b | https://github.com/zijian-hu/pytorchvideo/tree/51589b100437af2285c56ce2ccc7ccecb7f9b18b |
MatchingTensor | import torch
import torch.nn as nn
import torch.nn.functional as F
class MatchingTensor(nn.Module):
"""
Module that captures the basic interactions between two tensors.
:param matching_dims: Word dimension of two interaction texts.
:param channels: Number of word interaction tensor channels.
:par... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zfjsail/MatchZoo-py | MatchingTensor | false | 4,700 | [
"Apache-2.0"
] | 0 | c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 | https://github.com/zfjsail/MatchZoo-py/tree/c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 |
AdaptiveAvgPool3dOutSize1 | import torch
from typing import Tuple
import torch.nn as nn
from abc import abstractmethod
import torch.utils.data
import torch.nn
class EfficientBlockBase(nn.Module):
"""
PyTorchVideo/accelerator provides a set of efficient blocks
that have optimal efficiency for each target hardware device.
Each ef... | 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 typing import Tuple
import torch.nn as nn
from abc import abstractmethod
import torch.utils.data
import torch.nn
assert_size_stride = t... | zijian-hu/pytorchvideo | AdaptiveAvgPool3dOutSize1 | false | 4,701 | [
"Apache-2.0"
] | 0 | 51589b100437af2285c56ce2ccc7ccecb7f9b18b | https://github.com/zijian-hu/pytorchvideo/tree/51589b100437af2285c56ce2ccc7ccecb7f9b18b |
Cat | import torch
import torch.nn as nn
class Cat(nn.Module):
def __init__(self):
super(Cat, self).__init__()
def forward(self, x):
addition = torch.split(x, 2, dim=1)[0]
None
x = torch.cat([x, addition], dim=1)
return x
def get_inputs():
return [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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yifanpu001/PytorchToCaffe | Cat | false | 4,702 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
MaskedTemporalPooling | import torch
from typing import Optional
import torch.utils.data
import torch.nn
class MaskedTemporalPooling(torch.nn.Module):
"""
Applies temporal pooling operations on masked inputs. For each pooling operation
all masked values are ignored.
"""
def __init__(self, method: 'str'):
"""
... | 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.utils.data
import torch.nn
assert_size_stride = torch._C._dynamo.guards.asse... | zijian-hu/pytorchvideo | MaskedTemporalPooling | false | 4,703 | [
"Apache-2.0"
] | 0 | 51589b100437af2285c56ce2ccc7ccecb7f9b18b | https://github.com/zijian-hu/pytorchvideo/tree/51589b100437af2285c56ce2ccc7ccecb7f9b18b |
Add | import torch
import torch.nn as nn
class Add(nn.Module):
def __init__(self):
super(Add, self).__init__()
def forward(self, x):
x = torch.add(x, 20)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yifanpu001/PytorchToCaffe | Add | false | 4,704 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
SemanticComposite | import torch
import torch.nn as nn
class SemanticComposite(nn.Module):
"""
SemanticComposite module.
Apply a self-attention layer and a semantic composite fuse gate to compute the
encoding result of one tensor.
:param in_features: Feature size of input.
:param dropout_rate: The 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.... | zfjsail/MatchZoo-py | SemanticComposite | false | 4,705 | [
"Apache-2.0"
] | 0 | c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 | https://github.com/zfjsail/MatchZoo-py/tree/c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 |
Pow | import torch
import torch.nn as nn
class Pow(nn.Module):
def __init__(self):
super(Pow, self).__init__()
def forward(self, x):
x = torch.pow(x, 2)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yifanpu001/PytorchToCaffe | Pow | false | 4,706 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
Div | import torch
import torch.nn as nn
class Div(nn.Module):
def __init__(self):
super(Div, self).__init__()
def forward(self, x):
x = torch.div(x, 0.5)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yifanpu001/PytorchToCaffe | Div | false | 4,707 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
MatchModule | import torch
import torch.nn as nn
import torch.nn.functional as F
class MatchModule(nn.Module):
"""
Computing the match representation for Match LSTM.
:param hidden_size: Size of hidden vectors.
:param dropout_rate: Dropout rate of the projection layer. Defaults to 0.
Examples:
>>> impo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zfjsail/MatchZoo-py | MatchModule | false | 4,708 | [
"Apache-2.0"
] | 0 | c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 | https://github.com/zfjsail/MatchZoo-py/tree/c93e52e7db7e257b46bb8bf8df8ce1ab1944e2f2 |
Net | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 10, kernel_size=3)
self.conv2 = nn.Conv2d(10, 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
from torch._inductor.runtime.... | ygnn123/training_extensions | Net | false | 4,709 | [
"Apache-2.0"
] | 0 | c3aeba9359b0d4e0ef9c054de777d3ec081a9892 | https://github.com/ygnn123/training_extensions/tree/c3aeba9359b0d4e0ef9c054de777d3ec081a9892 |
Hardtanh | import torch
import torch.nn as nn
class Hardtanh(nn.Module):
def __init__(self):
super(Hardtanh, self).__init__()
self.layer = nn.Hardtanh(-2, 2)
def forward(self, x):
x = self.layer(x)
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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | yifanpu001/PytorchToCaffe | Hardtanh | false | 4,710 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
AdaptiveMaxPool2d | import torch
import torch.nn as nn
class AdaptiveMaxPool2d(nn.Module):
def __init__(self):
super(AdaptiveMaxPool2d, self).__init__()
self.layer = nn.AdaptiveMaxPool2d((5, 7))
def forward(self, x):
x = self.layer(x)
return x
def get_inputs():
return [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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | yifanpu001/PytorchToCaffe | AdaptiveMaxPool2d | false | 4,711 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
CustomClassificationHead | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class CustomClassificationHead(nn.Module):
def __init__(self, config, input_dim, n_labels):
super().__init__()
self.config = config
self.fc1 = nn.Linear(input_dim, 4096)
self.fc2 = 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | y-kamiya/emotion-classification | CustomClassificationHead | false | 4,712 | [
"MIT"
] | 0 | 8d5b6ab4aafd60607260dc87e5360c04bf149e18 | https://github.com/y-kamiya/emotion-classification/tree/8d5b6ab4aafd60607260dc87e5360c04bf149e18 |
TransposeMultiheadAttention | import torch
import torch.nn as nn
from typing import Optional
import torch.utils.data
import torch.nn
class TransposeMultiheadAttention(nn.Module):
"""
Wrapper for nn.MultiheadAttention which first transposes the input tensor
from (batch_size, seq_len, feature_dim) to (seq_length, batch_size, feature_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.... | zijian-hu/pytorchvideo | TransposeMultiheadAttention | false | 4,713 | [
"Apache-2.0"
] | 0 | 51589b100437af2285c56ce2ccc7ccecb7f9b18b | https://github.com/zijian-hu/pytorchvideo/tree/51589b100437af2285c56ce2ccc7ccecb7f9b18b |
Interpolate | import torch
import torch.nn as nn
import torch.nn.functional as F
class Interpolate(nn.Module):
def __init__(self):
super(Interpolate, self).__init__()
def forward(self, x):
x = F.interpolate(x, scale_factor=8, mode='nearest', align_corners=None
)
return x
def get_inpu... | 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... | yifanpu001/PytorchToCaffe | Interpolate | false | 4,714 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
PReLU | import torch
import torch.nn as nn
class PReLU(nn.Module):
def __init__(self):
super(PReLU, self).__init__()
self.layer = nn.PReLU()
def forward(self, x):
x = self.layer(x)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yifanpu001/PytorchToCaffe | PReLU | false | 4,715 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
leakyrelu | import torch
import torch.nn as nn
class leakyrelu(nn.Module):
def __init__(self, layer=10, channels=32):
super(leakyrelu, self).__init__()
layers = []
for i in range(layer):
layers.append(nn.LeakyReLU(inplace=True))
self.layers = nn.Sequential(*layers)
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
@triton.jit
def triton_poi_fused_leaky_relu_0(in_ptr... | yifanpu001/PytorchToCaffe | leakyrelu | false | 4,716 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
MaxPool2d | import torch
import torch.nn as nn
class MaxPool2d(nn.Module):
def __init__(self):
super(MaxPool2d, self).__init__()
self.layer = nn.MaxPool2d(3, stride=2)
def forward(self, x):
x = self.layer(x)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_ini... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | yifanpu001/PytorchToCaffe | MaxPool2d | false | 4,717 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
PetarVGAT | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class BaseModel(nn.Module):
@staticmethod
def add_args(parser):
"""Add model-specific arguments to the parser."""
pass
@classmethod
def build_model_from_args(cls, args):
"""Build 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | zxhhh97/cogdl | PetarVGAT | false | 4,718 | [
"MIT"
] | 0 | de21c78d9bbbf0c6cafbc72ff241cda35693ec37 | https://github.com/zxhhh97/cogdl/tree/de21c78d9bbbf0c6cafbc72ff241cda35693ec37 |
ConvTranspose2d | import torch
import torch.nn as nn
class ConvTranspose2d(nn.Module):
def __init__(self):
super(ConvTranspose2d, self).__init__()
self.convtranspose2d = nn.ConvTranspose2d(16, 33, 3, stride=2)
def forward(self, x):
x = self.convtranspose2d(x)
return x
def get_inputs():
r... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | yifanpu001/PytorchToCaffe | ConvTranspose2d | false | 4,719 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
_Transition | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class _Transition(nn.Module):
def __init__(self, in_channels, args):
super(_Transition, self).__init__()
self.pool = nn.Conv2d(in_channels, in_channels, kernel_size=2,
stride=2, groups=in_channels)
d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | yifanpu001/PytorchToCaffe | _Transition | false | 4,720 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
Mul | import torch
import torch.nn as nn
class Mul(nn.Module):
def __init__(self):
super(Mul, self).__init__()
def forward(self, x):
x = torch.mul(x, 20)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yifanpu001/PytorchToCaffe | Mul | false | 4,721 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
relu | import torch
import torch.nn as nn
class relu(nn.Module):
def __init__(self, layer=10, channels=32):
super(relu, self).__init__()
layers = []
for i in range(layer):
layers.append(nn.ReLU(inplace=True))
self.layers = nn.Sequential(*layers)
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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@... | yifanpu001/PytorchToCaffe | relu | false | 4,722 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
Sub | import torch
import torch.nn as nn
class Sub(nn.Module):
def __init__(self):
super(Sub, self).__init__()
def forward(self, x):
x = torch.sub(x, 20)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | yifanpu001/PytorchToCaffe | Sub | false | 4,723 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
maxpool | import torch
import torch.nn as nn
class maxpool(nn.Module):
def __init__(self, layer=10, channels=32):
super(maxpool, self).__init__()
layers = []
for i in range(layer):
layers.append(nn.MaxPool2d(3, 1, 1))
self.layers = nn.Sequential(*layers)
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._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | yifanpu001/PytorchToCaffe | maxpool | false | 4,724 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
PositionWiseFeedForward | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
def gelu(x):
"""Implementation of the gelu activation function by Hugging Face"""
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
class PositionWiseFeedForward(nn.Module):
""" FeedForward Neural Networks ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | akakakakakaa/pytorchic-bert | PositionWiseFeedForward | false | 4,725 | [
"Apache-2.0"
] | 0 | 055d72adce9a41c322d23145840f31a94d9ffec4 | https://github.com/akakakakakaa/pytorchic-bert/tree/055d72adce9a41c322d23145840f31a94d9ffec4 |
Conv2d | import torch
import torch.nn as nn
class Conv2d(nn.Module):
def __init__(self):
super(Conv2d, self).__init__()
self.conv2d = nn.Conv2d(16, 33, kernel_size=1, padding=1, stride=2)
def forward(self, x):
x = self.conv2d(x)
return x
def get_inputs():
return [torch.rand([4, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | yifanpu001/PytorchToCaffe | Conv2d | false | 4,726 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
softmax | import torch
import torch.nn as nn
class softmax(nn.Module):
def __init__(self, layer=10, channels=32):
super(softmax, self).__init__()
layers = []
for i in range(layer):
layers.append(nn.Softmax(dim=1))
self.layers = nn.Sequential(*layers)
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._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | yifanpu001/PytorchToCaffe | softmax | false | 4,727 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
Attention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
from torch.nn import Dropout
from torch.nn import Softmax
from torch.nn import Linear
class Attention(nn.Module):
def __init__(self, config):
super(Attention, self).__init__()
self.num_attention_heads = c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | LJOVO/TranSalNet | Attention | false | 4,728 | [
"MIT"
] | 0 | a2aba83e3b8f54c47b712511bf4f515f236326ed | https://github.com/LJOVO/TranSalNet/tree/a2aba83e3b8f54c47b712511bf4f515f236326ed |
LengthPredictor | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class LengthPredictionLoss(nn.Module):
def __init__(self, max_delta=50):
super().__init__()
self.max_delta = max_delta
def forward(self, logits, 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.nn import function... | ygnn123/training_extensions | LengthPredictor | false | 4,729 | [
"Apache-2.0"
] | 0 | c3aeba9359b0d4e0ef9c054de777d3ec081a9892 | https://github.com/ygnn123/training_extensions/tree/c3aeba9359b0d4e0ef9c054de777d3ec081a9892 |
toy_yolov3 | import torch
import torch.nn as nn
import torch.nn.functional as F
class toy_yolov3(nn.Module):
def __init__(self):
super(toy_yolov3, self).__init__()
self.conv1 = nn.Conv2d(3, 128, kernel_size=3, stride=2, padding=1)
self.conv2_1 = nn.Conv2d(128, 128, kernel_size=1, stride=1, padding=0)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | yifanpu001/PytorchToCaffe | toy_yolov3 | false | 4,730 | [
"MIT"
] | 0 | 37c1ebfc3547e93b1c174721036d03c831c60e48 | https://github.com/yifanpu001/PytorchToCaffe/tree/37c1ebfc3547e93b1c174721036d03c831c60e48 |
RobertaClassificationHead | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class RobertaClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size * 2, config.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.triton_helpers import libdevice
import torch.nn as ... | Masum06/CodeXGLUE | RobertaClassificationHead | false | 4,731 | [
"CC0-1.0",
"MIT"
] | 0 | bf1ab8c8878f978bd4ef3cb5e030e52f03e92854 | https://github.com/Masum06/CodeXGLUE/tree/bf1ab8c8878f978bd4ef3cb5e030e52f03e92854 |
RobustLogisticRegression | import torch
import numpy as np
from torch import nn
from torch.utils.data import DataLoader
from torchvision import transforms
from sklearn.preprocessing import StandardScaler
from sklearn import metrics
from torch.utils.data import Dataset
def compute_auc(labels, scores, pos_label=1):
fpr, tpr, _thresholds = me... | 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 torch.utils.data import DataLoader
from torchvision import transforms
from sklearn.preprocessin... | vitskvara/shape-guided-anomaly-detection | RobustLogisticRegression | false | 4,732 | [
"MIT"
] | 0 | 6685b2e0b97968a6d0f478d2920486da107b277f | https://github.com/vitskvara/shape-guided-anomaly-detection/tree/6685b2e0b97968a6d0f478d2920486da107b277f |
RobertaClassificationHead | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.utils.checkpoint
class RobertaClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Hzfinfdu/Black-Box-Tuning | RobertaClassificationHead | false | 4,733 | [
"MIT"
] | 0 | 64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 | https://github.com/Hzfinfdu/Black-Box-Tuning/tree/64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.utils.data
import torch.nn as nn
import torch.nn
import torch as torch
import torch.sparse
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Sengxian/cogdl | BertAttention | false | 4,734 | [
"MIT"
] | 0 | b0a855feef6a883bcc0f7df421fc6092ec18abde | https://github.com/Sengxian/cogdl/tree/b0a855feef6a883bcc0f7df421fc6092ec18abde |
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... | zzz123xyz/DeepCTR-Torch | InnerProductLayer | false | 4,735 | [
"Apache-2.0"
] | 0 | d6b880cc6b3761dbef90920a28182ef6737dd665 | https://github.com/zzz123xyz/DeepCTR-Torch/tree/d6b880cc6b3761dbef90920a28182ef6737dd665 |
BertLayer | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
class BertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.num_attention_heads = config.num_attention_heads
self.attention_head_size = int(config.h... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | SamarthMM/cs769-assignments | BertLayer | false | 4,736 | [
"MIT"
] | 0 | bac2ad57c50043608276df8e0f21181ef62696c7 | https://github.com/SamarthMM/cs769-assignments/tree/bac2ad57c50043608276df8e0f21181ef62696c7 |
Gate | import torch
import torch.nn as nn
from scipy.stats import entropy as entropy
from scipy.spatial.distance import cosine as cosine
class Gate(nn.Module):
def __init__(self, hidden_size):
super(Gate, self).__init__()
self.transform = nn.Linear(hidden_size * 2, hidden_size)
nn.init.kaiming_n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 scipy.stats import entropy as entropy
from scipy.spat... | yanda-wang/AMHSC | Gate | false | 4,737 | [
"MIT"
] | 0 | 9b0a48d1f0992ca3272e7089835a946c49d5f50d | https://github.com/yanda-wang/AMHSC/tree/9b0a48d1f0992ca3272e7089835a946c49d5f50d |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
import torch.utils.checkpoint
class BertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if (config.hidden_size % config.num_attention_heads != 0 and not
hasattr(config... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Hzfinfdu/Black-Box-Tuning | BertSelfAttention | false | 4,738 | [
"MIT"
] | 0 | 64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 | https://github.com/Hzfinfdu/Black-Box-Tuning/tree/64eb5505875dc1b242c6f0a2a2f07e4000c24cb4 |
Classifier3 | import torch
import torch.nn
import torch.utils.data
import torch.nn.functional as F
import torch.nn.parallel
class Classifier3(torch.nn.Module):
def __init__(self):
super(Classifier3, self).__init__()
self.conv1 = torch.nn.Conv2d(in_channels=3, out_channels=64,
kernel_size=3, 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._inductor.runtime import triton_helpers
import torch.nn
import torch.... | yuping1624/1082NCTU-Deep-Learning | Classifier3 | false | 4,739 | [
"MIT"
] | 0 | dc83e1c8709e9610a996f02091fe626f07b3c10f | https://github.com/yuping1624/1082NCTU-Deep-Learning/tree/dc83e1c8709e9610a996f02091fe626f07b3c10f |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch._utils
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5, stride=(2, 2))
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5, stride=(2, 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 ... | zyouc518/crow | Net | false | 4,740 | [
"Apache-2.0"
] | 0 | e3fe92e329649fb82b3fef6c0ab5b732f1918900 | https://github.com/zyouc518/crow/tree/e3fe92e329649fb82b3fef6c0ab5b732f1918900 |
CrossEntropyLoss | import torch
import torch.utils.cpp_extension
class CrossEntropyLoss(torch.nn.Module):
def __init__(self):
super(CrossEntropyLoss, self).__init__()
self.ce_loss = torch.nn.CrossEntropyLoss()
def forward(self, cls_output, label, **_):
return self.ce_loss(cls_output, label).mean()
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._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.cpp... | yingnengd/MyGAN | CrossEntropyLoss | false | 4,741 | [
"MIT"
] | 0 | 6e4abbe165c8f3b1e1b69d5d01177712761a3a1c | https://github.com/yingnengd/MyGAN/tree/6e4abbe165c8f3b1e1b69d5d01177712761a3a1c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.