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
Policy
# 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 Policy(nn.Module): def __init__(self, num_inputs, num_outputs): super(Policy, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.action_mean = nn.Linear(64, num_outputs) self.action_mean....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
Akella17/Deep-Bayesian-Quadrature-Policy-Optimization
Policy
false
7,644
[ "MIT" ]
16
e98fd68046486c002c33cf019db2ce66da18615b
https://github.com/Akella17/Deep-Bayesian-Quadrature-Policy-Optimization/tree/e98fd68046486c002c33cf019db2ce66da18615b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_inputs, num_outputs): super().__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 64) self.action_mean = nn.Linear(64, num_outputs) self.action_mean.weight.data.m...
HSigmoid
# 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.utils.data.distributed class HSigmoid(nn.Module): def __init__(self, inplace=True): super(HSigmoid, self).__init__() self.inplace = inplace def forward(self, x): out = F.relu6(x + 3, inplace=self.inplace)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data.distributed assert_size_stride = torch._C._...
AberHu/ImageNet-training
HSigmoid
false
7,645
[ "MIT" ]
12
7201eb140176f4d7ec1ed0ff5c27deba2dfb60c2
https://github.com/AberHu/ImageNet-training/tree/7201eb140176f4d7ec1ed0ff5c27deba2dfb60c2
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed class Model(nn.Module): def __init__(self, inplace=True): super().__init__() self.inplace = inplace def forward(self, x): out = F.relu6(x + 3, inplace=self.inplace) / 6 retu...
Scale
# 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 Scale(nn.Module): def __init__(self, scale=1.0): super(Scale, self).__init__() self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float)) def forward(self, x): return x * self.scale def get_inputs(): return [torch.rand([4, 4, 4, 4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
AllenPeng0209/SaccadeNet
Scale
false
7,646
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, scale=1.0): super().__init__() self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float)) def forward(self, x): return x * self.scale def get_inputs(): return [torch.rand([4, 4, 4, 4])] def g...
Abs
# 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 ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super(ModuleWrapper, self).__init__() def set_flag(self, flag_name, value): setattr(self, flag_name, value) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
AlliedToasters/elko_den
Abs
false
7,647
[ "Apache-2.0" ]
38
4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
https://github.com/AlliedToasters/elko_den/tree/4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
import torch import torch.nn as nn class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super().__init__() def set_flag(self, flag_name, value): setattr(self, flag_name, value) for m in self....
GHMC
# 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 def _expand_binary_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero(labels >= 1).squeeze() if inds.numel() > 0: bin_labels[inds, labels[inds] - 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 ...
AllenPeng0209/SaccadeNet
GHMC
false
7,648
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
import torch import torch.nn as nn import torch.nn.functional as F def _expand_binary_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero(labels >= 1).squeeze() if inds.numel() > 0: bin_labels[inds, labels[inds] - 1]...
ConvWS2d
# 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 def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-05): c_in = weight.size(0) weight_flat = weight.view(c_in, -1) mean = weight_flat.mean(dim=1, keepdim=True).view(c_in, 1, 1, 1) std = weight...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AllenPeng0209/SaccadeNet
ConvWS2d
false
7,649
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
import torch import torch.nn as nn import torch.nn.functional as F def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-05): c_in = weight.size(0) weight_flat = weight.view(c_in, -1) mean = weight_flat.mean(dim=1, keepdim=True).view(c_in, 1, 1, 1) std = weight...
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 class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, n_head=1, score_function ='scaled_dot_product'): super(Attention, self).__init__() if hidden_dim is None: hidden_dim = embe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
AlbertoPaz/ABSA-PyTorch
Attention
false
7,650
[ "MIT" ]
20
070a4b6f20cde0e2021c72b84c534659d749f36e
https://github.com/AlbertoPaz/ABSA-PyTorch/tree/070a4b6f20cde0e2021c72b84c534659d749f36e
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, embed_dim, hidden_dim=None, n_head=1, score_function ='scaled_dot_product'): super().__init__() if hidden_dim is None: hidden_dim = embed_dim self....
SmoothL1Loss
# 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 functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
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 functools impor...
AllenPeng0209/SaccadeNet
SmoothL1Loss
false
7,651
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
KL_loss_softmax
# 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.init class KL_loss_softmax(nn.Module): """ Compute KL_divergence between all prediction score (already sum=1, omit softmax function) """ def __init__(self): super(KL_loss_softmax, self).__init__() self.KL_loss = nn.KLDivLoss(reduce=Fa...
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...
AndresPMD/semantic_adaptive_margin
KL_loss_softmax
false
7,652
[ "Apache-2.0" ]
12
1e8bf2f1836498c48df030cb0a967b72b52e8460
https://github.com/AndresPMD/semantic_adaptive_margin/tree/1e8bf2f1836498c48df030cb0a967b72b52e8460
import torch import torch.nn as nn import torch.nn.init class Model(nn.Module): """ Compute KL_divergence between all prediction score (already sum=1, omit softmax function) """ def __init__(self): super().__init__() self.KL_loss = nn.KLDivLoss(reduce=False) def forward(self, im,...
Centered_Grad
# 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 Centered_Grad(nn.Module): def __init__(self): super(Centered_Grad, self).__init__() self.x_ker_init = torch.tensor([[[[-0.5, 0, 0.5]]]], dtype=torch. float, requires_grad=True) self.y_ker_init = torch.tensor([[[[-0.5], [0], [0.5]]]], dt...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
AmazingAng/pytorch-tvnet
Centered_Grad
false
7,653
[ "MIT" ]
12
e880d3ce15f55e5d9a11b423cfd1e0461de4fedb
https://github.com/AmazingAng/pytorch-tvnet/tree/e880d3ce15f55e5d9a11b423cfd1e0461de4fedb
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.x_ker_init = torch.tensor([[[[-0.5, 0, 0.5]]]], dtype=torch. float, requires_grad=True) self.y_ker_init = torch.tensor([[[[-0.5], [0], [0.5]]]], dtype= torch.floa...
ShuffleBlock
# 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 class ShuffleBlock(nn.Module): def __init__(self, groups=2): super(ShuffleBlock, self).__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Alibaba-MIIL/HeadSharingKD
ShuffleBlock
false
7,654
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn class Model(nn.Module): def __init__(self, groups=2): super().__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.size() g = self.groups ...
GLU
# 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 GLU(nn.Module): def __init__(self, input_channel, output_channel): super(GLU, self).__init__() self.linear_left = nn.Linear(input_channel, output_channel) self.linear_right = nn.Linear(input_channel, output_channel) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Abdulmajid-Murad/deep_probabilistic_forecast
GLU
false
7,655
[ "MIT" ]
11
399846381af4bb789021c9f63f121dd69fa0125d
https://github.com/Abdulmajid-Murad/deep_probabilistic_forecast/tree/399846381af4bb789021c9f63f121dd69fa0125d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_channel, output_channel): super().__init__() self.linear_left = nn.Linear(input_channel, output_channel) self.linear_right = nn.Linear(input_channel, output_channel) def forward(self, x): retu...
ActFirstResBlock
# 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 from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps self.momentum = mome...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
Alikfp/research-GANwriting
ActFirstResBlock
false
7,656
[ "MIT" ]
41
2190954218a733deac52c929f51bb85bca5d7216
https://github.com/Alikfp/research-GANwriting/tree/2190954218a733deac52c929f51bb85bca5d7216
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super().__init__() self.num_features = num_features self.eps = eps self.momentum = momentum self.weight = N...
Multi_feature_fusing
# 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 import torch.nn.functional as F import torch.nn.init def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) return X class Multi_feature_fusing(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np import torch.nn as nn import torch.nn.init assert_size_strid...
AndresPMD/semantic_adaptive_margin
Multi_feature_fusing
false
7,657
[ "Apache-2.0" ]
12
1e8bf2f1836498c48df030cb0a967b72b52e8460
https://github.com/AndresPMD/semantic_adaptive_margin/tree/1e8bf2f1836498c48df030cb0a967b72b52e8460
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.nn.init def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) return X class Model(nn.Module): ...
Permute
# 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 class Permute(nn.Module): def __init__(self, permutation=[2, 1, 0]): super().__init__() self.permutation = permutation def forward(self, input): return input[:, self.permutation] def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_ini...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Alibaba-AAIG/Beyond-ImageNet-Attack
Permute
false
7,658
[ "MIT" ]
23
c14b4844b64a8035b8fe033a617c0567224a9fa4
https://github.com/Alibaba-AAIG/Beyond-ImageNet-Attack/tree/c14b4844b64a8035b8fe033a617c0567224a9fa4
import torch from torch import nn class Model(nn.Module): def __init__(self, permutation=[2, 1, 0]): super().__init__() self.permutation = permutation def forward(self, input): return input[:, self.permutation] def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_...
FactorTransfer
# 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 FactorTransfer(nn.Module): """Paraphrasing Complex Network: Network Compression via Factor Transfer, NeurIPS 2018""" def __init__(self, p1=2, p2=1): super(FactorTransfer, self).__init__() self.p1 = p1 self.p2 = p2...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Alibaba-MIIL/HeadSharingKD
FactorTransfer
false
7,659
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """Paraphrasing Complex Network: Network Compression via Factor Transfer, NeurIPS 2018""" def __init__(self, p1=2, p2=1): super().__init__() self.p1 = p1 self.p2 = p2 def forward(self, f_s, ...
GHMR
# 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 GHMR(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper "Gradient Harmonized Single-stage Detector" https://arxiv.org/abs/1811.05181 Args: mu (float): The parameter for the Authentic Smooth L1 loss. bins ...
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...
AllenPeng0209/SaccadeNet
GHMR
false
7,660
[ "Apache-2.0" ]
30
0fce4266cbffc9a2c5f70335efa636da849ce70c
https://github.com/AllenPeng0209/SaccadeNet/tree/0fce4266cbffc9a2c5f70335efa636da849ce70c
import torch import torch.nn as nn class Model(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper "Gradient Harmonized Single-stage Detector" https://arxiv.org/abs/1811.05181 Args: mu (float): The parameter for the Authentic Smooth L1 loss. bins...
Forward_Grad
# 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 Forward_Grad(nn.Module): def __init__(self): super(Forward_Grad, self).__init__() self.x_ker_init = torch.tensor([[[[-1, 1]]]], dtype=torch.float, requires_grad=True) self.y_ker_init = torch.tensor([[[[-1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AmazingAng/pytorch-tvnet
Forward_Grad
false
7,661
[ "MIT" ]
12
e880d3ce15f55e5d9a11b423cfd1e0461de4fedb
https://github.com/AmazingAng/pytorch-tvnet/tree/e880d3ce15f55e5d9a11b423cfd1e0461de4fedb
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.x_ker_init = torch.tensor([[[[-1, 1]]]], dtype=torch.float, requires_grad=True) self.y_ker_init = torch.tensor([[[[-1], [1]]]], dtype=torch.fl...
EncoderImagePrecomp
# 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 collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) return X class EncoderImagePreco...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
AndresPMD/semantic_adaptive_margin
EncoderImagePrecomp
false
7,662
[ "Apache-2.0" ]
12
1e8bf2f1836498c48df030cb0a967b72b52e8460
https://github.com/AndresPMD/semantic_adaptive_margin/tree/1e8bf2f1836498c48df030cb0a967b72b52e8460
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) return X class Model(nn.Module):...
Normalize
# 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 class Normalize(nn.Module): """normalization layer""" def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Alibaba-MIIL/HeadSharingKD
Normalize
false
7,663
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn class Model(nn.Module): """normalization layer""" def __init__(self, power=2): super().__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm) retur...
LinearBlock
# 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.utils.data def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
AllenPu/mbdg
LinearBlock
false
7,664
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
import torch import torch.nn as nn import torch.utils.data def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super().__init__() self.num_features = num_features self.affine = affine ...
FeatureExtractor
# 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 FeatureExtractor(nn.Module): def __init__(self, num_inputs, num_outputs): super(FeatureExtractor, self).__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 48) self.affine3 = nn.Linear(48, num_outputs) def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Akella17/Deep-Bayesian-Quadrature-Policy-Optimization
FeatureExtractor
false
7,665
[ "MIT" ]
16
e98fd68046486c002c33cf019db2ce66da18615b
https://github.com/Akella17/Deep-Bayesian-Quadrature-Policy-Optimization/tree/e98fd68046486c002c33cf019db2ce66da18615b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_inputs, num_outputs): super().__init__() self.affine1 = nn.Linear(num_inputs, 64) self.affine2 = nn.Linear(64, 48) self.affine3 = nn.Linear(48, num_outputs) def forward(self, x): x = tor...
mlp
# 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 mlp(nn.Module): def __init__(self, seq_len): super(mlp, self).__init__() self.lin1 = nn.Linear(seq_len, 2048) self.lin2 = nn.Linear(2048, 2048) self.lin3 = nn.Linear(2048, seq_len) self.relu = nn.ReLU() def forward(self, 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 import torch.nn as nn assert_...
AliRoyat/MACS_IQA
mlp
false
7,666
[ "Apache-2.0" ]
16
d37ac72170dc0271065a7c54273b70ed52aee4b8
https://github.com/AliRoyat/MACS_IQA/tree/d37ac72170dc0271065a7c54273b70ed52aee4b8
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, seq_len): super().__init__() self.lin1 = nn.Linear(seq_len, 2048) self.lin2 = nn.Linear(2048, 2048) self.lin3 = nn.Linear(2048, seq_len) self.relu = nn.ReLU() def forward(self, input_): ...
Normalize_one
# 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 class Normalize_one(nn.Module): def __init__(self, mean, std): super(Normalize_one, self).__init__() self.mean = mean self.std = std def forward(self, input): x = input.clone() x = (x - self.mean) / self.std return x def get...
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...
Alibaba-AAIG/Beyond-ImageNet-Attack
Normalize_one
false
7,667
[ "MIT" ]
23
c14b4844b64a8035b8fe033a617c0567224a9fa4
https://github.com/Alibaba-AAIG/Beyond-ImageNet-Attack/tree/c14b4844b64a8035b8fe033a617c0567224a9fa4
import torch from torch import nn class Model(nn.Module): def __init__(self, mean, std): super().__init__() self.mean = mean self.std = std def forward(self, input): x = input.clone() x = (x - self.mean) / self.std return x def get_inputs(): return [torc...
FPNHead
# 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 FPNHead(nn.Module): """"this is the FPNHead class common to all backbones""" def __init__(self, num_in, num_mid, num_out): super(FPNHead, self).__init__() self.block0 = nn.Conv2d(num_in, num_mid, kernel_size=3, padding=1, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
AmaldevHari/Ghost-DeblurGAN
FPNHead
false
7,668
[ "MIT" ]
16
e725e5dad6a5fa5865d317e6644d96d0e800eae6
https://github.com/AmaldevHari/Ghost-DeblurGAN/tree/e725e5dad6a5fa5865d317e6644d96d0e800eae6
import torch import torch.nn as nn class Model(nn.Module): """"this is the FPNHead class common to all backbones""" def __init__(self, num_in, num_mid, num_out): super().__init__() self.block0 = nn.Conv2d(num_in, num_mid, kernel_size=3, padding=1, bias=False) self.block1 =...
LayerNorm
# 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.utils.data class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: ...
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...
AllenPu/mbdg
LayerNorm
false
7,669
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super().__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: self.gamma = nn....
HintLoss
# 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 class HintLoss(nn.Module): """Fitnets: hints for thin deep nets, ICLR 2015""" def __init__(self): super(HintLoss, self).__init__() self.crit = nn.MSELoss() def forward(self, f_s, f_t): loss = self.crit(f_s, f_t) return loss def get_inpu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Alibaba-MIIL/HeadSharingKD
HintLoss
false
7,670
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn class Model(nn.Module): """Fitnets: hints for thin deep nets, ICLR 2015""" def __init__(self): super().__init__() self.crit = nn.MSELoss() def forward(self, f_s, f_t): loss = self.crit(f_s, f_t) return loss def get_inputs(): return ...
DeContraster
# 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.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class DeContraster(AdversarialNoiseGenerator): def __init__(self, e...
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.distributions import torch.utils.data assert_size_stride = torch._C._dynamo....
AlexMeinke/Provable-OOD-Detection
DeContraster
false
7,671
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Model(AdversarialNoiseGenerator): def __init__(self, eps): ...
BinaryLoss
# 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.distributions import torch.utils.data class BinaryLoss(nn.Module): def __init__(self): super().__init__() def forward(self, output): return torch.logaddexp(torch.tensor([1.0], device=output.device), - output) def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.distributions import torch....
AlexMeinke/Provable-OOD-Detection
BinaryLoss
false
7,672
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, output): return torch.logaddexp(torch.tensor([1.0], device=output.device), - output) def get_inputs(): retu...
EncoderImageWeightNormPrecomp
# 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 collections import OrderedDict import torch.nn as nn import torch.nn.init from torch.nn.utils.weight_norm import weight_norm def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from collections im...
AndresPMD/semantic_adaptive_margin
EncoderImageWeightNormPrecomp
false
7,673
[ "Apache-2.0" ]
12
1e8bf2f1836498c48df030cb0a967b72b52e8460
https://github.com/AndresPMD/semantic_adaptive_margin/tree/1e8bf2f1836498c48df030cb0a967b72b52e8460
import torch from collections import OrderedDict import torch.nn as nn import torch.nn.init from torch.nn.utils.weight_norm import weight_norm def l2norm(X, dim=-1, eps=1e-12): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=dim, keepdim=True).sqrt() + eps X = torch.div(X, norm) re...
PKT
# 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 class PKT(nn.Module): """Probabilistic Knowledge Transfer for deep representation learning Code from author: https://github.com/passalis/probabilistic_kt""" def __init__(self): super(PKT, self).__init__() def forward(self, f_s, f_t): return self.cosi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 fr...
Alibaba-MIIL/HeadSharingKD
PKT
false
7,674
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn class Model(nn.Module): """Probabilistic Knowledge Transfer for deep representation learning Code from author: https://github.com/passalis/probabilistic_kt""" def __init__(self): super().__init__() def forward(self, f_s, f_t): return self.cosine_simi...
LinearVarianceUnif
# 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 torch.autograd import Variable from torch.nn import Parameter class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super(ModuleW...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn from torch.nn import Parameter assert_size_str...
AlliedToasters/elko_den
LinearVarianceUnif
false
7,675
[ "Apache-2.0" ]
38
4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
https://github.com/AlliedToasters/elko_den/tree/4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn import Parameter class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super().__ini...
KDE
# 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 KDE(nn.Module): """KD on embeddings - KDE""" def __init__(self): super(KDE, self).__init__() def forward(self, embedding_s, embedding_t): inputs_embed = F.normalize(embedding_s, p=2.0, dim=1) targets_embed = ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
Alibaba-MIIL/HeadSharingKD
KDE
false
7,676
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """KD on embeddings - KDE""" def __init__(self): super().__init__() def forward(self, embedding_s, embedding_t): inputs_embed = F.normalize(embedding_s, p=2.0, dim=1) targets_embed = F.norma...
MNIST_CNN
# 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 MNIST_CNN(nn.Module): """ Hand-tuned architecture for MNIST. Weirdness I've noticed so far with this architecture: - adding a linear layer after the mean-pool in features hurts RotatedMNIST-100 gen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
AllenPu/mbdg
MNIST_CNN
false
7,677
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): """ Hand-tuned architecture for MNIST. Weirdness I've noticed so far with this architecture: - adding a linear layer after the mean-pool in features hurts RotatedMNIST-100 general...
LinearVariance
# 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 torch.autograd import Variable from torch.nn import Parameter class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super(ModuleW...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AlliedToasters/elko_den
LinearVariance
false
7,678
[ "Apache-2.0" ]
38
4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
https://github.com/AlliedToasters/elko_den/tree/4e69f7f5c0dc7ffad54c7e190a2b75aba2eab7d2
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn import Parameter class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super().__ini...
DistillKL
# 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 DistillKL(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self, T): super(DistillKL, self).__init__() self.T = T def forward(self, y_s, y_t): p_s = F.log_softmax(y_s / self.T, dim=...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
Alibaba-MIIL/HeadSharingKD
DistillKL
false
7,679
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self, T): super().__init__() self.T = T def forward(self, y_s, y_t): p_s = F.log_softmax(y_s / self.T, dim=1) p_t = F....
Correlation
# 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 class Correlation(nn.Module): """Correlation Congruence for Knowledge Distillation, ICCV 2019. The authors nicely shared the code with me. I restructured their code to be compatible with my running framework. Credits go to the original author""" def __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.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
Alibaba-MIIL/HeadSharingKD
Correlation
false
7,680
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn class Model(nn.Module): """Correlation Congruence for Knowledge Distillation, ICCV 2019. The authors nicely shared the code with me. I restructured their code to be compatible with my running framework. Credits go to the original author""" def __init__(self): ...
HINet
# 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 HINet(nn.Module): def __init__(self, in_ch): super(HINet, self).__init__() self.instance_norm = nn.InstanceNorm2d(in_ch - in_ch // 2, affine=True) def forward(self, x): channels = x.shape[1] channels_i = channels - channels // 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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
AmaldevHari/Ghost-DeblurGAN
HINet
false
7,681
[ "MIT" ]
16
e725e5dad6a5fa5865d317e6644d96d0e800eae6
https://github.com/AmaldevHari/Ghost-DeblurGAN/tree/e725e5dad6a5fa5865d317e6644d96d0e800eae6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_ch): super().__init__() self.instance_norm = nn.InstanceNorm2d(in_ch - in_ch // 2, affine=True) def forward(self, x): channels = x.shape[1] channels_i = channels - channels // 2 x_i = x[:...
BinaryMarginLoss
# 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.distributions import torch.utils.data class BinaryMarginLoss(nn.Module): def __init__(self, margin=0.5): super().__init__() self.margin = margin def forward(self, output): return torch.logaddexp(torch.tensor([1.0], device=output.device)...
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.distributions import torch....
AlexMeinke/Provable-OOD-Detection
BinaryMarginLoss
false
7,682
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self, margin=0.5): super().__init__() self.margin = margin def forward(self, output): return torch.logaddexp(torch.tensor([1.0], device=output.device), ...
KDTH
# 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 KDTH(nn.Module): """KD with a Teacher Head auxiliary loss""" def __init__(self, T=4): super(KDTH, self).__init__() self.T = T def forward(self, y_s, y_t): y_s_th = y_s[1] y_s = y_s[0] p_t = 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 from torch ...
Alibaba-MIIL/HeadSharingKD
KDTH
false
7,683
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """KD with a Teacher Head auxiliary loss""" def __init__(self, T=4): super().__init__() self.T = T def forward(self, y_s, y_t): y_s_th = y_s[1] y_s = y_s[0] p_t = F.softmax(y...
Add_ParamI
# 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 import torch.utils.data class Add_ParamI(nn.Module): def __init__(self): super().__init__() self.bias = nn.Parameter(torch.zeros(1)) def forward(self, x): out = x + self.bias return out def ibp_forward(self, l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AlexMeinke/Provable-OOD-Detection
Add_ParamI
false
7,684
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.bias = nn.Parameter(torch.zeros(1)) def forward(self, x): out = x + self.bias return out def ibp_forward(self, l, u):...
Contraster
# 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.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Contraster(AdversarialNoiseGenerator): def __init__(self, eps...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo....
AlexMeinke/Provable-OOD-Detection
Contraster
false
7,685
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Model(AdversarialNoiseGenerator): def __init__(self, eps): ...
MLP
# 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 MLP(nn.Module): def __init__(self, indim, hs, outdim, mlp_drop): super().__init__() """ eh, et, |eh-et|, eh*et """ indim = 4 * indim self.linear1 = nn.Linear(indim, 2 * hs) self.linear...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AndrewZhe/Three-Sentences-Are-All-You-Need
MLP
false
7,686
[ "MIT" ]
21
afad6f9e700c9a95e03ef200718ebee8e18ca016
https://github.com/AndrewZhe/Three-Sentences-Are-All-You-Need/tree/afad6f9e700c9a95e03ef200718ebee8e18ca016
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, indim, hs, outdim, mlp_drop): super().__init__() """ eh, et, |eh-et|, eh*et """ indim = 4 * indim self.linear1 = nn.Linear(indim, 2 * hs) self.line...
Conv2dBlock
# 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 def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
AllenPu/mbdg
Conv2dBlock
false
7,687
[ "MIT" ]
27
243f53a57dcf4bfb6e717c0c9f64a839cff8d548
https://github.com/AllenPu/mbdg/tree/243f53a57dcf4bfb6e717c0c9f64a839cff8d548
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super().__init__() self.num_features = nu...
DistillMSE
# 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 DistillMSE(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self): super(DistillMSE, self).__init__() pass def forward(self, y_s, y_t): loss = nn.MSELoss(reduction='mean')(F.softmax...
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...
Alibaba-MIIL/HeadSharingKD
DistillMSE
false
7,688
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """Distilling the Knowledge in a Neural Network""" def __init__(self): super().__init__() pass def forward(self, y_s, y_t): loss = nn.MSELoss(reduction='mean')(F.softmax(y_s, dim=1), F. ...
OELossLogConf
# 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.distributions import torch.utils.data class OELossLogConf(nn.Module): def __init__(self): super().__init__() def forward(self, confs): return -confs.mean(1) 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 import torch.nn as nn import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AlexMeinke/Provable-OOD-Detection
OELossLogConf
false
7,689
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, confs): return -confs.mean(1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [...
Fire
# 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 collections import OrderedDict class Fire(nn.Module): def __init__(self, inplanes, squeeze_planes, expand1x1_planes, expand3x3_planes): super(Fire, self).__init__() self.inplanes = inplanes self.group1 = nn.Sequential(OrderedDict([('squeeze',...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from col...
Alibaba-AAIG/Beyond-ImageNet-Attack
Fire
false
7,690
[ "MIT" ]
23
c14b4844b64a8035b8fe033a617c0567224a9fa4
https://github.com/Alibaba-AAIG/Beyond-ImageNet-Attack/tree/c14b4844b64a8035b8fe033a617c0567224a9fa4
import torch from torch import nn from collections import OrderedDict class Model(nn.Module): def __init__(self, inplanes, squeeze_planes, expand1x1_planes, expand3x3_planes): super().__init__() self.inplanes = inplanes self.group1 = nn.Sequential(OrderedDict([('squeeze', nn.Conv2...
CTLSTMCell
# 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 CTLSTMCell(nn.Module): def __init__(self, hidden_dim, beta=1.0, device=None): super(CTLSTMCell, self).__init__() device = device or 'cpu' self.device = torch.device(device) self.hidden_dim = hidden_dim ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Anirudh-Murali/neural-hawkes-particle-smoothing
CTLSTMCell
false
7,691
[ "BSD-3-Clause" ]
37
96b258838bdab33b781008daeedfa61dec0d553c
https://github.com/Anirudh-Murali/neural-hawkes-particle-smoothing/tree/96b258838bdab33b781008daeedfa61dec0d553c
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, hidden_dim, beta=1.0, device=None): super().__init__() device = device or 'cpu' self.device = torch.device(device) self.hidden_dim = hidden_dim self.linear = nn.Li...
NormalNoiseGenerator
# 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.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class NormalNoiseGenerator(AdversarialNoiseGenerator): def __init__...
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 import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
AlexMeinke/Provable-OOD-Detection
NormalNoiseGenerator
false
7,692
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Model(AdversarialNoiseGenerator): def __init__(self, sigma=1....
GOODLoss
# 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.distributions import torch.utils.data class GOODLoss(nn.Module): def __init__(self): super().__init__() def forward(self, ub_log_conf): return (ub_log_conf ** 2 / 2).log1p() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.distributions import torch.utils.data assert...
AlexMeinke/Provable-OOD-Detection
GOODLoss
false
7,693
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, ub_log_conf): return (ub_log_conf ** 2 / 2).log1p() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_...
Lowerer
# 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.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Lowerer(AdversarialNoiseGenerator): def __init__(self, eps): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo....
AlexMeinke/Provable-OOD-Detection
Lowerer
false
7,694
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Model(AdversarialNoiseGenerator): def __init__(self, eps): ...
LinearI_Neg
# 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.distributions import torch.utils.data class LinearI_Neg(nn.Linear): def forward(self, x): return F.linear(x, -self.weight.exp(), self.bias) def ibp_forward(self, l, u): weight = -self.weight.exp() if 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 math as tl_math import torch....
AlexMeinke/Provable-OOD-Detection
LinearI_Neg
false
7,695
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.nn.functional as F import torch.distributions import torch.utils.data class Model(nn.Linear): def forward(self, x): return F.linear(x, -self.weight.exp(), self.bias) def ibp_forward(self, l, u): weight = -self.weight.exp() if self.bias ...
KDETH
# 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 KDTH(nn.Module): """KD with a Teacher Head auxiliary loss""" def __init__(self, T=4): super(KDTH, self).__init__() self.T = T def forward(self, y_s, y_t): y_s_th = y_s[1] y_s = y_s[0] p_t = 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 from torch ...
Alibaba-MIIL/HeadSharingKD
KDETH
false
7,696
[ "BSD-2-Clause" ]
15
8e2738bf069c7d12ec933f9b9107f267f7b6603a
https://github.com/Alibaba-MIIL/HeadSharingKD/tree/8e2738bf069c7d12ec933f9b9107f267f7b6603a
import torch from torch import nn import torch.nn.functional as F class KDTH(nn.Module): """KD with a Teacher Head auxiliary loss""" def __init__(self, T=4): super().__init__() self.T = T def forward(self, y_s, y_t): y_s_th = y_s[1] y_s = y_s[0] p_t = F.softmax(y_...
Unet_2levels
# 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 Unet_2levels(nn.Module): def __init__(self): super().__init__() self.relu = nn.ReLU() self.sigmoid = nn.Sigmoid() self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=True) self.maxpool = nn.MaxPool...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
AbdulMuqadim2001/dvae-refiner
Unet_2levels
false
7,697
[ "MIT" ]
27
c1ff46f91b28e613a3b7b157f8fd97ddf43e6fb2
https://github.com/AbdulMuqadim2001/dvae-refiner/tree/c1ff46f91b28e613a3b7b157f8fd97ddf43e6fb2
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.relu = nn.ReLU() self.sigmoid = nn.Sigmoid() self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=True) self.maxpool = nn.MaxPool2d(kern...
SavageLoss
# 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.distributions import torch.utils.data class SavageLoss(nn.Module): def __init__(self): super().__init__() def forward(self, output): return 1 / (1 + output.exp()) ** 2 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inp...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.distributions import torch.utils.data ...
AlexMeinke/Provable-OOD-Detection
SavageLoss
false
7,698
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, output): return 1 / (1 + output.exp()) ** 2 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs()...
UniformNoiseGenerator
# 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.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class UniformNoiseGenerator(AdversarialNoiseGenerator): def __init_...
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 import torch.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
AlexMeinke/Provable-OOD-Detection
UniformNoiseGenerator
false
7,699
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.distributions import torch.utils.data class AdversarialNoiseGenerator(torch.nn.Module): def __init__(self): super().__init__() return def forward(self, x): raise NotImplementedError() class Model(AdversarialNoiseGenerator): def __init__(self, min=0.0,...
Dunet_2levels
# 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 Unet_2levels(nn.Module): def __init__(self): super().__init__() self.relu = nn.ReLU() self.sigmoid = nn.Sigmoid() self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=True) self.maxpool = nn.MaxPool...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
AbdulMuqadim2001/dvae-refiner
Dunet_2levels
false
7,700
[ "MIT" ]
27
c1ff46f91b28e613a3b7b157f8fd97ddf43e6fb2
https://github.com/AbdulMuqadim2001/dvae-refiner/tree/c1ff46f91b28e613a3b7b157f8fd97ddf43e6fb2
import torch import torch.nn as nn class Unet_2levels(nn.Module): def __init__(self): super().__init__() self.relu = nn.ReLU() self.sigmoid = nn.Sigmoid() self.upsample = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=True) self.maxpool = nn.MaxPool...
GlobalAttention
# 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.cuda def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same value: ' + str(args) def se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AndrewM1998/MultimodalNMT
GlobalAttention
false
7,701
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
import torch import torch.nn as nn import torch.cuda def aeq(*args): """ Assert all arguments have the same value """ arguments = (arg for arg in args) first = next(arguments) assert all(arg == first for arg in arguments ), 'Not all arguments have the same value: ' + str(args) def se...
MLB
# 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 torch.nn import functional as F class MLB(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, activ_input= 'relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(MLB, self).__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 import nn assert_s...
AndresPMD/GCN_classification
MLB
false
7,702
[ "MIT" ]
39
b005c4256d68f1f90a7f73e7fdb3d066448de28c
https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, activ_input= 'relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super().__init__()...
EntityClassifier
# 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 MLP(nn.Module): def __init__(self, indim, hs, outdim, mlp_drop): super().__init__() """ eh, et, |eh-et|, eh*et """ indim = 4 * indim self.linear1 = nn.Linear(indim, 2 * hs) self.linear...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
AndrewZhe/Three-Sentences-Are-All-You-Need
EntityClassifier
false
7,703
[ "MIT" ]
21
afad6f9e700c9a95e03ef200718ebee8e18ca016
https://github.com/AndrewZhe/Three-Sentences-Are-All-You-Need/tree/afad6f9e700c9a95e03ef200718ebee8e18ca016
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): def __init__(self, indim, hs, outdim, mlp_drop): super().__init__() """ eh, et, |eh-et|, eh*et """ indim = 4 * indim self.linear1 = nn.Linear(indim, 2 * hs) self.linear...
HingeLoss
# 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.distributions import torch.utils.data class HingeLoss(nn.Module): def __init__(self, margin=1.0): super().__init__() self.margin = margin def forward(self, output): return F.relu(self.margin - output) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.distributions import torch.utils.data assert_size_stri...
AlexMeinke/Provable-OOD-Detection
HingeLoss
false
7,704
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.nn.functional as F import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self, margin=1.0): super().__init__() self.margin = margin def forward(self, output): return F.relu(self.margin - output) def g...
OELoss
# 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.distributions import torch.utils.data class OELoss(nn.Module): def __init__(self): super().__init__() def forward(self, logits): return -torch.log_softmax(logits, 1).mean(1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
AlexMeinke/Provable-OOD-Detection
OELoss
false
7,705
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, logits): return -torch.log_softmax(logits, 1).mean(1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_ini...
SourceContextGate
# 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.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AndrewM1998/MultimodalNMT
SourceContextGate
false
7,706
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
AttentionBlock
# 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 AttentionBlock(nn.Module): def __init__(self, in_features, middle_features, out_features): super().__init__() self.in_features = in_features self.middle_features = middle_features self.out_features = out_features self.W = 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 from torch._inductor.runtime....
Anjum48/commonlitreadabilityprize
AttentionBlock
false
7,707
[ "MIT" ]
28
b310742520b847b452ced0d27f47a934e834e4de
https://github.com/Anjum48/commonlitreadabilityprize/tree/b310742520b847b452ced0d27f47a934e834e4de
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_features, middle_features, out_features): super().__init__() self.in_features = in_features self.middle_features = middle_features self.out_features = out_features self.W = nn.Linear(in_featur...
Scale_By_ParamI
# 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 import torch.utils.data class Scale_By_ParamI(nn.Module): def __init__(self): super().__init__() self.scalar = nn.Parameter(torch.ones(1)) def forward(self, x): out = x * self.scalar return out def ibp_forward...
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.distributions import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AlexMeinke/Provable-OOD-Detection
Scale_By_ParamI
false
7,708
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.scalar = nn.Parameter(torch.ones(1)) def forward(self, x): out = x * self.scalar return out def ibp_forward(self, l, ...
Mish
# 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 Mish(nn.Module): def __init__(self): super().__init__() def forward(self, x): return x * torch.tanh(F.softplus(x)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
Archaic-Atom/JackFramework
Mish
false
7,709
[ "MIT" ]
13
e847d0bafe335ee33caf174676d12ad3c28011a6
https://github.com/Archaic-Atom/JackFramework/tree/e847d0bafe335ee33caf174676d12ad3c28011a6
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, x): return x * torch.tanh(F.softplus(x)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
TargetContextGate
# 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.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AndrewM1998/MultimodalNMT
TargetContextGate
false
7,710
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
MFB
# 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 torch.nn import functional as F class MFB(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, factor=2, activ_input='relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_norm=0.0, dropout_output=0.0): super(MFB,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
AndresPMD/GCN_classification
MFB
false
7,711
[ "MIT" ]
39
b005c4256d68f1f90a7f73e7fdb3d066448de28c
https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, factor=2, activ_input='relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_norm=0.0, dropout_output=0.0): super()....
Mlp
# 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 Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Arnav0400/ViT-Slim
Mlp
false
7,712
[ "MIT" ]
14
78edd4fecbb8cd4043e9878148576b1c327c74f9
https://github.com/Arnav0400/ViT-Slim/tree/78edd4fecbb8cd4043e9878148576b1c327c74f9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_features or in_features ...
QGOODLoss
# 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.nn as nn import torch.distributions import torch.utils.data class QGOODLoss(nn.Module): def __init__(self, quantile=0.8): super().__init__() self.quantile = quantile def forward(self, ub_log_conf): batch_size_out = ub_log_conf.shape[0] l ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.distributions import torch.utils.data assert...
AlexMeinke/Provable-OOD-Detection
QGOODLoss
false
7,713
[ "MIT" ]
21
9a132aec994ff718c96b81885736ab866df60d87
https://github.com/AlexMeinke/Provable-OOD-Detection/tree/9a132aec994ff718c96b81885736ab866df60d87
import math import torch import torch.nn as nn import torch.distributions import torch.utils.data class Model(nn.Module): def __init__(self, quantile=0.8): super().__init__() self.quantile = quantile def forward(self, ub_log_conf): batch_size_out = ub_log_conf.shape[0] l = ma...
MultinomialKLDivergenceLoss
# 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 class MultinomialKLDivergenceLoss(nn.Module): def __init__(self): super().__init__() def forward(self, p_proba, q_proba): loss = q_proba * (torch.log(q_proba) - torch.log(p_proba)) loss = torch.sum(loss) return loss / (p_proba.size(1) * p_pro...
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...
AuCson/SEDST
MultinomialKLDivergenceLoss
false
7,714
[ "MIT" ]
23
1c1691e2abc50eb2120ed49c874090f6c4f741d3
https://github.com/AuCson/SEDST/tree/1c1691e2abc50eb2120ed49c874090f6c4f741d3
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, p_proba, q_proba): loss = q_proba * (torch.log(q_proba) - torch.log(p_proba)) loss = torch.sum(loss) return loss / (p_proba.size(1) * p_proba.size(0)) def get_...
GCN
# 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 math import torch import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Anou9531/GUA
GCN
false
7,715
[ "MIT" ]
20
354acceb69656e76fb4ee296c66ae42c18cd939f
https://github.com/Anou9531/GUA/tree/354acceb69656e76fb4ee296c66ae42c18cd939f
from torch.nn import Module import math import torch import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
MSELoss
# 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 functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
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 functools import torch.nn as nn import torch.nn.functional as F assert_size_stride...
Andrew-Zhu/DyFPN
MSELoss
false
7,716
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
BothContextGate
# 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.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
AndrewM1998/MultimodalNMT
BothContextGate
false
7,717
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
import torch import torch.nn as nn import torch.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
ContextGate
# 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.cuda class ContextGate(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.cuda assert_size_stride = torch._C._dynamo.gu...
AndrewM1998/MultimodalNMT
ContextGate
false
7,718
[ "MIT" ]
40
b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
https://github.com/AndrewM1998/MultimodalNMT/tree/b66d3a40ac9bc5c11ae124f51d1a9abf7cd6a04b
import torch import torch.nn as nn import torch.cuda class Model(nn.Module): """ Context gate is a decoder module that takes as input the previous word embedding, the current decoder state and the attention state, and produces a gate. The gate can be used to select the input from the target side c...
LandmarkLoss
# 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 from torch import nn def wing_loss(y_true, y_pred, N_LANDMARK, w=10.0, epsilon=2.0): y_pred = y_pred.reshape(-1, N_LANDMARK, 2) y_true = y_true.reshape(-1, N_LANDMARK, 2) x = y_true - y_pred c = w * (1.0 - math.log(1.0 + w / epsilon)) absolute_x = torch.abs(x) losses =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math from torch import nn assert_size_stride = torch._C._dynamo.gu...
AnthonyF333/FaceLandmark_PFLD_UltraLight
LandmarkLoss
false
7,719
[ "Apache-2.0" ]
38
c7c9543bd7f44ab434240eab077242f259df21f8
https://github.com/AnthonyF333/FaceLandmark_PFLD_UltraLight/tree/c7c9543bd7f44ab434240eab077242f259df21f8
import math import torch from torch import nn def wing_loss(y_true, y_pred, N_LANDMARK, w=10.0, epsilon=2.0): y_pred = y_pred.reshape(-1, N_LANDMARK, 2) y_true = y_true.reshape(-1, N_LANDMARK, 2) x = y_true - y_pred c = w * (1.0 - math.log(1.0 + w / epsilon)) absolute_x = torch.abs(x) losses =...
MFH
# 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 torch.nn import functional as F class MFH(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, factor=2, activ_input='relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(MFH, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
AndresPMD/GCN_classification
MFH
false
7,720
[ "MIT" ]
39
b005c4256d68f1f90a7f73e7fdb3d066448de28c
https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, factor=2, activ_input='relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super()._...
LinearSum
# 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 torch.nn import functional as F class LinearSum(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, activ_input= 'relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super(LinearSu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
AndresPMD/GCN_classification
LinearSum
false
7,721
[ "MIT" ]
39
b005c4256d68f1f90a7f73e7fdb3d066448de28c
https://github.com/AndresPMD/GCN_classification/tree/b005c4256d68f1f90a7f73e7fdb3d066448de28c
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, input_dims, output_dim, mm_dim=1200, activ_input= 'relu', activ_output='relu', normalize=False, dropout_input=0.0, dropout_pre_lin=0.0, dropout_output=0.0): super().__init__()...
L1Loss
# 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 functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
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 functools impor...
Andrew-Zhu/DyFPN
L1Loss
false
7,722
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
DeconvBlock
# 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 DeconvBlock(nn.Module): def __init__(self, in_channels, out_channels): super(DeconvBlock, self).__init__() self.conv = nn.ConvTranspose2d(in_channels, out_channels, kernel_size=3, stride=2, padding=1, output_padding=0) self.pad = nn.Ref...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
ArminMasoumian/GCNDepth
DeconvBlock
false
7,723
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv = nn.ConvTranspose2d(in_channels, out_channels, kernel_size=3, stride=2, padding=1, output_padding=0) self.pad = nn.ReflectionPad2d((0, 1, 0, ...
ConvBlock
# 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 Conv3x3(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = nn.ZeroPad2d(1) self.conv = nn.Conv2d(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.triton_helpers import libdevice, math as tl_math im...
ArminMasoumian/GCNDepth
ConvBlock
false
7,724
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
import torch import torch.nn as nn class Conv3x3(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super().__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = nn.ZeroPad2d(1) self.conv = nn.Conv2d(int(in_channel...
CrossEntropyLoss
# 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 def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Andrew-Zhu/DyFPN
CrossEntropyLoss
false
7,725
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
SSIM
# 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 SSIM(nn.Module): def __init__(self): super(SSIM, self).__init__() self.mu_x_pool = nn.AvgPool2d(3, 1) self.mu_y_pool = nn.AvgPool2d(3, 1) self.sig_x_pool = nn.AvgPool2d(3, 1) self.sig_y_pool = nn.AvgPool2d(3, 1) self.sig_xy_...
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 ...
ArminMasoumian/GCNDepth
SSIM
false
7,726
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.mu_x_pool = nn.AvgPool2d(3, 1) self.mu_y_pool = nn.AvgPool2d(3, 1) self.sig_x_pool = nn.AvgPool2d(3, 1) self.sig_y_pool = nn.AvgPool2d(3, 1) self.sig_xy_pool = nn...
Hardswish
# 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 Hardswish(nn.Module): @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
AsakusaRinne/tensorrt_yolov5_tracker
Hardswish
false
7,727
[ "MIT" ]
22
b9a3a6fc94710e8291d6a614ed2b04cbc4c56599
https://github.com/AsakusaRinne/tensorrt_yolov5_tracker/tree/b9a3a6fc94710e8291d6a614ed2b04cbc4c56599
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
FlopsCrossEntropyLoss
# 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 def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Andrew-Zhu/DyFPN
FlopsCrossEntropyLoss
false
7,728
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
GaussianFocalLoss
# 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 functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
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 functools impor...
Andrew-Zhu/DyFPN
GaussianFocalLoss
false
7,729
[ "Apache-2.0" ]
32
a74463b59c4ce28253c2449a07c0f6692a0147a1
https://github.com/Andrew-Zhu/DyFPN/tree/a74463b59c4ce28253c2449a07c0f6692a0147a1
import functools import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
Conv3x3
# 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 Conv3x3(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super(Conv3x3, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = nn.ZeroPad2d(1) self.conv = nn.Conv2d(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.triton_helpers import math as tl_math import torch....
ArminMasoumian/GCNDepth
Conv3x3
false
7,730
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super().__init__() if use_refl: self.pad = nn.ReflectionPad2d(1) else: self.pad = nn.ZeroPad2d(1) self.conv = nn.Conv2d(int(in_channels)...
Project
# 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 Project(nn.Module): def __init__(self, batch_size, height, width, eps=1e-07): super(Project, self).__init__() self.batch_size = batch_size self.height = height self.width = width self.eps = eps def forward(self, points, K, T): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ArminMasoumian/GCNDepth
Project
false
7,731
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, batch_size, height, width, eps=1e-07): super().__init__() self.batch_size = batch_size self.height = height self.width = width self.eps = eps def forward(self, points, K, T): P = tor...
MakeFeatures
# 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 MakeFeatures(nn.Module): """ Returns features to be used by PairDrift. """ def __init__(self, in_dim, out_dim): super(MakeFeatures, self).__init__() self.single = nn.Linear(in_dim, out_dim) self.pair = nn.Linear(in_dim, out_dim) def forwar...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
AustenLamacraft/QuaRL
MakeFeatures
false
7,732
[ "MIT" ]
13
1764f0ccd0ba90d44e799b6ac908df76be14a52e
https://github.com/AustenLamacraft/QuaRL/tree/1764f0ccd0ba90d44e799b6ac908df76be14a52e
import torch import torch.nn as nn class Model(nn.Module): """ Returns features to be used by PairDrift. """ def __init__(self, in_dim, out_dim): super().__init__() self.single = nn.Linear(in_dim, out_dim) self.pair = nn.Linear(in_dim, out_dim) def forward(self, x): pairs...
Conv5x5
# 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 Conv5x5(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super(Conv5x5, self).__init__() if use_refl: self.pad = nn.ReflectionPad2d(2) else: self.pad = nn.ZeroPad2d(2) self.conv = nn.Conv2d(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.triton_helpers import math as tl_math import torch....
ArminMasoumian/GCNDepth
Conv5x5
false
7,733
[ "MIT" ]
32
9fa77812fa944c2701a45f09acf988815ca50aee
https://github.com/ArminMasoumian/GCNDepth/tree/9fa77812fa944c2701a45f09acf988815ca50aee
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, use_refl=True): super().__init__() if use_refl: self.pad = nn.ReflectionPad2d(2) else: self.pad = nn.ZeroPad2d(2) self.conv = nn.Conv2d(int(in_channels)...
BCEBlurWithLogitsLoss
# 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 BCEBlurWithLogitsLoss(nn.Module): def __init__(self, alpha=0.05): super(BCEBlurWithLogitsLoss, self).__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, true): loss = self.loss_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...
AsakusaRinne/tensorrt_yolov5_tracker
BCEBlurWithLogitsLoss
false
7,734
[ "MIT" ]
22
b9a3a6fc94710e8291d6a614ed2b04cbc4c56599
https://github.com/AsakusaRinne/tensorrt_yolov5_tracker/tree/b9a3a6fc94710e8291d6a614ed2b04cbc4c56599
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, alpha=0.05): super().__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, true): loss = self.loss_fcn(pred, true) pred = torch.sigmoid...
GCNSynthetic
# 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.functional as F import torch.nn as nn from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, bias=True): super(Grap...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Armagaan/cf-gnnexplainer
GCNSynthetic
false
7,735
[ "MIT" ]
15
22b415e114c52d8d60ca45a40c3cb33c1947400c
https://github.com/Armagaan/cf-gnnexplainer/tree/22b415e114c52d8d60ca45a40c3cb33c1947400c
import math import torch import torch.nn.functional as F import torch.nn as nn from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, bias=True): super().__...
BertLayerNorm
# 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 class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super(BertLayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_si...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ArrowLuo/GRACE
BertLayerNorm
false
7,736
[ "Apache-2.0" ]
17
f27b500ba905685c03eee6d91d87adc9ef78b4d1
https://github.com/ArrowLuo/GRACE/tree/f27b500ba905685c03eee6d91d87adc9ef78b4d1
import torch from torch import nn class Model(nn.Module): def __init__(self, hidden_size, eps=1e-12): """Construct a layernorm module in the TF style (epsilon inside the square root). """ super().__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.bias = nn...
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 class Net(torch.nn.Module): def __init__(self, n_input, n_hidden, n_output): super(Net, self).__init__() self.hidden1 = torch.nn.Linear(n_input, n_hidden) self.hidden2 = torch.nn.Linear(n_hidden, n_hidden) self.hidden3 = torch.nn.Linear(n_hidden, n_hidden) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
AstroHiro/NCM
Net
false
7,737
[ "MIT" ]
23
720db63ec018a1986ac9e370613f8209328b89e1
https://github.com/AstroHiro/NCM/tree/720db63ec018a1986ac9e370613f8209328b89e1
import torch class Model(torch.nn.Module): def __init__(self, n_input, n_hidden, n_output): super().__init__() self.hidden1 = torch.nn.Linear(n_input, n_hidden) self.hidden2 = torch.nn.Linear(n_hidden, n_hidden) self.hidden3 = torch.nn.Linear(n_hidden, n_hidden) self.hidde...
CrossEntropyLossOneHot
# 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 CrossEntropyLossOneHot(nn.Module): def __init__(self): super(CrossEntropyLossOneHot, self).__init__() self.log_softmax = nn.LogSoftmax(dim=-1) def forward(self, preds, labels): return torch.mean(torch.sum(-labels * self.log_softmax(preds), -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 ...
B0Qi/hualubei2020-callingsmoking
CrossEntropyLossOneHot
false
7,738
[ "MIT" ]
27
73d1049d95554b5d669afa93132a0fce37461ff4
https://github.com/B0Qi/hualubei2020-callingsmoking/tree/73d1049d95554b5d669afa93132a0fce37461ff4
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.log_softmax = nn.LogSoftmax(dim=-1) def forward(self, preds, labels): return torch.mean(torch.sum(-labels * self.log_softmax(preds), -1)) def get_inputs(): return [torch.rand(...
Attn
# 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 import torch.nn.functional as F class Attn(nn.Module): def __init__(self, hidden_size): super(Attn, self).__init__() self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) self.v = nn.Linear(self.hidden_size, 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....
AuCson/SEDST
Attn
false
7,739
[ "MIT" ]
23
1c1691e2abc50eb2120ed49c874090f6c4f741d3
https://github.com/AuCson/SEDST/tree/1c1691e2abc50eb2120ed49c874090f6c4f741d3
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, hidden_size): super().__init__() self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) self.v = nn.Linear(self.hidden_size, 1) def fo...
PermEqMean
# 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 PermEqMean(nn.Module): """ Returns equivariant layer used by EquivarDrift. """ def __init__(self, in_dim, out_dim): super(PermEqMean, self).__init__() self.Gamma = nn.Linear(in_dim, out_dim) self.Lambda = nn.Linear(in_dim, out_dim, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AustenLamacraft/QuaRL
PermEqMean
false
7,740
[ "MIT" ]
13
1764f0ccd0ba90d44e799b6ac908df76be14a52e
https://github.com/AustenLamacraft/QuaRL/tree/1764f0ccd0ba90d44e799b6ac908df76be14a52e
import torch import torch.nn as nn class Model(nn.Module): """ Returns equivariant layer used by EquivarDrift. """ def __init__(self, in_dim, out_dim): super().__init__() self.Gamma = nn.Linear(in_dim, out_dim) self.Lambda = nn.Linear(in_dim, out_dim, bias=False) def forward(self...
CombineFeatures
# 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 CombineFeatures(nn.Module): """ Returns layer to be used by PairDrift. """ def __init__(self, in_dim, out_dim, zero_init=False): super(CombineFeatures, self).__init__() self.single = nn.Linear(in_dim, out_dim) self.pair = nn.Linear(in_dim, out_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
AustenLamacraft/QuaRL
CombineFeatures
false
7,741
[ "MIT" ]
13
1764f0ccd0ba90d44e799b6ac908df76be14a52e
https://github.com/AustenLamacraft/QuaRL/tree/1764f0ccd0ba90d44e799b6ac908df76be14a52e
import torch import torch.nn as nn class Model(nn.Module): """ Returns layer to be used by PairDrift. """ def __init__(self, in_dim, out_dim, zero_init=False): super().__init__() self.single = nn.Linear(in_dim, out_dim) self.pair = nn.Linear(in_dim, out_dim) if zero_init: ...
disparityentropy
# 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.utils.data import torch.nn.parallel class disparityentropy(nn.Module): def __init__(self, maxdisp): super(disparityentropy, self).__init__() def forward(self, x): out = torch.sum(-x * torch.log(x), 1) return out def get_inputs(): r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn import torch.utils.data import torch.nn.parallel ass...
AvrilCheng/LidarStereoNet
disparityentropy
false
7,742
[ "MIT" ]
27
96c7cd6d5edb9b2fd302e2edd0c05cbda1ed024e
https://github.com/AvrilCheng/LidarStereoNet/tree/96c7cd6d5edb9b2fd302e2edd0c05cbda1ed024e
import torch from torch import nn import torch.utils.data import torch.nn.parallel class Model(nn.Module): def __init__(self, maxdisp): super().__init__() def forward(self, x): out = torch.sum(-x * torch.log(x), 1) return out def get_inputs(): return [torch.rand([4, 4, 4, 4])] ...
ConvReLUNorm
# 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 ConvReLUNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, dropout=0.0): super(ConvReLUNorm, self).__init__() self.conv = torch.nn.Conv1d(in_channels, out_channels, kernel_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....
AstraliteHeart/cookietts
ConvReLUNorm
false
7,743
[ "BSD-3-Clause" ]
25
c871f5f7b5790656d5b57bcd9e63946a2da52f0f
https://github.com/AstraliteHeart/cookietts/tree/c871f5f7b5790656d5b57bcd9e63946a2da52f0f
import torch import torch.utils.data import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, dropout=0.0): super().__init__() self.conv = torch.nn.Conv1d(in_channels, out_channels, kernel_size= kernel_size, padding=ker...