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
ReinforcedReceiver
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data from torch.distributions import Bernoulli import torch.distributions class ReinforcedReceiver(nn.Module): def __init__(self, n_bits, n_hidden): super(ReinforcedReceiver, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data import to...
XeniaOhmer/SystematicRepresentations
ReinforcedReceiver
false
1,241
[ "MIT" ]
0
825208d1be659dc820e61f577cdb53afc47302f4
https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data from torch.distributions import Bernoulli import torch.distributions class Model(nn.Module): def __init__(self, n_bits, n_hidden): super().__init__() self.emb_column = nn.Linear(n_b...
MLPComposition
# 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.parallel import torch.utils.data import torch.distributions class CompositionFunction(torch.nn.Module): def __init__(self, representation_size: 'int'): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: raise NotImplemented...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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.par...
XeniaOhmer/SystematicRepresentations
MLPComposition
false
1,242
[ "MIT" ]
0
825208d1be659dc820e61f577cdb53afc47302f4
https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4
import torch import torch.nn.parallel import torch.utils.data import torch.distributions class CompositionFunction(torch.nn.Module): def __init__(self, representation_size: 'int'): super().__init__() def forward(self, x: 'torch.Tensor', y: 'torch.Tensor') ->torch.Tensor: raise NotImplemented...
TopicEmbeddingAttention
# 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 import torch.multiprocessing from torch import nn import torch.utils.data class TopicEmbeddingAttention(nn.Module): """ query: encoder的隐藏状态 key value:主题嵌入向量 计算每个时间步t 对于加权topic embedding向量 """ def __init__(self, encoder_hidden_size, topic_num, topi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
WuDiDaBinGe/TAKG
TopicEmbeddingAttention
false
1,243
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch from torch.nn import functional as F import torch.multiprocessing from torch import nn import torch.utils.data class Model(nn.Module): """ query: encoder的隐藏状态 key value:主题嵌入向量 计算每个时间步t 对于加权topic embedding向量 """ def __init__(self, encoder_hidden_size, topic_num, topic_emb_dim): ...
MultiHeadedAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from typing import Optional from typing import Tuple from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention layer. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
WenjingXia/wenet
MultiHeadedAttention
false
1,244
[ "Apache-2.0" ]
0
9a1fd005cd06be16518a5476076b2ae6af2ec41a
https://github.com/WenjingXia/wenet/tree/9a1fd005cd06be16518a5476076b2ae6af2ec41a
import math import torch from typing import Optional from typing import Tuple from torch import nn class Model(nn.Module): """Multi-Head Attention layer. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. """ de...
F_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 warnings import torch.nn as nn import torch.nn.functional as F class F_conv(nn.Module): """ResNet transformation, not itself reversible, just used below""" def __init__(self, in_channels, channels, channels_hidden=None, stride= None, kernel_size=3, leaky_slope=0.1, batch_norm=Fals...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import warnings import torch.nn as nn assert_size_stride = torch._C._dynamo.guar...
Xenovortex/INN_Embedding_Classification
F_conv
false
1,245
[ "MIT" ]
0
df31ec3dcf70780cae5140a69ffafdd64f218e5f
https://github.com/Xenovortex/INN_Embedding_Classification/tree/df31ec3dcf70780cae5140a69ffafdd64f218e5f
import torch import warnings import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ResNet transformation, not itself reversible, just used below""" def __init__(self, in_channels, channels, channels_hidden=None, stride= None, kernel_size=3, leaky_slope=0.1, batch_norm=False...
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 Discriminator(nn.Module): """ The discriminator .. math:: \\begin{equation} \\mathcal{D}\\left(\\mathbf{h}_{i}^{(r)}, \\mathbf{s}^{(r)}\\right)=\\sigma\\left(\\mathbf{h}_{i}^{(r) T} \\mathbf{M}^{(r)} \\mathbf{s}^{(r)}\\right) \\end{equation} ...
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...
Xinstein3033/OpenHGNN
Discriminator
false
1,246
[ "Apache-2.0" ]
0
a9ca499834523419ecdaaa09e4b42f640486f262
https://github.com/Xinstein3033/OpenHGNN/tree/a9ca499834523419ecdaaa09e4b42f640486f262
import torch import torch.nn as nn class Model(nn.Module): """ The discriminator .. math:: \\begin{equation} \\mathcal{D}\\left(\\mathbf{h}_{i}^{(r)}, \\mathbf{s}^{(r)}\\right)=\\sigma\\left(\\mathbf{h}_{i}^{(r) T} \\mathbf{M}^{(r)} \\mathbf{s}^{(r)}\\right) \\end{equation} where...
WavePool
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn def getWavelet(in_channels, pool=True): """wavelet decomposition using conv2d""" harr_wav_L = 1 / np.sqrt(2) * np.ones((1, 2)) harr_wav_H = 1 / np.sqrt(2) * np.ones((1, 2)) harr_wav_H[0, 0] = -1 * harr_wav_H[0, 0] harr_wav_LL = np.transpose(harr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np from torch import nn assert_size_stride = torch._C._dynamo.gu...
XHChen0528/ConditionalGAN_Develop
WavePool
false
1,247
[ "MIT" ]
0
4ea6d8ea130589bc3ff8f3117660050ba41cdd0f
https://github.com/XHChen0528/ConditionalGAN_Develop/tree/4ea6d8ea130589bc3ff8f3117660050ba41cdd0f
import torch import numpy as np from torch import nn def getWavelet(in_channels, pool=True): """wavelet decomposition using conv2d""" harr_wav_L = 1 / np.sqrt(2) * np.ones((1, 2)) harr_wav_H = 1 / np.sqrt(2) * np.ones((1, 2)) harr_wav_H[0, 0] = -1 * harr_wav_H[0, 0] harr_wav_LL = np.transpose(harr...
RelPositionMultiHeadedAttention
# 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 typing import Optional from typing import Tuple from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention layer. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
WenjingXia/wenet
RelPositionMultiHeadedAttention
false
1,248
[ "Apache-2.0" ]
0
9a1fd005cd06be16518a5476076b2ae6af2ec41a
https://github.com/WenjingXia/wenet/tree/9a1fd005cd06be16518a5476076b2ae6af2ec41a
import math import torch from typing import Optional from typing import Tuple from torch import nn class MultiHeadedAttention(nn.Module): """Multi-Head Attention layer. Args: n_head (int): The number of heads. n_feat (int): The number of features. dropout_rate (float): Dropout rate. ...
ActivationQuantizer
# 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.autograd import Function import torch import torch.nn as nn class Round(Function): @staticmethod def forward(self, input): sign = torch.sign(input) output = sign * torch.floor(torch.abs(input) + 0.5) return output @staticmethod def backward(self, grad_output): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch....
XueYue404/QNN
ActivationQuantizer
false
1,249
[ "MIT" ]
0
43cea970404156b591088d77672df58261edf1eb
https://github.com/XueYue404/QNN/tree/43cea970404156b591088d77672df58261edf1eb
from torch.autograd import Function import torch import torch.nn as nn class Round(Function): @staticmethod def forward(self, input): sign = torch.sign(input) output = sign * torch.floor(torch.abs(input) + 0.5) return output @staticmethod def backward(self, grad_output): ...
ChannelReplicate
# 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 ChannelReplicate(nn.Module): def __init__(self, factor=3): super(ChannelReplicate, self).__init__() self.factor = factor def forward(self, input): template = input for i in range(0, self.factor - 1): input = torch.cat((temp...
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...
YingqiLiulll/scrips_for_SR
ChannelReplicate
false
1,250
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, factor=3): super().__init__() self.factor = factor def forward(self, input): template = input for i in range(0, self.factor - 1): input = torch.cat((template, input), 1) return i...
HFM
# 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 HFM(nn.Module): def __init__(self, k=2): super().__init__() self.k = k self.net = nn.Sequential(nn.AvgPool2d(kernel_size=self.k, stride= self.k), nn.Upsample(scale_factor=self.k, mode='nearest')) def forward(self, tL): asse...
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...
YingqiLiulll/scrips_for_SR
HFM
false
1,251
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, k=2): super().__init__() self.k = k self.net = nn.Sequential(nn.AvgPool2d(kernel_size=self.k, stride= self.k), nn.Upsample(scale_factor=self.k, mode='nearest')) def forward(self, tL): as...
InformedSender
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class InformedSender(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super(InformedSender, 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....
XeniaOhmer/SystematicRepresentations
InformedSender
false
1,252
[ "MIT" ]
0
825208d1be659dc820e61f577cdb53afc47302f4
https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class Model(nn.Module): def __init__(self, game_size, feat_size, embedding_size, hidden_size, vocab_size=100, temp=1.0): super().__init__() self.g...
ScaledDotProductAttention
# 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 ScaledDotProductAttention(nn.Module): def __init__(self, temperature, dropout=0.1): super(ScaledDotProductAttention, self).__init__() self.temperature = temperature self.dropout = nn.Dropout(p=dropout) def forward(self, q, k, v, mask=None): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
YacobBY/vedastr
ScaledDotProductAttention
false
1,253
[ "Apache-2.0" ]
0
2353780489b58d2398b9af49d238ef0df3f45f2a
https://github.com/YacobBY/vedastr/tree/2353780489b58d2398b9af49d238ef0df3f45f2a
import torch from torch import nn class Model(nn.Module): def __init__(self, temperature, dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(p=dropout) def forward(self, q, k, v, mask=None): attn = torch.matmul(q, k.transpose(2, 3)) / se...
RelationCrossing
# 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 RelationCrossing(nn.Module): def __init__(self, in_feats: 'int', out_feats: 'int', num_heads: 'int', dropout: 'float'=0.0, negative_slope: 'float'=0.2): """ Description ---------- Relation crossing l...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Xinstein3033/OpenHGNN
RelationCrossing
false
1,254
[ "Apache-2.0" ]
0
a9ca499834523419ecdaaa09e4b42f640486f262
https://github.com/Xinstein3033/OpenHGNN/tree/a9ca499834523419ecdaaa09e4b42f640486f262
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_feats: 'int', out_feats: 'int', num_heads: 'int', dropout: 'float'=0.0, negative_slope: 'float'=0.2): """ Description ---------- Relation crossing layer ...
WeightQuantizer
# 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.autograd import Function import torch import torch.nn as nn class Round(Function): @staticmethod def forward(self, input): sign = torch.sign(input) output = sign * torch.floor(torch.abs(input) + 0.5) return output @staticmethod def backward(self, grad_output): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch....
XueYue404/QNN
WeightQuantizer
false
1,255
[ "MIT" ]
0
43cea970404156b591088d77672df58261edf1eb
https://github.com/XueYue404/QNN/tree/43cea970404156b591088d77672df58261edf1eb
from torch.autograd import Function import torch import torch.nn as nn class Round(Function): @staticmethod def forward(self, input): sign = torch.sign(input) output = sign * torch.floor(torch.abs(input) + 0.5) return output @staticmethod def backward(self, grad_output): ...
LogisticRegression
# 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.utils.data class LogisticRegression(nn.Module): def __init__(self, input_units: 'int', output_units: 'int'): super().__init__() self._weights = nn.Parameter(torch.randn((input_units, output_units )), requires_grad=True) self._bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Yalfoosh/DUBUCE
LogisticRegression
false
1,256
[ "Apache-2.0" ]
0
3f53923c27b1bce0ac592b20c5bb98649cb7fb75
https://github.com/Yalfoosh/DUBUCE/tree/3f53923c27b1bce0ac592b20c5bb98649cb7fb75
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, input_units: 'int', output_units: 'int'): super().__init__() self._weights = nn.Parameter(torch.randn((input_units, output_units )), requires_grad=True) self._bias = nn.Paramet...
QuantLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.autograd import Function import torch import torch.nn as nn import torch.nn.functional as F class Round(Function): @staticmethod def forward(self, input): sign = torch.sign(input) output = sign * torch.floor(torch.abs(input) + 0.5) return output @staticmethod def b...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
XueYue404/QNN
QuantLinear
false
1,257
[ "MIT" ]
0
43cea970404156b591088d77672df58261edf1eb
https://github.com/XueYue404/QNN/tree/43cea970404156b591088d77672df58261edf1eb
from torch.autograd import Function import torch import torch.nn as nn import torch.nn.functional as F class Round(Function): @staticmethod def forward(self, input): sign = torch.sign(input) output = sign * torch.floor(torch.abs(input) + 0.5) return output @staticmethod def b...
PointwiseFeedForward
# 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 PointwiseFeedForward(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_hid, d_inner_hid=None, d_out=None, dropout=0): super(PointwiseFeedForward, self).__init__() if d_inner_hid is None: d_inner_hid = d_hid if...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
XuMayi/PyABSA
PointwiseFeedForward
false
1,258
[ "MIT" ]
0
3d71c0cdaea7ea1eff600d9091c3c63f61c111e5
https://github.com/XuMayi/PyABSA/tree/3d71c0cdaea7ea1eff600d9091c3c63f61c111e5
import torch import torch.nn as nn class Model(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_hid, d_inner_hid=None, d_out=None, dropout=0): super().__init__() if d_inner_hid is None: d_inner_hid = d_hid if d_out is None: d_out = d_inn...
ConcatenateLinear
# 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.tensorboard import torch.utils.data import torch.distributed class ConcatenateLinear(torch.nn.Module): """A torch module which concatenates several inputs and mixes them using a linear layer. """ def __init__(self, left_size, right_size, output_size): """Creates a new ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.tensorboard import torch.utils.data import torch.distributed ...
JoeLambourne/SketchGraphs
ConcatenateLinear
false
1,259
[ "MIT" ]
0
183c65f82d71d82c62b253092e9b7fa65846a3e6
https://github.com/JoeLambourne/SketchGraphs/tree/183c65f82d71d82c62b253092e9b7fa65846a3e6
import torch import torch.utils.tensorboard import torch.utils.data import torch.distributed class Model(torch.nn.Module): """A torch module which concatenates several inputs and mixes them using a linear layer. """ def __init__(self, left_size, right_size, output_size): """Creates a new concatenatin...
SqueezeEmbedding
# 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 SqueezeEmbedding(nn.Module): """ Squeeze sequence embedding length to the longest one in the batch """ def __init__(self, batch_first=True): super(SqueezeEmbedding, self).__init__() self.batch_first = batch_first def forward(self, x, x_len...
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...
XuMayi/PyABSA
SqueezeEmbedding
false
1,260
[ "MIT" ]
0
3d71c0cdaea7ea1eff600d9091c3c63f61c111e5
https://github.com/XuMayi/PyABSA/tree/3d71c0cdaea7ea1eff600d9091c3c63f61c111e5
import torch import torch.nn as nn class Model(nn.Module): """ Squeeze sequence embedding length to the longest one in the batch """ def __init__(self, batch_first=True): super().__init__() self.batch_first = batch_first def forward(self, x, x_len): """ sequence -...
QuantConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.autograd import Function import torch import torch.nn as nn import torch.nn.functional as F class Round(Function): @staticmethod def forward(self, input): sign = torch.sign(input) output = sign * torch.floor(torch.abs(input) + 0.5) return output @staticmethod def b...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
XueYue404/QNN
QuantConv2d
false
1,261
[ "MIT" ]
0
43cea970404156b591088d77672df58261edf1eb
https://github.com/XueYue404/QNN/tree/43cea970404156b591088d77672df58261edf1eb
from torch.autograd import Function import torch import torch.nn as nn import torch.nn.functional as F class Round(Function): @staticmethod def forward(self, input): sign = torch.sign(input) output = sign * torch.floor(torch.abs(input) + 0.5) return output @staticmethod def b...
PA
# 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 PA(nn.Module): """PA is pixel attention""" def __init__(self, nf): super(PA, self).__init__() self.conv = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() def forward(self, x): y = self.conv(x) y = self.sigmoid(y) o...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
YingqiLiulll/scrips_for_SR
PA
false
1,262
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn class Model(nn.Module): """PA is pixel attention""" def __init__(self, nf): super().__init__() self.conv = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() def forward(self, x): y = self.conv(x) y = self.sigmoid(y) out = ...
BSConvU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class BSConvU(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, dilation=1, bias=True, padding_mode='zeros', with_norm= True, bn_kwargs=None): super().__init__() self.with_norm = with_norm if bn_kwargs is None:...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride ...
YingqiLiulll/scrips_for_SR
BSConvU
false
1,263
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch class Model(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1, dilation=1, bias=True, padding_mode='zeros', with_norm= True, bn_kwargs=None): super().__init__() self.with_norm = with_norm if bn_kwargs is None: ...
aeEncoder
# 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 aeEncoder(nn.Module): def __init__(self, capacity, channel): super(aeEncoder, self).__init__() self.c = capacity self.channel = channel self.conv1 = nn.Conv2d(in_channels=self.channel, out_channels=self. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
XiaoyuanGuo/TEND_MedicalNoveltyDetection
aeEncoder
false
1,264
[ "MIT" ]
0
5c2144f0592373d814540cc0fa8e60197ea51756
https://github.com/XiaoyuanGuo/TEND_MedicalNoveltyDetection/tree/5c2144f0592373d814540cc0fa8e60197ea51756
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, capacity, channel): super().__init__() self.c = capacity self.channel = channel self.conv1 = nn.Conv2d(in_channels=self.channel, out_channels=self. c, kernel_si...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
XuMayi/PyABSA
Attention
false
1,265
[ "MIT" ]
0
3d71c0cdaea7ea1eff600d9091c3c63f61c111e5
https://github.com/XuMayi/PyABSA/tree/3d71c0cdaea7ea1eff600d9091c3c63f61c111e5
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
F_fully_convolutional
# 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 F_fully_convolutional(nn.Module): def __init__(self, in_channels, out_channels, internal_size=256, kernel_size=3, leaky_slope=0.02): super().__init__() pad = kernel_size // 2 self.leaky_slope = leaky_slope ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Xenovortex/INN_Embedding_Classification
F_fully_convolutional
false
1,266
[ "MIT" ]
0
df31ec3dcf70780cae5140a69ffafdd64f218e5f
https://github.com/Xenovortex/INN_Embedding_Classification/tree/df31ec3dcf70780cae5140a69ffafdd64f218e5f
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channels, out_channels, internal_size=256, kernel_size=3, leaky_slope=0.02): super().__init__() pad = kernel_size // 2 self.leaky_slope = leaky_slope self.conv1...
PAConv
# 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 PAConv(nn.Module): def __init__(self, nf, k_size=3): super(PAConv, self).__init__() self.k2 = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() self.k3 = nn.Conv2d(nf, nf, kernel_size=k_size, padding=(k_size - 1 ) // 2, bias=Fals...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
YingqiLiulll/scrips_for_SR
PAConv
false
1,267
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, nf, k_size=3): super().__init__() self.k2 = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() self.k3 = nn.Conv2d(nf, nf, kernel_size=k_size, padding=(k_size - 1 ) // 2, bias=False) se...
PVABlock
# 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 constant_init(module, val, bias=0): nn.init.constant_(module.weight, val) if hasattr(module, 'bias') and module.bias is not None: nn.init.constant_(module.bias, bias) def kaiming_init(module, a=0, is_rnn=False, mode='fan_in', nonlinearity= 'leaky_relu', bias...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
YacobBY/vedastr
PVABlock
false
1,268
[ "Apache-2.0" ]
0
2353780489b58d2398b9af49d238ef0df3f45f2a
https://github.com/YacobBY/vedastr/tree/2353780489b58d2398b9af49d238ef0df3f45f2a
import torch from torch import nn def constant_init(module, val, bias=0): nn.init.constant_(module.weight, val) if hasattr(module, 'bias') and module.bias is not None: nn.init.constant_(module.bias, bias) def kaiming_init(module, a=0, is_rnn=False, mode='fan_in', nonlinearity= 'leaky_relu', bias...
MyModel
# 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 MyModel(nn.Module): def __init__(self, state_size, action_size): super(MyModel, self).__init__() self.fc1 = nn.Linear(state_size, 120) self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Linear(84, action_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Yaphetsf75/slimevolleygym
MyModel
false
1,269
[ "Apache-2.0" ]
0
39882c2c8c86c974c9b1083e8d93b2b0fdeecb56
https://github.com/Yaphetsf75/slimevolleygym/tree/39882c2c8c86c974c9b1083e8d93b2b0fdeecb56
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_size, action_size): super().__init__() self.fc1 = nn.Linear(state_size, 120) self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Linear(84, action_size) def forward(sel...
GumbelSoftmaxLayer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch.distributions def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0, training: 'bool'=True, straight_through: 'bool'=False): size = log...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch...
XeniaOhmer/SystematicRepresentations
GumbelSoftmaxLayer
false
1,270
[ "MIT" ]
0
825208d1be659dc820e61f577cdb53afc47302f4
https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4
import torch import torch.nn as nn from torch.distributions import RelaxedOneHotCategorical import torch.nn.parallel import torch.utils.data import torch.distributions def gumbel_softmax_sample(logits: 'torch.Tensor', temperature: 'float'=1.0, training: 'bool'=True, straight_through: 'bool'=False): size = log...
ChannelRate
# 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 ChannelRate(nn.Module): rates: 'torch.Tensor' def __init__(self, num_channels: 'int', device=None, dtype=None): super().__init__() kw = {'device': device, 'dtype': dtype} self.rates = nn.Parameter(torch.ones(num_channels, **kw)) def forwar...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
YodaEmbedding/deep-compression
ChannelRate
false
1,271
[ "MIT" ]
0
cc1ea691921fbe2e5cffeb30a02b777dadd08700
https://github.com/YodaEmbedding/deep-compression/tree/cc1ea691921fbe2e5cffeb30a02b777dadd08700
import torch import torch.nn as nn class Model(nn.Module): rates: 'torch.Tensor' def __init__(self, num_channels: 'int', device=None, dtype=None): super().__init__() kw = {'device': device, 'dtype': dtype} self.rates = nn.Parameter(torch.ones(num_channels, **kw)) def forward(self...
TransformerEncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class TransformerEncoderLayer(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.0): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
XeniaOhmer/SystematicRepresentations
TransformerEncoderLayer
false
1,272
[ "MIT" ]
0
825208d1be659dc820e61f577cdb53afc47302f4
https://github.com/XeniaOhmer/SystematicRepresentations/tree/825208d1be659dc820e61f577cdb53afc47302f4
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.utils.data import torch.distributions class Model(nn.Module): def __init__(self, embed_dim, num_heads, hidden_size, dropout=0.0, attention_dropout=0.0, activation_dropout=0.0): super().__init_...
ARFB
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def defaultConv(inChannels, outChannels, kernelSize, bias=True): return nn.Conv2d(inChannels, outChannels, kernelSize, padding= kernelSize // 2, bias=bias) class ResidualUnit(nn.Module): def __init__(self, inChannel, outChannel, reScale, kernelSize=1, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
YingqiLiulll/scrips_for_SR
ARFB
false
1,273
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn def defaultConv(inChannels, outChannels, kernelSize, bias=True): return nn.Conv2d(inChannels, outChannels, kernelSize, padding= kernelSize // 2, bias=bias) class ResidualUnit(nn.Module): def __init__(self, inChannel, outChannel, reScale, kernelSize=1, bias=True ...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class ScaledDotProductAttention(nn.Module): def __init__(self, temperature, dropout=0.1): super(ScaledDotProductAttention, self).__init__() self.temperature = temperature self.dropout = nn.Dropout(p=dropout) def forward(self, q, k, v, mask=None): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
YacobBY/vedastr
MultiHeadAttention
false
1,274
[ "Apache-2.0" ]
0
2353780489b58d2398b9af49d238ef0df3f45f2a
https://github.com/YacobBY/vedastr/tree/2353780489b58d2398b9af49d238ef0df3f45f2a
import torch from torch import nn class ScaledDotProductAttention(nn.Module): def __init__(self, temperature, dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(p=dropout) def forward(self, q, k, v, mask=None): attn = torch.matmul(q, k.t...
DrugDrugAttentionLayer
# 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 class DrugDrugAttentionLayer(torch.nn.Module): """Co-attention layer for drug pairs.""" def __init__(self, feature_number: 'int'): """Initialize the co-attention layer. :param feature_number: Number of input features. """ super().__init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.fun...
YuWVandy/chemicalx
DrugDrugAttentionLayer
false
1,275
[ "Apache-2.0" ]
0
c02f979a502409c26700e6d5a1b2e6c0aa77e64c
https://github.com/YuWVandy/chemicalx/tree/c02f979a502409c26700e6d5a1b2e6c0aa77e64c
import torch import torch.nn.functional class Model(torch.nn.Module): """Co-attention layer for drug pairs.""" def __init__(self, feature_number: 'int'): """Initialize the co-attention layer. :param feature_number: Number of input features. """ super().__init__() self...
Highway
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F import torch.nn.functional class Highway(nn.Module): """The Highway update layer from [srivastava2015]_. .. [srivastava2015] Srivastava, R. K., *et al.* (2015). `Highway Networks <http://arxiv.org/abs/1505.00387>`_. *arXiv*,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
YuWVandy/chemicalx
Highway
false
1,276
[ "Apache-2.0" ]
0
c02f979a502409c26700e6d5a1b2e6c0aa77e64c
https://github.com/YuWVandy/chemicalx/tree/c02f979a502409c26700e6d5a1b2e6c0aa77e64c
import torch from torch import nn from torch.nn import functional as F import torch.nn.functional class Model(nn.Module): """The Highway update layer from [srivastava2015]_. .. [srivastava2015] Srivastava, R. K., *et al.* (2015). `Highway Networks <http://arxiv.org/abs/1505.00387>`_. *arXiv*, 1...
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, eps: 'float'=1e-09): super(DiceLoss, self).__init__() self.smooth = 1.0 self.eps = eps def forward(self, y_pred, y_true): num = y_true.size(0) probability = torch.sigmoid(y_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Yukei7/Multimodal-Segmentation-Network
DiceLoss
false
1,277
[ "MIT" ]
0
0a38aa8bbd2eb87e28209c810438248c0464a240
https://github.com/Yukei7/Multimodal-Segmentation-Network/tree/0a38aa8bbd2eb87e28209c810438248c0464a240
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, eps: 'float'=1e-09): super().__init__() self.smooth = 1.0 self.eps = eps def forward(self, y_pred, y_true): num = y_true.size(0) probability = torch.sigmoid(y_pred) probability = pro...
RegressionModel
# 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 RegressionModel(nn.Module): def __init__(self, num_features_in, num_anchors=1, feature_size=256): super(RegressionModel, self).__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
YuBeomGon/pytorch_retina
RegressionModel
false
1,278
[ "Apache-2.0" ]
0
a1713ecbf99e3cf2f8f5edce3329b808b4f9dee8
https://github.com/YuBeomGon/pytorch_retina/tree/a1713ecbf99e3cf2f8f5edce3329b808b4f9dee8
import torch import torch.nn as nn import torch.utils.data.distributed class Model(nn.Module): def __init__(self, num_features_in, num_anchors=1, feature_size=256): super().__init__() self.conv1 = nn.Conv2d(num_features_in, feature_size, kernel_size=3, padding=1) self.act1 = n...
RNNModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def initialize(dims, connection_prob=1.0, shape=0.1, scale=1.0): w = np.random.gamma(shape, scale, size=dims) w *= np.random.rand(*dims) < connection_prob return np.float32(w) class VanillaRNNCell(nn.Module...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
YuXie96/time
RNNModel
false
1,279
[ "MIT" ]
0
8539d55d2449c712f54331b06720ab7faf3593df
https://github.com/YuXie96/time/tree/8539d55d2449c712f54331b06720ab7faf3593df
import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def initialize(dims, connection_prob=1.0, shape=0.1, scale=1.0): w = np.random.gamma(shape, scale, size=dims) w *= np.random.rand(*dims) < connection_prob return np.float32(w) class VanillaRNNCell(nn.Module...
NHDUnitV2
# 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 NHDUnitV2(nn.Module): def __init__(self, in_channels, hidden_channels, *args, **kwargs): super(NHDUnitV2, self).__init__() self.in_channels = in_channels self.hidden_channels = hidden_channels self._build() def _build(self): se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
YiqunChen1999/NTIRE2021NHDehazing
NHDUnitV2
false
1,280
[ "MIT" ]
0
3341ae561ac8caff7f40ddf6d4408032a28ff13c
https://github.com/YiqunChen1999/NTIRE2021NHDehazing/tree/3341ae561ac8caff7f40ddf6d4408032a28ff13c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, hidden_channels, *args, **kwargs): super().__init__() self.in_channels = in_channels self.hidden_channels = hidden_channels self._build() def _build(self): self.conv_1 = nn.Conv...
EmbeddingLayer
# 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 class EmbeddingLayer(torch.nn.Module): """Attention layer.""" def __init__(self, feature_number: 'int'): """Initialize the relational embedding layer. :param feature_number: Number of features. """ super().__init__() self.weight...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
YuWVandy/chemicalx
EmbeddingLayer
false
1,281
[ "Apache-2.0" ]
0
c02f979a502409c26700e6d5a1b2e6c0aa77e64c
https://github.com/YuWVandy/chemicalx/tree/c02f979a502409c26700e6d5a1b2e6c0aa77e64c
import torch import torch.nn.functional class Model(torch.nn.Module): """Attention layer.""" def __init__(self, feature_number: 'int'): """Initialize the relational embedding layer. :param feature_number: Number of features. """ super().__init__() self.weights = torch...
VanillaRNNCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class VanillaRNNCell(nn.Module): def __init__(self, input_size, hidden_size, nonlinearity='tanh', ct=False): super(VanillaRNNCell, self).__init__() self.input_size = input_size self.hidden_size = hidden_size ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
YuXie96/time
VanillaRNNCell
false
1,282
[ "MIT" ]
0
8539d55d2449c712f54331b06720ab7faf3593df
https://github.com/YuXie96/time/tree/8539d55d2449c712f54331b06720ab7faf3593df
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size, hidden_size, nonlinearity='tanh', ct=False): super().__init__() self.input_size = input_size self.hidden_size = hidden_size self.nonlinearity = non...
SpatialAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv2d(2, 1, kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
YuanZi1501040205/Ice-detection-for-smart-track-heating-with-normal-only-self-supervised-learning
SpatialAttention
false
1,283
[ "MIT" ]
0
ac7603dc27cf1cc9ce29cfae6c525dd5dbbcdd83
https://github.com/YuanZi1501040205/Ice-detection-for-smart-track-heating-with-normal-only-self-supervised-learning/tree/ac7603dc27cf1cc9ce29cfae6c525dd5dbbcdd83
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, kernel_size=7): super().__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv2d(2, 1, kernel_size, padding=padding, bias=False)...
ResidualUnit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def defaultConv(inChannels, outChannels, kernelSize, bias=True): return nn.Conv2d(inChannels, outChannels, kernelSize, padding= kernelSize // 2, bias=bias) class ResidualUnit(nn.Module): def __init__(self, inChannel, outChannel, reScale, kernelSize=1, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
YingqiLiulll/scrips_for_SR
ResidualUnit
false
1,284
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn def defaultConv(inChannels, outChannels, kernelSize, bias=True): return nn.Conv2d(inChannels, outChannels, kernelSize, padding= kernelSize // 2, bias=bias) class Model(nn.Module): def __init__(self, inChannel, outChannel, reScale, kernelSize=1, bias=True )...
ClassificationModel
# 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 ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=1, num_classes=80, prior=0.01, feature_size=256): super(ClassificationModel, self).__init__() self.num_classes = num_classes ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
YuBeomGon/pytorch_retina
ClassificationModel
false
1,285
[ "Apache-2.0" ]
0
a1713ecbf99e3cf2f8f5edce3329b808b4f9dee8
https://github.com/YuBeomGon/pytorch_retina/tree/a1713ecbf99e3cf2f8f5edce3329b808b4f9dee8
import torch import torch.nn as nn import torch.utils.data.distributed class Model(nn.Module): def __init__(self, num_features_in, num_anchors=1, num_classes=80, prior=0.01, feature_size=256): super().__init__() self.num_classes = num_classes self.num_anchors = num_anchors ...
TopicMemeoryMechanism
# 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.multiprocessing from torch import nn import torch.utils.data class TopicMemeoryMechanism(nn.Module): def __init__(self, topic_num, bow_size, embed_size): super(TopicMemeoryMechanism, self).__init__() self.topic_num = topic_num self.bow_size = bow_size 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 import torch.multiprocessing ...
WuDiDaBinGe/TAKG
TopicMemeoryMechanism
false
1,286
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch import torch.multiprocessing from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, topic_num, bow_size, embed_size): super().__init__() self.topic_num = topic_num self.bow_size = bow_size self.embed_size = embed_size self.sour...
Lda2Vec
# 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 import torch.multiprocessing from torch import nn import torch.utils.data class ContextGate(nn.Module): def __init__(self, vector_dim, topic_dim): super().__init__() assert vector_dim == topic_dim self.fusion_linear = nn.Linear(vector_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....
WuDiDaBinGe/TAKG
Lda2Vec
false
1,287
[ "MIT" ]
0
83e608e677a4ee74722d18cb5ef430f4f6c6ad31
https://github.com/WuDiDaBinGe/TAKG/tree/83e608e677a4ee74722d18cb5ef430f4f6c6ad31
import torch from torch.nn import functional as F import torch.multiprocessing from torch import nn import torch.utils.data class ContextGate(nn.Module): def __init__(self, vector_dim, topic_dim): super().__init__() assert vector_dim == topic_dim self.fusion_linear = nn.Linear(vector_dim ...
PA_UP
# 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 PA(nn.Module): """PA is pixel attention""" def __init__(self, nf): super(PA, self).__init__() self.conv = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() def forward(self, x): y = self.conv(x) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
YingqiLiulll/scrips_for_SR
PA_UP
false
1,288
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn import torch.nn.functional as F class PA(nn.Module): """PA is pixel attention""" def __init__(self, nf): super().__init__() self.conv = nn.Conv2d(nf, nf, 1) self.sigmoid = nn.Sigmoid() def forward(self, x): y = self.conv(x) y = s...
BCEDiceLoss
# 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, eps: 'float'=1e-09): super(DiceLoss, self).__init__() self.smooth = 1.0 self.eps = eps def forward(self, y_pred, y_true): num = y_true.size(0) probability = torch.sigmoid(y_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 libdevice, math as tl_math import torc...
Yukei7/Multimodal-Segmentation-Network
BCEDiceLoss
false
1,289
[ "MIT" ]
0
0a38aa8bbd2eb87e28209c810438248c0464a240
https://github.com/Yukei7/Multimodal-Segmentation-Network/tree/0a38aa8bbd2eb87e28209c810438248c0464a240
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, eps: 'float'=1e-09): super().__init__() self.smooth = 1.0 self.eps = eps def forward(self, y_pred, y_true): num = y_true.size(0) probability = torch.sigmoid(y_pred) probability = ...
Upsample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ZGCTroy/guided-diffusion
Upsample
false
1,290
[ "MIT" ]
0
af987bb2b65db2875148a5466df79736ea5ae6a1
https://github.com/ZGCTroy/guided-diffusion/tree/af987bb2b65db2875148a5466df79736ea5ae6a1
import torch import torch.nn.functional as F import torch.nn as nn def conv_nd(dims, *args, **kwargs): """ Create a 1D, 2D, or 3D convolution module. """ if dims == 1: return nn.Conv1d(*args, **kwargs) elif dims == 2: return nn.Conv2d(*args, **kwargs) elif dims == 3: re...
ValueNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class ValueNetwork(nn.Module): def __init__(self, num_inputs, hidd...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Yunaik/drl_env
ValueNetwork
false
1,291
[ "MIT" ]
0
d284e79847c59daa6ccb222f30fc7e2a86375546
https://github.com/Yunaik/drl_env/tree/d284e79847c59daa6ccb222f30fc7e2a86375546
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class Model(nn.Module): def __init__(self, num_inputs, hidden_dim)...
QNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class QNetwork(nn.Module): def __init__(self, num_inputs, num_acti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Yunaik/drl_env
QNetwork
false
1,292
[ "MIT" ]
0
d284e79847c59daa6ccb222f30fc7e2a86375546
https://github.com/Yunaik/drl_env/tree/d284e79847c59daa6ccb222f30fc7e2a86375546
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data def weights_init_(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight, gain=1) torch.nn.init.constant_(m.bias, 0) class Model(nn.Module): def __init__(self, num_inputs, num_actions...
InnerProductModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class InnerProductModel(torch.nn.Module): @staticmethod def is_valid_model_type(model_type): raise NotImplementedError @staticmethod def get_model_from_type(model_type): raise NotImplementedError @property def loss_criterion(self): return torch.nn.MSELos...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda reinterpret...
Yufei-Kang/plato
InnerProductModel
false
1,293
[ "Apache-2.0" ]
0
16b170698242b1e11677e80229c3439a9e26965a
https://github.com/Yufei-Kang/plato/tree/16b170698242b1e11677e80229c3439a9e26965a
import torch class Model(torch.nn.Module): @staticmethod def is_valid_model_type(model_type): raise NotImplementedError @staticmethod def get_model_from_type(model_type): raise NotImplementedError @property def loss_criterion(self): return torch.nn.MSELoss() def...
SequenceSummaryLayer
# 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 SequenceSummaryLayer(nn.Module): def __init__(self, hidden_size, summary_layers): super().__init__() self.summary_layers = summary_layers self.linear = nn.Linear(hidden_size * summary_layers, hidden_size) self.pooler = nn.Linear(hidden_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Zaaachary/CSQA
SequenceSummaryLayer
false
1,294
[ "BSD-3-Clause" ]
0
6da6e076f67e9458deacb665d31463db14c7d860
https://github.com/Zaaachary/CSQA/tree/6da6e076f67e9458deacb665d31463db14c7d860
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, hidden_size, summary_layers): super().__init__() self.summary_layers = summary_layers self.linear = nn.Linear(hidden_size * summary_layers, hidden_size) self.pooler = nn.Linear(hidden_size, hidden_size) ...
EltwiseProdScoring
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class EltwiseProdScoring(nn.Module): """ Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring """ def __init__(self, h_dim, a_dim, dot_dim=256): """Initialize layer.""" super(EltwiseProdScoring,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
YzyLmc/AC-GG_0.2
EltwiseProdScoring
false
1,295
[ "BSD-2-Clause", "MIT" ]
0
ddedbbe4062f6646041e24c16593b087d3cf0095
https://github.com/YzyLmc/AC-GG_0.2/tree/ddedbbe4062f6646041e24c16593b087d3cf0095
import torch import torch.nn as nn class Model(nn.Module): """ Linearly mapping h and v to the same dimension, and do a elementwise multiplication and a linear scoring """ def __init__(self, h_dim, a_dim, dot_dim=256): """Initialize layer.""" super().__init__() self.linear...
AttentionMerge
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class AttentionMerge(nn.Module): def __init__(self, input_size, attention_size, dropout_prob=0.1): super(AttentionMerge, self).__init__() self.attention_size = attention_size self.hidden_layer = nn.Linear(input...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Zaaachary/CSQA
AttentionMerge
false
1,297
[ "BSD-3-Clause" ]
0
6da6e076f67e9458deacb665d31463db14c7d860
https://github.com/Zaaachary/CSQA/tree/6da6e076f67e9458deacb665d31463db14c7d860
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size, attention_size, dropout_prob=0.1): super().__init__() self.attention_size = attention_size self.hidden_layer = nn.Linear(input_size, self.attention_size) ...
ConformerFeedForward
# 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.utils.data import torch.optim class Swish(nn.Module): """ Swish activation function introduced in 'https://arxiv.org/abs/1710.05941' """ def forward(self, x): return x * torch.sigmoid(x) class ConformerFeedForward(nn.Module): """ feed-f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn import torch.utils.data import torch.optim assert_size_stri...
Zenodia/NeMo
ConformerFeedForward
false
1,298
[ "Apache-2.0" ]
0
3c288d8a7caf667c95444c39434e3ebc5f53d911
https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911
import torch from torch import nn import torch.utils.data import torch.optim class Swish(nn.Module): """ Swish activation function introduced in 'https://arxiv.org/abs/1710.05941' """ def forward(self, x): return x * torch.sigmoid(x) class Model(nn.Module): """ feed-forward module o...
MultiLayerPerceptron
# 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.optim class MultiLayerPerceptron(torch.nn.Module): """ A simple MLP that can either be used independently or put on top of pretrained models (such as BERT) and act as a classifier. Args: hidden_size (int): the size of each layer num_cla...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Zenodia/NeMo
MultiLayerPerceptron
false
1,299
[ "Apache-2.0" ]
0
3c288d8a7caf667c95444c39434e3ebc5f53d911
https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911
import torch import torch.utils.data import torch.optim class Model(torch.nn.Module): """ A simple MLP that can either be used independently or put on top of pretrained models (such as BERT) and act as a classifier. Args: hidden_size (int): the size of each layer num_classes (int): num...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Encoder(nn.Module): def __init__(self, out_dim=64): super(Encoder, self).__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1) self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=1, padding=1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
YoniSchirris/SimCLR
Encoder
false
1,300
[ "MIT" ]
0
a99b7f7d0fdbc5a9747abf70a8b216b328608796
https://github.com/YoniSchirris/SimCLR/tree/a99b7f7d0fdbc5a9747abf70a8b216b328608796
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, out_dim=64): super().__init__() self.conv1 = nn.Conv2d(3, 16, kernel_size=3, stride=1, padding=1) self.conv2 = nn.Conv2d(16, 32, kernel_size=3, stride=1, padding=1) self.c...
mnist_model
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class mnist_model(nn.Module): def __init__(self): super(mnist_model, self).__init__() self.conv1 = nn.Conv2d(1, 32, 3, 1, 0) self.conv2 = nn.Conv2d(32, 64, 3, 1, 0) self.conv3 = nn.Conv2d(64, 128, 1, 1, 0) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Xenovortex/INN_Embedding_Classification
mnist_model
false
1,302
[ "MIT" ]
0
df31ec3dcf70780cae5140a69ffafdd64f218e5f
https://github.com/Xenovortex/INN_Embedding_Classification/tree/df31ec3dcf70780cae5140a69ffafdd64f218e5f
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 32, 3, 1, 0) self.conv2 = nn.Conv2d(32, 64, 3, 1, 0) self.conv3 = nn.Conv2d(64, 128, 1, 1, 0) self.pool1 = nn.MaxPool...
ConvGLU
# 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.utils.data import torch.optim def str2act(txt): """Translates text to neural network activation""" return {'sigmoid': nn.Sigmoid(), 'relu': nn.ReLU(), 'none': nn. Sequential(), 'lrelu': nn.LeakyReLU(0.2), 'selu': nn.SELU()}[txt. lower()] class 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 import torch.utils.data import torch.optim assert_size_stri...
Zenodia/NeMo
ConvGLU
false
1,303
[ "Apache-2.0" ]
0
3c288d8a7caf667c95444c39434e3ebc5f53d911
https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911
import torch from torch import nn import torch.utils.data import torch.optim def str2act(txt): """Translates text to neural network activation""" return {'sigmoid': nn.Sigmoid(), 'relu': nn.ReLU(), 'none': nn. Sequential(), 'lrelu': nn.LeakyReLU(0.2), 'selu': nn.SELU()}[txt. lower()] class M...
BertSelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.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....
Andr3wis2Cool4School/AI-pro
BertSelfAttention
false
1,304
[ "MIT" ]
0
dfe5f5959bc187d899a86f13b84158c66f64d1cc
https://github.com/Andr3wis2Cool4School/AI-pro/tree/dfe5f5959bc187d899a86f13b84158c66f64d1cc
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class Model(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hidden size (%d) is not a...
ResidualBlock_noBN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaimin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
YingqiLiulll/scrips_for_SR
ResidualBlock_noBN
false
1,306
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaimin...
AttentionPool2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import numpy as np import torch as th import torch.nn as nn def count_flops_attn(model, _x, y): """ A counter for the `thop` package to count the operations in an attention operation. Meant to be used like: macs, params = thop.profile( model, in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ZGCTroy/guided-diffusion
AttentionPool2d
false
1,307
[ "MIT" ]
0
af987bb2b65db2875148a5466df79736ea5ae6a1
https://github.com/ZGCTroy/guided-diffusion/tree/af987bb2b65db2875148a5466df79736ea5ae6a1
import math import torch import numpy as np import torch as th import torch.nn as nn def count_flops_attn(model, _x, y): """ A counter for the `thop` package to count the operations in an attention operation. Meant to be used like: macs, params = thop.profile( model, in...
MaxPoolBlock
# 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 Block(nn.Module): def __init__(self): """Initialisation for a lower-level DeepLPF conv block :returns: N/A :rtype: N/A """ super(Block, self).__init__() def conv3x3(self, in_channels, out_channels, stride=1): """Repre...
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...
ZombaSY/DeepLPF
MaxPoolBlock
false
1,310
[ "BSD-3-Clause" ]
0
adce64ae01bc9e32f465a354cb1f6534f0d13597
https://github.com/ZombaSY/DeepLPF/tree/adce64ae01bc9e32f465a354cb1f6534f0d13597
import torch import torch.nn as nn class Block(nn.Module): def __init__(self): """Initialisation for a lower-level DeepLPF conv block :returns: N/A :rtype: N/A """ super().__init__() def conv3x3(self, in_channels, out_channels, stride=1): """Represents a con...
NumericalFeaturesEmbedding
# 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.tensorboard import torch.utils.data import torch.distributed class NumericalFeaturesEmbedding(torch.nn.Module): """Transform a sequence of numerical feature vectors into a single vector. Currently, this module simply aggregates the features by averaging, although more elab...
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.tensorboard import torch.utils.data import torch.distributed assert_size_stride = torch._C._dynamo.guards.assert_size_str...
JoeLambourne/SketchGraphs
NumericalFeaturesEmbedding
false
1,312
[ "MIT" ]
0
183c65f82d71d82c62b253092e9b7fa65846a3e6
https://github.com/JoeLambourne/SketchGraphs/tree/183c65f82d71d82c62b253092e9b7fa65846a3e6
import torch import torch.utils.tensorboard import torch.utils.data import torch.distributed class Model(torch.nn.Module): """Transform a sequence of numerical feature vectors into a single vector. Currently, this module simply aggregates the features by averaging, although more elaborate aggregation sch...
BinaryLayer
# 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 BinaryLayer(nn.Module): def forward(self, input): """Forward function for binary layer :param input: data :returns: sign of data :rtype: Tensor """ return torch.sign(input) def backward(self, grad_output): """...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ZombaSY/DeepLPF
BinaryLayer
false
1,314
[ "BSD-3-Clause" ]
0
adce64ae01bc9e32f465a354cb1f6534f0d13597
https://github.com/ZombaSY/DeepLPF/tree/adce64ae01bc9e32f465a354cb1f6534f0d13597
import torch import torch.nn as nn class Model(nn.Module): def forward(self, input): """Forward function for binary layer :param input: data :returns: sign of data :rtype: Tensor """ return torch.sign(input) def backward(self, grad_output): """Straig...
Critic
# 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 Critic(nn.Module): def __init__(self, numberOfInputs): super(Critic, self).__init__() self.fc1 = nn.Linear(numberOfInputs, 4096) self.fc2 = nn.Linear(4096, 2048) self.fc3 = nn.Linear(2048, 1024) 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.nn as nn assert_...
ZY-KK/panda
Critic
false
1,315
[ "MIT" ]
0
48fcbd65d563ef74aab2554be8de7662560c43da
https://github.com/ZY-KK/panda/tree/48fcbd65d563ef74aab2554be8de7662560c43da
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, numberOfInputs): super().__init__() self.fc1 = nn.Linear(numberOfInputs, 4096) self.fc2 = nn.Linear(4096, 2048) self.fc3 = nn.Linear(2048, 1024) self.fc4 = nn.Line...
FC2LayersShortcut
# 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 FC2LayersShortcut(nn.Module): def __init__(self, n_in, n_hidden, n_out, activation=F.relu): super(FC2LayersShortcut, self).__init__() self.fc1 = nn.Linear(n_in, n_hidden) self.fc2 = nn.Linear(n_hidden + n_in, n_out) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ZhiangChen/vca
FC2LayersShortcut
false
1,316
[ "MIT" ]
0
22b7568ac1894a56e7e64443565f7e44e096d778
https://github.com/ZhiangChen/vca/tree/22b7568ac1894a56e7e64443565f7e44e096d778
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n_in, n_hidden, n_out, activation=F.relu): super().__init__() self.fc1 = nn.Linear(n_in, n_hidden) self.fc2 = nn.Linear(n_hidden + n_in, n_out) self.activation = activatio...
EncoderImagePrecomp
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(x, dim=-1): return x / x.norm(2, dim=dim, keepdim=True).clamp(min=1e-06) class EncoderImagePrecomp(nn.Module): """ image encoder """ def __init__(self, img_dim, embed_size, no_imgno...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ZhouXing19/VGNSL_multilang
EncoderImagePrecomp
false
1,317
[ "MIT" ]
0
097ed7bf978dbff052075a26231984ade5522409
https://github.com/ZhouXing19/VGNSL_multilang/tree/097ed7bf978dbff052075a26231984ade5522409
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(x, dim=-1): return x / x.norm(2, dim=dim, keepdim=True).clamp(min=1e-06) class Model(nn.Module): """ image encoder """ def __init__(self, img_dim, embed_size, no_imgnorm=False): ...
InvConvNear
# 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 torch import nn import torch.utils.data import torch.optim class InvConvNear(nn.Module): def __init__(self, channels, n_split=4, no_jacobian=False, **kwargs): super().__init__() assert n_split % 2 == 0 self.channels = 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 import nn import torch.utils.data import torch.optim assert_size_stri...
Zenodia/NeMo
InvConvNear
false
1,318
[ "Apache-2.0" ]
0
3c288d8a7caf667c95444c39434e3ebc5f53d911
https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911
import torch from torch.nn import functional as F from torch import nn import torch.utils.data import torch.optim class Model(nn.Module): def __init__(self, channels, n_split=4, no_jacobian=False, **kwargs): super().__init__() assert n_split % 2 == 0 self.channels = channels self....
BCELosswithLogits
# 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 BCELosswithLogits(nn.Module): def __init__(self, pos_weight=1, reduction='mean'): super(BCELosswithLogits, self).__init__() self.pos_weight = pos_weight self.reduction = reduction def forward(self, logits, targe...
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 ...
ZonghaiZhu/EZBM
BCELosswithLogits
false
1,319
[ "MIT" ]
0
b4f6fbd10598c79f144b778ef848554ac62a173a
https://github.com/ZonghaiZhu/EZBM/tree/b4f6fbd10598c79f144b778ef848554ac62a173a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, pos_weight=1, reduction='mean'): super().__init__() self.pos_weight = pos_weight self.reduction = reduction def forward(self, logits, target): logits = F.sigmoid(logi...
GateLayer
# 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 GateLayer(nn.Module): def __init__(self, input_dim): super(GateLayer, self).__init__() self._norm_layer1 = nn.Linear(input_dim * 2, input_dim) self._norm_layer2 = nn.Linear(input_dim, 1) def forward(self, input1, input2): norm_input = s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
Zilize/CRSLab
GateLayer
false
1,320
[ "MIT" ]
0
fb357d0dfb7d2cf7b67b892d98e52032a31ca564
https://github.com/Zilize/CRSLab/tree/fb357d0dfb7d2cf7b67b892d98e52032a31ca564
import torch from torch import nn class Model(nn.Module): def __init__(self, input_dim): super().__init__() self._norm_layer1 = nn.Linear(input_dim * 2, input_dim) self._norm_layer2 = nn.Linear(input_dim, 1) def forward(self, input1, input2): norm_input = self._norm_layer1(to...
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.functional as F from torch.nn import Parameter class NormedLinear(nn.Module): def __init__(self, in_features, out_features): super(NormedLinear, self).__init__() self.weight = Parameter(torch.Tensor(in_features, out_features)) self.weight...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ZonghaiZhu/EZBM
NormedLinear
false
1,321
[ "MIT" ]
0
b4f6fbd10598c79f144b778ef848554ac62a173a
https://github.com/ZonghaiZhu/EZBM/tree/b4f6fbd10598c79f144b778ef848554ac62a173a
import torch import torch.nn as nn 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(torch.Tensor(in_features, out_features)) self.weight.data.uniform_(-1, 1).ren...
RFDB
# 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 ESA(nn.Module): def __init__(self, num_feat=50, conv=nn.Conv2d, p=0.25): super(ESA, self).__init__() f = num_feat // 4 BSConvS_kwargs = {} if conv.__name__ == 'BSConvS': BSConvS_kwargs = {'p': p} ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
YingqiLiulll/scrips_for_SR
RFDB
false
1,322
[ "MIT" ]
0
04fa6fdaf157e913d3e2521cd80315a10a2ccedc
https://github.com/YingqiLiulll/scrips_for_SR/tree/04fa6fdaf157e913d3e2521cd80315a10a2ccedc
import torch import torch.nn as nn import torch.nn.functional as F class ESA(nn.Module): def __init__(self, num_feat=50, conv=nn.Conv2d, p=0.25): super().__init__() f = num_feat // 4 BSConvS_kwargs = {} if conv.__name__ == 'BSConvS': BSConvS_kwargs = {'p': p} s...
GeneralizedFocalLoss
# 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 from torch import nn class GeneralizedFocalLoss(nn.Module): def __init__(self, beta=2): super(GeneralizedFocalLoss, self).__init__() self.beta = beta def forward(self, prediction, target, cls_weights): cls_weights = cls_weights.unsqueeze(-1).unsqu...
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...
ZhuokunYao/smoke
GeneralizedFocalLoss
false
1,323
[ "MIT" ]
0
d524fbe43b1aba6078c25d9aca7924b71a635e1d
https://github.com/ZhuokunYao/smoke/tree/d524fbe43b1aba6078c25d9aca7924b71a635e1d
import torch import torch.utils.data from torch import nn class Model(nn.Module): def __init__(self, beta=2): super().__init__() self.beta = beta def forward(self, prediction, target, cls_weights): cls_weights = cls_weights.unsqueeze(-1).unsqueeze(-1) shape = prediction.shape...
ClsConvHead
# 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 class ClsConvHead(nn.Module): """Global average pooling + conv head for classification """ def __init__(self, input_dim, output_dim): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d((1, 1)) self.conv = nn.Conv2d(i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dy...
a1004123217/pytorch-mobile
ClsConvHead
false
1,324
[ "MIT" ]
0
97974af3259a2073efbc334d57841efbd3eaadfb
https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb
import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """Global average pooling + conv head for classification """ def __init__(self, input_dim, output_dim): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d((1, 1)) self.conv = nn.Conv2d(input_d...
ConvBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Block(nn.Module): def __init__(self): """Initialisation for a lower-level DeepLPF conv block :returns: N/A :rtype: N/A """ super(Block, self).__init__() def conv3x3(self, in_channels, out_channels, stride=1): """Repre...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ZombaSY/DeepLPF
ConvBlock
false
1,325
[ "BSD-3-Clause" ]
0
adce64ae01bc9e32f465a354cb1f6534f0d13597
https://github.com/ZombaSY/DeepLPF/tree/adce64ae01bc9e32f465a354cb1f6534f0d13597
import torch import torch.nn as nn class Block(nn.Module): def __init__(self): """Initialisation for a lower-level DeepLPF conv block :returns: N/A :rtype: N/A """ super().__init__() def conv3x3(self, in_channels, out_channels, stride=1): """Represents a con...
TorchMulScalar
# 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 from torch.nn.quantized.modules import FloatFunctional class TorchMulScalar(nn.Module): """Wrapper around torch.mul so that all ops can be found at build y must be a scalar, needed for quantization """ def __init__(self): super()...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel from torch.nn.quantized.modules import FloatFunctional assert_size_stride = torch._C._dynamo....
a1004123217/pytorch-mobile
TorchMulScalar
false
1,326
[ "MIT" ]
0
97974af3259a2073efbc334d57841efbd3eaadfb
https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb
import torch import torch.nn as nn import torch.nn.parallel from torch.nn.quantized.modules import FloatFunctional class Model(nn.Module): """Wrapper around torch.mul so that all ops can be found at build y must be a scalar, needed for quantization """ def __init__(self): super().__init__...
SelfAttentionBatch
# 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 SelfAttentionBatch(nn.Module): def __init__(self, dim, da, alpha=0.2, dropout=0.5): super(SelfAttentionBatch, self).__init__() self.dim = dim self.da = da self.alpha = alpha self.dropout = dropout ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Zilize/CRSLab
SelfAttentionBatch
false
1,327
[ "MIT" ]
0
fb357d0dfb7d2cf7b67b892d98e52032a31ca564
https://github.com/Zilize/CRSLab/tree/fb357d0dfb7d2cf7b67b892d98e52032a31ca564
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dim, da, alpha=0.2, dropout=0.5): super().__init__() self.dim = dim self.da = da self.alpha = alpha self.dropout = dropout self.a = nn.Parameter(torch.zeros...
Swish
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Swish(nn.Module): def __init__(self): super(Swish, self).__init__() self.beta = nn.Parameter(torch.tensor(1.0)) def forward(self, x): return x * torch.sigmoid(self.beta * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
a07458666/UncertaintyFlow
Swish
false
1,328
[ "MIT" ]
0
cef2512901d4e27bb22fc3997522cd47c03b569c
https://github.com/a07458666/UncertaintyFlow/tree/cef2512901d4e27bb22fc3997522cd47c03b569c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.beta = nn.Parameter(torch.tensor(1.0)) def forward(self, x): return x * torch.sigmoid(self.beta * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(...
MultiHeadAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn import torch.utils.data import torch.optim class MultiHeadAttention(nn.Module): """ Multi-head scaled dot-product attention layer. Args: hidden_size: size of the embeddings in the model, also known as d_model num_attention_heads: number of 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....
Zenodia/NeMo
MultiHeadAttention
false
1,329
[ "Apache-2.0" ]
0
3c288d8a7caf667c95444c39434e3ebc5f53d911
https://github.com/Zenodia/NeMo/tree/3c288d8a7caf667c95444c39434e3ebc5f53d911
import math import torch from torch import nn import torch.utils.data import torch.optim class Model(nn.Module): """ Multi-head scaled dot-product attention layer. Args: hidden_size: size of the embeddings in the model, also known as d_model num_attention_heads: number of heads in multi-h...
LambdaLayer
# 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 LambdaLayer(nn.Module): def __init__(self, planes): super(LambdaLayer, self).__init__() self.planes = planes def forward(self, x): return F.pad(x[:, :, ::2, ::2], (0, 0, 0, 0, self.planes // 4, 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ZonghaiZhu/EZBM
LambdaLayer
false
1,330
[ "MIT" ]
0
b4f6fbd10598c79f144b778ef848554ac62a173a
https://github.com/ZonghaiZhu/EZBM/tree/b4f6fbd10598c79f144b778ef848554ac62a173a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, planes): super().__init__() self.planes = planes def forward(self, x): return F.pad(x[:, :, ::2, ::2], (0, 0, 0, 0, self.planes // 4, self .planes // 4), 'constan...
AttentionVasvani
# 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 AttentionVasvani(nn.Module): def __init__(self, encoder_dim=128, decoder_dim=128): super(AttentionVasvani, self).__init__() def forward(self, k, q): x = torch.sum(k * q, dim=1, keepdim=True) x /= torch.sqrt(torch.norm(k, p=1, dim=1, keepdim=Tru...
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 from torch import nn assert_size_stride = torch._C._dynamo.gua...
a1247418/MT18_LH_human-sleep-classification
AttentionVasvani
false
1,333
[ "MIT" ]
0
c4a40571390aaa14b1cc8a458100e21252fe05d2
https://github.com/a1247418/MT18_LH_human-sleep-classification/tree/c4a40571390aaa14b1cc8a458100e21252fe05d2
import torch from torch import nn class Model(nn.Module): def __init__(self, encoder_dim=128, decoder_dim=128): super().__init__() def forward(self, k, q): x = torch.sum(k * q, dim=1, keepdim=True) x /= torch.sqrt(torch.norm(k, p=1, dim=1, keepdim=True)) return x def get_in...
LocalResponseNormLayer
# 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 LocalResponseNormLayer(nn.Module): def forward(self, tensor, size=5, alpha=9.999999747378752e-05, beta= 0.75, k=1.0): return F.local_response_norm(tensor, size=size, alpha=alpha, beta= beta, k=k) def get_inputs...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
a-kore/lucent
LocalResponseNormLayer
false
1,334
[ "Apache-2.0" ]
0
6b2b4dfea45c36c99e16f9923104a532df80e0a8
https://github.com/a-kore/lucent/tree/6b2b4dfea45c36c99e16f9923104a532df80e0a8
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def forward(self, tensor, size=5, alpha=9.999999747378752e-05, beta= 0.75, k=1.0): return F.local_response_norm(tensor, size=size, alpha=alpha, beta= beta, k=k) def get_inputs(): return [t...
HSigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel from torch.nn.quantized.modules import FloatFunctional class TorchAddScalar(nn.Module): """ Wrapper around torch.add so that all ops can be found at build y must be a scalar, needed for quantization """ def __init__(self): super(...
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.parallel from torch.nn.quantized.modules import Flo...
a1004123217/pytorch-mobile
HSigmoid
false
1,335
[ "MIT" ]
0
97974af3259a2073efbc334d57841efbd3eaadfb
https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb
import torch import torch.nn as nn import torch.nn.parallel from torch.nn.quantized.modules import FloatFunctional class TorchAddScalar(nn.Module): """ Wrapper around torch.add so that all ops can be found at build y must be a scalar, needed for quantization """ def __init__(self): super(...
BinaryClassifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class BinaryClassifier(nn.Module): """ Define a neural network that performs binary classification. The network should accept your number of features as input, and produce a single sigmoid value, that can be ro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
ZombieSocrates/ml-udacity-case-studies
BinaryClassifier
false
1,336
[ "MIT" ]
0
e4552a11276dc7564c51dac86ae854ca92a88659
https://github.com/ZombieSocrates/ml-udacity-case-studies/tree/e4552a11276dc7564c51dac86ae854ca92a88659
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): """ Define a neural network that performs binary classification. The network should accept your number of features as input, and produce a single sigmoid value, that can be rounded to a ...
Actor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, numberOfInputs, numberOfOutputs): super(Actor, self).__init__() self.fc1 = nn.Linear(numberOfInputs, 4096) self.fc2 = nn.Linear(4096, 2048) self.fc3 = nn.Linear(2048, 1024...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ZY-KK/panda
Actor
false
1,337
[ "MIT" ]
0
48fcbd65d563ef74aab2554be8de7662560c43da
https://github.com/ZY-KK/panda/tree/48fcbd65d563ef74aab2554be8de7662560c43da
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, numberOfInputs, numberOfOutputs): super().__init__() self.fc1 = nn.Linear(numberOfInputs, 4096) self.fc2 = nn.Linear(4096, 2048) self.fc3 = nn.Linear(2048, 1024) s...
HSwish
# 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 from torch.nn.quantized.modules import FloatFunctional class TorchAddScalar(nn.Module): """ Wrapper around torch.add so that all ops can be found at build y must be a scalar, needed for quantization """ def __init__(self): super(...
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.parallel from torch.nn.quantized.modules import Flo...
a1004123217/pytorch-mobile
HSwish
false
1,338
[ "MIT" ]
0
97974af3259a2073efbc334d57841efbd3eaadfb
https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb
import torch import torch.nn as nn import torch.nn.parallel from torch.nn.quantized.modules import FloatFunctional class TorchAddScalar(nn.Module): """ Wrapper around torch.add so that all ops can be found at build y must be a scalar, needed for quantization """ def __init__(self): super(...
MSERegularizedLoss
# 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 import torch as tc import torch.nn.functional as F from torch.nn.modules.module import Module class MSERegularizedLoss(Module): def __init__(self, alpha=1): super(MSERegularizedLoss, self).__init__() self.alpha = alpha def forward(self, weights, predi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module from torch.nn.modules.module import Module assert_size_stride...
aalto-intelligent-robotics/mc-dropout-notebooks
MSERegularizedLoss
false
1,339
[ "MIT" ]
0
fc174c05166061eb21d4c5816c519828c8e72916
https://github.com/aalto-intelligent-robotics/mc-dropout-notebooks/tree/fc174c05166061eb21d4c5816c519828c8e72916
from torch.nn import Module import torch import torch as tc import torch.nn.functional as F from torch.nn.modules.module import Module class Model(Module): def __init__(self, alpha=1): super().__init__() self.alpha = alpha def forward(self, weights, prediction, target): mse = F.mse_l...
CompositeActivation
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class CompositeActivation(torch.nn.Module): def forward(self, x): x = torch.atan(x) return torch.cat([x / 0.67, x * x / 0.6], 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.triton_helpers import libdevice assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
a-kore/lucent
CompositeActivation
false
1,340
[ "Apache-2.0" ]
0
6b2b4dfea45c36c99e16f9923104a532df80e0a8
https://github.com/a-kore/lucent/tree/6b2b4dfea45c36c99e16f9923104a532df80e0a8
import torch class Model(torch.nn.Module): def forward(self, x): x = torch.atan(x) return torch.cat([x / 0.67, x * x / 0.6], 1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Upsample
# 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 Upsample(nn.Module): def __init__(self, factor): super(Upsample, self).__init__() self.factor = factor def forward(self, x): x = nn.functional.interpolate(x, scale_factor=self.factor, mode= 'bilinear', align_corners=False) ...
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...
a3ahmad/DDPM
Upsample
false
1,341
[ "MIT" ]
0
180440740cb82c2b4e7e0b06a0d8e662b5aa3f05
https://github.com/a3ahmad/DDPM/tree/180440740cb82c2b4e7e0b06a0d8e662b5aa3f05
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, factor): super().__init__() self.factor = factor def forward(self, x): x = nn.functional.interpolate(x, scale_factor=self.factor, mode= 'bilinear', align_corners=False) return x def ge...
UpSample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class UpSample(nn.Module): def __init__(self, n_channels, factor=2): super(UpSample, self).__init__() out_channels = n_channels * factor * factor self.proj = nn.Conv2d(n_channels, out_channels, 1, 1, 0) self.up = nn.PixelShuffle(factor) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
aa10402tw/RealTime-Segmentation
UpSample
false
1,342
[ "MIT" ]
0
8c5cf13cd5570c48fa7bae9e6ec014989450889d
https://github.com/aa10402tw/RealTime-Segmentation/tree/8c5cf13cd5570c48fa7bae9e6ec014989450889d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_channels, factor=2): super().__init__() out_channels = n_channels * factor * factor self.proj = nn.Conv2d(n_channels, out_channels, 1, 1, 0) self.up = nn.PixelShuffle(factor) self.init_weight()...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn def new_parameter(*size): out = nn.Parameter(torch.FloatTensor(*size)) torch.nn.init.xavier_normal_(out) return out class Attention(nn.Module): def __init__(self, attention_size): super(Attention, self).__init__() se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
aaronbae/acl2020-dialogue-coherence-assessment
Attention
false
1,343
[ "MIT" ]
0
98142558b2f80ace390d6b583a3242a373803a85
https://github.com/aaronbae/acl2020-dialogue-coherence-assessment/tree/98142558b2f80ace390d6b583a3242a373803a85
import torch import torch.nn.functional as F import torch.nn as nn def new_parameter(*size): out = nn.Parameter(torch.FloatTensor(*size)) torch.nn.init.xavier_normal_(out) return out class Model(nn.Module): def __init__(self, attention_size): super().__init__() self.attention = new_...
MaxPool2dLayer
# 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 MaxPool2dLayer(nn.Module): def forward(self, tensor, kernel_size=(3, 3), stride=(1, 1), padding=0, ceil_mode=False): return F.max_pool2d(tensor, kernel_size, stride=stride, padding= padding, ceil_mode=ceil_mode) ...
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...
a-kore/lucent
MaxPool2dLayer
false
1,344
[ "Apache-2.0" ]
0
6b2b4dfea45c36c99e16f9923104a532df80e0a8
https://github.com/a-kore/lucent/tree/6b2b4dfea45c36c99e16f9923104a532df80e0a8
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def forward(self, tensor, kernel_size=(3, 3), stride=(1, 1), padding=0, ceil_mode=False): return F.max_pool2d(tensor, kernel_size, stride=stride, padding= padding, ceil_mode=ceil_mode) def get...
LocalNet
# 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 LocalNet(nn.Module): def forward(self, x_in): """Double convolutional block :param x_in: image features :returns: image features :rtype: Tensor """ x = self.lrelu(self.conv1(self.refpad(x_in))) x = self.lrelu(self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
ZombaSY/DeepLPF
LocalNet
false
1,345
[ "BSD-3-Clause" ]
0
adce64ae01bc9e32f465a354cb1f6534f0d13597
https://github.com/ZombaSY/DeepLPF/tree/adce64ae01bc9e32f465a354cb1f6534f0d13597
import torch import torch.nn as nn class Model(nn.Module): def forward(self, x_in): """Double convolutional block :param x_in: image features :returns: image features :rtype: Tensor """ x = self.lrelu(self.conv1(self.refpad(x_in))) x = self.lrelu(self.con...
InvConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.optim class InvConv(nn.Module): """Invertible 1x1 Convolution for 2D inputs. Originally described in Glow (https://arxiv.org/abs/1807.03039). Does not support LU-decomposed version. Args: num_channe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn import torch.optim assert_size_stride =...
a-heintz/Flow-based-RelativeStateEstimation
InvConv
false
1,346
[ "MIT" ]
0
9633fd74323db1206969186c2d2caa7a766e1948
https://github.com/a-heintz/Flow-based-RelativeStateEstimation/tree/9633fd74323db1206969186c2d2caa7a766e1948
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.optim class Model(nn.Module): """Invertible 1x1 Convolution for 2D inputs. Originally described in Glow (https://arxiv.org/abs/1807.03039). Does not support LU-decomposed version. Args: num_channels...
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 from torch import nn class DiceLoss(nn.Module): def __init__(self): super(DiceLoss, self).__init__() def forward(self, predict, target): N = target.size(0) smooth = 1 predict_flat = predict.view(N, -1) target_flat = target.view(N, -1) intersection...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
abc008/MT-Brain-Network
DiceLoss
false
1,347
[ "MIT" ]
0
a823722d4d3211c955bc1370bd8399d27c6640f4
https://github.com/abc008/MT-Brain-Network/tree/a823722d4d3211c955bc1370bd8399d27c6640f4
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, predict, target): N = target.size(0) smooth = 1 predict_flat = predict.view(N, -1) target_flat = target.view(N, -1) intersection = (predict_flat ...
GLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class GLU(nn.Module): def __init__(self, input_num): super(GLU, self).__init__() self.sigmoid = nn.Sigmoid() self.linear = nn.Linear(input_num, input_num) def forward(self, x): lin = self.linear(x.permute(0, 2, 3, 1)) lin = lin.permut...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
aagnone3/dc19t2
GLU
false
1,348
[ "Apache-2.0" ]
0
cc7baf2a8fe73d28c224f0bf68b5355efd96c24f
https://github.com/aagnone3/dc19t2/tree/cc7baf2a8fe73d28c224f0bf68b5355efd96c24f
import torch from torch import nn class Model(nn.Module): def __init__(self, input_num): super().__init__() self.sigmoid = nn.Sigmoid() self.linear = nn.Linear(input_num, input_num) def forward(self, x): lin = self.linear(x.permute(0, 2, 3, 1)) lin = lin.permute(0, 3,...
SqueezeExcite
# 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.nn.functional as F def _make_divisible(v, divisor, min_value=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It can be seen here: https://gi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
a1004123217/pytorch-mobile
SqueezeExcite
false
1,349
[ "MIT" ]
0
97974af3259a2073efbc334d57841efbd3eaadfb
https://github.com/a1004123217/pytorch-mobile/tree/97974af3259a2073efbc334d57841efbd3eaadfb
import torch import torch.nn as nn import torch.nn.parallel import torch.nn.functional as F def _make_divisible(v, divisor, min_value=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It can be seen here: https://gi...