entry_point
stringlengths
1
65
original_triton_code
stringlengths
4.5k
619k
python_code
stringlengths
208
60.9k
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
pytorch_code
stringlengths
200
4.05k
ImgSenRanking
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.utils.data def l2norm(input, p=2.0, dim=1, eps=1e-12): """ Compute L2 norm, row-wise """ l2_inp = input / input.norm(p, dim, keepdim=True).clamp(min=eps) return l2_inp.expand_as(input) def xavier_weight(tensor): nin, nout = tensor.size()[0], tenso...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ypxie/HDGan
ImgSenRanking
false
16,770
[ "MIT" ]
160
d98e2a85f7ae6ce7bfacd1c15e519558d97cb931
https://github.com/ypxie/HDGan/tree/d98e2a85f7ae6ce7bfacd1c15e519558d97cb931
import torch import numpy as np import torch.utils.data def l2norm(input, p=2.0, dim=1, eps=1e-12): """ Compute L2 norm, row-wise """ l2_inp = input / input.norm(p, dim, keepdim=True).clamp(min=eps) return l2_inp.expand_as(input) def xavier_weight(tensor): nin, nout = tensor.size()[0], tenso...
Seedloss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F class Seedloss(nn.Module): def __init__(self, ignore_label=21): super(Seedloss, self).__init__() self.ignore_label = ignore_label self.eps = 1e-05 def my_softmax(self, score, dim=1): probs = torch.clamp(F...
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...
yaoqi-zd/SGAN
Seedloss
false
16,771
[ "MIT" ]
48
43d8a859b03967e2423a73ef1ba332ee71714ba4
https://github.com/yaoqi-zd/SGAN/tree/43d8a859b03967e2423a73ef1ba332ee71714ba4
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, ignore_label=21): super().__init__() self.ignore_label = ignore_label self.eps = 1e-05 def my_softmax(self, score, dim=1): probs = torch.clamp(F.softmax(score, d...
PrimaryCaps
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class PrimaryCaps(nn.Module): """Creates a primary convolutional capsule layer that outputs a pose matrix and an activation. Note that for computation convenience, pose matrix are stored in first part while the activations are stored in the second part. Arg...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
yl-1993/Matrix-Capsules-EM-PyTorch
PrimaryCaps
false
16,772
[ "MIT" ]
97
ca4cd7f45a4234ddf49efe9db34c9ff645378437
https://github.com/yl-1993/Matrix-Capsules-EM-PyTorch/tree/ca4cd7f45a4234ddf49efe9db34c9ff645378437
import torch import torch.nn as nn class Model(nn.Module): """Creates a primary convolutional capsule layer that outputs a pose matrix and an activation. Note that for computation convenience, pose matrix are stored in first part while the activations are stored in the second part. Args: ...
MaskedMHA
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.utils.data from torch.nn import functional as F class MaskedMHA(nn.Module): """ Multi Head Attention with mask Modified from https://github.com/karpathy/minGPT/blob/master/mingpt/model.py """ def __init__(self, n_embd, n_head, attn_pdro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
yjh0410/actionformer_release
MaskedMHA
false
16,773
[ "MIT" ]
61
7a97422111d3e29c8d2e14088c850c6975855ea7
https://github.com/yjh0410/actionformer_release/tree/7a97422111d3e29c8d2e14088c850c6975855ea7
import math import torch import torch.nn as nn import torch.utils.data from torch.nn import functional as F class Model(nn.Module): """ Multi Head Attention with mask Modified from https://github.com/karpathy/minGPT/blob/master/mingpt/model.py """ def __init__(self, n_embd, n_head, attn_pdrop=0....
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.utils.data import torch import torch.nn as nn from torch.nn import functional as F class FocalLoss(nn.Module): def __init__(self, weight=None, gamma=1.0, num_classes=80): super(FocalLoss, self).__init__() assert gamma >= 0 self.gamma = gamma ...
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 numpy as np imp...
yulonghui/yingying_boss
FocalLoss
false
16,774
[ "MIT" ]
306
f9cf956cb6507ef43f8005c61027f6b54f418224
https://github.com/yulonghui/yingying_boss/tree/f9cf956cb6507ef43f8005c61027f6b54f418224
import torch import numpy as np import torch.utils.data import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, weight=None, gamma=1.0, num_classes=80): super().__init__() assert gamma >= 0 self.gamma = gamma self.weight =...
GCT
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class GCT(nn.Module): def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False ): super(GCT, self).__init__() self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1)) self.gamma = nn.Parameter(torch.zeros(1, num_channels, 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 libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
yoxu515/CFBI
GCT
false
16,775
[ "BSD-3-Clause" ]
312
0bab1e3c9fc3e3ba0629f716d60221e8f8d9d586
https://github.com/yoxu515/CFBI/tree/0bab1e3c9fc3e3ba0629f716d60221e8f8d9d586
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False ): super().__init__() self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1)) self.gamma = nn.Parameter(torch.zeros(1, num_channels, 1, 1)) ...
MyEntLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class MyEntLoss(nn.Module): def __init__(self): super().__init__() def forward(self, x): x = torch.nn.Softmax(dim=1)(x) p = x / torch.repeat_interleave(x.sum(dim=1).unsqueeze(-1), repeats =20, dim=1) logp = torch.log2(p) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
yuantn/MI-AOD
MyEntLoss
false
16,776
[ "Apache-2.0" ]
188
e57114d60f9ce5e43839cdf7068a90ee58092ec8
https://github.com/yuantn/MI-AOD/tree/e57114d60f9ce5e43839cdf7068a90ee58092ec8
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): x = torch.nn.Softmax(dim=1)(x) p = x / torch.repeat_interleave(x.sum(dim=1).unsqueeze(-1), repeats =20, dim=1) logp = torch.log2(p) ent ...
ActorNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as func class ActorNetwork(torch.nn.Module): def __init__(self, s_space, a_space): super(ActorNetwork, self).__init__() self.first_dense = torch.nn.Linear(s_space, 50) self.second_dense = torch.nn.Linear(50, a_space) def forward(self, s): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
yutiansut/Personae
ActorNetwork
false
16,777
[ "MIT" ]
1,046
e5e89cbaaf2c4708952d25fdb25e99837aecdb4e
https://github.com/yutiansut/Personae/tree/e5e89cbaaf2c4708952d25fdb25e99837aecdb4e
import torch import torch.nn.functional as func class Model(torch.nn.Module): def __init__(self, s_space, a_space): super().__init__() self.first_dense = torch.nn.Linear(s_space, 50) self.second_dense = torch.nn.Linear(50, a_space) def forward(self, s): phi_s = func.relu(self...
CriticNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as func class CriticNetwork(torch.nn.Module): def __init__(self, s_space, a_space): super(CriticNetwork, self).__init__() self.s_dense = torch.nn.Linear(s_space, 50) self.a_dense = torch.nn.Linear(a_space, 50) self.q_dense = torch.nn.Linear(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
yutiansut/Personae
CriticNetwork
false
16,778
[ "MIT" ]
1,046
e5e89cbaaf2c4708952d25fdb25e99837aecdb4e
https://github.com/yutiansut/Personae/tree/e5e89cbaaf2c4708952d25fdb25e99837aecdb4e
import torch import torch.nn.functional as func class Model(torch.nn.Module): def __init__(self, s_space, a_space): super().__init__() self.s_dense = torch.nn.Linear(s_space, 50) self.a_dense = torch.nn.Linear(a_space, 50) self.q_dense = torch.nn.Linear(50, 1) def forward(sel...
GELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn class GELU(nn.Module): def forward(self, x): cdf = 0.5 * (1.0 + torch.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) return x * cdf 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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
yyht/Funnel_Transformer
GELU
false
16,779
[ "MIT" ]
193
4b35a794d5e122a8054471863a52d4eac1c39dcd
https://github.com/yyht/Funnel_Transformer/tree/4b35a794d5e122a8054471863a52d4eac1c39dcd
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def forward(self, x): cdf = 0.5 * (1.0 + torch.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) return x * cdf def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
DynamicPreHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class DynamicPreHead(nn.Module): def __init__(self, in_dim=3, embed_dim=100, kernel_size=1): super(DynamicPreHead, self).__init__() self.conv = nn.Conv2d(in_dim, embed_dim, kernel_size=kernel_size, stride=1, padding=int((kernel_size - 1) / 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....
yoxu515/CFBI
DynamicPreHead
false
16,780
[ "BSD-3-Clause" ]
312
0bab1e3c9fc3e3ba0629f716d60221e8f8d9d586
https://github.com/yoxu515/CFBI/tree/0bab1e3c9fc3e3ba0629f716d60221e8f8d9d586
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_dim=3, embed_dim=100, kernel_size=1): super().__init__() self.conv = nn.Conv2d(in_dim, embed_dim, kernel_size=kernel_size, stride=1, padding=int((kernel_size - 1) / 2)) self.bn = nn.GroupNorm(int(...
Dense
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn def get_einsum_string(ndims, einsum_symbols=None): if einsum_symbols is None: einsum_symbols = ['u', 'v', 'w', 'x', 'y', 'z'] assert ndims <= len(einsum_symbols) einsum_prefix = '' for i in range(ndims): einsum_prefix += einsum_symb...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
yyht/Funnel_Transformer
Dense
false
16,781
[ "MIT" ]
193
4b35a794d5e122a8054471863a52d4eac1c39dcd
https://github.com/yyht/Funnel_Transformer/tree/4b35a794d5e122a8054471863a52d4eac1c39dcd
import torch import numpy as np import torch.nn as nn def get_einsum_string(ndims, einsum_symbols=None): if einsum_symbols is None: einsum_symbols = ['u', 'v', 'w', 'x', 'y', 'z'] assert ndims <= len(einsum_symbols) einsum_prefix = '' for i in range(ndims): einsum_prefix += einsum_symb...
InteractionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torchvision.transforms.functional as F from torch import nn import torch.nn.functional as F class InteractionLayer(nn.Module): def __init__(self, d_model, d_feature, dropout=0.1): super().__init__() self.d_feature = d_feature self.det_tfm = nn.Linear(d_mode...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
yoyomimi/AS-Net
InteractionLayer
false
16,782
[ "MIT" ]
49
85ce753707c6d1838c3983111ccbba4b1861f438
https://github.com/yoyomimi/AS-Net/tree/85ce753707c6d1838c3983111ccbba4b1861f438
import math import torch import torchvision.transforms.functional as F from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, d_model, d_feature, dropout=0.1): super().__init__() self.d_feature = d_feature self.det_tfm = nn.Linear(d_model, d_featur...
Biaffine
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Biaffine(nn.Module): """ Biaffine layer for first-order scoring :cite:`dozat-etal-2017-biaffine`. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y)` of the vector pair :math:`(x, y)` is computed as :math:`x^T W ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
yzhangcs/parser
Biaffine
false
16,783
[ "MIT" ]
439
3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
https://github.com/yzhangcs/parser/tree/3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
import torch import torch.nn as nn class Model(nn.Module): """ Biaffine layer for first-order scoring :cite:`dozat-etal-2017-biaffine`. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y)` of the vector pair :math:`(x, y)` is computed as :math:`x^T W y /...
SAN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class SAN(nn.Module): def __init__(self, d_model, nhead, dropout=0.1): super(SAN, self).__init__() self.d_model = d_model self.nhead = nhead self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.dropout = nn.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 import triton_helpers from torch._inductor.runtime....
yuriy-os/russian-reviews-bert-e2e-absa
SAN
false
16,784
[ "Apache-2.0" ]
293
369a6179353e3bf28643e8e9347b624078e38bf4
https://github.com/yuriy-os/russian-reviews-bert-e2e-absa/tree/369a6179353e3bf28643e8e9347b624078e38bf4
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, d_model, nhead, dropout=0.1): super().__init__() self.d_model = d_model self.nhead = nhead self.self_attn = nn.MultiheadAttention(d_model, nhead, dropout=dropout) self.dropout = nn.Dropout(p=drop...
Triaffine
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Triaffine(nn.Module): """ Triaffine layer for second-order scoring :cite:`zhang-etal-2020-efficient,wang-etal-2019-second`. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y, z)` of the vector triple :math:`(x, y...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
yzhangcs/parser
Triaffine
false
16,785
[ "MIT" ]
439
3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
https://github.com/yzhangcs/parser/tree/3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
import torch import torch.nn as nn class Model(nn.Module): """ Triaffine layer for second-order scoring :cite:`zhang-etal-2020-efficient,wang-etal-2019-second`. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y, z)` of the vector triple :math:`(x, y, z)...
GlobalMaxPooling
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class GlobalMaxPooling(nn.Module): def __init__(self): super(GlobalMaxPooling, self).__init__() def forward(self, x): res, _ = torch.max(x, dim=1) return res def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): 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._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
zake7749/Sequence-to-Sequence-101
GlobalMaxPooling
false
16,786
[ "MIT" ]
64
f9e9a8e836dc1cb3b35d6e148f6378fcd2736951
https://github.com/zake7749/Sequence-to-Sequence-101/tree/f9e9a8e836dc1cb3b35d6e148f6378fcd2736951
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): res, _ = torch.max(x, dim=1) return res def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
PositionalEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class PositionalEmbedding(nn.Module): def __init__(self, n_model, max_len=1024): super().__init__() self.embed = nn.Embedding(max_len, n_model) self.reset_parameters() @torch.no_grad() def reset_parameters(self): w = self.embed.weight ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
yzhangcs/parser
PositionalEmbedding
false
16,787
[ "MIT" ]
439
3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
https://github.com/yzhangcs/parser/tree/3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_model, max_len=1024): super().__init__() self.embed = nn.Embedding(max_len, n_model) self.reset_parameters() @torch.no_grad() def reset_parameters(self): w = self.embed.weight max_len,...
KernelConv
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class KernelConv(nn.Module): """ the class of computing prediction """ def __init__(self, kernel_size=[5], sep_conv=False, core_bias=False): super(KernelConv, self).__init__() self.kernel_size = sorted(kernel_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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
xenbaloch/efficientderain
KernelConv
false
16,788
[ "MIT" ]
109
d5646815fd14a5a03c859102ecd2f298db7e53be
https://github.com/xenbaloch/efficientderain/tree/d5646815fd14a5a03c859102ecd2f298db7e53be
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ the class of computing prediction """ def __init__(self, kernel_size=[5], sep_conv=False, core_bias=False): super().__init__() self.kernel_size = sorted(kernel_size) self.sep_conv = ...
SinusoidPositionalEmbedding
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class SinusoidPositionalEmbedding(nn.Module): def forward(self, x): seq_len, n_model = x[0].shape pos = x.new_tensor(range(seq_len)).unsqueeze(-1) / 10000 ** (x. new_tensor(range(n_model)) // 2 * 2 / n_model) pos[:, 0::2], pos[:, 1::2] = pos[...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
yzhangcs/parser
SinusoidPositionalEmbedding
false
16,789
[ "MIT" ]
439
3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
https://github.com/yzhangcs/parser/tree/3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
import torch import torch.nn as nn class Model(nn.Module): def forward(self, x): seq_len, n_model = x[0].shape pos = x.new_tensor(range(seq_len)).unsqueeze(-1) / 10000 ** (x. new_tensor(range(n_model)) // 2 * 2 / n_model) pos[:, 0::2], pos[:, 1::2] = pos[:, 0::2].sin(), pos[:,...
OfflineTripletLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch import nn class OfflineTripletLoss(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a negative sample """ def __init__(self, margin=0.1): super(OfflineTripletLoss, self).__init__() self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
zhangxinyu-tj/PAST
OfflineTripletLoss
false
16,790
[ "MIT" ]
112
67f1f7a780e869aa7867167538edb03faa96dec5
https://github.com/zhangxinyu-tj/PAST/tree/67f1f7a780e869aa7867167538edb03faa96dec5
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): """ Triplet loss Takes embeddings of an anchor sample, a positive sample and a negative sample """ def __init__(self, margin=0.1): super().__init__() self.margin = margin def forward(sel...
SinusoidRelativePositionalEmbedding
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class SinusoidRelativePositionalEmbedding(nn.Module): def forward(self, x): seq_len, n_model = x[0].shape pos = x.new_tensor(range(seq_len)) pos = (pos - pos.unsqueeze(-1)).unsqueeze(-1) / 10000 ** (x. new_tensor(range(n_model)) // 2 * 2 / n_...
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...
yzhangcs/parser
SinusoidRelativePositionalEmbedding
false
16,791
[ "MIT" ]
439
3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
https://github.com/yzhangcs/parser/tree/3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
import torch import torch.nn as nn class Model(nn.Module): def forward(self, x): seq_len, n_model = x[0].shape pos = x.new_tensor(range(seq_len)) pos = (pos - pos.unsqueeze(-1)).unsqueeze(-1) / 10000 ** (x. new_tensor(range(n_model)) // 2 * 2 / n_model) pos[..., 0::2],...
SoftCrossEntropy
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F class SoftCrossEntropy(nn.Module): def __init__(self): super().__init__() def forward(self, inputs, target): log_likelihood = -F.log_softmax(inputs, dim=1) sample_num, _class_num = target.shape loss = torch.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._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
zake7749/WSDM-Cup-2019
SoftCrossEntropy
false
16,792
[ "Apache-2.0" ]
64
5e9c9ae4197a5dedf6dbccc712bb2bbaae99edee
https://github.com/zake7749/WSDM-Cup-2019/tree/5e9c9ae4197a5dedf6dbccc712bb2bbaae99edee
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, inputs, target): log_likelihood = -F.log_softmax(inputs, dim=1) sample_num, _class_num = target.shape loss = torch.sum(torch.mul(...
Quantization
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class Quant(torch.autograd.Function): @staticmethod def forward(ctx, input): input = torch.clamp(input, 0, 1) output = (input * 255.0).round() / 255.0 return output @staticmethod def backward(ctx, grad_output): return grad_output c...
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...
yzxing87/Invertible-ISP
Quantization
false
16,793
[ "MIT" ]
246
344dd333dd2a075f6a9e4ffc445dc387ca3014c4
https://github.com/yzxing87/Invertible-ISP/tree/344dd333dd2a075f6a9e4ffc445dc387ca3014c4
import torch import torch.nn as nn class Quant(torch.autograd.Function): @staticmethod def forward(ctx, input): input = torch.clamp(input, 0, 1) output = (input * 255.0).round() / 255.0 return output @staticmethod def backward(ctx, grad_output): return grad_output c...
SoftMarginTriplet
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss class SoftMarginTriplet(_Loss): __constants__ = ['reduction'] """ inputs `x1`, `x2`, two 1D mini-batch `Tensor`s, and a label 1D mini-batch tensor `y` with values (`1` or `-1`). If `y == 1` then it assumed the fi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.guards.asse...
zhangxinyu-tj/PAST
SoftMarginTriplet
false
16,794
[ "MIT" ]
112
67f1f7a780e869aa7867167538edb03faa96dec5
https://github.com/zhangxinyu-tj/PAST/tree/67f1f7a780e869aa7867167538edb03faa96dec5
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss class Model(_Loss): __constants__ = ['reduction'] """ inputs `x1`, `x2`, two 1D mini-batch `Tensor`s, and a label 1D mini-batch tensor `y` with values (`1` or `-1`). If `y == 1` then it assumed the first input sh...
BCELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def bce_loss(pred, target, use_sigmoid=True): """Quality Focal Loss (QFL) is from `Generalized Focal Loss: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
zhangzhengde0225/SwinTrack
BCELoss
false
16,795
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def bce_loss(pred, target, use_sigmoid=True): """Quality Focal Loss (QFL) is from `Generalized Focal Loss: ...
DotAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F class DotAttention(nn.Module): def __init__(self, hidden_size): super(DotAttention, self).__init__() self.hidden_size = hidden_size self.attn_vector = nn.Parameter(torch.Tensor(1, 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....
zake7749/DeepToxic
DotAttention
false
16,796
[ "MIT" ]
206
92710446c55fe60526099f808a7e1179402e199f
https://github.com/zake7749/DeepToxic/tree/92710446c55fe60526099f808a7e1179402e199f
import torch import torch.nn as nn import torch.nn.init as init import torch.nn.functional as F class Model(nn.Module): def __init__(self, hidden_size): super().__init__() self.hidden_size = hidden_size self.attn_vector = nn.Parameter(torch.Tensor(1, hidden_size), requires_gra...
IoULoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def fp16_clamp(x, min=None, max=None): if not x.is_cuda and x.dtype == torch.float16: return x.float().clamp(min, max).half() 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.distribut...
zhangzhengde0225/SwinTrack
IoULoss
false
16,797
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def fp16_clamp(x, min=None, max=None): if not x.is_cuda and x.dtype == torch.float16: return x.float().clamp(min, max).half() r...
DIoULoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def diou(pred, target, eps=1e-07): lt = torch.max(pred[:, :2], target[:, :2]) rb = torch.min(pred[:, 2:], target[:, 2:]) wh = (rb -...
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.distributed import torch import torch.nn as nn import torch.nn.functional im...
zhangzhengde0225/SwinTrack
DIoULoss
false
16,798
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def diou(pred, target, eps=1e-07): lt = torch.max(pred[:, :2], target[:, :2]) rb = torch.min(pred[:, 2:], target[:, 2:]) wh = (rb -...
VarifocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def varifocal_loss(pred, target, alpha=0.75, gamma=2.0, iou_weighted=True, use_sigmoid=True): """`Varif...
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...
zhangzhengde0225/SwinTrack
VarifocalLoss
false
16,799
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def varifocal_loss(pred, target, alpha=0.75, gamma=2.0, iou_weighted=True, use_sigmoid=True): """`Varif...
CXLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data class CXLoss(nn.Module): def __init__(self, sigma=0.1, b=1.0, similarity='consine'): super(CXLoss, self).__init__() self.similarity = similarity self.sigma = sigma 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....
yizhiwang96/deepvecfont
CXLoss
false
16,800
[ "MIT" ]
68
3ba4adb0406f16a6f387c5e12dd12286c9c341e8
https://github.com/yizhiwang96/deepvecfont/tree/3ba4adb0406f16a6f387c5e12dd12286c9c341e8
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data class Model(nn.Module): def __init__(self, sigma=0.1, b=1.0, similarity='consine'): super().__init__() self.similarity = similarity self.sigma = sigma self.b = b ...
MaskedMHCA
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.utils.data from torch.nn import functional as F class LayerNorm(nn.Module): """ LayerNorm that supports inputs of size B, C, T """ def __init__(self, num_channels, eps=1e-05, affine=True, device=None, dtype=None): super().__i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
yjh0410/actionformer_release
MaskedMHCA
false
16,801
[ "MIT" ]
61
7a97422111d3e29c8d2e14088c850c6975855ea7
https://github.com/yjh0410/actionformer_release/tree/7a97422111d3e29c8d2e14088c850c6975855ea7
import math import torch import torch.nn as nn import torch.utils.data from torch.nn import functional as F class LayerNorm(nn.Module): """ LayerNorm that supports inputs of size B, C, T """ def __init__(self, num_channels, eps=1e-05, affine=True, device=None, dtype=None): super().__i...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch 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__() self.lin = weight_norm(nn.Linear(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....
zaynmi/semantic-equivalent-da-for-vqa
Attention
false
16,802
[ "MIT" ]
298
f121fb3e8fee8af5f1935a7526f19e0d884bd95b
https://github.com/zaynmi/semantic-equivalent-da-for-vqa/tree/f121fb3e8fee8af5f1935a7526f19e0d884bd95b
import torch import torch.utils.data import torch 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().__init__() self.lin = weight_norm(nn.Linear(in_size, out_s...
EltwiseProdScoring
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class EltwiseProdScoring(nn.Module): """ Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring """ def __init__(self, h_dim, a_dim, dot_dim=256): """Initialize layer.""" super(EltwiseProdScoring,...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
zhangybzbo/speaker_follower
EltwiseProdScoring
false
16,803
[ "BSD-2-Clause", "MIT" ]
117
e4d109ee26b2f57066adc9720443abf842ee9a9d
https://github.com/zhangybzbo/speaker_follower/tree/e4d109ee26b2f57066adc9720443abf842ee9a9d
import torch import torch.nn as nn class Model(nn.Module): """ Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring """ def __init__(self, h_dim, a_dim, dot_dim=256): """Initialize layer.""" super().__init__() self.linear...
RelativePositionalEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class RelativePositionalEmbedding(nn.Module): def __init__(self, n_model, max_len=1024): super().__init__() self.embed = nn.Embedding(max_len, n_model) self.reset_parameters() @torch.no_grad() def reset_parameters(self): w = self.embed.w...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
yzhangcs/parser
RelativePositionalEmbedding
false
16,804
[ "MIT" ]
439
3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
https://github.com/yzhangcs/parser/tree/3abebde1c9fe0bf2e99adce845aaf2a04b194f8a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_model, max_len=1024): super().__init__() self.embed = nn.Embedding(max_len, n_model) self.reset_parameters() @torch.no_grad() def reset_parameters(self): w = self.embed.weight max_len,...
Classifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch 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) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
zaynmi/semantic-equivalent-da-for-vqa
Classifier
false
16,805
[ "MIT" ]
298
f121fb3e8fee8af5f1935a7526f19e0d884bd95b
https://github.com/zaynmi/semantic-equivalent-da-for-vqa/tree/f121fb3e8fee8af5f1935a7526f19e0d884bd95b
import torch import torch.utils.data import torch 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().__init__() self.lin = weight_norm(nn.Linear(in_size, out_size), dim=None) self.dro...
GumbelSigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class GumbelSigmoid(nn.Module): def __init__(self, max_T, decay_alpha): super(GumbelSigmoid, self).__init__() self.max_T = max_T self.decay_alpha = decay_alpha self.softmax = nn.Softmax(dim=1) self.p_value = 1e-08 self.register_bu...
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...
zdaxie/SpatiallyAdaptiveInference-Detection
GumbelSigmoid
false
16,806
[ "Apache-2.0" ]
55
323801deac6f0641d00ecb23f6885df8483cc447
https://github.com/zdaxie/SpatiallyAdaptiveInference-Detection/tree/323801deac6f0641d00ecb23f6885df8483cc447
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, max_T, decay_alpha): super().__init__() self.max_T = max_T self.decay_alpha = decay_alpha self.softmax = nn.Softmax(dim=1) self.p_value = 1e-08 self.register_buffer('cur_T', torch.tensor(...
AdaptiveInstanceNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch import torch.nn as nn import torch.sparse class AdaptiveInstanceNorm(nn.Module): def __init__(self, in_channel, style_dim): super().__init__() self.norm = nn.InstanceNorm2d(in_channel) self.linear = nn.Linear(style_dim, in_channel * 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.triton_helpers import libdevice import torch.utils....
zhengqili/Crowdsampling-the-Plenoptic-Function
AdaptiveInstanceNorm
false
16,807
[ "MIT" ]
70
3164e9f9574d597690f83dfdfb34cc470d2dcb88
https://github.com/zhengqili/Crowdsampling-the-Plenoptic-Function/tree/3164e9f9574d597690f83dfdfb34cc470d2dcb88
import torch import torch.utils.data import torch import torch.nn as nn import torch.sparse class Model(nn.Module): def __init__(self, in_channel, style_dim): super().__init__() self.norm = nn.InstanceNorm2d(in_channel) self.linear = nn.Linear(style_dim, in_channel * 2) self.linea...
CIoULoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def ciou(pred, target, eps=1e-07): lt = torch.max(pred[:, :2], target[:, :2]) rb = torch.min(pred[:, 2:], target[:, 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 math import torch.dis...
zhangzhengde0225/SwinTrack
CIoULoss
false
16,808
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import math import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def ciou(pred, target, eps=1e-07): lt = torch.max(pred[:, :2], target[:, :2]) rb = torch.min(pred[:, 2:], target[:, 2:]) ...
LWS
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class LWS(nn.Module): def __init__(self, num_features, num_classes, bias=True): super(LWS, self).__init__() self.fc = nn.Linear(num_features, num_classes, bias=bias) self.scales = nn.Parameter(torch.ones(num_classes)) for param_name, param in 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
zhangyongshun/BagofTricks-LT
LWS
false
16,809
[ "MIT" ]
115
aec4d9a552236c32231374b7b00fa5bf4208dae3
https://github.com/zhangyongshun/BagofTricks-LT/tree/aec4d9a552236c32231374b7b00fa5bf4208dae3
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_features, num_classes, bias=True): super().__init__() self.fc = nn.Linear(num_features, num_classes, bias=bias) self.scales = nn.Parameter(torch.ones(num_classes)) for param_name, param in self.fc.na...
RNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.autograd import Variable class RNN(nn.Module): def __init__(self, input_size, hidden_size, output_size): super(RNN, self).__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(input_size + hidden_size, hidden_size) self.i2o = ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.autograd import Variable assert_size_stride = t...
zhiyongc/Graph_Convolutional_LSTM
RNN
false
16,810
[ "MIT" ]
281
a703b63e626b1e2563fe3f45d9714e468b1d4a0e
https://github.com/zhiyongc/Graph_Convolutional_LSTM/tree/a703b63e626b1e2563fe3f45d9714e468b1d4a0e
import torch import torch.nn as nn from torch.autograd import Variable class Model(nn.Module): def __init__(self, input_size, hidden_size, output_size): super().__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(input_size + hidden_size, hidden_size) self.i2o = nn.Line...
CosineClassifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn import torch.nn.functional as F def cosine_fully_connected_layer(x_in, weight, scale=None, bias=None, normalize_x=True, normalize_w=True): assert x_in.dim() == 2 assert weight.dim() == 2 assert x_in.size(1) == weight.size(0) if normalize_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....
zheang01/FACT
CosineClassifier
false
16,811
[ "MIT" ]
65
a877cc86acc4d29fb7589c8ac571c8aef09e5fd8
https://github.com/zheang01/FACT/tree/a877cc86acc4d29fb7589c8ac571c8aef09e5fd8
import torch import numpy as np from torch import nn import torch.nn.functional as F def cosine_fully_connected_layer(x_in, weight, scale=None, bias=None, normalize_x=True, normalize_w=True): assert x_in.dim() == 2 assert weight.dim() == 2 assert x_in.size(1) == weight.size(0) if normalize_x: ...
GIoULoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def fp16_clamp(x, min=None, max=None): if not x.is_cuda and x.dtype == torch.float16: return x.float().clamp(min, max).half() 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 import torch.distributed import torch import torch.nn as nn import torch.nn.functional im...
zhangzhengde0225/SwinTrack
GIoULoss
false
16,812
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def fp16_clamp(x, min=None, max=None): if not x.is_cuda and x.dtype == torch.float16: return x.float().clamp(min, max).half() r...
BoundedIoULoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def bounded_iou_loss(pred, target, beta=0.2, eps=0.001): """BIoULoss. This is an implementation of paper `Improving Object Localiz...
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.distribut...
zhangzhengde0225/SwinTrack
BoundedIoULoss
false
16,813
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler def bounded_iou_loss(pred, target, beta=0.2, eps=0.001): """BIoULoss. This is an implementation of paper `Improving Object Localiz...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F from queue import * from math import * class Attention(nn.Module): def __init__(self, hidden_size): super(Attention, self).__init__() self.attn = nn.Linear(hidden_size * 2, hidden_size) self.v = nn.Parameter(to...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
zhongerqiandan/OpenDialog
Attention
false
16,814
[ "MIT" ]
98
f478b2a912c8c742da5ced510ac40da59217ddb3
https://github.com/zhongerqiandan/OpenDialog/tree/f478b2a912c8c742da5ced510ac40da59217ddb3
import math import torch import torch.nn as nn import torch.nn.functional as F from queue import * from math import * class Model(nn.Module): def __init__(self, hidden_size): super().__init__() self.attn = nn.Linear(hidden_size * 2, hidden_size) self.v = nn.Parameter(torch.randn(hidden_si...
segmentation_layer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class segmentation_layer(nn.Module): def __init__(self, args): super(segmentation_layer, self).__init__() self.segm_layer = nn.Conv2d(32, args.snumclass, kernel_size=1) def forward(self, featMap): segm =...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
zhenpeiyang/RelativePose
segmentation_layer
false
16,815
[ "BSD-3-Clause" ]
144
2e9fdf5003c5952cf610f8c6d891519b9e9e014b
https://github.com/zhenpeiyang/RelativePose/tree/2e9fdf5003c5952cf610f8c6d891519b9e9e014b
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class Model(nn.Module): def __init__(self, args): super().__init__() self.segm_layer = nn.Conv2d(32, args.snumclass, kernel_size=1) def forward(self, featMap): segm = self.segm_layer(featMap) ret...
MyUpsample2
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class MyUpsample2(nn.Module): def forward(self, x): return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x .size(0), x.size(1), x.size(2) * 2, x.size(3) * 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.nn.parallel import torch.optim import torch.utils.data.distributed assert_size_stride = torch._C._dynamo....
zigonk/ReSC
MyUpsample2
false
16,816
[ "MIT" ]
57
c816365b0410f521974060ef0cc6eaa1dd09b63a
https://github.com/zigonk/ReSC/tree/c816365b0410f521974060ef0cc6eaa1dd09b63a
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): def forward(self, x): return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x .size(0), x.size(1), x.size(2) * 2, x.size(3) * 2) def get...
BCEFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class BCEFocalLoss(torch.nn.Module): """ 二分类的Focalloss alpha 固定 """ def __init__(self, gamma=2, alpha=0.25, reduction='sum', loss_weight=1.0): super().__init__() self.gamma = gamma self.alpha = alpha self.reduction = reduction self.loss_weight = loss_w...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
zhiqi-li/Panoptic-SegFormer
BCEFocalLoss
false
16,817
[ "Apache-2.0" ]
97
cdb9b68059e9ef825a3f7079c37aa835b1711227
https://github.com/zhiqi-li/Panoptic-SegFormer/tree/cdb9b68059e9ef825a3f7079c37aa835b1711227
import torch class Model(torch.nn.Module): """ 二分类的Focalloss alpha 固定 """ def __init__(self, gamma=2, alpha=0.25, reduction='sum', loss_weight=1.0): super().__init__() self.gamma = gamma self.alpha = alpha self.reduction = reduction self.loss_weight = loss_weight ...
LAM_Gconv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class LAM_Gconv(nn.Module): def __init__(self, in_features, out_features, activation=nn.ReLU( inplace=True)): super(LAM_Gconv, self).__init__() self.fc = nn.Linear(in_features=in_features, out_features=out_features) self.activation = 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....
zhaoweixi/GraFormer
LAM_Gconv
false
16,818
[ "BSD-2-Clause" ]
384
0a0a04014cdf157c11ab8e952862efa27c6a1980
https://github.com/zhaoweixi/GraFormer/tree/0a0a04014cdf157c11ab8e952862efa27c6a1980
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_features, out_features, activation=nn.ReLU( inplace=True)): super().__init__() self.fc = nn.Linear(in_features=in_features, out_features=out_features) self.activation = activation def laplacian(s...
IRHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from queue import * from math import * class IRHead(nn.Module): def __init__(self, hidden_size, dropout=0.5): super(IRHead, self).__init__() self.M = nn.Parameter(torch.randn(hidden_size, hidden_size)) self.hidden_layer = nn.Linear(hidden_size * 2 + 1, 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.triton_helpers import libdevice import torch.nn as ...
zhongerqiandan/OpenDialog
IRHead
false
16,819
[ "MIT" ]
98
f478b2a912c8c742da5ced510ac40da59217ddb3
https://github.com/zhongerqiandan/OpenDialog/tree/f478b2a912c8c742da5ced510ac40da59217ddb3
import torch import torch.nn as nn from queue import * from math import * class Model(nn.Module): def __init__(self, hidden_size, dropout=0.5): super().__init__() self.M = nn.Parameter(torch.randn(hidden_size, hidden_size)) self.hidden_layer = nn.Linear(hidden_size * 2 + 1, hidden_size) ...
DenseBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaiming_normal_(m.weight, a=0, mode='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 import torch.nn as nn import torch.nn.init as init assert_size_stride = torch._C...
yzxing87/Invertible-ISP
DenseBlock
false
16,820
[ "MIT" ]
246
344dd333dd2a075f6a9e4ffc445dc387ca3014c4
https://github.com/yzxing87/Invertible-ISP/tree/344dd333dd2a075f6a9e4ffc445dc387ca3014c4
import torch import torch.nn as nn import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaiming_normal_(m.weight, a=0, mode='f...
LSTM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn from torch.autograd import Variable class LSTM(nn.Module): def __init__(self, input_size, cell_size, hidden_size): """ cell_size is the size of cell_state. hidden_size is the size of hidden_state, or say the output_state o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
zhiyongc/Graph_Convolutional_LSTM
LSTM
false
16,821
[ "MIT" ]
281
a703b63e626b1e2563fe3f45d9714e468b1d4a0e
https://github.com/zhiyongc/Graph_Convolutional_LSTM/tree/a703b63e626b1e2563fe3f45d9714e468b1d4a0e
import torch import torch.nn.functional as F import torch.nn as nn from torch.autograd import Variable class Model(nn.Module): def __init__(self, input_size, cell_size, hidden_size): """ cell_size is the size of cell_state. hidden_size is the size of hidden_state, or say the output_state ...
BG_loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data.distributed class BG_loss(nn.Module): def __init__(self): super(BG_loss, self).__init__() self.loss = nn.L1Loss() def forward(self, real_imgs, fake_imgs, masks): real_imgs_ = real_imgs.clone() fake_imgs_ = fake_imgs.c...
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 ...
ziqi-jin/OpenUnReID
BG_loss
false
16,822
[ "Apache-2.0" ]
344
50eb516945c418398cac890029d1b366c27c0185
https://github.com/ziqi-jin/OpenUnReID/tree/50eb516945c418398cac890029d1b366c27c0185
import torch import torch.nn as nn import torch.utils.data.distributed class Model(nn.Module): def __init__(self): super().__init__() self.loss = nn.L1Loss() def forward(self, real_imgs, fake_imgs, masks): real_imgs_ = real_imgs.clone() fake_imgs_ = fake_imgs.clone() ...
SmoothSoftmax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from torch import nn class SmoothSoftmax(nn.Module): def forward(self, x: 'Tensor'): logistic_value = torch.sigmoid(x) return logistic_value / logistic_value.sum(dim=-1, keepdim=True) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
zsl24/voice-activity-detection
SmoothSoftmax
false
16,823
[ "MIT" ]
74
a034be23c6283121c6b72e778c6ff6711045cbe3
https://github.com/zsl24/voice-activity-detection/tree/a034be23c6283121c6b72e778c6ff6711045cbe3
import torch from torch import Tensor from torch import nn class Model(nn.Module): def forward(self, x: 'Tensor'): logistic_value = torch.sigmoid(x) return logistic_value / logistic_value.sum(dim=-1, keepdim=True) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
Quaternion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class Quaternion(nn.Module): def __init__(self): super(Quaternion, self).__init__() def forward(self, rvec): theta = torch.sqrt(1e-05 + torch.sum(rvec ** 2, dim=1)) rvec = rvec / theta[:, None] return torch.stack((1.0...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dy...
zhuhao-nju/mofanerf
Quaternion
false
16,824
[ "MIT" ]
55
0206526e25aab3dd8f0cc789f290c7559642676b
https://github.com/zhuhao-nju/mofanerf/tree/0206526e25aab3dd8f0cc789f290c7559642676b
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, rvec): theta = torch.sqrt(1e-05 + torch.sum(rvec ** 2, dim=1)) rvec = rvec / theta[:, None] return torch.stack((1.0 - 2.0 * rvec[:, 1] *...
Rodrigues
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class Rodrigues(nn.Module): def __init__(self): super(Rodrigues, self).__init__() def forward(self, rvec): theta = torch.sqrt(1e-05 + torch.sum(rvec ** 2, dim=1)) rvec = rvec / theta[:, None] costh = torch.cos(theta) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.utils.data assert_size_stri...
zhuhao-nju/mofanerf
Rodrigues
false
16,825
[ "MIT" ]
55
0206526e25aab3dd8f0cc789f290c7559642676b
https://github.com/zhuhao-nju/mofanerf/tree/0206526e25aab3dd8f0cc789f290c7559642676b
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, rvec): theta = torch.sqrt(1e-05 + torch.sum(rvec ** 2, dim=1)) rvec = rvec / theta[:, None] costh = torch.cos(theta) sinth = tor...
ChebConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import init class ChebConv(nn.Module): """ The ChebNet convolution operation. :param in_c: int, number of input channels. :param out_c: int, number of output channels. :param K: int, the order of Chebyshev Polynomial. """ 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.triton_helpers import libdevice import torch.nn as ...
zhaoweixi/GraFormer
ChebConv
false
16,826
[ "BSD-2-Clause" ]
384
0a0a04014cdf157c11ab8e952862efa27c6a1980
https://github.com/zhaoweixi/GraFormer/tree/0a0a04014cdf157c11ab8e952862efa27c6a1980
import torch import torch.nn as nn from torch.nn import init class Model(nn.Module): """ The ChebNet convolution operation. :param in_c: int, number of input channels. :param out_c: int, number of output channels. :param K: int, the order of Chebyshev Polynomial. """ def __init__(self, i...
Attention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from torch import nn class Attention(nn.Module): def forward(self, selected_input: 'Tensor', attention: 'Tensor'): attended_input = selected_input * attention.unsqueeze(-1) return attended_input def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch....
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...
zsl24/voice-activity-detection
Attention
false
16,827
[ "MIT" ]
74
a034be23c6283121c6b72e778c6ff6711045cbe3
https://github.com/zsl24/voice-activity-detection/tree/a034be23c6283121c6b72e778c6ff6711045cbe3
import torch from torch import Tensor from torch import nn class Model(nn.Module): def forward(self, selected_input: 'Tensor', attention: 'Tensor'): attended_input = selected_input * attention.unsqueeze(-1) return attended_input def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand...
RerangeLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn as nn class RerangeLayer(nn.Module): def __init__(self): super(RerangeLayer, self).__init__() def forward(self, inp): return (inp + 1.0) / 2.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
zvict/HyperRIM
RerangeLayer
false
16,828
[ "Apache-2.0" ]
92
f3800196b59ea0f94561efa88ec2e6675e4c8b00
https://github.com/zvict/HyperRIM/tree/f3800196b59ea0f94561efa88ec2e6675e4c8b00
import torch import torch.utils.data import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, inp): return (inp + 1.0) / 2.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, focusing_param=2, balance_param=0.25): super(FocalLoss, self).__init__() self.focusing_param = focusing_param self.balance_param = balance_param def forward(self, output,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
zwx8981/DBCNN-Pytorch
FocalLoss
false
16,829
[ "MIT" ]
150
16c3156054a30a3eabb45dffcf538f42452a14f3
https://github.com/zwx8981/DBCNN-Pytorch/tree/16c3156054a30a3eabb45dffcf538f42452a14f3
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, focusing_param=2, balance_param=0.25): super().__init__() self.focusing_param = focusing_param self.balance_param = balance_param def forward(self, output, target): c...
cross_entropy_prob
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class cross_entropy_prob(nn.Module): def __init__(self): super(cross_entropy_prob, self).__init__() def forward(self, pred, soft_targets): pred = F.log_softmax(pred) loss = torch.mean(torch.sum(-soft_targets * pred, 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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
zwx8981/DBCNN-Pytorch
cross_entropy_prob
false
16,830
[ "MIT" ]
150
16c3156054a30a3eabb45dffcf538f42452a14f3
https://github.com/zwx8981/DBCNN-Pytorch/tree/16c3156054a30a3eabb45dffcf538f42452a14f3
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, pred, soft_targets): pred = F.log_softmax(pred) loss = torch.mean(torch.sum(-soft_targets * pred, 1)) return loss def get_inpu...
SelfAttentionBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler class Mlp(nn.Module): """ Multilayer perceptron.""" def __init__(self, in_features, hidden_features=None, out_features=None, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
zhangzhengde0225/SwinTrack
SelfAttentionBlock
false
16,831
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler class Mlp(nn.Module): """ Multilayer perceptron.""" def __init__(self, in_features, hidden_features=None, out_features=None, a...
A2Block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class A2Block(nn.Module): """ Implementation of A2Block(NIPS 2018) """ def __init__(self, inplane, plane): super(A2Block, self).__init__() self.down = nn.Conv2d(inplane, plane, 1) self.up = nn.Conv2d(plane, inplane, 1) self.gather...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
zj1008/GALD-DGCNet
A2Block
false
16,832
[ "MIT" ]
127
be7ebfe2b3d28ea28a2b4714852999d4af2a785e
https://github.com/zj1008/GALD-DGCNet/tree/be7ebfe2b3d28ea28a2b4714852999d4af2a785e
import torch import torch.nn as nn class Model(nn.Module): """ Implementation of A2Block(NIPS 2018) """ def __init__(self, inplane, plane): super().__init__() self.down = nn.Conv2d(inplane, plane, 1) self.up = nn.Conv2d(plane, inplane, 1) self.gather_down = nn.Conv...
BoundedSingleVar
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class BoundedSingleVar(torch.nn.Module): """Wrapper a single parameter to represent an unknown coefficient in inverse problem with the upper and lower bound. :param lower_bound: The lower bound for the parameter. :type lower_bound: float :param upper_bound: The upper bound for the parame...
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...
zweien/idrlnet
BoundedSingleVar
false
16,833
[ "Apache-2.0" ]
66
3a19a3301d565c0906aac84ff31eefcff75726a8
https://github.com/zweien/idrlnet/tree/3a19a3301d565c0906aac84ff31eefcff75726a8
import torch class Model(torch.nn.Module): """Wrapper a single parameter to represent an unknown coefficient in inverse problem with the upper and lower bound. :param lower_bound: The lower bound for the parameter. :type lower_bound: float :param upper_bound: The upper bound for the parameter. :t...
FcCat
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class FcCat(nn.Module): def __init__(self, nIn, nOut): super(FcCat, self).__init__() self.fc = nn.Linear(nIn, nOut, bias=False) def forward(self, x): out = torch.cat((x, self.fc(x)), 1) return out def get_inputs(): return [torch.rand([...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
zwh930712/densenet.pytorch
FcCat
false
16,834
[ "Apache-2.0" ]
826
d1cd5e1957975628286e516512c6d1c14430f810
https://github.com/zwh930712/densenet.pytorch/tree/d1cd5e1957975628286e516512c6d1c14430f810
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, nIn, nOut): super().__init__() self.fc = nn.Linear(nIn, nOut, bias=False) def forward(self, x): out = torch.cat((x, self.fc(x)), 1) return out def get_inputs(): return [torch.rand([4, 4, 4, 4]...
CrossAttentionBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler class Mlp(nn.Module): """ Multilayer perceptron.""" def __init__(self, in_features, hidden_features=None, out_features=None, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
zhangzhengde0225/SwinTrack
CrossAttentionBlock
false
16,835
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler class Mlp(nn.Module): """ Multilayer perceptron.""" def __init__(self, in_features, hidden_features=None, out_features=None, a...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class FcCat(nn.Module): def __init__(self, nIn, nOut): super(FcCat, self).__init__() self.fc = nn.Linear(nIn, nOut, bias=False) def forward(self, x): out = torch.cat((x, self.fc(x)), 1) return out class Net(nn.Module): def __init__(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
zwh930712/densenet.pytorch
Net
false
16,836
[ "Apache-2.0" ]
826
d1cd5e1957975628286e516512c6d1c14430f810
https://github.com/zwh930712/densenet.pytorch/tree/d1cd5e1957975628286e516512c6d1c14430f810
import torch import torch.nn as nn class FcCat(nn.Module): def __init__(self, nIn, nOut): super().__init__() self.fc = nn.Linear(nIn, nOut, bias=False) def forward(self, x): out = torch.cat((x, self.fc(x)), 1) return out class Model(nn.Module): def __init__(self, nFeat...
SpatialSoftmaxBZ
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn.functional as F class SpatialSoftmaxBZ(torch.nn.Module): """ IMPORTANT: i in [0, 1], where 0 is at the bottom, 1 is at the top j in [-1, 1] """ def __init__(self, height, width): super().__init__() self.height = height 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 math as tl_math import numpy as np ass...
zwc662/SequentialAttack
SpatialSoftmaxBZ
false
16,837
[ "MIT" ]
116
677b19c51ea76d794939ee126fccd75ffa0e6fe6
https://github.com/zwc662/SequentialAttack/tree/677b19c51ea76d794939ee126fccd75ffa0e6fe6
import torch import numpy as np import torch.nn.functional as F class Model(torch.nn.Module): """ IMPORTANT: i in [0, 1], where 0 is at the bottom, 1 is at the top j in [-1, 1] """ def __init__(self, height, width): super().__init__() self.height = height self.width = ...
AttentionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.utils.data import torch.distributed import torch.nn as nn import torch.optim import torch.optim.lr_scheduler def Linear(in_features, out_features, bias=True, dropout=0): """Weight-normalized Linear layer (input: N x T x C)""" m = nn.Linear(in_features,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
zsquaredz/XSum
AttentionLayer
false
16,838
[ "MIT" ]
235
10f2fac2e70801e7a3973c864b5a24b61d3f8bfe
https://github.com/zsquaredz/XSum/tree/10f2fac2e70801e7a3973c864b5a24b61d3f8bfe
import torch import torch.nn.functional as F import torch.utils.data import torch.distributed import torch.nn as nn import torch.optim import torch.optim.lr_scheduler def Linear(in_features, out_features, bias=True, dropout=0): """Weight-normalized Linear layer (input: N x T x C)""" m = nn.Linear(in_features,...
PSNR
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn.modules.loss import _Loss class PSNR(_Loss): def __init__(self): super(PSNR, self).__init__() self.val_range = 255 def _quantize(self, img): img = img * self.val_range img = img.clamp(0, self.val_range).round() return img def forward(se...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn.modules.loss i...
zzh-tech/RSCD
PSNR
false
16,839
[ "MIT" ]
57
b287b1621121f8ca7ece6b27ebd4e28a5f8e6f5e
https://github.com/zzh-tech/RSCD/tree/b287b1621121f8ca7ece6b27ebd4e28a5f8e6f5e
import torch from torch.nn.modules.loss import _Loss class Model(_Loss): def __init__(self): super().__init__() self.val_range = 255 def _quantize(self, img): img = img * self.val_range img = img.clamp(0, self.val_range).round() return img def forward(self, x, y)...
DenseLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def actFunc(act, *args, **kwargs): act = act.lower() if act == 'relu': return nn.ReLU() elif act == 'relu6': return nn.ReLU6() elif act == 'leakyrelu': return nn.LeakyReLU(0.1) elif act == 'prelu': return nn.PReLU() elif act ==...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
zzh-tech/RSCD
DenseLayer
false
16,840
[ "MIT" ]
57
b287b1621121f8ca7ece6b27ebd4e28a5f8e6f5e
https://github.com/zzh-tech/RSCD/tree/b287b1621121f8ca7ece6b27ebd4e28a5f8e6f5e
import torch import torch.nn as nn def actFunc(act, *args, **kwargs): act = act.lower() if act == 'relu': return nn.ReLU() elif act == 'relu6': return nn.ReLU6() elif act == 'leakyrelu': return nn.LeakyReLU(0.1) elif act == 'prelu': return nn.PReLU() elif act ==...
TxtNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class TxtNet(nn.Module): def __init__(self, code_len, txt_feat_len): super(TxtNet, self).__init__() self.fc1 = nn.Linear(txt_feat_len, 4096) self.fc2 = nn.Linear(4096, code_len) self.alpha = 1.0 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 from torch._inductor.runtime....
zzs1994/DJsRH
TxtNet
false
16,841
[ "MIT" ]
53
6041c2df810723dd0052e2e5b7c6bd33033f0f21
https://github.com/zzs1994/DJsRH/tree/6041c2df810723dd0052e2e5b7c6bd33033f0f21
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, code_len, txt_feat_len): super().__init__() self.fc1 = nn.Linear(txt_feat_len, 4096) self.fc2 = nn.Linear(4096, code_len) self.alpha = 1.0 def forward(sel...
FeatureFusion
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler class Mlp(nn.Module): """ Multilayer perceptron.""" def __init__(self, in_features, hidden_features=None, out_features=None, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
zhangzhengde0225/SwinTrack
FeatureFusion
false
16,842
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler class Mlp(nn.Module): """ Multilayer perceptron.""" def __init__(self, in_features, hidden_features=None, out_features=None, a...
TargetQueryDecoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler class Mlp(nn.Module): """ Multilayer perceptron.""" def __init__(self, in_features, hidden_features=None, out_features=None, a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
zhangzhengde0225/SwinTrack
TargetQueryDecoderLayer
false
16,843
[ "MIT" ]
143
526be17f8ef266cb924c6939bd8dda23e9b73249
https://github.com/zhangzhengde0225/SwinTrack/tree/526be17f8ef266cb924c6939bd8dda23e9b73249
import torch import torch.distributed import torch import torch.nn as nn import torch.nn.functional import torch.utils.data import torch.optim import torch.optim.lr_scheduler class Mlp(nn.Module): """ Multilayer perceptron.""" def __init__(self, in_features, hidden_features=None, out_features=None, a...
Actor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, kernel_size): super(Actor, self).__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=kernel_size) self.conv2 = nn.Conv2d(16, 4, kernel_size=kernel_size) self.pool1 = nn.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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
zwc662/SequentialAttack
Actor
false
16,844
[ "MIT" ]
116
677b19c51ea76d794939ee126fccd75ffa0e6fe6
https://github.com/zwc662/SequentialAttack/tree/677b19c51ea76d794939ee126fccd75ffa0e6fe6
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, kernel_size): super().__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=kernel_size) self.conv2 = nn.Conv2d(16, 4, kernel_size=kernel_size) self.pool1 = nn.MaxPool2d(2,...
StdConv2dSame
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.functional as F import torch.utils.data.distributed def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 0) def pad_same(x, k, s, d=(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
ziniuwan/maed
StdConv2dSame
false
16,845
[ "MIT" ]
145
9e1f1c37eba81da86c8d9c62dc9be41a01abff5b
https://github.com/ziniuwan/maed/tree/9e1f1c37eba81da86c8d9c62dc9be41a01abff5b
import math import torch import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.functional as F import torch.utils.data.distributed def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 0) def pad_same(x, k, s, d=(...
MDNHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal from torch.distributions import Categorical from torch.nn.utils import vector_to_parameters from torch.nn.utils import parameters_to_vector def ortho_init(module, no...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn...
zuoxingdong/lagom
MDNHead
false
16,846
[ "MIT" ]
383
3b6710804dbc79c6dffb369ac87c68f4055ab6cd
https://github.com/zuoxingdong/lagom/tree/3b6710804dbc79c6dffb369ac87c68f4055ab6cd
from torch.nn import Module import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal from torch.distributions import Categorical from torch.nn.utils import vector_to_parameters from torch.nn.utils import parameters_to_vector def ortho_init(module, no...
_ASPPModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class GCT(nn.Module): def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False ): super(GCT, self).__init__() self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1)) self.gamma = nn.Parameter(torch.zeros(1, num_channels, 1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
yoxu515/CFBI
_ASPPModule
false
16,847
[ "BSD-3-Clause" ]
312
0bab1e3c9fc3e3ba0629f716d60221e8f8d9d586
https://github.com/yoxu515/CFBI/tree/0bab1e3c9fc3e3ba0629f716d60221e8f8d9d586
import torch import torch.nn as nn class GCT(nn.Module): def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False ): super().__init__() self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1)) self.gamma = nn.Parameter(torch.zeros(1, num_channels, 1, 1)) ...
Gaussian
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor import torch.utils.tensorboard import torch.utils.data class Gaussian(torch.nn.Module): """Gaussian activation""" def forward(self, x: 'Tensor') ->Tensor: return torch.exp(-x * 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.triton_helpers import math as tl_math import torch.utils.tensorboard import torch.utils.data assert_size_stride...
yangyinuo823/torchani
Gaussian
false
16,848
[ "MIT" ]
305
b0cd62eda59829d197b3c37f2215ba1af64f1c8d
https://github.com/yangyinuo823/torchani/tree/b0cd62eda59829d197b3c37f2215ba1af64f1c8d
import torch from torch import Tensor import torch.utils.tensorboard import torch.utils.data class Model(torch.nn.Module): """Gaussian activation""" def forward(self, x: 'Tensor') ->Tensor: return torch.exp(-x * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
waspIntrinsicComposer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class waspIntrinsicComposer(nn.Module): def __init__(self, opt): super(waspIntrinsicComposer, self).__init__() self.ngpu = opt.ngpu self.nc = opt.nc def f...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
zhixinshu/DeformingAutoencoders-pytorch
waspIntrinsicComposer
false
16,849
[ "BSD-2-Clause" ]
112
72996c5d11ae25dd0051bb51df353fef88e65742
https://github.com/zhixinshu/DeformingAutoencoders-pytorch/tree/72996c5d11ae25dd0051bb51df353fef88e65742
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class Model(nn.Module): def __init__(self, opt): super().__init__() self.ngpu = opt.ngpu self.nc = opt.nc def forward(self, shading, albedo): self...
VGG16
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class VGG16(nn.Module): def __init__(self, conv5_dilation=1): super(VGG16, self).__init__() None self.conv1_1 = nn.Conv2d(3, 64, 3, padding=1) self.conv1_2 = nn.Conv2d(64, 64, 3, padding=1) self.pool1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
yaoqi-zd/SGAN
VGG16
false
16,850
[ "MIT" ]
48
43d8a859b03967e2423a73ef1ba332ee71714ba4
https://github.com/yaoqi-zd/SGAN/tree/43d8a859b03967e2423a73ef1ba332ee71714ba4
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, conv5_dilation=1): super().__init__() None self.conv1_1 = nn.Conv2d(3, 64, 3, padding=1) self.conv1_2 = nn.Conv2d(64, 64, 3, padding=1) self.pool1 = nn.MaxPoo...
BridgeConnection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.utils import tensorboard as tensorboard class BridgeConnection(nn.Module): def __init__(self, in_dim, out_dim, dout_p): super(BridgeConnection, self).__init__() self.norm = nn.LayerNorm(in_dim) self.linear = nn.Linear(in_dim, out_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....
valterlej/CustomBMT
BridgeConnection
false
16,851
[ "MIT" ]
157
c9326752d1355c81f845f2caab9c047be76067de
https://github.com/valterlej/CustomBMT/tree/c9326752d1355c81f845f2caab9c047be76067de
import torch import torch.nn as nn from torch.utils import tensorboard as tensorboard class Model(nn.Module): def __init__(self, in_dim, out_dim, dout_p): super().__init__() self.norm = nn.LayerNorm(in_dim) self.linear = nn.Linear(in_dim, out_dim) self.dropout = nn.Dropout(dout_p)...
FeatureEmbedder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn from torch.utils import tensorboard as tensorboard class FeatureEmbedder(nn.Module): def __init__(self, d_feat, d_model): super(FeatureEmbedder, self).__init__() self.d_model = d_model self.embedder = nn.Linear(d_feat, d_model) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
valterlej/CustomBMT
FeatureEmbedder
false
16,852
[ "MIT" ]
157
c9326752d1355c81f845f2caab9c047be76067de
https://github.com/valterlej/CustomBMT/tree/c9326752d1355c81f845f2caab9c047be76067de
import torch import numpy as np import torch.nn as nn from torch.utils import tensorboard as tensorboard class Model(nn.Module): def __init__(self, d_feat, d_model): super().__init__() self.d_model = d_model self.embedder = nn.Linear(d_feat, d_model) self.activation = nn.ReLU() ...
SpatialCGNL
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class SpatialCGNL(nn.Module): """Spatial CGNL block with dot production kernel for image classfication. """ def __init__(self, inplanes, planes, use_scale=False, groups=8): self.use_scale = use_scale self.groups = groups super(SpatialCGNL, 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....
zj1008/GALD-DGCNet
SpatialCGNL
false
16,853
[ "MIT" ]
127
be7ebfe2b3d28ea28a2b4714852999d4af2a785e
https://github.com/zj1008/GALD-DGCNet/tree/be7ebfe2b3d28ea28a2b4714852999d4af2a785e
import torch import torch.nn as nn class Model(nn.Module): """Spatial CGNL block with dot production kernel for image classfication. """ def __init__(self, inplanes, planes, use_scale=False, groups=8): self.use_scale = use_scale self.groups = groups super().__init__() self...
MultiheadedAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn from torch.utils import tensorboard as tensorboard def attention(Q, K, V, mask, dropout=None): d_k = Q.size(-1) QKt = Q.matmul(K.transpose(-1, -2)) sm_input = QKt / np.sqrt(d_k) if mask is not None: sm_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 import triton_helpers from torch._inductor.runtime....
valterlej/CustomBMT
MultiheadedAttention
false
16,854
[ "MIT" ]
157
c9326752d1355c81f845f2caab9c047be76067de
https://github.com/valterlej/CustomBMT/tree/c9326752d1355c81f845f2caab9c047be76067de
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn from torch.utils import tensorboard as tensorboard def attention(Q, K, V, mask, dropout=None): d_k = Q.size(-1) QKt = Q.matmul(K.transpose(-1, -2)) sm_input = QKt / np.sqrt(d_k) if mask is not None: sm_input ...
SinkhornDistance
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data class SinkhornDistance(torch.nn.Module): """ Given two empirical measures each with :math:`P_1` locations :math:`x\\in\\mathbb{R}^{D_1}` and :math:`P_2` locations :math:`y\\in\\mathbb{R}^{D_2}`, outputs an approximation of the regularized OT cost for po...
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.dat...
yjh0410/actionformer_release
SinkhornDistance
false
16,855
[ "MIT" ]
61
7a97422111d3e29c8d2e14088c850c6975855ea7
https://github.com/yjh0410/actionformer_release/tree/7a97422111d3e29c8d2e14088c850c6975855ea7
import torch import torch.utils.data class Model(torch.nn.Module): """ Given two empirical measures each with :math:`P_1` locations :math:`x\\in\\mathbb{R}^{D_1}` and :math:`P_2` locations :math:`y\\in\\mathbb{R}^{D_2}`, outputs an approximation of the regularized OT cost for point clouds....
FCN8s
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class FCN8s(nn.Module): def __init__(self, n_class=3): super(FCN8s, self).__init__() self.conv1_1 = nn.Conv2d(3, 64, 3, padding=100) self.relu1_1 = nn.ReLU(inplace=True) self.conv1_2 = nn.Conv2d(64, 64, 3, padding=1) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
twni2016/OrganSegRSTN_PyTorch
FCN8s
false
16,856
[ "MIT" ]
100
bf571320e718c8f138e04d48645e3b4dfe75801d
https://github.com/twni2016/OrganSegRSTN_PyTorch/tree/bf571320e718c8f138e04d48645e3b4dfe75801d
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, n_class=3): super().__init__() self.conv1_1 = nn.Conv2d(3, 64, 3, padding=100) self.relu1_1 = nn.ReLU(inplace=True) self.conv1_2 = nn.Conv2d(64, 64, 3, padding=1) self.relu1_2 ...
LayoutNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class LayoutNet(nn.Module): def __init__(self): super(LayoutNet, self).__init__() self.conv1 = nn.Conv2d(3, 32, kernel_size=3, padding=1, stride=1) self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1, stride=1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
wellowdata/pytorch-layoutnet
LayoutNet
false
16,857
[ "MIT" ]
155
3d4352f94ed00d3c37890e9119452811d4f0893f
https://github.com/wellowdata/pytorch-layoutnet/tree/3d4352f94ed00d3c37890e9119452811d4f0893f
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 32, kernel_size=3, padding=1, stride=1) self.conv2 = nn.Conv2d(32, 64, kernel_size=3, padding=1, stride=1) self.conv3 = nn.Co...
ClassNetVideoConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Unit3D(nn.Module): """Basic unit containing Conv3D + BatchNorm + non-linearity.""" def __init__(self, in_channels, output_channels, kernel_shape=(1, 1, 1), stride=(1, 1, 1), padding=0, activation_fn=F.rel...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.utils.data as...
SheffieldAI/pykale
ClassNetVideoConv
false
16,858
[ "MIT" ]
324
be7670941fb06835883c80477b26702d407017db
https://github.com/SheffieldAI/pykale/tree/be7670941fb06835883c80477b26702d407017db
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Unit3D(nn.Module): """Basic unit containing Conv3D + BatchNorm + non-linearity.""" def __init__(self, in_channels, output_channels, kernel_shape=(1, 1, 1), stride=(1, 1, 1), padding=0, activation_fn=F.rel...
single_param
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.distributions class single_param(nn.Module): def __init__(self, value): super(single_param, self).__init__() self.p = nn.Parameter(torch.FloatTensor([value])) def forward(self): return torch.abs(self.p) def get_inputs(): return []...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.distributions assert_size_stride = tor...
AaltoML/PeriodicBNN
single_param
false
16,859
[ "MIT" ]
9
1638edb365641e7fe2ea2ab3c15b9439473f9cf3
https://github.com/AaltoML/PeriodicBNN/tree/1638edb365641e7fe2ea2ab3c15b9439473f9cf3
import torch import torch.nn as nn import torch.distributions class Model(nn.Module): def __init__(self, value): super().__init__() self.p = nn.Parameter(torch.FloatTensor([value])) def forward(self): return torch.abs(self.p) def get_inputs(): return [] def get_init_inputs():...
VertexDirectEmbedder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data from torch import nn def normalize_embeddings(embeddings: 'torch.Tensor', epsilon: 'float'=1e-06 ) ->torch.Tensor: """ Normalize N D-dimensional embedding vectors arranged in a tensor [N, D] Args: embeddings (tensor [N, D]): N D-dimensional embedding vecto...
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.utils.data from...
AbirKhan96/facebook-detectron2
VertexDirectEmbedder
false
16,860
[ "Apache-2.0" ]
5
6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
import torch import torch.utils.data from torch import nn def normalize_embeddings(embeddings: 'torch.Tensor', epsilon: 'float'=1e-06 ) ->torch.Tensor: """ Normalize N D-dimensional embedding vectors arranged in a tensor [N, D] Args: embeddings (tensor [N, D]): N D-dimensional embedding vecto...
IIDIsotropicGaussianUVLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.utils.data import torch.nn.functional as F from torch import nn class IIDIsotropicGaussianUVLoss(nn.Module): """ Loss for the case of iid residuals with isotropic covariance: $Sigma_i = sigma_i^2 I$ The loss (negative log likelihood) is then: $1/2 sum_{i=1}^n ...
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 math...
AbirKhan96/facebook-detectron2
IIDIsotropicGaussianUVLoss
false
16,861
[ "Apache-2.0" ]
5
6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
import math import torch import torch.utils.data import torch.nn.functional as F from torch import nn class Model(nn.Module): """ Loss for the case of iid residuals with isotropic covariance: $Sigma_i = sigma_i^2 I$ The loss (negative log likelihood) is then: $1/2 sum_{i=1}^n (log(2 pi) + 2 log si...
LastLevelMaxPool
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn.functional as F from torch import nn class LastLevelMaxPool(nn.Module): """ This module is used in the original FPN to generate a downsampled P6 feature from P5. """ def __init__(self): super().__init__() self.num_levels = 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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
AbirKhan96/facebook-detectron2
LastLevelMaxPool
false
16,862
[ "Apache-2.0" ]
5
6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
import torch import torch.utils.data import torch.nn.functional as F from torch import nn class Model(nn.Module): """ This module is used in the original FPN to generate a downsampled P6 feature from P5. """ def __init__(self): super().__init__() self.num_levels = 1 self.i...
HardSigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.utils.data.distributed from torch import nn import torch.nn.functional as F import torch.nn.parallel import torch.optim def hard_sigmoid(input_, inplace: 'bool'=False): """hard sigmoid function""" if inplace: return input_.add_(3.0).clamp_(0.0, 6.0).di...
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.utils.data.distributed from torch import nn import t...
Adlik/zen_nas
HardSigmoid
false
16,863
[ "Apache-2.0" ]
7
d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57
https://github.com/Adlik/zen_nas/tree/d820d5c7d5bbb6fd66a76d5f16513647d6ea7a57
import torch import torch.utils.data import torch.utils.data.distributed from torch import nn import torch.nn.functional as F import torch.nn.parallel import torch.optim def hard_sigmoid(input_, inplace: 'bool'=False): """hard sigmoid function""" if inplace: return input_.add_(3.0).clamp_(0.0, 6.0).di...
ResizeTransform
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as nnf import torch.utils class ResizeTransform(nn.Module): """ Resize a transform, which involves resizing the vector field *and* rescaling it. """ def __init__(self, vel_resize, ndims): super().__init__() self.factor = 1....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
Alison-brie/AutoReg
ResizeTransform
false
16,864
[ "MIT" ]
10
a23d45a6f7c6e47f61430e1565dda316452a4418
https://github.com/Alison-brie/AutoReg/tree/a23d45a6f7c6e47f61430e1565dda316452a4418
import torch import torch.nn as nn import torch.nn.functional as nnf import torch.utils class Model(nn.Module): """ Resize a transform, which involves resizing the vector field *and* rescaling it. """ def __init__(self, vel_resize, ndims): super().__init__() self.factor = 1.0 / vel_re...
Conv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn.functional as F class Conv2d(torch.nn.Conv2d): """ A wrapper around :class:`torch.nn.Conv2d` to support empty inputs and more features. """ def __init__(self, *args, **kwargs): """ Extra keyword arguments supported in addition to th...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size...
AbirKhan96/facebook-detectron2
Conv2d
false
16,865
[ "Apache-2.0" ]
5
6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
import torch import torch.utils.data import torch.nn.functional as F class Model(torch.nn.Conv2d): """ A wrapper around :class:`torch.nn.Conv2d` to support empty inputs and more features. """ def __init__(self, *args, **kwargs): """ Extra keyword arguments supported in addition to tho...
Linear_softmax
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Linear_softmax(nn.Module): def __init__(self, inp, out): super(Linear_softmax, self).__init__() self.f1 = nn.Linear(inp, out) def forward(self, x): x = self.f1(x) return F.softmax(x, dim=1) def get_inp...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Alfo5123/ConcreteDropout
Linear_softmax
false
16,866
[ "MIT" ]
7
c442871553e20a2de078c0fbac7fa52302d50abf
https://github.com/Alfo5123/ConcreteDropout/tree/c442871553e20a2de078c0fbac7fa52302d50abf
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, inp, out): super().__init__() self.f1 = nn.Linear(inp, out) def forward(self, x): x = self.f1(x) return F.softmax(x, dim=1) def get_inputs(): return [torch.rand...
IndepAnisotropicGaussianUVLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.utils.data import torch.nn.functional as F from torch import nn class IndepAnisotropicGaussianUVLoss(nn.Module): """ Loss for the case of independent residuals with anisotropic covariances: $Sigma_i = sigma_i^2 I + r_i r_i^T$ The loss (negative log likelihood) is ...
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 math...
AbirKhan96/facebook-detectron2
IndepAnisotropicGaussianUVLoss
false
16,867
[ "Apache-2.0" ]
5
6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
https://github.com/AbirKhan96/facebook-detectron2/tree/6a3bf813353d74bbeb8674e3566e7bbb33eb5c87
import math import torch import torch.utils.data import torch.nn.functional as F from torch import nn class Model(nn.Module): """ Loss for the case of independent residuals with anisotropic covariances: $Sigma_i = sigma_i^2 I + r_i r_i^T$ The loss (negative log likelihood) is then: $1/2 sum_{i=1}^...
TrueDynamics
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn from torch.autograd import Variable class TrueDynamics(nn.Module): def __init__(self, env, hidden_size=200, drop_prob=0.0): super().__init__() self.env = env self.hidden_size = hidden_size self.drop_prob = drop_prob sel...
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 ...
Alfo5123/ConcreteDropout
TrueDynamics
false
16,868
[ "MIT" ]
7
c442871553e20a2de078c0fbac7fa52302d50abf
https://github.com/Alfo5123/ConcreteDropout/tree/c442871553e20a2de078c0fbac7fa52302d50abf
import torch import numpy as np import torch.nn as nn from torch.autograd import Variable class Model(nn.Module): def __init__(self, env, hidden_size=200, drop_prob=0.0): super().__init__() self.env = env self.hidden_size = hidden_size self.drop_prob = drop_prob self.mask1...
EqualConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') 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 import nn from math import sqrt assert_size_stride = torch._C._dynamo...
AaltoVision/balanced-pioneer
EqualConv2d
false
16,869
[ "MIT" ]
5
51f58080fd2db3159de3e1ccb47f38e03220faf0
https://github.com/AaltoVision/balanced-pioneer/tree/51f58080fd2db3159de3e1ccb47f38e03220faf0
import torch from torch import nn from math import sqrt def equal_lr(module, name='weight'): EqualLR.apply(module, name) return module class EqualLR: def __init__(self, name): self.name = name def compute_weight(self, module): weight = getattr(module, self.name + '_orig') f...