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
JSCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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....
kiminh/mt-dnn
JSCriterion
false
7,033
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
NsSymKlCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * def stable_kl(logit, target, epsilon=1e-06, reduce=True): logit = logit.view(-1, logit.size(-1)).float() target = target.view(-1, target.size(-1)).float() bs = logit.size(0) p = ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn.functi...
kiminh/mt-dnn
NsSymKlCriterion
false
7,034
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * def stable_kl(logit, target, epsilon=1e-06, reduce=True): logit = logit.view(-1, logit.size(-1)).float() target = target.view(-1, target.size(-1)).float() bs = logit.size(0) p = ...
BERTLhuc
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn from torch.nn.parameter import Parameter class BERTLhuc(nn.Module): def __init__(self, config): super(BERTLhuc, self).__init__() self.lhuc = Parameter(torch.zeros(config.hidden_size)) def forward(self, hidden_st...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided...
DAQuestionAnswering/Bert-n-Pals
BERTLhuc
false
7,035
[ "MIT" ]
1
d5a288b9ac62259e70c249635108ba3906e19f00
https://github.com/DAQuestionAnswering/Bert-n-Pals/tree/d5a288b9ac62259e70c249635108ba3906e19f00
from _paritybench_helpers import _mock_config import torch import torch.nn as nn from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, config): super().__init__() self.lhuc = Parameter(torch.zeros(config.hidden_size)) def forward(self, hidden_states): hi...
Cosine
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from _paritybench_helpers import _mock_config import torch from torch.optim.lr_scheduler import * class Cosine(torch.nn.Module): def __init__(self, config): super().__init__() def forward(self, src, tgt): src = src.float() tgt = tgt.float() return (torch.matmul(src, tgt.trans...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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.optim.lr...
kiminh/mt-dnn
Cosine
false
7,036
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
from _paritybench_helpers import _mock_config import torch from torch.optim.lr_scheduler import * class Model(torch.nn.Module): def __init__(self, config): super().__init__() def forward(self, src, tgt): src = src.float() tgt = tgt.float() return (torch.matmul(src, tgt.transp...
ConvLayer
# 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 ConvLayer(nn.Module): """1-D Convolution layer to extract high-level features of each time-series input :param n_features: Number of input features/nodes :param window_size: length of the input sequence :param kernel_size: size of kernel to use in the convolutio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
kj21choi/LATAD
ConvLayer
false
7,037
[ "MIT" ]
1
80d91e0f251ad0225342ee30e2461a39fa9cca97
https://github.com/kj21choi/LATAD/tree/80d91e0f251ad0225342ee30e2461a39fa9cca97
import torch from torch import nn class Model(nn.Module): """1-D Convolution layer to extract high-level features of each time-series input :param n_features: Number of input features/nodes :param window_size: length of the input sequence :param kernel_size: size of kernel to use in the convolution op...
SymKlCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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....
kiminh/mt-dnn
SymKlCriterion
false
7,038
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
NN1
# 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 NN1(nn.Module): def __init__(self, input_dimension): super(NN1, self).__init__() self.linear1 = nn.Linear(input_dimension, 60) self.linear2 = nn.Linear(60, 25) self.linear3 = nn.Linear(25, 1) self.sig = nn.Sigmoid() self.rel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
kirtanp/MAMO-fair
NN1
false
7,039
[ "Apache-2.0" ]
1
fd0fc39383f11a9e1ec401233b89c2399860fb94
https://github.com/kirtanp/MAMO-fair/tree/fd0fc39383f11a9e1ec401233b89c2399860fb94
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dimension): super().__init__() self.linear1 = nn.Linear(input_dimension, 60) self.linear2 = nn.Linear(60, 25) self.linear3 = nn.Linear(25, 1) self.sig = nn.Sigmoid() self.relu = nn....
Transformation
# 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 Transformation(torch.nn.Module): def __init__(self, input_size): super(Transformation, self).__init__() self.input_size = input_size self.linear1 = torch.nn.Linear(self.input_size, self.input_size) self.linear2 = torch.nn.Linear(self.input_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
kj21choi/LATAD
Transformation
false
7,040
[ "MIT" ]
1
80d91e0f251ad0225342ee30e2461a39fa9cca97
https://github.com/kj21choi/LATAD/tree/80d91e0f251ad0225342ee30e2461a39fa9cca97
import torch from torch import nn class Model(torch.nn.Module): def __init__(self, input_size): super().__init__() self.input_size = input_size self.linear1 = torch.nn.Linear(self.input_size, self.input_size) self.linear2 = torch.nn.Linear(self.input_size, self.input_size) ...
TemporalAttentionLayer
# 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 TemporalAttentionLayer(nn.Module): """Single Graph Temporal Attention Layer :param n_features: number of input features/nodes :param window_size: length of the input sequence :param dropout: percentage of nodes to dropout :param alpha: negative slope used 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....
kj21choi/LATAD
TemporalAttentionLayer
false
7,041
[ "MIT" ]
1
80d91e0f251ad0225342ee30e2461a39fa9cca97
https://github.com/kj21choi/LATAD/tree/80d91e0f251ad0225342ee30e2461a39fa9cca97
import torch from torch import nn class Model(nn.Module): """Single Graph Temporal Attention Layer :param n_features: number of input features/nodes :param window_size: length of the input sequence :param dropout: percentage of nodes to dropout :param alpha: negative slope used in the leaky rely a...
UpConv
# 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 UpConv(nn.Module): def __init__(self, input_nc, output_nc, kernel_size): super(UpConv, self).__init__() self.deconv = nn.ConvTranspose2d(in_channels=input_nc, out_channels =output_nc, kernel_size=2, bias=True, stride=2, padding=0) self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
kkrish39/realtime-depth-prediction-from-monocular-videos
UpConv
false
7,042
[ "BSD-3-Clause" ]
1
9cde9c1a6df6c91af1ada80b3aaeebae03fc59dc
https://github.com/kkrish39/realtime-depth-prediction-from-monocular-videos/tree/9cde9c1a6df6c91af1ada80b3aaeebae03fc59dc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_nc, output_nc, kernel_size): super().__init__() self.deconv = nn.ConvTranspose2d(in_channels=input_nc, out_channels =output_nc, kernel_size=2, bias=True, stride=2, padding=0) self.activation_fn...
FeatureAttentionLayer
# 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 FeatureAttentionLayer(nn.Module): """Single Graph Feature/Spatial Attention Layer :param n_features: Number of input features/nodes :param window_size: length of the input sequence :param dropout: percentage of nodes to dropout :param alpha: negative slope u...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
kj21choi/LATAD
FeatureAttentionLayer
false
7,043
[ "MIT" ]
1
80d91e0f251ad0225342ee30e2461a39fa9cca97
https://github.com/kj21choi/LATAD/tree/80d91e0f251ad0225342ee30e2461a39fa9cca97
import torch from torch import nn class Model(nn.Module): """Single Graph Feature/Spatial Attention Layer :param n_features: Number of input features/nodes :param window_size: length of the input sequence :param dropout: percentage of nodes to dropout :param alpha: negative slope used in the leaky...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, nf=64): super(Attention, self).__init__() self.sAtt_1 = nn.Conv2d(nf, nf, 1, 1, bias=True) self.max_pool = nn.MaxPool2d(3, stride=2, padding=1) self.avg_pool = nn.AvgP...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
juyongjiang/Simple-SR
Attention
false
7,044
[ "MIT" ]
1
76820511abc04fbe6e4a79d23c67aee97406d563
https://github.com/juyongjiang/Simple-SR/tree/76820511abc04fbe6e4a79d23c67aee97406d563
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, nf=64): super().__init__() self.sAtt_1 = nn.Conv2d(nf, nf, 1, 1, bias=True) self.max_pool = nn.MaxPool2d(3, stride=2, padding=1) self.avg_pool = nn.AvgPool2d(3, stride=2, ...
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 torch import torch.nn as nn import torch.utils.data class MSELoss(nn.Module): def __init__(self): super(self.__class__, self).__init__() def forward(self, input, target): return torch.mean(torch.sum((input - target) ** 2, 1)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
klovbe/UnsupervisedDeepLearning-Pytorch
MSELoss
false
7,045
[ "MIT" ]
1
35e8e49cd4024179db173f3dab2e6d1a5d037d35
https://github.com/klovbe/UnsupervisedDeepLearning-Pytorch/tree/35e8e49cd4024179db173f3dab2e6d1a5d037d35
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super(self.__class__, self).__init__() def forward(self, input, target): return torch.mean(torch.sum((input - target) ** 2, 1)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), tor...
BCELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class BCELoss(nn.Module): def __init__(self): super(self.__class__, self).__init__() def forward(self, input, target): return -torch.mean(torch.sum(target * torch.log(torch.clamp(input, min=1e-10)) + (1 - target) * torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
klovbe/UnsupervisedDeepLearning-Pytorch
BCELoss
false
7,046
[ "MIT" ]
1
35e8e49cd4024179db173f3dab2e6d1a5d037d35
https://github.com/klovbe/UnsupervisedDeepLearning-Pytorch/tree/35e8e49cd4024179db173f3dab2e6d1a5d037d35
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super(self.__class__, self).__init__() def forward(self, input, target): return -torch.mean(torch.sum(target * torch.log(torch.clamp(input, min=1e-10)) + (1 - target) * torch.lo...
MaxMarginCriterion
# 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 MaxMarginCriterion(nn.Module): def __init__(self, visual_rank_weight, lang_rank_weight, margin): super(MaxMarginCriterion, self).__init__() self.visual_rank = visual_rank_weight > 0 self.lang_rank = lang_rank_weight > 0 self.visual_rank_wei...
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...
kmario23/MAttNet
MaxMarginCriterion
false
7,047
[ "MIT" ]
1
0d66321eb5dc9c8523a5ebf45f608b0672b051ab
https://github.com/kmario23/MAttNet/tree/0d66321eb5dc9c8523a5ebf45f608b0672b051ab
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, visual_rank_weight, lang_rank_weight, margin): super().__init__() self.visual_rank = visual_rank_weight > 0 self.lang_rank = lang_rank_weight > 0 self.visual_rank_weight = visual_rank_weight self...
TanhTransform
# 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 def arctanh(x, eps=1e-06): """ Calculates the inverse hyperbolic tangent. """ x *= 1.0 - eps return torch.log((1 + x) / (1 - x)) * 0.5 class TanhTransform(nn.Module): """ Computes the tanh transform used to remove box constraints from C&W paper ...
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_...
knalbant/oppel
TanhTransform
false
7,048
[ "MIT" ]
1
03f840565ef64587ddb7a8b4145d8df7fb0279a3
https://github.com/knalbant/oppel/tree/03f840565ef64587ddb7a8b4145d8df7fb0279a3
import torch import torch.nn as nn def arctanh(x, eps=1e-06): """ Calculates the inverse hyperbolic tangent. """ x *= 1.0 - eps return torch.log((1 + x) / (1 - x)) * 0.5 class Model(nn.Module): """ Computes the tanh transform used to remove box constraints from C&W paper NOTE: T...
BCEFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class BCEFocalLoss(nn.Module): def __init__(self, alpha=0.25, gamma=2.0): super().__init__() self.alpha = alpha self.gamma = gamma def forward(self, preds, targets): bce_loss = nn.BCEWithLogitsLoss(reduction='none')(preds, targets) p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
koukyo1994/riadd-competition
BCEFocalLoss
false
7,049
[ "MIT" ]
1
0e399305aef21d40125cadccee55be1f0b310216
https://github.com/koukyo1994/riadd-competition/tree/0e399305aef21d40125cadccee55be1f0b310216
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, alpha=0.25, gamma=2.0): super().__init__() self.alpha = alpha self.gamma = gamma def forward(self, preds, targets): bce_loss = nn.BCEWithLogitsLoss(reduction='none')(preds, targets) probas =...
LSEPLoss
# 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 def lsep_loss_stable(input, target, average=True): n = input.size(0) differences = input.unsqueeze(1) - input.unsqueeze(2) where_lower = (target.unsqueeze(1) < target.unsqueeze(2)).float() differences = differences.view(n, -1) where_lower = where_lower.view(n, -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 ...
koukyo1994/riadd-competition
LSEPLoss
false
7,050
[ "MIT" ]
1
0e399305aef21d40125cadccee55be1f0b310216
https://github.com/koukyo1994/riadd-competition/tree/0e399305aef21d40125cadccee55be1f0b310216
import torch import torch.nn as nn def lsep_loss_stable(input, target, average=True): n = input.size(0) differences = input.unsqueeze(1) - input.unsqueeze(2) where_lower = (target.unsqueeze(1) < target.unsqueeze(2)).float() differences = differences.view(n, -1) where_lower = where_lower.view(n, -1...
SwaVLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from typing import List import torch.nn as nn @torch.no_grad() def sinkhorn(out: 'torch.Tensor', iterations: 'int'=3, epsilon: 'float'=0.05): """Distributed sinkhorn algorithm. As outlined in [0] and implemented in [1]. [0]: SwaV, 2020, https://arxiv.org/abs/...
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.functi...
jianzhnie/self_supervised
SwaVLoss
false
7,051
[ "Apache-2.0" ]
1
d1e0f31ab032150ab0ad007c1e19773135a5fb79
https://github.com/jianzhnie/self_supervised/tree/d1e0f31ab032150ab0ad007c1e19773135a5fb79
import torch import torch.nn.functional as F from typing import List import torch.nn as nn @torch.no_grad() def sinkhorn(out: 'torch.Tensor', iterations: 'int'=3, epsilon: 'float'=0.05): """Distributed sinkhorn algorithm. As outlined in [0] and implemented in [1]. [0]: SwaV, 2020, https://arxiv.org/abs/...
UNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.cuda import * def conv3x3(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True) def maxpool2x2(): return nn.MaxPoo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jabae/detectEM
UNet
false
7,052
[ "MIT" ]
1
2d1a5116164d0bed0a8ea767a227d05a8970a448
https://github.com/jabae/detectEM/tree/2d1a5116164d0bed0a8ea767a227d05a8970a448
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.cuda import * def conv3x3(in_channels, out_channels): return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=True) def maxpool2x2(): return nn.MaxPoo...
SoftEntropy
# 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 from torch.nn import * from torch.optim.lr_scheduler import * class SoftEntropy(nn.Module): def __init__(self): super(SoftEntropy, self).__init__() self.logsoftmax = nn.LogSoftmax(dim=1) def forward(self, inputs, targets): ...
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 f...
knifefield/uda-reid-contest
SoftEntropy
false
7,053
[ "MIT" ]
1
8b642cb4c5e63bb1dbfb07d0ac6dacdc26729e91
https://github.com/knifefield/uda-reid-contest/tree/8b642cb4c5e63bb1dbfb07d0ac6dacdc26729e91
import torch from torch import nn import torch.nn.functional as F from torch.nn import * from torch.optim.lr_scheduler import * class Model(nn.Module): def __init__(self): super().__init__() self.logsoftmax = nn.LogSoftmax(dim=1) def forward(self, inputs, targets): log_probs = self.l...
AugCNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F def apply_init_(modules): """ Initialize NN modules """ for m in modules: if isinstance(m, nn.Conv2d): nn.init.xavier_uniform_(m.weight) if m.bias is not None: nn.init.constant_(m.bi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn import functional as F assert_size_stride = ...
krg-nandu/prj-taxRL
AugCNN
false
7,054
[ "MIT" ]
1
be65d004c196aff73714dcb346c814ae97db30e2
https://github.com/krg-nandu/prj-taxRL/tree/be65d004c196aff73714dcb346c814ae97db30e2
import torch import torch.nn as nn from torch.nn import functional as F def apply_init_(modules): """ Initialize NN modules """ for m in modules: if isinstance(m, nn.Conv2d): nn.init.xavier_uniform_(m.weight) if m.bias is not None: nn.init.constant_(m.bi...
PSNRLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn.functional import mse_loss def psnr_loss(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float' ) ->torch.Tensor: """Function that computes PSNR See :class:`~kornia.losses.PSNR` for details. """ if not torch.is_tensor(input) or not torch.i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from t...
kshitij12345/kornia
PSNRLoss
false
7,055
[ "Apache-2.0" ]
1
4fcc9a570dfa38f67ec812c8fdfabe434b3e466e
https://github.com/kshitij12345/kornia/tree/4fcc9a570dfa38f67ec812c8fdfabe434b3e466e
import torch import torch.nn as nn from torch.nn.functional import mse_loss def psnr_loss(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float' ) ->torch.Tensor: """Function that computes PSNR See :class:`~kornia.losses.PSNR` for details. """ if not torch.is_tensor(input) or not torch.i...
SeparatedLoss
# 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 BCEFocalLoss(nn.Module): def __init__(self, alpha=0.25, gamma=2.0): super().__init__() self.alpha = alpha self.gamma = gamma def forward(self, preds, targets): bce_loss = nn.BCEWithLogitsLoss(reduction='none')(preds, targets) p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
koukyo1994/riadd-competition
SeparatedLoss
false
7,056
[ "MIT" ]
1
0e399305aef21d40125cadccee55be1f0b310216
https://github.com/koukyo1994/riadd-competition/tree/0e399305aef21d40125cadccee55be1f0b310216
import torch import torch.nn as nn class BCEFocalLoss(nn.Module): def __init__(self, alpha=0.25, gamma=2.0): super().__init__() self.alpha = alpha self.gamma = gamma def forward(self, preds, targets): bce_loss = nn.BCEWithLogitsLoss(reduction='none')(preds, targets) p...
MyNet
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.testing._internal.common_utils import * class MyNet(nn.Module): def __init__(self): super().__init__() self.elu = nn.ELU() def forward(self, x): return self.elu(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.testing._internal.common_utils import * assert...
LexcaliburR/notebook
MyNet
false
7,057
[ "MIT" ]
1
84a8f3801dff20d07caa0ed2584e722656fb5726
https://github.com/LexcaliburR/notebook/tree/84a8f3801dff20d07caa0ed2584e722656fb5726
import torch import torch.nn as nn from torch.testing._internal.common_utils import * class Model(nn.Module): def __init__(self): super().__init__() self.elu = nn.ELU() def forward(self, x): return self.elu(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_i...
TripletLoss
# 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 from torch.nn import * from torch.optim.lr_scheduler import * def _batch_hard(mat_distance, mat_similarity, indice=False): sorted_mat_distance, positive_indices = torch.sort(mat_distance + - 9999999.0 * (1 - mat_similarity), dim=1, descendi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
knifefield/uda-reid-contest
TripletLoss
false
7,058
[ "MIT" ]
1
8b642cb4c5e63bb1dbfb07d0ac6dacdc26729e91
https://github.com/knifefield/uda-reid-contest/tree/8b642cb4c5e63bb1dbfb07d0ac6dacdc26729e91
import torch from torch import nn import torch.nn.functional as F from torch.nn import * from torch.optim.lr_scheduler import * def _batch_hard(mat_distance, mat_similarity, indice=False): sorted_mat_distance, positive_indices = torch.sort(mat_distance + - 9999999.0 * (1 - mat_similarity), dim=1, descendi...
BinaryFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class BinaryFocalLoss(torch.nn.Module): """ from https://github.com/qubvel/segmentation_models""" def __init__(self, gamma=2.0, alpha=0.25, eps=1e-07): super().__init__() self.gamma = gamma self.alpha = alpha self.eps = eps def forward(self, pr, gt): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math assert_size_stride = t...
kungfuai/d3m-segmentation-research
BinaryFocalLoss
false
7,059
[ "MIT" ]
1
5bc44ddd0e8522fb2b369866ad47aa62a24a8f63
https://github.com/kungfuai/d3m-segmentation-research/tree/5bc44ddd0e8522fb2b369866ad47aa62a24a8f63
import torch class Model(torch.nn.Module): """ from https://github.com/qubvel/segmentation_models""" def __init__(self, gamma=2.0, alpha=0.25, eps=1e-07): super().__init__() self.gamma = gamma self.alpha = alpha self.eps = eps def forward(self, pr, gt): pr = torch...
PredictiveEntropy
# 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 class PredictiveEntropy(nn.Module): def __init__(self): super(PredictiveEntropy, self).__init__() def forward(self, x): b = F.softmax(x, dim=1) * F.log_softmax(x, dim=1) b = -1.0 * b.sum(dim=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 ...
kowshikthopalli/MULDENS
PredictiveEntropy
false
7,060
[ "MIT" ]
1
e2d5f8ec51024c5bdda6d1fcde4a96a3f31e6930
https://github.com/kowshikthopalli/MULDENS/tree/e2d5f8ec51024c5bdda6d1fcde4a96a3f31e6930
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): b = F.softmax(x, dim=1) * F.log_softmax(x, dim=1) b = -1.0 * b.sum(dim=1) return b def get_inputs(...
CalibrationModel
# 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 CalibrationModel(torch.nn.Module): """ Adds temperature scaling parameters to trained model""" def __init__(self): super().__init__() self.temperature = torch.nn.Parameter(torch.ones(1) * 1.5) def forward(self, logits, device=torch.device('cpu')): return logits...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
kungfuai/d3m-segmentation-research
CalibrationModel
false
7,061
[ "MIT" ]
1
5bc44ddd0e8522fb2b369866ad47aa62a24a8f63
https://github.com/kungfuai/d3m-segmentation-research/tree/5bc44ddd0e8522fb2b369866ad47aa62a24a8f63
import torch class Model(torch.nn.Module): """ Adds temperature scaling parameters to trained model""" def __init__(self): super().__init__() self.temperature = torch.nn.Parameter(torch.ones(1) * 1.5) def forward(self, logits, device=torch.device('cpu')): return logits / self.tem...
BasicBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F def apply_init_(modules): """ Initialize NN modules """ for m in modules: if isinstance(m, nn.Conv2d): nn.init.xavier_uniform_(m.weight) if m.bias is not None: nn.init.constant_(m.bi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
krg-nandu/prj-taxRL
BasicBlock
false
7,062
[ "MIT" ]
1
be65d004c196aff73714dcb346c814ae97db30e2
https://github.com/krg-nandu/prj-taxRL/tree/be65d004c196aff73714dcb346c814ae97db30e2
import torch import torch.nn as nn from torch.nn import functional as F def apply_init_(modules): """ Initialize NN modules """ for m in modules: if isinstance(m, nn.Conv2d): nn.init.xavier_uniform_(m.weight) if m.bias is not None: nn.init.constant_(m.bi...
Linear_2L_KFRA
# 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 sample_K_laplace_MN(MAP, upper_Qinv, lower_HHinv): Z = MAP.data.new(MAP.size()).normal_(mean=0, std=1) all_mtx_sample = MAP + torch.matmul(torch.matmul(lower_HHinv, Z), upper_Qinv) weight_mtx_sample = all_mtx_sample[:, :-1] bias_mt...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
kw-lee/Bayesian-Neural-Networks
Linear_2L_KFRA
false
7,063
[ "MIT" ]
1
3327fcf85e47c15d86c872211427bff133880c34
https://github.com/kw-lee/Bayesian-Neural-Networks/tree/3327fcf85e47c15d86c872211427bff133880c34
import torch import torch.nn as nn import torch.utils.data def sample_K_laplace_MN(MAP, upper_Qinv, lower_HHinv): Z = MAP.data.new(MAP.size()).normal_(mean=0, std=1) all_mtx_sample = MAP + torch.matmul(torch.matmul(lower_HHinv, Z), upper_Qinv) weight_mtx_sample = all_mtx_sample[:, :-1] bias_mt...
GaussianSubnetBlock
# 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 GaussianSubnetBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel, tanh=False): super().__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel, padding=1 if kernel > 1 else 0) self.activation = nn.Tanh() if...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
laitalaj/cvpce
GaussianSubnetBlock
false
7,064
[ "MIT" ]
1
7509e7d7783039f39a88edc6e411333bcf6fb2af
https://github.com/laitalaj/cvpce/tree/7509e7d7783039f39a88edc6e411333bcf6fb2af
import torch from torch import nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel, tanh=False): super().__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel, padding=1 if kernel > 1 else 0) self.activation = nn.Tanh() if tanh else nn....
Detector
# 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 Detector(nn.Module): def __init__(self): super(Detector, self).__init__() self.conv1 = nn.Conv2d(50, 50, 3, 1, 1) self.conv2 = nn.Conv2d(50, 50, 3, 1, 1) self.fc1 = nn.Linear(2 * 2 * 50, 50) self.fc2 =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ksivaman/observer-networks
Detector
false
7,065
[ "MIT" ]
1
a0cd540c762751c5500f714dc3979d3a62b9ea77
https://github.com/ksivaman/observer-networks/tree/a0cd540c762751c5500f714dc3979d3a62b9ea77
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(50, 50, 3, 1, 1) self.conv2 = nn.Conv2d(50, 50, 3, 1, 1) self.fc1 = nn.Linear(2 * 2 * 50, 50) self.fc2 = nn.Linear(50, 2)...
BahdanauAttention
# 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 import torch.utils.data from typing import * from torch.nn import Parameter import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class BaseAttention(nn.Module): """Base class for attention layers.""" 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, math as tl_math im...
lahiruts/espresso
BahdanauAttention
false
7,066
[ "MIT" ]
1
940a1bf3c2c3d4a057d543b875c329b0515e6b55
https://github.com/lahiruts/espresso/tree/940a1bf3c2c3d4a057d543b875c329b0515e6b55
import math import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data from typing import * from torch.nn import Parameter import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class BaseAttention(nn.Module): """Base class for attention layers.""" def ...
EncoderNO2
# 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 EncoderNO2(nn.Module): def __init__(self, D, H, M): super().__init__() self.D = D self.M = M self.H = H self.enc1 = nn.Linear(in_features=self.D, out_features=self.H) self.enc2 = nn.Linear(in_features=self.H, out_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 import triton_helpers from torch._inductor.runtime....
le0x99/deep-generative-modeling
EncoderNO2
false
7,067
[ "MIT" ]
1
40ffd1640dc3e5a6a2b4ba16a1d767034f081475
https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, D, H, M): super().__init__() self.D = D self.M = M self.H = H self.enc1 = nn.Linear(in_features=self.D, out_features=self.H) self.enc2 = nn.Linear(in_features=self.H, out_features=self.M ...
Decoder2
# 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 Decoder2(nn.Module): def __init__(self, M, H, D): super().__init__() self.D = D self.M = M self.H = H self.dec1 = nn.Linear(in_features=self.M, out_features=self.H * 2) self.dec2 = nn.Linear(in_features=self.H * 2, out_featu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
le0x99/deep-generative-modeling
Decoder2
false
7,068
[ "MIT" ]
1
40ffd1640dc3e5a6a2b4ba16a1d767034f081475
https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, M, H, D): super().__init__() self.D = D self.M = M self.H = H self.dec1 = nn.Linear(in_features=self.M, out_features=self.H * 2) self.dec2 = nn.Linear(in_features=self.H * 2, out_features...
InnerProductDecoder
# 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 InnerProductDecoder(nn.Module): def __init__(self, activation=torch.sigmoid, dropout=0.1): super().__init__() self.dropout = dropout self.activation = activation def forward(self, z): z = F.dropout(z, se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
leiyu-thunder/gae_dgl
InnerProductDecoder
false
7,069
[ "Apache-2.0" ]
1
c743acc96e24c4ca3ae72d08956381f302b373bd
https://github.com/leiyu-thunder/gae_dgl/tree/c743acc96e24c4ca3ae72d08956381f302b373bd
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, activation=torch.sigmoid, dropout=0.1): super().__init__() self.dropout = dropout self.activation = activation def forward(self, z): z = F.dropout(z, self.dropout) ...
NN_logsoftmax
# 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 NN_logsoftmax(nn.Module): """Build a new class for the network you want to run, returning log softmax""" def set_parameters(self, initializers): """Set the parameter values obtained from vanilla NN as initializers""" ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
laravomfell/tvd_loss
NN_logsoftmax
false
7,070
[ "MIT" ]
1
b30a925f95985a03ff70bfa40a6ec3662432779d
https://github.com/laravomfell/tvd_loss/tree/b30a925f95985a03ff70bfa40a6ec3662432779d
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """Build a new class for the network you want to run, returning log softmax""" def set_parameters(self, initializers): """Set the parameter values obtained from vanilla NN as initializers""" with to...
Decoder
# 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 Decoder(nn.Module): def __init__(self, M, H, D): super().__init__() self.D = D self.M = M self.H = H self.dec1 = nn.Linear(in_features=self.M, out_features=self.H) self.dec2 = nn.Linear(in_features=self.H, out_features=self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
le0x99/deep-generative-modeling
Decoder
false
7,071
[ "MIT" ]
1
40ffd1640dc3e5a6a2b4ba16a1d767034f081475
https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, M, H, D): super().__init__() self.D = D self.M = M self.H = H self.dec1 = nn.Linear(in_features=self.M, out_features=self.H) self.dec2 = nn.Linear(in_features=self.H, out_features=self.H)...
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 class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv2d(1, 32, kernel_size=5) self.conv2 = nn.Conv2d(32, 32, kernel_size=5) self.conv3 = nn.Conv2d(32, 64, kernel_size=5) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
krishnachaitanya7/Manifolk
CNN
false
7,072
[ "MIT" ]
1
779a044af8ce82c913957ce341b9c9f2f1d1e815
https://github.com/krishnachaitanya7/Manifolk/tree/779a044af8ce82c913957ce341b9c9f2f1d1e815
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 32, kernel_size=5) self.conv2 = nn.Conv2d(32, 32, kernel_size=5) self.conv3 = nn.Conv2d(32, 64, kernel_size=5) self.f...
NetPart1
# 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 import torch.nn.parallel import torch.optim import torch.utils.data.distributed class NetPart1(nn.Module): def __init__(self): super(NetPart1, self).__init__() d1 = 768 self.conv1 = nn.Conv2d(1, d1,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
lancelee82/necklace
NetPart1
false
7,073
[ "MIT" ]
1
7a7cfbc05284c1a7ae0a923c8b9a3efdd0037579
https://github.com/lancelee82/necklace/tree/7a7cfbc05284c1a7ae0a923c8b9a3efdd0037579
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data import torch.nn.parallel import torch.optim import torch.utils.data.distributed class Model(nn.Module): def __init__(self): super().__init__() d1 = 768 self.conv1 = nn.Conv2d(1, d1, 3, 1) se...
Encoder
# 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 Encoder(nn.Module): def __init__(self, D, H, M): super().__init__() self.D = D self.M = M self.H = H self.enc1 = nn.Linear(in_features=self.D, out_features=self.H) self.enc2 = nn.Linear(in_features=self.H, out_features=self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
le0x99/deep-generative-modeling
Encoder
false
7,074
[ "MIT" ]
1
40ffd1640dc3e5a6a2b4ba16a1d767034f081475
https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, D, H, M): super().__init__() self.D = D self.M = M self.H = H self.enc1 = nn.Linear(in_features=self.D, out_features=self.H) self.enc2 = nn.Linear(in_features=self.H, out_features=self.H)...
Invertible1x1Conv
# 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.autograd import Variable import torch.utils.data import torch.nn class Invertible1x1Conv(torch.nn.Module): """ The layer outputs both the convolution, and the log determinant of its weight matrix. If reverse=True it does convolution with inverse...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.functional as F from torch.autograd import Variable import torch...
leo0519/TensorRT
Invertible1x1Conv
false
7,075
[ "Apache-2.0" ]
1
498dcb009fe4c2dedbe9c61044d3de4f3c04a41b
https://github.com/leo0519/TensorRT/tree/498dcb009fe4c2dedbe9c61044d3de4f3c04a41b
import torch import torch.nn.functional as F from torch.autograd import Variable import torch.utils.data import torch.nn class Model(torch.nn.Module): """ The layer outputs both the convolution, and the log determinant of its weight matrix. If reverse=True it does convolution with inverse """ ...
NN_softmax
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class NN_logsoftmax(nn.Module): """Build a new class for the network you want to run, returning log softmax""" def set_parameters(self, initializers): """Set the parameter values obtained from vanilla NN as initializers""" ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
laravomfell/tvd_loss
NN_softmax
false
7,076
[ "MIT" ]
1
b30a925f95985a03ff70bfa40a6ec3662432779d
https://github.com/laravomfell/tvd_loss/tree/b30a925f95985a03ff70bfa40a6ec3662432779d
import torch from torch import nn import torch.nn.functional as F class NN_logsoftmax(nn.Module): """Build a new class for the network you want to run, returning log softmax""" def set_parameters(self, initializers): """Set the parameter values obtained from vanilla NN as initializers""" ...
_ShiftedSoftPlus
# 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.jit import torch.nn.functional import torch.nn class _ShiftedSoftPlus(torch.nn.Module): """ Shifted softplus as defined in SchNet, NeurIPS 2017. :param beta: value for the a more general softplus, default = 1 :param threshold: values above are linear function, de...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import math import torch.jit import torch.nn.functional import...
leoil/nequip
_ShiftedSoftPlus
false
7,077
[ "MIT" ]
1
83b888797025c94b9963a508bc213a7c98da5bcb
https://github.com/leoil/nequip/tree/83b888797025c94b9963a508bc213a7c98da5bcb
import math import torch import torch.jit import torch.nn.functional import torch.nn class Model(torch.nn.Module): """ Shifted softplus as defined in SchNet, NeurIPS 2017. :param beta: value for the a more general softplus, default = 1 :param threshold: values above are linear function, default = 20 ...
BesselBasis
# 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.jit import torch.nn.functional from torch import nn import torch.nn class BesselBasis(nn.Module): r_max: 'float' prefactor: 'float' def __init__(self, r_max, num_basis=8, trainable=True): """Radial Bessel Basis, as proposed in DimeNet: https://arxiv.org/abs/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 math as tl_math import math import torch.jit import torch.nn.functional from torch import...
leoil/nequip
BesselBasis
false
7,078
[ "MIT" ]
1
83b888797025c94b9963a508bc213a7c98da5bcb
https://github.com/leoil/nequip/tree/83b888797025c94b9963a508bc213a7c98da5bcb
import math import torch import torch.jit import torch.nn.functional from torch import nn import torch.nn class Model(nn.Module): r_max: 'float' prefactor: 'float' def __init__(self, r_max, num_basis=8, trainable=True): """Radial Bessel Basis, as proposed in DimeNet: https://arxiv.org/abs/2003.03...
Decoder3
# 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 Decoder3(nn.Module): def __init__(self, M, H, D): super().__init__() self.D = D self.M = M self.H = H self.dec1 = nn.Linear(in_features=self.M, out_features=self.H) self.dec2 = nn.Linear(in_features=self.H, out_features=self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
le0x99/deep-generative-modeling
Decoder3
false
7,079
[ "MIT" ]
1
40ffd1640dc3e5a6a2b4ba16a1d767034f081475
https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, M, H, D): super().__init__() self.D = D self.M = M self.H = H self.dec1 = nn.Linear(in_features=self.M, out_features=self.H) self.dec2 = nn.Linear(in_features=self.H, out_features=self.H ...
GainesMul
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class GainesMul(torch.nn.Module): """ this module is for Gaines stochastic multiplication, supporting unipolar/bipolar """ def __init__(self, mode='bipolar', stype=torch.float): super(GainesMul, self).__init__() self.mode = mode self.stype = stype def UnaryMu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
libingzheren/Stochastic_Computing
GainesMul
false
7,080
[ "MIT" ]
1
c02461454618e9ce0c86ce695fad9e95d1ca5e00
https://github.com/libingzheren/Stochastic_Computing/tree/c02461454618e9ce0c86ce695fad9e95d1ca5e00
import torch class Model(torch.nn.Module): """ this module is for Gaines stochastic multiplication, supporting unipolar/bipolar """ def __init__(self, mode='bipolar', stype=torch.float): super().__init__() self.mode = mode self.stype = stype def UnaryMul_forward(self, inp...
Encoder3
# 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 Encoder3(nn.Module): def __init__(self, D, H, M): super().__init__() self.D = D self.M = M self.H = H self.enc1 = nn.Linear(in_features=self.D, out_features=self.H * 2) self.enc2 = nn.Linear(in_features=self.H * 2, out_featu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
le0x99/deep-generative-modeling
Encoder3
false
7,081
[ "MIT" ]
1
40ffd1640dc3e5a6a2b4ba16a1d767034f081475
https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, D, H, M): super().__init__() self.D = D self.M = M self.H = H self.enc1 = nn.Linear(in_features=self.D, out_features=self.H * 2) self.enc2 = nn.Linear(in_features=self.H * 2, out_features...
ProtectedMultiheadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data from torch.nn import Parameter import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class ProtectedMultiheadAttention(nn.Module): """Multi-headed attention. See "Attention Is All You Need" for...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
laiguokun/fairseq
ProtectedMultiheadAttention
false
7,082
[ "MIT" ]
1
6c01c91aac81eb2e3173add4463dfa45c404ffa5
https://github.com/laiguokun/fairseq/tree/6c01c91aac81eb2e3173add4463dfa45c404ffa5
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data from torch.nn import Parameter import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Model(nn.Module): """Multi-headed attention. See "Attention Is All You Need" for more details. """...
CustomGruCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class CustomGruCell(nn.Module): """ A forward only GRU cell. Input should be: (sequence length x batch size x input_size). The output is the output of the final forward call. It's not clear if it would be possible to use the output from each ce...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
li4112/PySyft
CustomGruCell
false
7,083
[ "Apache-2.0" ]
1
e593cad25d6831623e6a2b6d34bcb04adcbe00f9
https://github.com/li4112/PySyft/tree/e593cad25d6831623e6a2b6d34bcb04adcbe00f9
import torch import numpy as np import torch.nn as nn class Model(nn.Module): """ A forward only GRU cell. Input should be: (sequence length x batch size x input_size). The output is the output of the final forward call. It's not clear if it would be possible to use the output from each cell in a ...
MNIST_FC
# 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 MNIST_FC(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(28 * 28, 32) self.fc2 = nn.Linear(32, 10) def forward(self, xb): xb = xb.view(-1, 28 * 28) xb = F.relu(self.fc1(xb...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lihebi/AdvAE
MNIST_FC
false
7,084
[ "MIT" ]
1
56dea2a33c7da64bcc577b0c061a38406fdde101
https://github.com/lihebi/AdvAE/tree/56dea2a33c7da64bcc577b0c061a38406fdde101
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(28 * 28, 32) self.fc2 = nn.Linear(32, 10) def forward(self, xb): xb = xb.view(-1, 28 * 28) xb = F.relu(self.fc1(xb)) ...
SpatialAttentionModule
# 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 SpatialAttentionModule(nn.Module): def __init__(self): super(SpatialAttentionModule, self).__init__() self.conv2d = nn.Conv2d(in_channels=2, out_channels=1, kernel_size= 7, stride=1, padding=3) self.sigmoid = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
lidawei0124/ISD_yolo_dual
SpatialAttentionModule
false
7,085
[ "Apache-2.0" ]
1
a4617a6ad20b3988f3b422df7a1b8533e32e241b
https://github.com/lidawei0124/ISD_yolo_dual/tree/a4617a6ad20b3988f3b422df7a1b8533e32e241b
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.conv2d = nn.Conv2d(in_channels=2, out_channels=1, kernel_size= 7, stride=1, padding=3) self.sigmoid = nn.Sigmoid() def forward(self, x): ...
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 from torch import nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.fc1 = nn.Linear(28 * 28, 512) self.fc2 = nn.Linear(512, 512) self.fc3 = nn.Linear(512, 10) self.droput = nn.Dropout(0.2) def fo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
liguodongIOT/nlp-app-samples
Net
false
7,086
[ "Apache-2.0" ]
1
e0cc747e88c7b5c701b5099462d2dd6277c23381
https://github.com/liguodongIOT/nlp-app-samples/tree/e0cc747e88c7b5c701b5099462d2dd6277c23381
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(28 * 28, 512) self.fc2 = nn.Linear(512, 512) self.fc3 = nn.Linear(512, 10) self.droput = nn.Dropout(0.2) def forward(s...
Attention_ElementWiseProduct
# 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 Attention_ElementWiseProduct(nn.Module): """ Input: behavior: 3D tensor with shape: ``(batch_size,field_size,embedding_size)``. candidate: 3D tensor with shape: ``(batch_size,1,embedding_size)``. Output: ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
liangzhang-lz/SparrowRecSys
Attention_ElementWiseProduct
false
7,087
[ "Apache-2.0" ]
1
9fe1a27d3903117e6e2b5487c0689c0bd9281473
https://github.com/liangzhang-lz/SparrowRecSys/tree/9fe1a27d3903117e6e2b5487c0689c0bd9281473
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Input: behavior: 3D tensor with shape: ``(batch_size,field_size,embedding_size)``. candidate: 3D tensor with shape: ``(batch_size,1,embedding_size)``. Output: attention_weight: ...
AlexNet
# 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 LRN(nn.Module): """ Local Response Normalization """ def __init__(self, kernel_size, alpha, beta): super(LRN, self).__init__() self.avg_pool = nn.AvgPool2d(kernel_size=kernel_size, stride=1, padding=int(kernel_size / 2)) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jjeamin/obJDetection
AlexNet
false
7,088
[ "MIT" ]
1
eb7fbc410beb00fad1a6477e827e9ce2d8efbac5
https://github.com/jjeamin/obJDetection/tree/eb7fbc410beb00fad1a6477e827e9ce2d8efbac5
import torch import torch.nn as nn class LRN(nn.Module): """ Local Response Normalization """ def __init__(self, kernel_size, alpha, beta): super().__init__() self.avg_pool = nn.AvgPool2d(kernel_size=kernel_size, stride=1, padding=int(kernel_size / 2)) self.alpha =...
AttentionConv
# 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.nn.init as init class AttentionConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, groups=1, bias=False): super(AttentionConv, self).__init__() self.out_channels = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
likui01/DRFuser
AttentionConv
false
7,089
[ "MIT" ]
1
06539a6fa9203b1e9dc9d4d944cfcd5f7603f5e9
https://github.com/likui01/DRFuser/tree/06539a6fa9203b1e9dc9d4d944cfcd5f7603f5e9
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, groups=1, bias=False): super().__init__() self.out_channels = out_channels self.k...
Split
# 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 Split(nn.Module): def __init__(self): super(Split, self).__init__() def forward(self, x): n = int(x.size(1) / 2) x1 = x[:, :n, :, :].contiguous() x2 = x[:, n:, :, :].contiguous() return x1, x2 def inverse(self, x1, x2): ...
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...
lingzenan/invertible-resnet
Split
false
7,090
[ "MIT" ]
1
57b1c0de51a885aed074b77628f3b0c85c548e70
https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): n = int(x.size(1) / 2) x1 = x[:, :n, :, :].contiguous() x2 = x[:, n:, :, :].contiguous() return x1, x2 def inverse(self, x1, x2): retur...
squeeze
# 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 squeeze(nn.Module): def __init__(self, block_size): super(squeeze, self).__init__() self.block_size = block_size self.block_size_sq = block_size * block_size def inverse(self, input): output = input.permute(0, 2, 3, 1) batch_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
lingzenan/invertible-resnet
squeeze
false
7,091
[ "MIT" ]
1
57b1c0de51a885aed074b77628f3b0c85c548e70
https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, block_size): super().__init__() self.block_size = block_size self.block_size_sq = block_size * block_size def inverse(self, input): output = input.permute(0, 2, 3, 1) batch_size, d_height, d...
Conv2dZeroInit
# 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 Conv2dZeroInit(nn.Conv2d): def __init__(self, channels_in, channels_out, filter_size, stride=1, padding=0, logscale=3.0): super().__init__(channels_in, channels_out, filter_size, stride= stride, padding=padding) self.register_parameter(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
lingzenan/invertible-resnet
Conv2dZeroInit
false
7,092
[ "MIT" ]
1
57b1c0de51a885aed074b77628f3b0c85c548e70
https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70
import torch import torch.nn as nn class Model(nn.Conv2d): def __init__(self, channels_in, channels_out, filter_size, stride=1, padding=0, logscale=3.0): super().__init__(channels_in, channels_out, filter_size, stride= stride, padding=padding) self.register_parameter('logs', n...
DQN
# 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 DQN(nn.Module): def __init__(self, observation_size, action_size, H1=200, H2=160, H3= 120, H4=60): """ :param observation_size: Size of belief as defined in belief_agent.py :param action_size: Model has 1 out...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
lilianluong/multitask-card-games
DQN
false
7,093
[ "MIT" ]
1
ae32e85583c61cc27a44946a6b5fa7c1e2c152ff
https://github.com/lilianluong/multitask-card-games/tree/ae32e85583c61cc27a44946a6b5fa7c1e2c152ff
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, observation_size, action_size, H1=200, H2=160, H3= 120, H4=60): """ :param observation_size: Size of belief as defined in belief_agent.py :param action_size: Model has 1 o...
MaxMinGroup
# 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 def process_maxmin_groupsize(x, group_size, axis=-1): size = list(x.size()) num_channels = size[axis] if num_channels % group_size: raise ValueError( 'number of features({}) is not a multiple of group_size({})'. format(num_channels, num_un...
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...
lingzenan/invertible-resnet
MaxMinGroup
false
7,094
[ "MIT" ]
1
57b1c0de51a885aed074b77628f3b0c85c548e70
https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70
import torch import torch.nn as nn def process_maxmin_groupsize(x, group_size, axis=-1): size = list(x.size()) num_channels = size[axis] if num_channels % group_size: raise ValueError( 'number of features({}) is not a multiple of group_size({})'. format(num_channels, num_un...
SpatialGate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.utils.data from itertools import product as product from math import sqrt as sqrt class SpatialGate(nn.Module): def __init__(self, in_channels: 'int', num_groups: 'int'=1, kernel_size: 'int'=1, padding: 'int'=0, stride: 'int'=1, gate_activation:...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
lingtengqiu/LearnableTreeFilterV2
SpatialGate
false
7,095
[ "Apache-2.0" ]
1
3814a5a84c0a5c33d6538749eaf5aed4827366de
https://github.com/lingtengqiu/LearnableTreeFilterV2/tree/3814a5a84c0a5c33d6538749eaf5aed4827366de
import math import torch import torch.nn as nn import torch.utils.data from itertools import product as product from math import sqrt as sqrt class Model(nn.Module): def __init__(self, in_channels: 'int', num_groups: 'int'=1, kernel_size: 'int'=1, padding: 'int'=0, stride: 'int'=1, gate_activation: 'str'...
ClassificationCircleLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data from typing import Tuple from torch.nn.functional import cross_entropy from itertools import product as product from math import sqrt as sqrt class ClassificationCircleLoss(nn.Module): """Circle loss for class-level labels as described in the paper `"...
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 ...
lingtengqiu/LearnableTreeFilterV2
ClassificationCircleLoss
false
7,096
[ "Apache-2.0" ]
1
3814a5a84c0a5c33d6538749eaf5aed4827366de
https://github.com/lingtengqiu/LearnableTreeFilterV2/tree/3814a5a84c0a5c33d6538749eaf5aed4827366de
import torch import torch.nn as nn import torch.utils.data from typing import Tuple from torch.nn.functional import cross_entropy from itertools import product as product from math import sqrt as sqrt class Model(nn.Module): """Circle loss for class-level labels as described in the paper `"Circle Loss: A Unif...
MeanVarFC
# 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 MeanVarFC(nn.Module): def __init__(self, input_shape): super(MeanVarFC, self).__init__() shape = list(input_shape) shape[0] = 1 shape[1] *= 2 self.param = nn.Parameter(0.01 * torch.randn(shape)) def forward(self, x): x ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
lingzenan/invertible-resnet
MeanVarFC
false
7,097
[ "MIT" ]
1
57b1c0de51a885aed074b77628f3b0c85c548e70
https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_shape): super().__init__() shape = list(input_shape) shape[0] = 1 shape[1] *= 2 self.param = nn.Parameter(0.01 * torch.randn(shape)) def forward(self, x): x = x + self.param ...
SeparableConvBlock
# 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.utils.data import torch.nn.functional as F from itertools import product as product from math import sqrt as sqrt class Conv2dSamePadding(torch.nn.Conv2d): """ A wrapper around :class:`torch.nn.Conv2d` to support "SAME" padding mode and more features. """ def __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 import math import torch.utils.data import torch.nn.functional as F from itertoo...
lingtengqiu/LearnableTreeFilterV2
SeparableConvBlock
false
7,098
[ "Apache-2.0" ]
1
3814a5a84c0a5c33d6538749eaf5aed4827366de
https://github.com/lingtengqiu/LearnableTreeFilterV2/tree/3814a5a84c0a5c33d6538749eaf5aed4827366de
import math import torch import torch.utils.data import torch.nn.functional as F from itertools import product as product from math import sqrt as sqrt class Conv2dSamePadding(torch.nn.Conv2d): """ A wrapper around :class:`torch.nn.Conv2d` to support "SAME" padding mode and more features. """ def __i...
MultiHeadAttention
# 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 numpy as np from torch import nn class MultiHeadAttention(nn.Module): def __init__(self, n_heads, input_dim, embed_dim, val_dim=None, key_dim =None): super(MultiHeadAttention, self).__init__() if val_dim is None: val_dim = embed_dim // n_heads ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lin-bo/RL_back2depot_VRP
MultiHeadAttention
false
7,099
[ "MIT" ]
1
2a159d1df221ff314d98d79b8fde2b739a454ff7
https://github.com/lin-bo/RL_back2depot_VRP/tree/2a159d1df221ff314d98d79b8fde2b739a454ff7
import math import torch import numpy as np from torch import nn class Model(nn.Module): def __init__(self, n_heads, input_dim, embed_dim, val_dim=None, key_dim =None): super().__init__() if val_dim is None: val_dim = embed_dim // n_heads if key_dim is None: ...
EDMLoss
# 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.optim class EDMLoss(nn.Module): def __init__(self): super(EDMLoss, self).__init__() def forward(self, p_target: 'torch.Tensor', p_estimate: 'torch.Tensor'): assert p_target.shape == p_estimate.shape cdf_target = torch.cumsum(p_target, 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 from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
lishiyu0088/Neural_Bradley-Terry
EDMLoss
false
7,100
[ "MIT" ]
1
ea2108267cf24c1fcfdf432e70810283d90495af
https://github.com/lishiyu0088/Neural_Bradley-Terry/tree/ea2108267cf24c1fcfdf432e70810283d90495af
import torch import torch.nn as nn import torch.optim class Model(nn.Module): def __init__(self): super().__init__() def forward(self, p_target: 'torch.Tensor', p_estimate: 'torch.Tensor'): assert p_target.shape == p_estimate.shape cdf_target = torch.cumsum(p_target, dim=1) c...
ActNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter import Parameter class ActNorm(nn.Module): def __init__(self, num_channels, eps=1e-05): super(ActNorm, self).__init__() self.eps = eps self.num_channels = num_channels self._log_scale = Param...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn from torch.nn import Parameter from torch.nn.parame...
lingzenan/invertible-resnet
ActNorm
false
7,101
[ "MIT" ]
1
57b1c0de51a885aed074b77628f3b0c85c548e70
https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70
import torch import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, num_channels, eps=1e-05): super().__init__() self.eps = eps self.num_channels = num_channels self._log_scale = Parameter(torch.Tens...
ActNorm2D
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter import Parameter class ActNorm2D(nn.Module): def __init__(self, num_channels, eps=1e-05): super(ActNorm2D, self).__init__() self.eps = eps self.num_channels = num_channels self._log_scale = P...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn from torch.nn import Parameter from torch.nn.parame...
lingzenan/invertible-resnet
ActNorm2D
false
7,102
[ "MIT" ]
1
57b1c0de51a885aed074b77628f3b0c85c548e70
https://github.com/lingzenan/invertible-resnet/tree/57b1c0de51a885aed074b77628f3b0c85c548e70
import torch import torch.nn as nn from torch.nn import Parameter from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, num_channels, eps=1e-05): super().__init__() self.eps = eps self.num_channels = num_channels self._log_scale = Parameter(torch.Tens...
SigmoidFocalClassificationLoss
# 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 def _sigmoid_cross_entropy_with_logits(logits, labels): loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits) loss += torch.log1p(torch.exp(-torch.abs(logits))) return loss class SigmoidFocalClassificationLoss(nn.Module): """Sigmoid focal cross entrop...
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...
liuhuaijjin/rpn_rois_proposals_layers
SigmoidFocalClassificationLoss
false
7,103
[ "MIT" ]
1
c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
import torch import torch.nn as nn def _sigmoid_cross_entropy_with_logits(logits, labels): loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits) loss += torch.log1p(torch.exp(-torch.abs(logits))) return loss class Model(nn.Module): """Sigmoid focal cross entropy loss. Focal loss ...
GAT
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super(GraphAttentionLay...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
leiloong/PaperRobot
GAT
false
7,104
[ "MIT" ]
1
070972dc1548571c28d89d2c54fb379e87d172c7
https://github.com/leiloong/PaperRobot/tree/070972dc1548571c28d89d2c54fb379e87d172c7
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super().__init__() ...
DiceLoss
# 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 DiceLoss(nn.Module): def __init__(self, ignore_target=-1): super().__init__() self.ignore_target = ignore_target def forward(self, input, target): """ :param input: (N), logit :param target: (N), {0, 1} :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...
liuhuaijjin/rpn_rois_proposals_layers
DiceLoss
false
7,105
[ "MIT" ]
1
c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, ignore_target=-1): super().__init__() self.ignore_target = ignore_target def forward(self, input, target): """ :param input: (N), logit :param target: (N), {0, 1} :return: ""...
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 torch import torch.nn as nn class SmoothL1Loss(nn.Module): def __init__(self, beta=1.0, reduction='mean'): super().__init__() self.beta = beta self.reduction = reduction def forward(self, pred, target, weight=None): assert pred.size() == target.size() and target.numel(...
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...
liuhuaijjin/rpn_rois_proposals_layers
SmoothL1Loss
false
7,106
[ "MIT" ]
1
c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, beta=1.0, reduction='mean'): super().__init__() self.beta = beta self.reduction = reduction def forward(self, pred, target, weight=None): assert pred.size() == target.size() and target.numel() > 0 ...
LR_PAD
# 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 def lr_pad(x, padding=1): return torch.cat([x[..., -padding:], x, x[..., :padding]], dim=3) class LR_PAD(nn.Module): def __init__(self, padding=1): super(LR_PAD, self).__init__() self.padding = padding def forward(self, x): return lr_pad(x, sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
lixuran/Room_Layout_Estimation_new
LR_PAD
false
7,107
[ "MIT" ]
1
8e73b66e1418675e5bb82f3780091c406fe721d8
https://github.com/lixuran/Room_Layout_Estimation_new/tree/8e73b66e1418675e5bb82f3780091c406fe721d8
import torch from torch import nn def lr_pad(x, padding=1): return torch.cat([x[..., -padding:], x, x[..., :padding]], dim=3) class Model(nn.Module): def __init__(self, padding=1): super().__init__() self.padding = padding def forward(self, x): return lr_pad(x, self.padding) ...
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...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import * class Attention(nn.Module): def __init__(self, opt): super(Attention, self).__init__() self.rnn_size = opt.rnn_size self.att_hid_size = opt.att_hid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
liuqihan/NeuralBabyTalk
Attention
false
7,108
[ "MIT" ]
1
4a2ef428ec9f251a1eb898cc0c828a6ef1c55e69
https://github.com/liuqihan/NeuralBabyTalk/tree/4a2ef428ec9f251a1eb898cc0c828a6ef1c55e69
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import * class Model(nn.Module): def __init__(self, opt): super().__init__() self.rnn_size = opt.rnn_size self.att_hid_size = opt.att_hid_size self....
RewardCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.autograd import * class RewardCriterion(nn.Module): def __init__(self): super(RewardCriterion, self).__init__() def forward(self, input, seq, reward): input = input.gather(2, seq.unsqueeze(2)).squeeze(2) input = input.reshape(-1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.autograd import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
linzhlalala/self-critical.pytorch
RewardCriterion
false
7,109
[ "MIT" ]
1
b856250ac52ba63656b1b03cdc3d7e830ed43f68
https://github.com/linzhlalala/self-critical.pytorch/tree/b856250ac52ba63656b1b03cdc3d7e830ed43f68
import torch import torch.nn as nn from torch.autograd import * class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input, seq, reward): input = input.gather(2, seq.unsqueeze(2)).squeeze(2) input = input.reshape(-1) reward = reward.reshape(-1) ...
MaskLoss
# 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.hub class MaskLoss(nn.Module): def __init__(self, size_average=None, reduce=None, reduction='mean'): super(MaskLoss, self).__init__() self.reduction = reduction def forward(self, input, target): N, _W = input.size() torch.min(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 libdevice, math as tl_math import torc...
lisadunlap/explainable-nbdt
MaskLoss
false
7,110
[ "MIT" ]
1
e045bfd0b55b21fd87c9a233b73a0ca77672efff
https://github.com/lisadunlap/explainable-nbdt/tree/e045bfd0b55b21fd87c9a233b73a0ca77672efff
import torch import torch.nn as nn import torch.hub class Model(nn.Module): def __init__(self, size_average=None, reduce=None, reduction='mean'): super().__init__() self.reduction = reduction def forward(self, input, target): N, _W = input.size() torch.min(input, target) ...
rbbox_corners_aligned
# 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 rbbox_corners_aligned(nn.Module): def _init_(self, gboxes): super(rbbox_corners_aligned, self)._init_() self.corners_gboxes = gboxes return def forward(ctx, gboxes): """ There is no rotation performed here. As axis are alig...
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...
liuhuaijjin/rpn_rois_proposals_layers
rbbox_corners_aligned
false
7,111
[ "MIT" ]
1
c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
import torch import torch.nn as nn class Model(nn.Module): def _init_(self, gboxes): super(rbbox_corners_aligned, self)._init_() self.corners_gboxes = gboxes return def forward(ctx, gboxes): """ There is no rotation performed here. As axis are aligned. ...
SpatialAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data from torch import nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=3): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data from ...
ljjyxz123/CenterMask
SpatialAttention
false
7,112
[ "BSD-2-Clause" ]
1
443eebde30e209eeb3b953f7ef35d3f7f14aaca5
https://github.com/ljjyxz123/CenterMask/tree/443eebde30e209eeb3b953f7ef35d3f7f14aaca5
import torch import torch.utils.data from torch import nn class Model(nn.Module): def __init__(self, kernel_size=3): super().__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv = nn.Conv2d(2, 1, kernel_size, paddin...
coRNNCell
# 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.utils class coRNNCell(nn.Module): def __init__(self, n_inp, n_hid, dt, gamma, epsilon): super(coRNNCell, self).__init__() self.dt = dt self.gamma = gamma self.epsilon = epsilon self.i2h = nn.Linear(n_inp + n_hid + n_hid, n_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
lkampoli/coRNN
coRNNCell
false
7,113
[ "MIT" ]
1
c9c2edfebab289f3053eb48030f273e4b977a187
https://github.com/lkampoli/coRNN/tree/c9c2edfebab289f3053eb48030f273e4b977a187
import torch from torch import nn import torch.nn.utils class Model(nn.Module): def __init__(self, n_inp, n_hid, dt, gamma, epsilon): super().__init__() self.dt = dt self.gamma = gamma self.epsilon = epsilon self.i2h = nn.Linear(n_inp + n_hid + n_hid, n_hid) def forwa...
CatCombine
# 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 class CatCombine(nn.Module): def __init__(self, C): super(CatCombine, self).__init__() self.compress = nn.Linear(C * 2, C) def forward(self, x, y): return self.compress(torch.cat((x, y), dim=-1)) def get_inputs(): return [to...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils assert_size_stride = torch._C._dynamo.g...
lorylei/DARTS-et
CatCombine
false
7,114
[ "Apache-2.0" ]
1
f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
https://github.com/lorylei/DARTS-et/tree/f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
import torch import torch.nn as nn import torch.utils class Model(nn.Module): def __init__(self, C): super().__init__() self.compress = nn.Linear(C * 2, C) def forward(self, x, y): return self.compress(torch.cat((x, y), dim=-1)) def get_inputs(): return [torch.rand([4, 4, 4, 4]...
FBANKNormalizer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.utils.data class FBANKNormalizer(torch.nn.Module): def __init__(self, config): super(FBANKNormalizer, self).__init__() self.num_mel_bins = config.num_mel_bins self.weight = torch.nn.Parameter(torch.tensor([1 / 10] * s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
lorenlugosch/autoregressive-models
FBANKNormalizer
false
7,115
[ "Apache-2.0" ]
1
2c50bc331d3b68cc7144f7456591bbc2321cc658
https://github.com/lorenlugosch/autoregressive-models/tree/2c50bc331d3b68cc7144f7456591bbc2321cc658
from _paritybench_helpers import _mock_config import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, config): super().__init__() self.num_mel_bins = config.num_mel_bins self.weight = torch.nn.Parameter(torch.tensor([1 / 10] * self. num_mel_bins))...
CNNLayerNorm
# 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 CNNLayerNorm(nn.Module): """Layer normalization built for cnns input""" def __init__(self, n_feats: 'int'): super(CNNLayerNorm, self).__init__() self.layer_norm = nn.LayerNorm(n_feats) def forward(self, x: 'torch.tensor') ->torch.tensor: x...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
loopdigga96/numbers_recognition
CNNLayerNorm
false
7,116
[ "Apache-2.0" ]
1
dd1110d3fd18b5ca20278a010c550aeaad495e19
https://github.com/loopdigga96/numbers_recognition/tree/dd1110d3fd18b5ca20278a010c550aeaad495e19
import torch import torch.nn as nn class Model(nn.Module): """Layer normalization built for cnns input""" def __init__(self, n_feats: 'int'): super().__init__() self.layer_norm = nn.LayerNorm(n_feats) def forward(self, x: 'torch.tensor') ->torch.tensor: x = x.transpose(2, 3).cont...
CausalPad
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data class CausalPad(torch.nn.Module): def __init__(self): super(CausalPad, self).__init__() def forward(self, input): return torch.nn.functional.pad(input, (0, 0, 1, 0)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
lorenlugosch/autoregressive-models
CausalPad
false
7,117
[ "Apache-2.0" ]
1
2c50bc331d3b68cc7144f7456591bbc2321cc658
https://github.com/lorenlugosch/autoregressive-models/tree/2c50bc331d3b68cc7144f7456591bbc2321cc658
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, input): return torch.nn.functional.pad(input, (0, 0, 1, 0)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
_Residual_Block
# 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 _Residual_Block(nn.Module): def __init__(self): super(_Residual_Block, self).__init__() self.conv1 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size =3, stride=1, padding=1, bias=False) self.in1 = nn.InstanceNorm2d(64, affine=Tru...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
liruilong940607/SRResnet
_Residual_Block
false
7,118
[ "MIT" ]
1
928b1c076bfa051dffd5165ea966af5dfd9c372d
https://github.com/liruilong940607/SRResnet/tree/928b1c076bfa051dffd5165ea966af5dfd9c372d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size =3, stride=1, padding=1, bias=False) self.in1 = nn.InstanceNorm2d(64, affine=True) self.relu = nn.Leaky...
FC_Layer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def standardize(param, assert_length): if type(param) is not list and type(param) is not tuple: param = [param] * assert_length assert len(param ) == assert_length, 'expect %s input params, got %s input parameter' % ( assert_length, len(param)) re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
loveorchids/omni_torch
FC_Layer
false
7,119
[ "Apache-2.0" ]
1
9bd654387619c0cbc6aee9e91482ecc9200138ef
https://github.com/loveorchids/omni_torch/tree/9bd654387619c0cbc6aee9e91482ecc9200138ef
import torch import torch.nn as nn def standardize(param, assert_length): if type(param) is not list and type(param) is not tuple: param = [param] * assert_length assert len(param ) == assert_length, 'expect %s input params, got %s input parameter' % ( assert_length, len(param)) re...
Conv
# 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.utils import torch.utils.checkpoint class Conv(torch.nn.Module): def __init__(self, in_dim, out_dim, filter_length, stride): super(Conv, self).__init__() self.conv = torch.nn.Conv1d(in_channels=in_dim, out_channels= out_dim, kernel_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.utils import torch.utils.checkpoint assert_...
lorenlugosch/graves-transducers
Conv
false
7,120
[ "Apache-2.0" ]
1
489f46d58eba35d34163bb8b887c31d6e043c990
https://github.com/lorenlugosch/graves-transducers/tree/489f46d58eba35d34163bb8b887c31d6e043c990
import torch import torch.utils.data import torch.utils import torch.utils.checkpoint class Model(torch.nn.Module): def __init__(self, in_dim, out_dim, filter_length, stride): super().__init__() self.conv = torch.nn.Conv1d(in_channels=in_dim, out_channels= out_dim, kernel_size=filter_...
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 class LayerNorm(nn.LayerNorm): def __init__(self, normalized_shape, eps=1e-05, elementwise_affine=True): """Layer Norm.""" super(LayerNorm, self).__init__(normalized_shape, eps=eps, elementwise_affine=elementwise_affine) def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
lorinczb/pytorch-dc-tts
LayerNorm
false
7,121
[ "MIT" ]
1
9dae50678113e2f60ad0752b99b959bb0b11dfc9
https://github.com/lorinczb/pytorch-dc-tts/tree/9dae50678113e2f60ad0752b99b959bb0b11dfc9
import torch import torch.nn as nn class Model(nn.LayerNorm): def __init__(self, normalized_shape, eps=1e-05, elementwise_affine=True): """Layer Norm.""" super().__init__(normalized_shape, eps=eps, elementwise_affine=elementwise_affine) def forward(self, x): x = x.permute...
mbr_convex_hull
# 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 mbr_convex_hull(nn.Module): """ Miminum Bounding Rectangle (MBR) Algorithm core: The orientation of the MBR is the same as the one of one of the edges of the point cloud convex hull, which means the result rectangle must overlap with at least one of...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
liuhuaijjin/rpn_rois_proposals_layers
mbr_convex_hull
false
7,122
[ "MIT" ]
1
c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
https://github.com/liuhuaijjin/rpn_rois_proposals_layers/tree/c5f9f09b3ae8c52e4b6fa3fda391f993cb7d42c1
import torch import torch.nn as nn class Model(nn.Module): """ Miminum Bounding Rectangle (MBR) Algorithm core: The orientation of the MBR is the same as the one of one of the edges of the point cloud convex hull, which means the result rectangle must overlap with at least one of the edges...
Joiner
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import torch import torch.utils.data import torch.utils import torch.utils.checkpoint class Joiner(torch.nn.Module): def __init__(self, config): super(Joiner, self).__init__() self.tanh = torch.nn.Tanh() self.num_outputs = config.num_tokens + ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
lorenlugosch/graves-transducers
Joiner
false
7,123
[ "Apache-2.0" ]
1
489f46d58eba35d34163bb8b887c31d6e043c990
https://github.com/lorenlugosch/graves-transducers/tree/489f46d58eba35d34163bb8b887c31d6e043c990
from _paritybench_helpers import _mock_config import torch import torch.utils.data import torch.utils import torch.utils.checkpoint class Model(torch.nn.Module): def __init__(self, config): super().__init__() self.tanh = torch.nn.Tanh() self.num_outputs = config.num_tokens + 1 sel...
Upsample
# 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 Upsample(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv1x1 = nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0) self.conv3x3 = nn.Conv2d(in_channels, out_channels, kernel_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
loong8888/TextSnake.pytorch
Upsample
false
7,124
[ "MIT" ]
1
49c24f71043c1895b91f8c7379995037fcc644f7
https://github.com/loong8888/TextSnake.pytorch/tree/49c24f71043c1895b91f8c7379995037fcc644f7
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv1x1 = nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0) self.conv3x3 = nn.Conv2d(in_channels, out_channels, kernel_size=3...
AR
# 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 AR(nn.Module): def __init__(self, window: 'int', hidden_size: 'int'): super(AR, self).__init__() self.linear = nn.Linear(window, hidden_size) def forward(self, x): x = torch.transpose(x, 1, 2) x = self.linear(x) x = torch.trans...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
lucianolorenti/rul_pm
AR
false
7,125
[ "MIT" ]
1
da9dfad79129dd47d24923cfd6c833869ef7b6a7
https://github.com/lucianolorenti/rul_pm/tree/da9dfad79129dd47d24923cfd6c833869ef7b6a7
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, window: 'int', hidden_size: 'int'): super().__init__() self.linear = nn.Linear(window, hidden_size) def forward(self, x): x = torch.transpose(x, 1, 2) x = self.linear(x) x = torch.transpose(...
JS_Divergence
# 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 JS_Divergence(nn.Module): def __init__(self): super().__init__() self.engine = nn.KLDivLoss() def forward(self, x, y): return self.engine(x, y) + self.engine(y, x) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
loveorchids/omni_torch
JS_Divergence
false
7,126
[ "Apache-2.0" ]
1
9bd654387619c0cbc6aee9e91482ecc9200138ef
https://github.com/loveorchids/omni_torch/tree/9bd654387619c0cbc6aee9e91482ecc9200138ef
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.engine = nn.KLDivLoss() def forward(self, x, y): return self.engine(x, y) + self.engine(y, x) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] d...
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_...
liuziyang1106/TSAN-brain-age-estimation
mlp
false
7,127
[ "MIT" ]
1
374b481291edb9516ee9871a53f7acb6a2eeaebc
https://github.com/liuziyang1106/TSAN-brain-age-estimation/tree/374b481291edb9516ee9871a53f7acb6a2eeaebc
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_): ...
Swish
# 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 class Swish(nn.Module): def __init__(self): super(Swish, self).__init__() self.beta = nn.Parameter(torch.ones(1)) def forward(self, x): return x * F.sigmoid(self.beta * x) def get_inputs(): re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
lorylei/DARTS-et
Swish
false
7,128
[ "Apache-2.0" ]
1
f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
https://github.com/lorylei/DARTS-et/tree/f22cfd53c14afd6ba602b8ecfbff9cdf77fc2ff8
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils class Model(nn.Module): def __init__(self): super().__init__() self.beta = nn.Parameter(torch.ones(1)) def forward(self, x): return x * F.sigmoid(self.beta * x) def get_inputs(): return [torch...
SpatialAttention
# 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 SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super().__init__() self.conv = nn.Conv2d(2, 1, kernel_size=kernel_size, padding= kernel_size // 2) self.sigmoid = nn.Sigmoid() def forward(self, x): max_result,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
lulor/project_vg
SpatialAttention
false
7,129
[ "MIT" ]
1
27b0c3b3038c5a666dde516a0a265ae8ddf2059f
https://github.com/lulor/project_vg/tree/27b0c3b3038c5a666dde516a0a265ae8ddf2059f
import torch from torch import nn class Model(nn.Module): def __init__(self, kernel_size=7): super().__init__() self.conv = nn.Conv2d(2, 1, kernel_size=kernel_size, padding= kernel_size // 2) self.sigmoid = nn.Sigmoid() def forward(self, x): max_result, _ = torch....
Predict_Network1
# 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.optim as optim def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class LayerNorm(nn.Module): """ Simple 1D LayerNorm. ""...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ltzheng/CDS
Predict_Network1
false
7,130
[ "Apache-2.0" ]
1
397282147498647a9f26577adfa451e8478de76d
https://github.com/ltzheng/CDS/tree/397282147498647a9f26577adfa451e8478de76d
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class LayerNorm(nn.Module): """ Simple 1D LayerNorm. ""...
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, in_features, out_features): super().__init__() self.in_features = in_features self.out_features = out_features self.fc1 = nn.Linear(in_features, in_features // 2) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
luogan1234/movie-dialog-project
MLP
false
7,131
[ "MIT" ]
1
17ac4a10c069c6b4c41bb675b98a35b2182cf504
https://github.com/luogan1234/movie-dialog-project/tree/17ac4a10c069c6b4c41bb675b98a35b2182cf504
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_features, out_features): super().__init__() self.in_features = in_features self.out_features = out_features self.fc1 = nn.Linear(in_features, in_features // 2) ...
MLPLayer
# 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 MLPLayer(nn.Module): def __init__(self, in_dim, out_dim): super().__init__() self.in_dim = in_dim mid_dim = in_dim // 2 self.out_dim = out_dim self.fc1 = nn.Linear(in_dim, mid_dim) self.fc2 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
luogan1234/prerequisite-prediction-co-training
MLPLayer
false
7,132
[ "MIT" ]
1
28e3f241ada5afe75a73525375087be230735c2a
https://github.com/luogan1234/prerequisite-prediction-co-training/tree/28e3f241ada5afe75a73525375087be230735c2a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_dim, out_dim): super().__init__() self.in_dim = in_dim mid_dim = in_dim // 2 self.out_dim = out_dim self.fc1 = nn.Linear(in_dim, mid_dim) self.fc2 = nn....