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
LBM
# 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 LBM(nn.Module): def __init__(self, l_dim, r_dim): super(LBM, self).__init__() self.W = nn.Bilinear(l_dim, r_dim, 1, bias=False) def forward(self, e1, e2): """ e1: tensor of size (*, l_dim) e2: tensor of size (*, r_dim) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
aryaman4/TaxoExpan
LBM
false
9,785
[ "Apache-2.0" ]
0
3d9b9a21ba7cdd872dc62181dd14ff271e20b245
https://github.com/aryaman4/TaxoExpan/tree/3d9b9a21ba7cdd872dc62181dd14ff271e20b245
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, l_dim, r_dim): super().__init__() self.W = nn.Bilinear(l_dim, r_dim, 1, bias=False) def forward(self, e1, e2): """ e1: tensor of size (*, l_dim) e2: tensor of size (*, r_dim) return...
depthwise_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.nn as nn import torch.utils.data class depthwise_conv(nn.Module): def __init__(self, kernel_size=3, stride=1, padding=1): super(depthwise_conv, self).__init__() self.depthwise = nn.Conv2d(1, 1, kernel_size=kernel_size, stride= stride, padding=padding) de...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
Zacchaeus14/lang-seg
depthwise_conv
false
9,786
[ "MIT" ]
0
ad1196a4d33830f3219dbe2260a69364a745f094
https://github.com/Zacchaeus14/lang-seg/tree/ad1196a4d33830f3219dbe2260a69364a745f094
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, kernel_size=3, stride=1, padding=1): super().__init__() self.depthwise = nn.Conv2d(1, 1, kernel_size=kernel_size, stride= stride, padding=padding) def forward(self, x): C...
GramMatrix
# 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 GramMatrix(nn.Module): def forward(self, input): a, b, c, d = input.size() features = input.view(a * b, c * d) G = torch.mm(features, features.t()) return G.div(a * b * c * d) def get_inputs(): return [torch.rand([4, 4, 4, 4])] 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bigsshark/mycode
GramMatrix
false
9,787
[ "MIT" ]
0
550e58675cd533265b6a21258aa7bc1859191011
https://github.com/bigsshark/mycode/tree/550e58675cd533265b6a21258aa7bc1859191011
import torch import torch.nn as nn class Model(nn.Module): def forward(self, input): a, b, c, d = input.size() features = input.view(a * b, c * d) G = torch.mm(features, features.t()) return G.div(a * b * c * d) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_i...
RBF_activation
# 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 RBF_activation(torch.nn.Module): def __init__(self, input_features): super(RBF_activation, self).__init__() self.input_features = input_features self.centers = nn.Parameter(torch.ones(input_features)) self.log_sigma2 = nn...
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 numpy as np import torch.nn as nn assert_size_stride = ...
bkompa/PyTorch_CIFAR10_GAU
RBF_activation
false
9,789
[ "MIT" ]
0
2c6da19b251a9536167df473dabcb5cc34c66133
https://github.com/bkompa/PyTorch_CIFAR10_GAU/tree/2c6da19b251a9536167df473dabcb5cc34c66133
import torch import numpy as np import torch.nn as nn class Model(torch.nn.Module): def __init__(self, input_features): super().__init__() self.input_features = input_features self.centers = nn.Parameter(torch.ones(input_features)) self.log_sigma2 = nn.Parameter(torch.ones(input_f...
ConditionalBatchNorm2d
# 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 def l2normalize(v, eps=0.0001): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.module = module 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 ...
bhagwanalbert/BigGAN-PyTorch
ConditionalBatchNorm2d
false
9,790
[ "MIT" ]
0
34bd6d9d04bb2e9699c27324454197dd01584d22
https://github.com/bhagwanalbert/BigGAN-PyTorch/tree/34bd6d9d04bb2e9699c27324454197dd01584d22
import torch import torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=0.0001): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super().__init__() self.module = module self.name = name ...
CutMixCrossEntropyLoss
# 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 torch.nn import Module import torch from torch.nn.modules.module import Module import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed def cross_entropy(input, target, size_average=True): """ Cross entropy that accepts soft targets Args: pred: pred...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn import M...
bottlenome/cutmix
CutMixCrossEntropyLoss
false
9,791
[ "MIT" ]
0
d18c2bda47e7d1786819420edbb2c8e5ad43385f
https://github.com/bottlenome/cutmix/tree/d18c2bda47e7d1786819420edbb2c8e5ad43385f
from torch.nn import Module import torch from torch.nn.modules.module import Module import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed def cross_entropy(input, target, size_average=True): """ Cross entropy that accepts soft targets Args: pred: pred...
Pool
# 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 Pool(nn.Module): def __init__(self): super(Pool, self).__init__() def forward(self, x): return F.adaptive_avg_pool2d(x, (5, 5)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retu...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
borisfom/TRTorch
Pool
false
9,792
[ "BSD-3-Clause" ]
0
1660633c6f6a480cd123d9d91cabf4eced12e8f3
https://github.com/borisfom/TRTorch/tree/1660633c6f6a480cd123d9d91cabf4eced12e8f3
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return F.adaptive_avg_pool2d(x, (5, 5)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
HyperpriorSynthesis
# 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 HyperpriorSynthesis(nn.Module): """ Hyperprior 'synthesis model' as proposed in [1]. Outputs distribution parameters of input latents. [1] Ballé et. al., "Variational image compression with a scale hyperprior", arXiv:1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ali-zafari/high-fidelity-generative-compression
HyperpriorSynthesis
false
9,793
[ "Apache-2.0" ]
0
37ab8d6727df48f8ebf4577db0986ccd0ffe404b
https://github.com/ali-zafari/high-fidelity-generative-compression/tree/37ab8d6727df48f8ebf4577db0986ccd0ffe404b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Hyperprior 'synthesis model' as proposed in [1]. Outputs distribution parameters of input latents. [1] Ballé et. al., "Variational image compression with a scale hyperprior", arXiv:1802.01436 (201...
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda import torch.distributed import torch.multiprocessing class FocalLoss(nn.Module): """Focal Loss - https://arxiv.org/abs/1708.02002""" def __init__(self, alpha=0.25, gamma=2): super().__init__() self.alpha = a...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
azuredsky/retinanet-examples
FocalLoss
false
9,794
[ "BSD-3-Clause" ]
0
1b35d8e7d3360050f25fd80e09ecac3eb2654301
https://github.com/azuredsky/retinanet-examples/tree/1b35d8e7d3360050f25fd80e09ecac3eb2654301
import torch import torch.nn as nn import torch.nn.functional as F import torch.cuda import torch.distributed import torch.multiprocessing class Model(nn.Module): """Focal Loss - https://arxiv.org/abs/1708.02002""" def __init__(self, alpha=0.25, gamma=2): super().__init__() self.alpha = alpha...
TSA_Fusion
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class TSA_Fusion(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super(TSA_Fusion, self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
andreistirb/mmsr
TSA_Fusion
false
9,795
[ "Apache-2.0" ]
0
da6b1109c8dab795a7d451d80dc78e9eb8cfe16c
https://github.com/andreistirb/mmsr/tree/da6b1109c8dab795a7d451d80dc78e9eb8cfe16c
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super().__init__() ...
Postnet
# 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 Postnet(nn.Module): """Postnet is a simple linear layer for predicting the target frames given the RNN context during training. We don't need the Postnet for feature extraction. """ def __init__(self, input_size, output_size=80): super(Postnet, 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
apoorv2904/Self-Supervised-Speech-Pretraining-and-Representation-Learning
Postnet
false
9,796
[ "MIT" ]
0
6bdf02836ed31fdf7f185eddcd004770526c57c3
https://github.com/apoorv2904/Self-Supervised-Speech-Pretraining-and-Representation-Learning/tree/6bdf02836ed31fdf7f185eddcd004770526c57c3
import torch from torch import nn class Model(nn.Module): """Postnet is a simple linear layer for predicting the target frames given the RNN context during training. We don't need the Postnet for feature extraction. """ def __init__(self, input_size, output_size=80): super().__init__() ...
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 import torch.cuda import torch.distributed import torch.multiprocessing class SmoothL1Loss(nn.Module): """Smooth L1 Loss""" def __init__(self, beta=0.11): super().__init__() self.beta = beta def forward(self, pred, target): x = (pred - target).a...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda import torch.distributed import t...
azuredsky/retinanet-examples
SmoothL1Loss
false
9,797
[ "BSD-3-Clause" ]
0
1b35d8e7d3360050f25fd80e09ecac3eb2654301
https://github.com/azuredsky/retinanet-examples/tree/1b35d8e7d3360050f25fd80e09ecac3eb2654301
import torch import torch.nn as nn import torch.cuda import torch.distributed import torch.multiprocessing class Model(nn.Module): """Smooth L1 Loss""" def __init__(self, beta=0.11): super().__init__() self.beta = beta def forward(self, pred, target): x = (pred - target).abs() ...
ResnetBlockFC
# 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.autograd.profiler as profiler class ResnetBlockFC(nn.Module): """ Fully connected ResNet Block class. Taken from DVR code. :param size_in (int): input dimension :param size_out (int): output dimension :param size_h (int): hidden dimension """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
alrivero/pixel-nerf
ResnetBlockFC
false
9,798
[ "BSD-2-Clause" ]
0
c054befe189602627f021cda8376adc5940c8668
https://github.com/alrivero/pixel-nerf/tree/c054befe189602627f021cda8376adc5940c8668
import torch from torch import nn import torch.autograd.profiler as profiler class Model(nn.Module): """ Fully connected ResNet Block class. Taken from DVR code. :param size_in (int): input dimension :param size_out (int): output dimension :param size_h (int): hidden dimension """ def...
TwoHiddenLayerFc
# 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 TwoHiddenLayerFc(nn.Module): def __init__(self, input_shape, out_dim): super(TwoHiddenLayerFc, self).__init__() self.fc1 = nn.Linear(input_shape, 200) self.fc2 = nn.Linear(200, 200) self.fc3 = nn.Linear(200, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bokunwang/fedavgpy
TwoHiddenLayerFc
false
9,799
[ "MIT" ]
0
22f2fae287f15025e953ab595aa6fd6faedf83d2
https://github.com/bokunwang/fedavgpy/tree/22f2fae287f15025e953ab595aa6fd6faedf83d2
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_shape, out_dim): super().__init__() self.fc1 = nn.Linear(input_shape, 200) self.fc2 = nn.Linear(200, 200) self.fc3 = nn.Linear(200, out_dim) def forward(self, x...
LxmertAttentionOutput
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from itertools import * class LxmertAttentionOutput(nn.Module): def __init__(self, hidden_size, hidden_dropout_prob): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.LayerNorm = nn.LayerNorm(hidden_size, eps=1e-12) self.dr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
ashutoshbsathe/SmBop
LxmertAttentionOutput
false
9,800
[ "MIT" ]
0
ce5f67ec070df55b84d7f3617659011732020c96
https://github.com/ashutoshbsathe/SmBop/tree/ce5f67ec070df55b84d7f3617659011732020c96
import torch from torch import nn from itertools import * class Model(nn.Module): def __init__(self, hidden_size, hidden_dropout_prob): super().__init__() self.dense = nn.Linear(hidden_size, hidden_size) self.LayerNorm = nn.LayerNorm(hidden_size, eps=1e-12) self.dropout = nn.Dropo...
LxmertCrossAttentionLayer
# 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 from torch import nn from itertools import * class LxmertAttention(nn.Module): def __init__(self, hidden_size, num_attention_heads, attention_probs_dropout_prob, ctx_dim): super().__init__() if hidden_size % num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ashutoshbsathe/SmBop
LxmertCrossAttentionLayer
false
9,801
[ "MIT" ]
0
ce5f67ec070df55b84d7f3617659011732020c96
https://github.com/ashutoshbsathe/SmBop/tree/ce5f67ec070df55b84d7f3617659011732020c96
import math import torch from torch import nn from itertools import * class LxmertAttention(nn.Module): def __init__(self, hidden_size, num_attention_heads, attention_probs_dropout_prob, ctx_dim): super().__init__() if hidden_size % num_attention_heads != 0: raise ValueError( ...
SoftQNetwork
# 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 SoftQNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003): super(SoftQNetwork, self).__init__() self.linear1 = nn.Linear(num_inputs + num_actions, hidden_size) self.linear2 = 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 assert_...
biemann/rl-testbed-for-energyplus
SoftQNetwork
false
9,802
[ "MIT" ]
0
a01be4d12eda970b352729ff6cb4a3eea8ddee6a
https://github.com/biemann/rl-testbed-for-energyplus/tree/a01be4d12eda970b352729ff6cb4a3eea8ddee6a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, init_w=0.003): super().__init__() self.linear1 = nn.Linear(num_inputs + num_actions, hidden_size) self.linear2 = nn.Linear(hidden_size, hidde...
Conv_ReLU_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 Conv_ReLU_Block(nn.Module): def __init__(self): super(Conv_ReLU_Block, self).__init__() self.conv = nn.Conv2d(in_channels=64, out_channels=64, kernel_size= 3, stride=1, padding=1, bias=False) self.relu = nn.ReLU(inplace=True) def f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
b4435242/pytorch-vdsr
Conv_ReLU_Block
false
9,803
[ "MIT" ]
0
01541bc3d52105c8fd0e4d9cf7308ac267fe5f49
https://github.com/b4435242/pytorch-vdsr/tree/01541bc3d52105c8fd0e4d9cf7308ac267fe5f49
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(in_channels=64, out_channels=64, kernel_size= 3, stride=1, padding=1, bias=False) self.relu = nn.ReLU(inplace=True) def forward(self, x): return...
PolicyNetwork
# 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 from torch.distributions import Normal class PolicyNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, action_range= 1.0, init_w=0.003, log_std_min=-20, log_std_max=2): super(PolicyNetwo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
biemann/rl-testbed-for-energyplus
PolicyNetwork
false
9,804
[ "MIT" ]
0
a01be4d12eda970b352729ff6cb4a3eea8ddee6a
https://github.com/biemann/rl-testbed-for-energyplus/tree/a01be4d12eda970b352729ff6cb4a3eea8ddee6a
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal class Model(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size, action_range= 1.0, init_w=0.003, log_std_min=-20, log_std_max=2): super().__init__() ...
NTN
# 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 NTN(nn.Module): def __init__(self, l_dim, r_dim, k=4, non_linear=F.tanh): super(NTN, self).__init__() self.u_R = nn.Linear(k, 1, bias=False) self.f = non_linear self.W = nn.Bilinear(l_dim, r_dim, k, bias=True...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
aryaman4/TaxoExpan
NTN
false
9,805
[ "Apache-2.0" ]
0
3d9b9a21ba7cdd872dc62181dd14ff271e20b245
https://github.com/aryaman4/TaxoExpan/tree/3d9b9a21ba7cdd872dc62181dd14ff271e20b245
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, l_dim, r_dim, k=4, non_linear=F.tanh): super().__init__() self.u_R = nn.Linear(k, 1, bias=False) self.f = non_linear self.W = nn.Bilinear(l_dim, r_dim, k, bias=True) ...
MultiHeadAttentionWithMetrics
# 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 MultiHeadAttentionWithMetrics(nn.Module): def __init__(self, ctx, heads_count, d_model, dropout_prob=0.1, mode= 'self-attention'): super(MultiHeadAttentionWithMetrics, self).__init__() assert d_model % heads_count == 0 as...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bingrao/deeplearning
MultiHeadAttentionWithMetrics
false
9,806
[ "MIT" ]
0
8488478a4355a7f56d49c5126f529c21d5a95798
https://github.com/bingrao/deeplearning/tree/8488478a4355a7f56d49c5126f529c21d5a95798
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, ctx, heads_count, d_model, dropout_prob=0.1, mode= 'self-attention'): super().__init__() assert d_model % heads_count == 0 assert mode in ('self-attention', 'memory-attention') ...
DepthwiseSeparableConvolution
# 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 DepthwiseSeparableConvolution(nn.Module): def __init__(self, in_ch, out_ch, kernel_size=3, stride=1, padding=1): super().__init__() """ input : N*C1 output : N*C1 groups = C1 """ self.depthwise_conv = nn.C...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
LiChengChen666/DetectDee
DepthwiseSeparableConvolution
false
9,807
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn class Model(nn.Module): def __init__(self, in_ch, out_ch, kernel_size=3, stride=1, padding=1): super().__init__() """ input : N*C1 output : N*C1 groups = C1 """ self.depthwise_conv = nn.Conv2d(in_channels=in_ch,...
DuelingQNetwork
# 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 class DuelingQNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
bfMendonca/deep-reinforcement-learning
DuelingQNetwork
false
9,808
[ "MIT" ]
0
fa8f68d960542658429a4e1a4b1e9fdfb1af0030
https://github.com/bfMendonca/deep-reinforcement-learning/tree/fa8f68d960542658429a4e1a4b1e9fdfb1af0030
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed): """Initialize parameters and build model. Params ====== state_size (int): Dimension of each state ...
SpatialGroupEnhance
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import init class SpatialGroupEnhance(nn.Module): def __init__(self, groups): super().__init__() self.groups = groups self.avg_pool = nn.AdaptiveAvgPool2d(1) self.weight = nn.Parameter(torch.zeros(1, groups, 1, 1)) self.bias ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn from torch.nn import init assert_size_stride = torch._C._d...
LiChengChen666/DetectDee
SpatialGroupEnhance
false
9,809
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn from torch.nn import init class Model(nn.Module): def __init__(self, groups): super().__init__() self.groups = groups self.avg_pool = nn.AdaptiveAvgPool2d(1) self.weight = nn.Parameter(torch.zeros(1, groups, 1, 1)) self.bias = nn.Parameter...
Depth_Pointwise_Conv1d
# 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 Depth_Pointwise_Conv1d(nn.Module): def __init__(self, in_ch, out_ch, k): super().__init__() if k == 1: self.depth_conv = nn.Identity() else: self.depth_conv = nn.Conv1d(in_channels=in_ch, out_channels= in_ch, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
LiChengChen666/DetectDee
Depth_Pointwise_Conv1d
false
9,810
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn class Model(nn.Module): def __init__(self, in_ch, out_ch, k): super().__init__() if k == 1: self.depth_conv = nn.Identity() else: self.depth_conv = nn.Conv1d(in_channels=in_ch, out_channels= in_ch, kernel_size=k, gr...
DoubleAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import init from torch.nn import functional as F class DoubleAttention(nn.Module): def __init__(self, in_channels, c_m, c_n, reconstruct=True): super().__init__() self.in_channels = in_channels self.reconstruct = reconstruct self.c_m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
LiChengChen666/DetectDee
DoubleAttention
false
9,811
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn from torch.nn import init from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_channels, c_m, c_n, reconstruct=True): super().__init__() self.in_channels = in_channels self.reconstruct = reconstruct self.c_m = c_m ...
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...
LiChengChen666/DetectDee
SpatialAttention
false
9,812
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
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....
LxmertAttention
# 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 from torch import nn from itertools import * class LxmertAttention(nn.Module): def __init__(self, hidden_size, num_attention_heads, attention_probs_dropout_prob, ctx_dim): super().__init__() if hidden_size % num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ashutoshbsathe/SmBop
LxmertAttention
false
9,813
[ "MIT" ]
0
ce5f67ec070df55b84d7f3617659011732020c96
https://github.com/ashutoshbsathe/SmBop/tree/ce5f67ec070df55b84d7f3617659011732020c96
import math import torch from torch import nn from itertools import * class Model(nn.Module): def __init__(self, hidden_size, num_attention_heads, attention_probs_dropout_prob, ctx_dim): super().__init__() if hidden_size % num_attention_heads != 0: raise ValueError( ...
ExternalAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import init class ExternalAttention(nn.Module): def __init__(self, d_model, S=64): super().__init__() self.mk = nn.Linear(d_model, S, bias=False) self.mv = nn.Linear(S, d_model, bias=False) self.softmax = nn.Softmax(dim=1) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
LiChengChen666/DetectDee
ExternalAttention
false
9,814
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn from torch.nn import init class Model(nn.Module): def __init__(self, d_model, S=64): super().__init__() self.mk = nn.Linear(d_model, S, bias=False) self.mv = nn.Linear(S, d_model, bias=False) self.softmax = nn.Softmax(dim=1) self.init_weig...
HyperpriorAnalysis
# 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 HyperpriorAnalysis(nn.Module): """ Hyperprior 'analysis model' as proposed in [1]. [1] Ballé et. al., "Variational image compression with a scale hyperprior", arXiv:1802.01436 (2018). C: Number of input channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ali-zafari/high-fidelity-generative-compression
HyperpriorAnalysis
false
9,815
[ "Apache-2.0" ]
0
37ab8d6727df48f8ebf4577db0986ccd0ffe404b
https://github.com/ali-zafari/high-fidelity-generative-compression/tree/37ab8d6727df48f8ebf4577db0986ccd0ffe404b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Hyperprior 'analysis model' as proposed in [1]. [1] Ballé et. al., "Variational image compression with a scale hyperprior", arXiv:1802.01436 (2018). C: Number of input channels """ def ...
ChannelAttentionModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
ChannelAttentionModule
false
9,816
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
ECAAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import init class ECAAttention(nn.Module): def __init__(self, kernel_size=3): super().__init__() self.gap = nn.AdaptiveAvgPool2d(1) self.conv = nn.Conv1d(1, 1, kernel_size=kernel_size, padding=( kernel_size - 1) // 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 import nn from torch.nn import init assert_size_stride = torch._C._dy...
LiChengChen666/DetectDee
ECAAttention
false
9,817
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn from torch.nn import init class Model(nn.Module): def __init__(self, kernel_size=3): super().__init__() self.gap = nn.AdaptiveAvgPool2d(1) self.conv = nn.Conv1d(1, 1, kernel_size=kernel_size, padding=( kernel_size - 1) // 2) self.sigmo...
VectorQuantizeLayer_GB
# 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 VectorQuantizeLayer_GB(nn.Module): def __init__(self, input_dim, vq_size, vq_dim, temp=(1.0, 0.1, 0.99), groups=1, combine_groups=True, time_first=True, activation=nn.GELU( ), weight_proj_depth=1, weight_proj_factor=1): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
apoorv2904/Self-Supervised-Speech-Pretraining-and-Representation-Learning
VectorQuantizeLayer_GB
false
9,818
[ "MIT" ]
0
6bdf02836ed31fdf7f185eddcd004770526c57c3
https://github.com/apoorv2904/Self-Supervised-Speech-Pretraining-and-Representation-Learning/tree/6bdf02836ed31fdf7f185eddcd004770526c57c3
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, vq_size, vq_dim, temp=(1.0, 0.1, 0.99), groups=1, combine_groups=True, time_first=True, activation=nn.GELU( ), weight_proj_depth=1, weight_proj_factor=1): """Vector quan...
ZPool
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class ZPool(nn.Module): def forward(self, x): return torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1) .unsqueeze(1)), dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
LiChengChen666/DetectDee
ZPool
false
9,819
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn class Model(nn.Module): def forward(self, x): return torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1) .unsqueeze(1)), dim=1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
SimplifiedScaledDotProductAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn from torch.nn import init class SimplifiedScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
SimplifiedScaledDotProductAttention
false
9,820
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch import numpy as np from torch import nn from torch.nn import init class Model(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param d_k: Dimensionality of queries...
OutlookAttention
# 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 from torch import nn from torch.nn import functional as F class OutlookAttention(nn.Module): def __init__(self, dim, num_heads=1, kernel_size=3, padding=1, stride=1, qkv_bias=False, attn_drop=0.1): super().__init__() self.dim = dim self.num_heads = num_hea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
OutlookAttention
false
9,823
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import math import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, dim, num_heads=1, kernel_size=3, padding=1, stride=1, qkv_bias=False, attn_drop=0.1): super().__init__() self.dim = dim self.num_heads = num_heads ...
ScaledDotProductAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
ScaledDotProductAttention
false
9,824
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch import numpy as np from torch import nn from torch.nn import init class Model(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param d_k: Dimensionality ...
CustomizedNet
# 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.distributed class CustomizedNet(nn.Module): def __init__(self, dropout, input_size, input_feature_num, hidden_dim, output_size): """ Simply use linear layers for multi-variate single-step forecasting. """ super()._...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
bendavidsteel/BigDL
CustomizedNet
false
9,825
[ "Apache-2.0" ]
0
b49d978c5ec8ebaf3d4c1343f25edeb5a21e31f3
https://github.com/bendavidsteel/BigDL/tree/b49d978c5ec8ebaf3d4c1343f25edeb5a21e31f3
import torch import torch.nn as nn import torch.utils.data.distributed class Model(nn.Module): def __init__(self, dropout, input_size, input_feature_num, hidden_dim, output_size): """ Simply use linear layers for multi-variate single-step forecasting. """ super().__init__(...
Reorg
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.utils.data class Reorg(nn.Module): def forward(self, x): return torch.cat([x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2, 1::2], x[..., 1::2, 1::2]], 1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ret...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._...
bruceli-rw0/rob535-perception
Reorg
false
9,826
[ "MIT" ]
0
b800b48aea888b0959b19fe13c637e1f257417e6
https://github.com/bruceli-rw0/rob535-perception/tree/b800b48aea888b0959b19fe13c637e1f257417e6
import torch from torch import nn import torch.utils.data class Model(nn.Module): def forward(self, x): return torch.cat([x[..., ::2, ::2], x[..., 1::2, ::2], x[..., ::2, 1::2], x[..., 1::2, 1::2]], 1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ret...
NetVLAD
# 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 from sklearn.neighbors import NearestNeighbors class NetVLAD(nn.Module): """NetVLAD layer implementation""" def __init__(self, num_clusters=64, dim=128, normalize_input=True, vladv2=False, use_faiss=True): "...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
StephenHausler/Patch-NetVLAD
NetVLAD
false
9,827
[ "MIT" ]
0
5d8b68fb7aa686e9c08a48ce504ecc552fff7b0b
https://github.com/StephenHausler/Patch-NetVLAD/tree/5d8b68fb7aa686e9c08a48ce504ecc552fff7b0b
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from sklearn.neighbors import NearestNeighbors class Model(nn.Module): """NetVLAD layer implementation""" def __init__(self, num_clusters=64, dim=128, normalize_input=True, vladv2=False, use_faiss=True): """...
_leaky_relu
# 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.optim import torch.utils.data class _leaky_relu(nn.Module): def __init__(self): super(_leaky_relu, self).__init__() def forward(self, x): x_neg = 0.1 * x return torch.max(x_neg, x) def get_inputs(): return [torch.rand([4, 4, 4, 4])...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import torch.optim import torch.utils.data assert_size_stride = torc...
ap229997/cc
_leaky_relu
false
9,828
[ "MIT" ]
0
d6f272b8270a371c877f4315047610b33a6e9f2d
https://github.com/ap229997/cc/tree/d6f272b8270a371c877f4315047610b33a6e9f2d
import torch from torch import nn import torch.optim import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): x_neg = 0.1 * x return torch.max(x_neg, x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs...
RajeevNet
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.nn.functional as F import torch.optim import torch.utils.data import torch.utils.data.distributed class RajeevNet(nn.Module): def __init__(self): super(RajeevNet, self).__init__() def forward(self, input): x = nn.Adapti...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
carlosdcastillo/janice
RajeevNet
false
9,829
[ "MIT" ]
0
221a94dd25ab4304d3c959a364ec89548b807509
https://github.com/carlosdcastillo/janice/tree/221a94dd25ab4304d3c959a364ec89548b807509
import torch import torch.nn as nn import torch.nn.parallel import torch.nn.functional as F import torch.optim import torch.utils.data import torch.utils.data.distributed class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input): x = nn.AdaptiveAvgPool2d(1)(inpu...
FeedForward
# 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 FeedForward(nn.Module): def __init__(self, d_model, d_ff): super(FeedForward, self).__init__() self.linear1 = nn.Linear(in_features=d_model, out_features=d_ff) self.linear2 = nn.Linear(in_features=d_ff, out_features=d_model) self.layer_norm...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
caixunshiren/transformer-from-scratch
FeedForward
false
9,831
[ "MIT" ]
0
dbbacab4752f9fc5e33f583c0b1b5258572fb646
https://github.com/caixunshiren/transformer-from-scratch/tree/dbbacab4752f9fc5e33f583c0b1b5258572fb646
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, d_model, d_ff): super().__init__() self.linear1 = nn.Linear(in_features=d_model, out_features=d_ff) self.linear2 = nn.Linear(in_features=d_ff, out_features=d_model) self.layer_norm = nn.LayerNorm(d_model...
CosNorm_Classifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn import torch.utils.data from torch.nn.parameter import Parameter class CosNorm_Classifier(nn.Module): def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001 ): super(CosNorm_Classifier, self).__init__() self.in_dims = in_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
caisarl76/classifier-balancing
CosNorm_Classifier
false
9,832
[ "BSD-3-Clause" ]
0
b381279dc29539afb92fe40f7ca917e352aff9c6
https://github.com/caisarl76/classifier-balancing/tree/b381279dc29539afb92fe40f7ca917e352aff9c6
import math import torch from torch import nn import torch.utils.data from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001 ): super().__init__() self.in_dims = in_dims self.out_dims = out_dims ...
DAModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
DAModule
false
9,834
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
UFOAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import init def XNorm(x, gamma): norm_tensor = torch.norm(x, 2, -1, True) return x * gamma / norm_tensor class UFOAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
LiChengChen666/DetectDee
UFOAttention
false
9,835
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn from torch.nn import init def XNorm(x, gamma): norm_tensor = torch.norm(x, 2, -1, True) return x * gamma / norm_tensor class Model(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :p...
ResidualAttention
# 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 ResidualAttention(nn.Module): def __init__(self, channel=512, num_class=1000, la=0.2): super().__init__() self.la = la self.fc = nn.Conv2d(in_channels=channel, out_channels=num_class, kernel_size=1, stride=1, bias=False) def forward...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
LiChengChen666/DetectDee
ResidualAttention
false
9,836
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn class Model(nn.Module): def __init__(self, channel=512, num_class=1000, la=0.2): super().__init__() self.la = la self.fc = nn.Conv2d(in_channels=channel, out_channels=num_class, kernel_size=1, stride=1, bias=False) def forward(self, x): ...
ActorNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class ActorNet(nn.Module): def __init__(self, state_size, action_size, fc1_units=128, fc2_units=128): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bwosh/DRL_ContinuousControl
ActorNet
false
9,837
[ "MIT" ]
0
34314cd600f0da428bc6dddf1b89b64bc04d43df
https://github.com/bwosh/DRL_ContinuousControl/tree/34314cd600f0da428bc6dddf1b89b64bc04d43df
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): def __init__(self, state_size, action_size, fc1_units=128, fc2_units=128): ...
ResNetV2
# 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 collections import OrderedDict import torch.nn.functional as F def conv1x1(cin, cout, stride=1, bias=False): return StdConv2d(cin, cout, kernel_size=1, stride=stride, padding=0, bias=bias) def conv3x3(cin, cout, stride=1, groups=1, bias=False): return StdConv2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
YLtrees2/ViT-pytorch-Low-rank-Approximation
ResNetV2
false
9,838
[ "MIT" ]
0
249a8db1ab99b6a482c527853e4aa0cf52659bb8
https://github.com/YLtrees2/ViT-pytorch-Low-rank-Approximation/tree/249a8db1ab99b6a482c527853e4aa0cf52659bb8
import torch import torch.nn as nn from collections import OrderedDict import torch.nn.functional as F def conv1x1(cin, cout, stride=1, bias=False): return StdConv2d(cin, cout, kernel_size=1, stride=stride, padding=0, bias=bias) def conv3x3(cin, cout, stride=1, groups=1, bias=False): return StdConv2...
AttentionSortNet
# 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.nn import functional as F from functools import partial from torch import nn def bucket(buckets, t, dim=1): shape = list(t.shape) shape[dim:dim + 1] = [buckets, -1] return t.reshape(*shape) def expand_dim(t, dim, k): expand_shape = [-1] * len(t.shape) expand_shape[dim] = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
blizda/sinkhorn-transformer
AttentionSortNet
false
9,839
[ "MIT" ]
0
4b626a40759010e4cb1752f22387fdbda438f37c
https://github.com/blizda/sinkhorn-transformer/tree/4b626a40759010e4cb1752f22387fdbda438f37c
import torch from torch.nn import functional as F from functools import partial from torch import nn def bucket(buckets, t, dim=1): shape = list(t.shape) shape[dim:dim + 1] = [buckets, -1] return t.reshape(*shape) def expand_dim(t, dim, k): expand_shape = [-1] * len(t.shape) expand_shape[dim] = ...
GroupedChannelNorm
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class GroupedChannelNorm(nn.Module): def __init__(self, num_groups): super().__init__() self.num_groups = num_groups def forward(self, x): shape = list(x.shape) new_shape = [shape[0], self.num_groups, sha...
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.utils.data import torch import torch.nn as nn assert_size_stride =...
a11isonliu/contrastive-unpaired-translation
GroupedChannelNorm
false
9,840
[ "BSD-3-Clause" ]
0
67651ed9877cae121d9398f46094ce8dbc678802
https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802
import torch import torch.utils.data import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_groups): super().__init__() self.num_groups = num_groups def forward(self, x): shape = list(x.shape) new_shape = [shape[0], self.num_groups, shape[1] // self...
ParallelPolarizedSelfAttention
# 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 ParallelPolarizedSelfAttention(nn.Module): def __init__(self, channel=512): super().__init__() self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1)) self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1)) self.softmax_channel = 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 from torch._inductor.runtime....
LiChengChen666/DetectDee
ParallelPolarizedSelfAttention
false
9,841
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn class Model(nn.Module): def __init__(self, channel=512): super().__init__() self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1)) self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1)) self.softmax_channel = nn.Softmax(1) self....
FusedLeakyReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return F.leaky_relu(input + bias, negative_slope) * scale class FusedLeakyReLU(nn.Module): def __init__(self, channel, negative_slop...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.asse...
a11isonliu/contrastive-unpaired-translation
FusedLeakyReLU
false
9,842
[ "BSD-3-Clause" ]
0
67651ed9877cae121d9398f46094ce8dbc678802
https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return F.leaky_relu(input + bias, negative_slope) * scale class Model(nn.Module): def __init__(self, channel, negative_slope=0.2, sc...
ReshapeF
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out ...
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.utils.data import torch import torch.nn as nn assert_size_stride =...
a11isonliu/contrastive-unpaired-translation
ReshapeF
false
9,843
[ "BSD-3-Clause" ]
0
67651ed9877cae121d9398f46094ce8dbc678802
https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super().__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm + ...
CriticNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class CriticNet(nn.Module): def __init__(self, state_size, action_size, fc1_units=128, fc2_units=128): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
bwosh/DRL_ContinuousControl
CriticNet
false
9,844
[ "MIT" ]
0
34314cd600f0da428bc6dddf1b89b64bc04d43df
https://github.com/bwosh/DRL_ContinuousControl/tree/34314cd600f0da428bc6dddf1b89b64bc04d43df
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_init(layer): fan_in = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(fan_in) return -lim, lim class Model(nn.Module): def __init__(self, state_size, action_size, fc1_units=128, fc2_units=128): ...
fully_connected
# 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 fully_connected(nn.Module): def __init__(self, input_dims, hidden_dims, out_dims, bias=True, drop=True ): super(fully_connected, self).__init__() self.input_dims = input_dims self.hidden_dims = hidden_dims self.out_dims = out_dims ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
cankucuksozen/COMP551--ComputerVision-with-DL
fully_connected
false
9,845
[ "MIT" ]
0
44c4510a7163ad4bcf00ce0e9d112ae1ba59b143
https://github.com/cankucuksozen/COMP551--ComputerVision-with-DL/tree/44c4510a7163ad4bcf00ce0e9d112ae1ba59b143
import torch from torch import nn class Model(nn.Module): def __init__(self, input_dims, hidden_dims, out_dims, bias=True, drop=True ): super().__init__() self.input_dims = input_dims self.hidden_dims = hidden_dims self.out_dims = out_dims self.drop = drop ...
PoolingF
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data impo...
a11isonliu/contrastive-unpaired-translation
PoolingF
false
9,846
[ "BSD-3-Clause" ]
0
67651ed9877cae121d9398f46094ce8dbc678802
https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super().__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm + ...
PositionwiseFeedForward
# 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 LayerNormalization(nn.Module): """ Layer normalization module """ def __init__(self, d_hid, eps=0.001): super(LayerNormalization, self).__init__() self.eps = eps self.a_2 = nn.Parameter(torch.ones(d_hid), requires_grad=True) self.b_2 = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
awesome-archive/attention-is-all-you-need-pytorch
PositionwiseFeedForward
false
9,847
[ "MIT" ]
0
d1fb26fafaf7170a7c3a45968cd555f3c6aeb3bc
https://github.com/awesome-archive/attention-is-all-you-need-pytorch/tree/d1fb26fafaf7170a7c3a45968cd555f3c6aeb3bc
import torch import torch.nn as nn class LayerNormalization(nn.Module): """ Layer normalization module """ def __init__(self, d_hid, eps=0.001): super().__init__() self.eps = eps self.a_2 = nn.Parameter(torch.ones(d_hid), requires_grad=True) self.b_2 = nn.Parameter(torch.zeros...
Discriminator
# 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 BaseModel(nn.Module): def __init__(self): super(BaseModel, self).__init__() def weights_init(self): classname = self.__class__.__name__ if classname.find('Conv') != -1: nn.init.normal_(self.weight.data, 0.0, 0.02) elif clas...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
by256/PSGAN
Discriminator
false
9,848
[ "MIT" ]
0
ac086d4e25f6fbbe024cb4cdaf9075c88849ef01
https://github.com/by256/PSGAN/tree/ac086d4e25f6fbbe024cb4cdaf9075c88849ef01
import torch import torch.nn as nn class BaseModel(nn.Module): def __init__(self): super().__init__() def weights_init(self): classname = self.__class__.__name__ if classname.find('Conv') != -1: nn.init.normal_(self.weight.data, 0.0, 0.02) elif classname.find('Bat...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class Net(nn.Module): def __init__(self, N_STATES, N_ACTIONS): super(Net, self).__init__() self.fc1 = nn.Linear(N_STATES, 80) self.fc1.weight.data.normal_(0, 0.1) self.fc2 = nn.Linear(80, 60) self.fc2.weigh...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
cariosr/States-Joeynmt
Net
false
9,849
[ "MIT" ]
0
6b2eb67b990b586fe2bc4fb49004d749bc4f33be
https://github.com/cariosr/States-Joeynmt/tree/6b2eb67b990b586fe2bc4fb49004d749bc4f33be
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, N_STATES, N_ACTIONS): super().__init__() self.fc1 = nn.Linear(N_STATES, 80) self.fc1.weight.data.normal_(0, 0.1) self.fc2 = nn.Linear(80, 60) self.fc2.weight.data....
Normalize
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out ...
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.utils.data import torch import torch.nn as nn assert_size_stride =...
a11isonliu/contrastive-unpaired-translation
Normalize
false
9,850
[ "BSD-3-Clause" ]
0
67651ed9877cae121d9398f46094ce8dbc678802
https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802
import torch import torch.utils.data import torch import torch.nn as nn class Model(nn.Module): def __init__(self, power=2): super().__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm + 1e-0...
SequentialPolarizedSelfAttention
# 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 SequentialPolarizedSelfAttention(nn.Module): def __init__(self, channel=512): super().__init__() self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1)) self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1)) self.softmax_channel = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
SequentialPolarizedSelfAttention
false
9,851
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch from torch import nn class Model(nn.Module): def __init__(self, channel=512): super().__init__() self.ch_wv = nn.Conv2d(channel, channel // 2, kernel_size=(1, 1)) self.ch_wq = nn.Conv2d(channel, 1, kernel_size=(1, 1)) self.softmax_channel = nn.Softmax(1) self....
BinaryReg
# 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 typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.parallel class BinaryReg(nn.Module): """Regularization for encouraging the outputs to be binary. Args: pred (torch.Tensor): foreground logits. mask (Optional[torch.Tensor], optional): weight...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
HarshSulakhe/pytorch_connectomics
BinaryReg
false
9,852
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch from typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """Regularization for encouraging the outputs to be binary. Args: pred (torch.Tensor): foreground logits. mask (Optional[torch.Tensor], optional): weight mas...
Conv2dBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super(LayerNorm, self).__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 impor...
a11isonliu/contrastive-unpaired-translation
Conv2dBlock
false
9,853
[ "BSD-3-Clause" ]
0
67651ed9877cae121d9398f46094ce8dbc678802
https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802
import torch import torch.utils.data import torch import torch.nn as nn class LayerNorm(nn.Module): def __init__(self, num_features, eps=1e-05, affine=True): super().__init__() self.num_features = num_features self.affine = affine self.eps = eps if self.affine: ...
ContourDTConsistency
# 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 typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.parallel class ContourDTConsistency(nn.Module): """Consistency regularization between the instance contour map and signed distance transform. Args: pred1 (torch.Tensor): contour 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
HarshSulakhe/pytorch_connectomics
ContourDTConsistency
false
9,854
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch from typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """Consistency regularization between the instance contour map and signed distance transform. Args: pred1 (torch.Tensor): contour logits. pred2 (torch.Te...
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, loss_weight=1.0): super(DiceLoss, self).__init__() self.loss_weight = loss_weight def forward(self, input, target, mask, reduce=True): batch_size = input.size(0) input = torch.sigmoid(input) ...
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...
bhuyle/PAN_ocr
DiceLoss
false
9,855
[ "Apache-2.0" ]
0
bcd03892d4eb08a779a0a7ae63d526d8ea38cb01
https://github.com/bhuyle/PAN_ocr/tree/bcd03892d4eb08a779a0a7ae63d526d8ea38cb01
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, loss_weight=1.0): super().__init__() self.loss_weight = loss_weight def forward(self, input, target, mask, reduce=True): batch_size = input.size(0) input = torch.sigmoid(input) input = input...
WeightedBCEFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class WeightedBCEFocalLoss(nn.Module): """Weighted binary focal loss with logits. """ def __init__(self, gamma=2.0, alpha=0.25, eps=0.0): super().__init__() self.eps = eps ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
HarshSulakhe/pytorch_connectomics
WeightedBCEFocalLoss
false
9,856
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class Model(nn.Module): """Weighted binary focal loss with logits. """ def __init__(self, gamma=2.0, alpha=0.25, eps=0.0): super().__init__() self.eps = eps self.gam...
ForegroundDTConsistency
# 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 typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class ForegroundDTConsistency(nn.Module): """Consistency regularization between the binary foreground mask and signed distance transform. Args: pred1 (to...
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...
HarshSulakhe/pytorch_connectomics
ForegroundDTConsistency
false
9,857
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch from typing import Optional import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class Model(nn.Module): """Consistency regularization between the binary foreground mask and signed distance transform. Args: pred1 (torch.Tensor): foreg...
ToRGB
# 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 import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, 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 import math import torch.utils.data import torch import torch.nn as nn import to...
a11isonliu/contrastive-unpaired-translation
ToRGB
false
9,858
[ "BSD-3-Clause" ]
0
67651ed9877cae121d9398f46094ce8dbc678802
https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802
import math import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, u...
WSDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn as nn import torch.nn.parallel class WSDiceLoss(nn.Module): def __init__(self, smooth=100.0, power=2.0, v2=0.85, v1=0.15): super().__init__() self.smooth = smooth self.power = power self.v2 = v2 self.v1 = v1 def dic...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
HarshSulakhe/pytorch_connectomics
WSDiceLoss
false
9,859
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch import torch.utils.data import torch.nn as nn import torch.nn.parallel class Model(nn.Module): def __init__(self, smooth=100.0, power=2.0, v2=0.85, v1=0.15): super().__init__() self.smooth = smooth self.power = power self.v2 = v2 self.v1 = v1 def dice_los...
WeightedCE
# 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 typing import Optional from typing import List import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class WeightedCE(nn.Module): """Mask weighted multi-class cross-entropy (CE) loss. """ def __init__(self, class_weight: 'Optional[List[fl...
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 typing import Opt...
HarshSulakhe/pytorch_connectomics
WeightedCE
false
9,860
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch from typing import Optional from typing import List import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class Model(nn.Module): """Mask weighted multi-class cross-entropy (CE) loss. """ def __init__(self, class_weight: 'Optional[List[float]]...
ModulatedConv2d
# 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 import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, 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.triton_helpers import libdevice import math import ...
a11isonliu/contrastive-unpaired-translation
ModulatedConv2d
false
9,861
[ "BSD-3-Clause" ]
0
67651ed9877cae121d9398f46094ce8dbc678802
https://github.com/a11isonliu/contrastive-unpaired-translation/tree/67651ed9877cae121d9398f46094ce8dbc678802
import math import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, u...
PatchMerging3D
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class PatchMerging3D(nn.Module): """ Patch Merging Layer Args: dim (int): Number of input channels. norm_layer (nn.Module, optional): Normalization layer. Default: nn.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.triton_helpers import libdevice import torch.utils....
HarshSulakhe/pytorch_connectomics
PatchMerging3D
false
9,862
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class Model(nn.Module): """ Patch Merging Layer Args: dim (int): Number of input channels. norm_layer (nn.Module, optional): Normalization layer. Default: nn.LayerNorm """ ...
WeightedBCEWithLogitsLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class WeightedBCEWithLogitsLoss(nn.Module): """Weighted binary cross-entropy with logits. """ def __init__(self, size_average=True, reduce=True, eps=0.0): super().__init__() ...
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...
HarshSulakhe/pytorch_connectomics
WeightedBCEWithLogitsLoss
false
9,863
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class Model(nn.Module): """Weighted binary cross-entropy with logits. """ def __init__(self, size_average=True, reduce=True, eps=0.0): super().__init__() self.size_average =...
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.utils.data import torch.nn as nn import torch.nn.parallel class DiceLoss(nn.Module): """DICE loss. """ def __init__(self, reduce=True, smooth=100.0, power=1): super(DiceLoss, self).__init__() self.smooth = smooth self.reduce = reduce self.power = ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
HarshSulakhe/pytorch_connectomics
DiceLoss
false
9,864
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch import torch.utils.data import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """DICE loss. """ def __init__(self, reduce=True, smooth=100.0, power=1): super().__init__() self.smooth = smooth self.reduce = reduce self.power = power def di...
AdaptiveConcatPool2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.init class AdaptiveConcatPool2d(nn.Module): def __init__(self, sz=None): super().__init__() sz = sz or (1, 1) self.ap = nn.AdaptiveAvgPool2d(sz) self.mp = nn.AdaptiveMaxPool2d(sz) def forward(self, x): return torch.ca...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo.guards.a...
MichoelSnow/data_science
AdaptiveConcatPool2d
false
9,865
[ "MIT" ]
0
7f6c054624268308ec4126a601c9fa8bc5de157c
https://github.com/MichoelSnow/data_science/tree/7f6c054624268308ec4126a601c9fa8bc5de157c
import torch import torch.nn as nn import torch.nn.init class Model(nn.Module): def __init__(self, sz=None): super().__init__() sz = sz or (1, 1) self.ap = nn.AdaptiveAvgPool2d(sz) self.mp = nn.AdaptiveMaxPool2d(sz) def forward(self, x): return torch.cat([self.mp(x), ...
AvgPoolPad
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.init class AvgPoolPad(nn.Module): def __init__(self, stride=2, padding=1): super(AvgPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_include_pad=...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dy...
MichoelSnow/data_science
AvgPoolPad
false
9,866
[ "MIT" ]
0
7f6c054624268308ec4126a601c9fa8bc5de157c
https://github.com/MichoelSnow/data_science/tree/7f6c054624268308ec4126a601c9fa8bc5de157c
import torch import torch.nn as nn import torch.nn.init class Model(nn.Module): def __init__(self, stride=2, padding=1): super().__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_include_pad=False) def forwa...
CausalAttentionSortNet
# 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.nn import functional as F from functools import partial from torch import nn def bucket(buckets, t, dim=1): shape = list(t.shape) shape[dim:dim + 1] = [buckets, -1] return t.reshape(*shape) def max_neg_value(tensor): return -torch.finfo(tensor.dtype).max def expand_dim(t, d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
blizda/sinkhorn-transformer
CausalAttentionSortNet
false
9,867
[ "MIT" ]
0
4b626a40759010e4cb1752f22387fdbda438f37c
https://github.com/blizda/sinkhorn-transformer/tree/4b626a40759010e4cb1752f22387fdbda438f37c
import torch from torch.nn import functional as F from functools import partial from torch import nn def bucket(buckets, t, dim=1): shape = list(t.shape) shape[dim:dim + 1] = [buckets, -1] return t.reshape(*shape) def max_neg_value(tensor): return -torch.finfo(tensor.dtype).max def expand_dim(t, d...
MaxPoolPad
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.init class MaxPoolPad(nn.Module): def __init__(self): super(MaxPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(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 from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo.guards.a...
MichoelSnow/data_science
MaxPoolPad
false
9,868
[ "MIT" ]
0
7f6c054624268308ec4126a601c9fa8bc5de157c
https://github.com/MichoelSnow/data_science/tree/7f6c054624268308ec4126a601c9fa8bc5de157c
import torch import torch.nn as nn import torch.nn.init class Model(nn.Module): def __init__(self): super().__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(x) x = self.pool(x) ...
CoxPHLossSorted
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07 ) ->Tensor: """Requires the input to be sorted by descending duration time. See DatasetDurationSorted. We calculate the negative log of $( rac{h_i}{\\sum_{j \\in R_i} h_j})^d$, where...
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 Tens...
bseewald/pycox
CoxPHLossSorted
false
9,869
[ "BSD-2-Clause" ]
0
366348d51ecd902a01ab830b2f0a4cf1694d9ae2
https://github.com/bseewald/pycox/tree/366348d51ecd902a01ab830b2f0a4cf1694d9ae2
import torch from torch import Tensor def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07 ) ->Tensor: """Requires the input to be sorted by descending duration time. See DatasetDurationSorted. We calculate the negative log of $( rac{h_i}{\\sum_{j \\in R_i} h_j})^d$, where...
down
# 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 down(nn.Module): def __init__(self, inChannels, outChannels, filterSize): super(down, self).__init__() self.conv1 = nn.Conv2d(inChannels, outChannels, filterSize, stride= 1, padding=int((filterSize - 1) / 2)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
brainma/ASRNet
down
false
9,870
[ "MIT" ]
0
b88edbcfbcee2cc77f7f4b2a8d139ced303a4f14
https://github.com/brainma/ASRNet/tree/b88edbcfbcee2cc77f7f4b2a8d139ced303a4f14
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, inChannels, outChannels, filterSize): super().__init__() self.conv1 = nn.Conv2d(inChannels, outChannels, filterSize, stride= 1, padding=int((filterSize - 1) / 2)) self...
NormedLinear
# 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.parallel import torch.optim import torch.utils.data import torch import torch.nn.functional as F from torch.nn import Parameter class NormedLinear(nn.Module): def __init__(self, in_features, out_features): super(NormedLinear, self).__init__() 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....
caisarl76/LDAM-DRW
NormedLinear
false
9,871
[ "MIT" ]
0
f3d7e98ec40bfbf2c9a806387764a54c5a31d22d
https://github.com/caisarl76/LDAM-DRW/tree/f3d7e98ec40bfbf2c9a806387764a54c5a31d22d
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch import torch.nn.functional as F from torch.nn import Parameter class Model(nn.Module): def __init__(self, in_features, out_features): super().__init__() self.weight = Parameter(torc...
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch import torch.nn.functional as F def focal_loss(input_values, gamma): """Computes the focal loss""" p = torch.exp(-input_values) loss = (1 - p) ** gamma * input_values return loss.mean() ...
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 ...
caisarl76/LDAM-DRW
FocalLoss
false
9,872
[ "MIT" ]
0
f3d7e98ec40bfbf2c9a806387764a54c5a31d22d
https://github.com/caisarl76/LDAM-DRW/tree/f3d7e98ec40bfbf2c9a806387764a54c5a31d22d
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data import torch import torch.nn.functional as F def focal_loss(input_values, gamma): """Computes the focal loss""" p = torch.exp(-input_values) loss = (1 - p) ** gamma * input_values return loss.mean() ...
CenterLoss
# 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 CenterLoss(nn.Module): def __init__(self): super(CenterLoss, self).__init__() self.l2_loss = nn.MSELoss(reduction='sum') def forward(self, outputs, targets): return self.l2_loss(outputs, targets) / outputs.size(0) def get_inputs(): retur...
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...
bysen32/WS-DAN.PyTorch
CenterLoss
false
9,873
[ "MIT" ]
0
de206591f037ea82fc52eaf6915de7f64375e0c9
https://github.com/bysen32/WS-DAN.PyTorch/tree/de206591f037ea82fc52eaf6915de7f64375e0c9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.l2_loss = nn.MSELoss(reduction='sum') def forward(self, outputs, targets): return self.l2_loss(outputs, targets) / outputs.size(0) def get_inputs(): return [torch.rand([4, 4, ...
PatchEmbed3D
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class PatchEmbed3D(nn.Module): """ Video to Patch Embedding. Args: patch_size (int): Patch token size. Default: (2,4,4). in_channel (int): Number of input video channels. Default...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch.nn as nn import torch.nn.parallel assert_si...
HarshSulakhe/pytorch_connectomics
PatchEmbed3D
false
9,874
[ "MIT" ]
0
73402e654afde69a43a5836cc90a32ef75c75dc2
https://github.com/HarshSulakhe/pytorch_connectomics/tree/73402e654afde69a43a5836cc90a32ef75c75dc2
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel class Model(nn.Module): """ Video to Patch Embedding. Args: patch_size (int): Patch token size. Default: (2,4,4). in_channel (int): Number of input video channels. Default: 3. ...
PositionAttentionModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
LiChengChen666/DetectDee
PositionAttentionModule
false
9,875
[ "Apache-2.0" ]
0
1e6aaa0d15b1fc12d1342d8a922004e372b5f437
https://github.com/LiChengChen666/DetectDee/tree/1e6aaa0d15b1fc12d1342d8a922004e372b5f437
import torch import numpy as np from torch import nn from torch.nn import init class ScaledDotProductAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ :param d_model: Output dimensionality of the model :param ...
tri_att
# 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 tri_att(nn.Module): def __init__(self): super(tri_att, self).__init__() self.feature_norm = nn.Softmax(dim=2) self.bilinear_norm = nn.Softmax(dim=2) def forward(self, x): n = x.size(0) c = x.size(1) h = x.size(2) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
bysen32/WS-DAN.PyTorch
tri_att
false
9,876
[ "MIT" ]
0
de206591f037ea82fc52eaf6915de7f64375e0c9
https://github.com/bysen32/WS-DAN.PyTorch/tree/de206591f037ea82fc52eaf6915de7f64375e0c9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.feature_norm = nn.Softmax(dim=2) self.bilinear_norm = nn.Softmax(dim=2) def forward(self, x): n = x.size(0) c = x.size(1) h = x.size(2) w = x.size(3)...
CharbonnierCompLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn as nn from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Returns: Tensor: Reduced lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import functools import torc...
Sardhendu/mmediting
CharbonnierCompLoss
false
9,877
[ "Apache-2.0" ]
0
623b59ac758d856abc9fab7e845beeab61074d8f
https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f
import functools import torch import torch.nn as nn from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Returns: Tensor: Reduced lo...
DiscShiftLoss
# 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 DiscShiftLoss(nn.Module): """Disc shift loss. Args: loss_weight (float, optional): Loss weight. Defaults to 1.0. """ def __init__(self, loss_weight=0.1): super().__init__() self.loss_weight = loss_weight def forward(self, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Sardhendu/mmediting
DiscShiftLoss
false
9,878
[ "Apache-2.0" ]
0
623b59ac758d856abc9fab7e845beeab61074d8f
https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f
import torch import torch.nn as nn class Model(nn.Module): """Disc shift loss. Args: loss_weight (float, optional): Loss weight. Defaults to 1.0. """ def __init__(self, loss_weight=0.1): super().__init__() self.loss_weight = loss_weight def forward(self, x): ...
DoubleInputNet
# 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 as t import torch.nn as nn class DoubleInputNet(nn.Module): def __init__(self, firstinsize, secondinsize, outsize, activation=lambda x: x): super().__init__() self.firstinsize = firstinsize self.secondinsize = secondinsize self.outsize = outsize ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
cbekar/DRL_Project
DoubleInputNet
false
9,879
[ "MIT" ]
0
90d197773c7746b253ee7d997d0526e15d05578a
https://github.com/cbekar/DRL_Project/tree/90d197773c7746b253ee7d997d0526e15d05578a
import torch import torch as t import torch.nn as nn class Model(nn.Module): def __init__(self, firstinsize, secondinsize, outsize, activation=lambda x: x): super().__init__() self.firstinsize = firstinsize self.secondinsize = secondinsize self.outsize = outsize se...
PixelNorm
# 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 pixel_norm(x, eps=1e-06): """Pixel Normalization. This normalization is proposed in: Progressive Growing of GANs for Improved Quality, Stability, and Variation Args: x (torch.Tensor): Tensor to be normalized. eps (float, optional): Epsilon to av...
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_...
Sardhendu/mmediting
PixelNorm
false
9,880
[ "Apache-2.0" ]
0
623b59ac758d856abc9fab7e845beeab61074d8f
https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f
import torch import torch.nn as nn def pixel_norm(x, eps=1e-06): """Pixel Normalization. This normalization is proposed in: Progressive Growing of GANs for Improved Quality, Stability, and Variation Args: x (torch.Tensor): Tensor to be normalized. eps (float, optional): Epsilon to av...
MaxPool
# 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.parallel import torch.optim import torch.utils.data class MaxPool(nn.Module): def __init__(self, kernel_size, stride=1, padding=1, zero_pad=False): super(MaxPool, self).__init__() self.zero_pad = nn.ZeroPad2d((1, 0, 1, 0)) if zero_pad else None ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data ...
OrKatz7/kaggle-hubmap
MaxPool
false
9,881
[ "MIT" ]
0
5cf8c5aebe956c256fa7f3db432639e28f29c6a3
https://github.com/OrKatz7/kaggle-hubmap/tree/5cf8c5aebe956c256fa7f3db432639e28f29c6a3
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data class Model(nn.Module): def __init__(self, kernel_size, stride=1, padding=1, zero_pad=False): super().__init__() self.zero_pad = nn.ZeroPad2d((1, 0, 1, 0)) if zero_pad else None self.pool...
SpatialCrossMapLRN
# 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.parallel import torch.optim import torch.utils.data class SpatialCrossMapLRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, k=1, ACROSS_CHANNELS=True): super(SpatialCrossMapLRN, self).__init__() self.ACROSS_CHANNELS = A...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.nn.parallel import torch.optim import torch.u...
OrKatz7/kaggle-hubmap
SpatialCrossMapLRN
false
9,882
[ "MIT" ]
0
5cf8c5aebe956c256fa7f3db432639e28f29c6a3
https://github.com/OrKatz7/kaggle-hubmap/tree/5cf8c5aebe956c256fa7f3db432639e28f29c6a3
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data class Model(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, k=1, ACROSS_CHANNELS=True): super().__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if ACROSS_CHAN...
L1CompositionLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn as nn from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Returns: Tensor: Reduced lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
Sardhendu/mmediting
L1CompositionLoss
false
9,883
[ "Apache-2.0" ]
0
623b59ac758d856abc9fab7e845beeab61074d8f
https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f
import functools import torch import torch.nn as nn from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Returns: Tensor: Reduced lo...
MSECompositionLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn as nn from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Returns: Tensor: Reduced lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import functools import torch.nn as nn from torch.nn import functional as F assert_size_s...
Sardhendu/mmediting
MSECompositionLoss
false
9,884
[ "Apache-2.0" ]
0
623b59ac758d856abc9fab7e845beeab61074d8f
https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f
import functools import torch import torch.nn as nn from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Returns: Tensor: Reduced lo...
ConvNet
# 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 ConvNet(nn.Module): def __init__(self): super(ConvNet, self).__init__() self.conv1 = nn.Conv2d(1, 3, kernel_size=3) self.fc = nn.Linear(192, 10) def forward(self, x): x = F.relu(F.max_pool2d(self.conv1(x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
chao5645/T-1000
ConvNet
false
9,885
[ "MIT" ]
0
99751bcfd79bd94df3667e7311e3b3af2b912505
https://github.com/chao5645/T-1000/tree/99751bcfd79bd94df3667e7311e3b3af2b912505
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, 3, kernel_size=3) self.fc = nn.Linear(192, 10) def forward(self, x): x = F.relu(F.max_pool2d(self.conv1(x), 3)) ...
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 from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data def init_weight(m): classname = m.__class__.__name__ if classname.find('Conv') != -1: nn.init.kaiming_normal_(m.weight, mode='fan_in', nonlinearity='relu') if m.bias is not None: m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
OrKatz7/kaggle-hubmap
SpatialAttentionModule
false
9,886
[ "MIT" ]
0
5cf8c5aebe956c256fa7f3db432639e28f29c6a3
https://github.com/OrKatz7/kaggle-hubmap/tree/5cf8c5aebe956c256fa7f3db432639e28f29c6a3
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data def init_weight(m): classname = m.__class__.__name__ if classname.find('Conv') != -1: nn.init.kaiming_normal_(m.weight, mode='fan_in', nonlinearity='relu') if m.bias is not None: m...
ExtResNetBlock
# 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 def conv3d(in_channels, out_channels, kernel_size, bias, padding): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding): """ Create a list 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.triton_helpers import libdevice from torch import n...
charmsoya/pytorch-3dunet
ExtResNetBlock
false
9,887
[ "MIT" ]
0
07a8dabf988ac3df110a3c10db6ed5fb769498d9
https://github.com/charmsoya/pytorch-3dunet/tree/07a8dabf988ac3df110a3c10db6ed5fb769498d9
import torch from torch import nn def conv3d(in_channels, out_channels, kernel_size, bias, padding): return nn.Conv3d(in_channels, out_channels, kernel_size, padding= padding, bias=bias) def create_conv(in_channels, out_channels, kernel_size, order, num_groups, padding): """ Create a list of...
CharbonnierLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn as nn from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Returns: Tensor: Reduced lo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import functools import torc...
Sardhendu/mmediting
CharbonnierLoss
false
9,888
[ "Apache-2.0" ]
0
623b59ac758d856abc9fab7e845beeab61074d8f
https://github.com/Sardhendu/mmediting/tree/623b59ac758d856abc9fab7e845beeab61074d8f
import functools import torch import torch.nn as nn from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Returns: Tensor: Reduced lo...
L2Norm
# 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 L2Norm(nn.Module): def __init__(self, n_channels, scale=1.0): super(L2Norm, self).__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(torch.Tensor(self.n_channels)) self.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.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
bluan2019/face-alignment
L2Norm
false
9,889
[ "BSD-3-Clause" ]
0
9e256b18a02c7bd924a88c1203fb875853263336
https://github.com/bluan2019/face-alignment/tree/9e256b18a02c7bd924a88c1203fb875853263336
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_channels, scale=1.0): super().__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(torch.Tensor(self.n_channels)) self.weight.data *= 0...