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
ResBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.autograd class ResBlock(nn.Module): def __init__(self, num_features, use_batch_norm=False): super(ResBlock, self).__init__() self.num_features = num_features self.conv_layer1 = nn.Conv2d(num_features, num_features, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
HubBucket-Team/annotated_deep_learning_paper_implementations
ResBlock
false
5,312
[ "MIT" ]
1
4a9716b01e336c57739dfdbdd90648276b53c433
https://github.com/HubBucket-Team/annotated_deep_learning_paper_implementations/tree/4a9716b01e336c57739dfdbdd90648276b53c433
import torch from torch import nn import torch.utils.data import torch.autograd class Model(nn.Module): def __init__(self, num_features, use_batch_norm=False): super().__init__() self.num_features = num_features self.conv_layer1 = nn.Conv2d(num_features, num_features, kernel_s...
_Logit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 _Logit(torch.nn.Module): """ Simple logistic regression model. """ def __init__(self, din, dout=1): """ Model parameter constructor. Args: din Number of input dimensions dout Number of output dimensions """ super().__init__() self._din = din ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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_cu...
IKACE/DifferentialByzantine-1
_Logit
false
5,313
[ "MIT" ]
1
809fd6e070fedeb87a6dbff6f883e93e3c5c8e09
https://github.com/IKACE/DifferentialByzantine-1/tree/809fd6e070fedeb87a6dbff6f883e93e3c5c8e09
import torch class Model(torch.nn.Module): """ Simple logistic regression model. """ def __init__(self, din, dout=1): """ Model parameter constructor. Args: din Number of input dimensions dout Number of output dimensions """ super().__init__() self._din = din ...
PytorchMultiClass
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PytorchMultiClass(nn.Module): def __init__(self, num_features): super(PytorchMultiClass, self).__init__() self.layer_1 = nn.Linear(num_features, 80) self.layer_2 = nn.Linear(80, 100) self.layer_out = nn.Linea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
HninPwint/beer_type_prediction
PytorchMultiClass
false
5,314
[ "MIT" ]
1
6845920821bedc059dbe92af5c4a7689cb616023
https://github.com/HninPwint/beer_type_prediction/tree/6845920821bedc059dbe92af5c4a7689cb616023
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_features): super().__init__() self.layer_1 = nn.Linear(num_features, 80) self.layer_2 = nn.Linear(80, 100) self.layer_out = nn.Linear(100, 104) self.softmax = ...
VGG_block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import init class VGG_block(nn.Module): """ 1. default have the bias 2. using ReLU and 3 * max pooling 3. 10 layers of VGG original 4. 2 extra layers by CMU 5. default in_dim = 3,out_dim = 128 6. all kernal_size = 3, stride =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
H-Liu1997/Pytorch_Pose_Estimation_Framework
VGG_block
false
5,315
[ "MIT" ]
1
06616b3459ff639f8486e6ea4f93922597788b2a
https://github.com/H-Liu1997/Pytorch_Pose_Estimation_Framework/tree/06616b3459ff639f8486e6ea4f93922597788b2a
import torch import torch.nn as nn from torch.nn import init class Model(nn.Module): """ 1. default have the bias 2. using ReLU and 3 * max pooling 3. 10 layers of VGG original 4. 2 extra layers by CMU 5. default in_dim = 3,out_dim = 128 6. all kernal_size = 3, stride = 1 ...
SSE
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn.modules.loss import _Loss class SSE(_Loss): """ Definition: sum_squared_error = 1/2 * nn.MSELoss(reduction = 'sum') The backward is defined as: input-target """ def __init__(self, under_penalty, over_penalty): super(SSE, self).__init__(under_penalty, over_penalt...
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.nn.modules.loss import _Loss assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
IVRL/CCID
SSE
false
5,316
[ "MIT" ]
1
0d57c33696da87279d24777a2efd1204f5088bc9
https://github.com/IVRL/CCID/tree/0d57c33696da87279d24777a2efd1204f5088bc9
import torch from torch.nn.modules.loss import _Loss class Model(_Loss): """ Definition: sum_squared_error = 1/2 * nn.MSELoss(reduction = 'sum') The backward is defined as: input-target """ def __init__(self, under_penalty, over_penalty): super().__init__(under_penalty, over_penalty) ...
PixelNorm
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class PixelNorm(nn.Module): def __init__(self, epsilon=1e-08): """ @notice: avoid in-place ops. https://discuss.pytorch.org/t/encounter-the-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operatio...
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_...
Iceland-Leo/StyleGAN2_PyTorch
PixelNorm
false
5,318
[ "MIT" ]
1
3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, epsilon=1e-08): """ @notice: avoid in-place ops. https://discuss.pytorch.org/t/encounter-the-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operation/83...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn class Net(nn.Module): def __init__(self): super(Net, self).__init__() for m in self.modules(): if isinstance(m, nn.Conv2d): n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels m.weight.data.normal_(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 import math import torch.nn a...
Groenbech96/Learning-to-See-in-the-Dark
Net
false
5,319
[ "MIT" ]
1
a068c8642a651e4af195cd71e253694d88dfe3c5
https://github.com/Groenbech96/Learning-to-See-in-the-Dark/tree/a068c8642a651e4af195cd71e253694d88dfe3c5
import math import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() for m in self.modules(): if isinstance(m, nn.Conv2d): n = m.kernel_size[0] * m.kernel_size[1] * m.out_channels m.weight.data.normal_(0, math.sq...
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....
Honghe/wenet
MultiHeadedAttention
false
5,320
[ "Apache-2.0" ]
1
4421790bec3778df591816d69f0449930a9be321
https://github.com/Honghe/wenet/tree/4421790bec3778df591816d69f0449930a9be321
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...
MLPClassifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MLPClassifier(nn.Module): def __init__(self, input_dim, target_dim): super(MLPClassifier, self).__init__() self.input_dim = input_dim self.target_dim = target_dim self.fc1 = nn.Linear(self.input_dim, 128) self.fc2 = nn.Linear(128, 6...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ITU-AI-ML-in-5G-Challenge/-ITU-ML5G-PS-032-KDDI-naist-lsm
MLPClassifier
false
5,321
[ "MIT" ]
1
f0c54cfde8fb9a5b78e116de7814a1afbd856799
https://github.com/ITU-AI-ML-in-5G-Challenge/-ITU-ML5G-PS-032-KDDI-naist-lsm/tree/f0c54cfde8fb9a5b78e116de7814a1afbd856799
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, target_dim): super().__init__() self.input_dim = input_dim self.target_dim = target_dim self.fc1 = nn.Linear(self.input_dim, 128) self.fc2 = nn.Linear(128, 64) self.fc3 = nn.Li...
Minibatch_stddev_layer
# 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 Minibatch_stddev_layer(nn.Module): """ Minibatch standard deviation layer. (D_stylegan2) """ def __init__(self, group_size=4, num_new_features=1): super().__init__() self.group_size = group_size self.num_new_features = num_new_featu...
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_...
Iceland-Leo/StyleGAN2_PyTorch
Minibatch_stddev_layer
false
5,322
[ "MIT" ]
1
3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
import torch import torch.nn as nn class Model(nn.Module): """ Minibatch standard deviation layer. (D_stylegan2) """ def __init__(self, group_size=4, num_new_features=1): super().__init__() self.group_size = group_size self.num_new_features = num_new_features def forw...
ToRGB
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import numpy as np from torch import nn import torch.nn.functional as F import torch.utils.data from typing import List import torch.autograd class EqualizedWeight(nn.Module): """ <a id="equalized_weight"></a> ## Learning-rate Equalized Weights Parameter This is based on equa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import numpy as np from torch import nn import torch.nn.functional a...
HubBucket-Team/annotated_deep_learning_paper_implementations
ToRGB
false
5,323
[ "MIT" ]
1
4a9716b01e336c57739dfdbdd90648276b53c433
https://github.com/HubBucket-Team/annotated_deep_learning_paper_implementations/tree/4a9716b01e336c57739dfdbdd90648276b53c433
import math import torch import numpy as np from torch import nn import torch.nn.functional as F import torch.utils.data from typing import List import torch.autograd class EqualizedWeight(nn.Module): """ <a id="equalized_weight"></a> ## Learning-rate Equalized Weights Parameter This is based on equa...
Head
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Conv(nn.Module): def __init__(self, filters0, filters1, kernel_size, bn, bias=True): super().__init__() if bn: bias = False self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1, padding=kernel_size // 2, bias=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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Hiroki9759/HandyRL
Head
false
5,324
[ "MIT" ]
1
7d4dc869ba2f657d65fc461be4bed2d90dd0343b
https://github.com/Hiroki9759/HandyRL/tree/7d4dc869ba2f657d65fc461be4bed2d90dd0343b
import torch import torch.nn as nn class Conv(nn.Module): def __init__(self, filters0, filters1, kernel_size, bn, bias=True): super().__init__() if bn: bias = False self.conv = nn.Conv2d(filters0, filters1, kernel_size, stride=1, padding=kernel_size // 2, bias=bias...
Encoding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization class Encoding(nn.Module): """Encoding Layer: a learnable residual encoder. Input is of shape (batch_size, channels, height, width). Output is of shape (batch_size, num_codes, channels). Ar...
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 ...
HusterRC/mmsegmentation
Encoding
false
5,325
[ "Apache-2.0" ]
1
c3e4dbc2e06de3f47f75098f76772b4ee7e91e35
https://github.com/HusterRC/mmsegmentation/tree/c3e4dbc2e06de3f47f75098f76772b4ee7e91e35
import torch import torch.nn.functional as F import torch.nn as nn import torch._C import torch.serialization class Model(nn.Module): """Encoding Layer: a learnable residual encoder. Input is of shape (batch_size, channels, height, width). Output is of shape (batch_size, num_codes, channels). Args:...
ExampleBackbone
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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._C import torch.serialization class ExampleBackbone(nn.Module): def __init__(self): super(ExampleBackbone, self).__init__() self.conv = nn.Conv2d(3, 3, 3) def init_weights(self, pretrained=None): pass def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch._C import torch.serialization assert_size_str...
HusterRC/mmsegmentation
ExampleBackbone
false
5,326
[ "Apache-2.0" ]
1
c3e4dbc2e06de3f47f75098f76772b4ee7e91e35
https://github.com/HusterRC/mmsegmentation/tree/c3e4dbc2e06de3f47f75098f76772b4ee7e91e35
import torch import torch.nn as nn import torch._C import torch.serialization class Model(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(3, 3, 3) def init_weights(self, pretrained=None): pass def forward(self, x): return [self.conv(x)] def get...
FCUDown
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from functools import partial class FCUDown(nn.Module): """ CNN feature maps -> Transformer patch embeddings """ def __init__(self, inplanes, outplanes, dw_stride, act_layer=nn.GELU, norm_layer=partial(nn.LayerNorm, eps=1e-06)): super(FCUDown, self).__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.triton_helpers import libdevice import torch.nn as ...
Huzhen757/Conformer
FCUDown
false
5,327
[ "Apache-2.0" ]
1
4f7a80cec28b9ced8c0225a85a32997f7cd2b93c
https://github.com/Huzhen757/Conformer/tree/4f7a80cec28b9ced8c0225a85a32997f7cd2b93c
import torch import torch.nn as nn from functools import partial class Model(nn.Module): """ CNN feature maps -> Transformer patch embeddings """ def __init__(self, inplanes, outplanes, dw_stride, act_layer=nn.GELU, norm_layer=partial(nn.LayerNorm, eps=1e-06)): super().__init__() ...
PPMConcat
# 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._C import torch.serialization class PPMConcat(nn.ModuleList): """Pyramid Pooling Module that only concat the features of each layer. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. """ def __init__(sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch._C import torch.serialization assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strid...
HusterRC/mmsegmentation
PPMConcat
false
5,328
[ "Apache-2.0" ]
1
c3e4dbc2e06de3f47f75098f76772b4ee7e91e35
https://github.com/HusterRC/mmsegmentation/tree/c3e4dbc2e06de3f47f75098f76772b4ee7e91e35
import torch import torch.nn as nn import torch._C import torch.serialization class Model(nn.ModuleList): """Pyramid Pooling Module that only concat the features of each layer. Args: pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid Module. """ def __init__(self, p...
BCELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional import torch.nn as nn def centercrop(image, w, h): _nt, _ct, ht, wt = image.size() padw, padh = (wt - w) // 2, (ht - h) // 2 if padw > 0 and padh > 0: image = image[:, :, padh:-padh, padw:-padw] return image class BCELoss(nn.Module): def __init__(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
HelenGuohx/cv-ferattn-code
BCELoss
false
5,329
[ "MIT" ]
1
faa9b7850fe2a0f8c08193bb129b5fec4639d616
https://github.com/HelenGuohx/cv-ferattn-code/tree/faa9b7850fe2a0f8c08193bb129b5fec4639d616
import torch import torch.nn.functional import torch.nn as nn def centercrop(image, w, h): _nt, _ct, ht, wt = image.size() padw, padh = (wt - w) // 2, (ht - h) // 2 if padw > 0 and padh > 0: image = image[:, :, padh:-padh, padw:-padw] return image class Model(nn.Module): def __init__(se...
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 from torch.nn import Linear from torch.nn import Dropout from torch.nn import LayerNorm from typing import Optional import torch.utils.data from typing import Tuple class InProjContainer(torch.nn.Module): def __init__(self, query_proj, key_proj, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Hirni-Meshram3/text
TransformerEncoderLayer
false
5,330
[ "BSD-3-Clause" ]
1
84e6c7bd99c7fb3c229ff289aa722149e3136094
https://github.com/Hirni-Meshram3/text/tree/84e6c7bd99c7fb3c229ff289aa722149e3136094
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Linear from torch.nn import Dropout from torch.nn import LayerNorm from typing import Optional import torch.utils.data from typing import Tuple class InProjContainer(torch.nn.Module): def __init__(self, query_proj, key_proj, ...
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 import torch.nn as nn import torch.nn.functional as F def scaled_dot_product_attention(q, k, v, mask): """ q: query = (..., seq_len_q, depth) k: key = (..., seq_len_k, depth) v: value = (..., seq_len_v, depth_v) mask: float tensor with shape broadcastable to (..., seq_len_q, s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
IanYHWu/tied-representation-learning
MultiHeadAttention
false
5,331
[ "MIT" ]
1
bda9814dc40cf552f7bdd2ade78f5e2958a7ea83
https://github.com/IanYHWu/tied-representation-learning/tree/bda9814dc40cf552f7bdd2ade78f5e2958a7ea83
import torch import torch.nn as nn import torch.nn.functional as F def scaled_dot_product_attention(q, k, v, mask): """ q: query = (..., seq_len_q, depth) k: key = (..., seq_len_k, depth) v: value = (..., seq_len_v, depth_v) mask: float tensor with shape broadcastable to (..., seq_len_q, s...
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....
Honghe/wenet
RelPositionMultiHeadedAttention
false
5,332
[ "Apache-2.0" ]
1
4421790bec3778df591816d69f0449930a9be321
https://github.com/Honghe/wenet/tree/4421790bec3778df591816d69f0449930a9be321
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. ...
ToLongTensor
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from typing import List import torch.nn as nn import torch.utils.data class ToLongTensor(nn.Module): """Convert a list of integers to long tensor """ def __init__(self): super(ToLongTensor, self).__init__() def forward(self, tokens: 'List[List[int]]') ->...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
Hirni-Meshram3/text
ToLongTensor
false
5,333
[ "BSD-3-Clause" ]
1
84e6c7bd99c7fb3c229ff289aa722149e3136094
https://github.com/Hirni-Meshram3/text/tree/84e6c7bd99c7fb3c229ff289aa722149e3136094
import torch from torch import Tensor from typing import List import torch.nn as nn import torch.utils.data class Model(nn.Module): """Convert a list of integers to long tensor """ def __init__(self): super().__init__() def forward(self, tokens: 'List[List[int]]') ->Tensor: return to...
MsgNorm
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F class MsgNorm(torch.nn.Module): def __init__(self, learn_msg_scale=False): super(MsgNorm, self).__init__() self.msg_scale = torch.nn.Parameter(torch.Tensor([1.0]), requires_grad=learn_msg_scale) def forward(self, x, msg, p=2): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
Hermine2015/deep_gcns_torch
MsgNorm
false
5,334
[ "MIT" ]
1
69524a2a5de2ba4c3adb0fea0a090b3e9b4510d4
https://github.com/Hermine2015/deep_gcns_torch/tree/69524a2a5de2ba4c3adb0fea0a090b3e9b4510d4
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self, learn_msg_scale=False): super().__init__() self.msg_scale = torch.nn.Parameter(torch.Tensor([1.0]), requires_grad=learn_msg_scale) def forward(self, x, msg, p=2): msg = F.normali...
make_dense
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class make_dense(nn.Module): def __init__(self, nChannels, growthRate, kernel_size=3): super(make_dense, self).__init__() self.conv = nn.Conv2d(nChannels, growthRate, kernel_size= kernel_size, padding=kernel_size - 1, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
HusterRC/FHDR
make_dense
false
5,335
[ "BSD-3-Clause" ]
1
f61fea7eba3de8430fc2891afdabc77dd8e5f13f
https://github.com/HusterRC/FHDR/tree/f61fea7eba3de8430fc2891afdabc77dd8e5f13f
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, nChannels, growthRate, kernel_size=3): super().__init__() self.conv = nn.Conv2d(nChannels, growthRate, kernel_size= kernel_size, padding=kernel_size - 1, bias=False, dilation=...
_Full
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 _Full(torch.nn.Module): """ Simple, small fully connected model. """ def __init__(self): """ Model parameter constructor. """ super().__init__() self._f1 = torch.nn.Linear(28 * 28, 100) self._f2 = torch.nn.Linear(100, 10) def forward(self, x): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
IKACE/DifferentialByzantine-1
_Full
false
5,336
[ "MIT" ]
1
809fd6e070fedeb87a6dbff6f883e93e3c5c8e09
https://github.com/IKACE/DifferentialByzantine-1/tree/809fd6e070fedeb87a6dbff6f883e93e3c5c8e09
import torch class Model(torch.nn.Module): """ Simple, small fully connected model. """ def __init__(self): """ Model parameter constructor. """ super().__init__() self._f1 = torch.nn.Linear(28 * 28, 100) self._f2 = torch.nn.Linear(100, 10) def forward(self, x): ...
ConvDownsample2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 def _setup_kernel(k): k = np.asarray(k, dtype=np.float32) if k.ndim == 1: k = np.outer(k, k) k /= np.sum(k) assert k.ndim == 2 assert k.shape[0] == k.shape[1] return k class ConvDownsample2d(nn.Modu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
Iceland-Leo/StyleGAN2_PyTorch
ConvDownsample2d
false
5,337
[ "MIT" ]
1
3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def _setup_kernel(k): k = np.asarray(k, dtype=np.float32) if k.ndim == 1: k = np.outer(k, k) k /= np.sum(k) assert k.ndim == 2 assert k.shape[0] == k.shape[1] return k class Model(nn.Module): d...
Generator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Generator(nn.Module): def __init__(self, input_size, hidden_size, output_size): super(Generator, self).__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = 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 ...
Iamsdt/UdacityDeepLearningNanodegree
Generator
false
5,338
[ "Apache-2.0" ]
1
507c2ce620f42e36271549471b819d3d7fceb1b6
https://github.com/Iamsdt/UdacityDeepLearningNanodegree/tree/507c2ce620f42e36271549471b819d3d7fceb1b6
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): def __init__(self, input_size, hidden_size, output_size): super().__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = nn.Linear(hidden_size, hidden_size * 2) ...
GeneratorBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import numpy as np from torch import nn import torch.nn.functional as F import torch.utils.data from typing import Tuple from typing import Optional from typing import List import torch.autograd class EqualizedWeight(nn.Module): """ <a id="equalized_weight"></a> ## Learning-rate E...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
HubBucket-Team/annotated_deep_learning_paper_implementations
GeneratorBlock
false
5,339
[ "MIT" ]
1
4a9716b01e336c57739dfdbdd90648276b53c433
https://github.com/HubBucket-Team/annotated_deep_learning_paper_implementations/tree/4a9716b01e336c57739dfdbdd90648276b53c433
import math import torch import numpy as np from torch import nn import torch.nn.functional as F import torch.utils.data from typing import Tuple from typing import Optional from typing import List import torch.autograd class EqualizedWeight(nn.Module): """ <a id="equalized_weight"></a> ## Learning-rate E...
RKDAngleLoss
# 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 RKDAngleLoss(nn.Module): """ Module for calculating RKD Angle Loss """ def forward(self, teacher, student, normalize=True): """ Forward function :param teacher (torch.FloatTensor): Prediction made by the...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Het-Shah/KD_Lib
RKDAngleLoss
false
5,340
[ "MIT" ]
1
5577250cf74e3a529033b244da9b2b9fcf7623a9
https://github.com/Het-Shah/KD_Lib/tree/5577250cf74e3a529033b244da9b2b9fcf7623a9
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Module for calculating RKD Angle Loss """ def forward(self, teacher, student, normalize=True): """ Forward function :param teacher (torch.FloatTensor): Prediction made by the teache...
WingLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch def identity(x): return x class WingLoss(torch.nn.Module): def __init__(self, w: 'float'=10, eps: 'float'=2, reduction: 'str'='mean' ) ->None: assert reduction is None or reduction in ('mean', 'sum') super().__init__() self._w = w self._eps =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
Ilyabasharov/made_mail.ru
WingLoss
false
5,341
[ "MIT" ]
1
a81bfd874ab80eb8c7eaad8a4acf723f327f2f50
https://github.com/Ilyabasharov/made_mail.ru/tree/a81bfd874ab80eb8c7eaad8a4acf723f327f2f50
import math import torch def identity(x): return x class Model(torch.nn.Module): def __init__(self, w: 'float'=10, eps: 'float'=2, reduction: 'str'='mean' ) ->None: assert reduction is None or reduction in ('mean', 'sum') super().__init__() self._w = w self._eps = ep...
SPPLayer
# 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 SPPLayer(torch.nn.Module): def __init__(self, level): super(SPPLayer, self).__init__() self.level = level def forward(self, x): _n, _c, _h, _w = x.size() a = 6 + (self.level - 1) * -2 zero_pad = torch.nn.ZeroPad2d((a, a, a, a)) x = zero_pad(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
IrisDinge/YoloV3_DOTA
SPPLayer
false
5,342
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch class Model(torch.nn.Module): def __init__(self, level): super().__init__() self.level = level def forward(self, x): _n, _c, _h, _w = x.size() a = 6 + (self.level - 1) * -2 zero_pad = torch.nn.ZeroPad2d((a, a, a, a)) x = zero_pad(x) return...
AttentiveNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 AttentiveNet(nn.Module): def __init__(self, input_size, hidden_size) ->None: super().__init__() self.cov2 = nn.Conv1d(hidden_size, hidden_size, kernel_size=3, padding=1) self.cov1 = nn.Conv1d(input_size, h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
ISYSLAB-HUST/DeepNeuropePred
AttentiveNet
false
5,344
[ "MIT" ]
1
f87f36fdbbc966f727eb063a0f9984850294ba37
https://github.com/ISYSLAB-HUST/DeepNeuropePred/tree/f87f36fdbbc966f727eb063a0f9984850294ba37
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size, hidden_size) ->None: super().__init__() self.cov2 = nn.Conv1d(hidden_size, hidden_size, kernel_size=3, padding=1) self.cov1 = nn.Conv1d(input_size, hidden_s...
CReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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...
IrisDinge/YoloV3_DOTA
CReLU
false
5,345
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
InferenceBatchSoftmax
# 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 itertools import product as product from math import sqrt as sqrt from torch.nn import init as init from torch.nn import functional as F class InferenceBatchSoftmax(nn.Module): def __init__(self): super(InferenceBatchSoftmax, self).__init__() @staticmethod ...
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 ...
IncyLiu/autokeras
InferenceBatchSoftmax
false
5,346
[ "MIT" ]
1
e9dbf66b005e2ffaabe29bc366bb4e72fa79add8
https://github.com/IncyLiu/autokeras/tree/e9dbf66b005e2ffaabe29bc366bb4e72fa79add8
import torch import torch.nn as nn from itertools import product as product from math import sqrt as sqrt from torch.nn import init as init from torch.nn import functional as F class Model(nn.Module): def __init__(self): super().__init__() @staticmethod def forward(input_): return F.soft...
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 def masked_softmax(vector: 'torch.Tensor', mask: 'torch.Tensor', dim: 'int' =-1, memory_efficient: 'bool'=False, mask_fill_value: 'float'=-1e+32 ) ->torch.Tensor: """ https://github.com/allenai/allennlp/blob/b6cc9d39651273e8ec2a7e334908ffa9de5c2026/allennlp/nn/util.py#L231 ``torch.nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
IouJenLiu/AFK
ScaledDotProductAttention
false
5,347
[ "MIT" ]
1
db2b47bb3a5614b61766114b87f143e4a61a4a8d
https://github.com/IouJenLiu/AFK/tree/db2b47bb3a5614b61766114b87f143e4a61a4a8d
import torch def masked_softmax(vector: 'torch.Tensor', mask: 'torch.Tensor', dim: 'int' =-1, memory_efficient: 'bool'=False, mask_fill_value: 'float'=-1e+32 ) ->torch.Tensor: """ https://github.com/allenai/allennlp/blob/b6cc9d39651273e8ec2a7e334908ffa9de5c2026/allennlp/nn/util.py#L231 ``torch.nn....
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch class Net(torch.nn.Module): """Implementing two layer nn.""" def __init__(self, D_IN, H, D_OUT): super().__init__() self.linear1 = torch.nn.Linear(D_IN, H) self.linear2 = torch.nn.Linear(H, D_OUT) def forward(self, x): h = self.linear1(x) h_relu = tor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
ImadDabbura/deep_learning_with_pytorch
Net
false
5,348
[ "MIT" ]
1
0cac0614ab08b30654de192e540048cf4243a4e4
https://github.com/ImadDabbura/deep_learning_with_pytorch/tree/0cac0614ab08b30654de192e540048cf4243a4e4
import torch class Model(torch.nn.Module): """Implementing two layer nn.""" def __init__(self, D_IN, H, D_OUT): super().__init__() self.linear1 = torch.nn.Linear(D_IN, H) self.linear2 = torch.nn.Linear(H, D_OUT) def forward(self, x): h = self.linear1(x) h_relu = t...
XSigmoidLoss
# 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 XSigmoidLoss(nn.Module): def __init__(self): super().__init__() def forward(self, y_t, y_prime_t): ey_t = y_t - y_prime_t return torch.mean(2 * ey_t / (1 + torch.exp(-ey_t)) - ey_t) def get_inputs(): return [torch.rand([4, 4, 4, 4]), tor...
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 ...
IshanBaliyan/DEEP-TFM_with_cGAN
XSigmoidLoss
false
5,349
[ "MIT" ]
1
8d711c025367031197e5b8c7c768fc9fbea406ce
https://github.com/IshanBaliyan/DEEP-TFM_with_cGAN/tree/8d711c025367031197e5b8c7c768fc9fbea406ce
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, y_t, y_prime_t): ey_t = y_t - y_prime_t return torch.mean(2 * ey_t / (1 + torch.exp(-ey_t)) - ey_t) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand...
PLU
# 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 PLU(nn.Module): """ y = max(alpha*(x+c)−c, min(alpha*(x−c)+c, x)) from PLU: The Piecewise Linear Unit Activation Function """ def __init__(self, alpha=0.1, c=1): super().__init__() self.alpha = alpha self.c = c def forward(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
IrisDinge/YoloV3_DOTA
PLU
false
5,350
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch import torch.nn as nn class Model(nn.Module): """ y = max(alpha*(x+c)−c, min(alpha*(x−c)+c, x)) from PLU: The Piecewise Linear Unit Activation Function """ def __init__(self, alpha=0.1, c=1): super().__init__() self.alpha = alpha self.c = c def forward(se...
MultipleConst
# 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 MultipleConst(nn.Module): def forward(self, data): return 255 * data def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
IvoryCandy/neural-style
MultipleConst
false
5,351
[ "Apache-2.0" ]
1
d9d73676479e36c1cbd6c9af36d857f80099504b
https://github.com/IvoryCandy/neural-style/tree/d9d73676479e36c1cbd6c9af36d857f80099504b
import torch import torch.nn as nn class Model(nn.Module): def forward(self, data): return 255 * data def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Reorg
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class Reorg(nn.Module): """ This layer reorganizes a tensor according to a stride. The dimensions 2,3 will be sliced by the stride and then stacked in dimension 1. (input must have 4 dimensions) Args: stride (int): stride to divide the input tensor """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
IrisDinge/YoloV3_DOTA
Reorg
false
5,352
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch import torch.nn as nn class Model(nn.Module): """ This layer reorganizes a tensor according to a stride. The dimensions 2,3 will be sliced by the stride and then stacked in dimension 1. (input must have 4 dimensions) Args: stride (int): stride to divide the input tensor """ ...
L2Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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_...
IrisDinge/YoloV3_DOTA
L2Norm
false
5,353
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
Block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from functools import partial class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Huzhen757/Conformer
Block
false
5,354
[ "Apache-2.0" ]
1
4f7a80cec28b9ced8c0225a85a32997f7cd2b93c
https://github.com/Huzhen757/Conformer/tree/4f7a80cec28b9ced8c0225a85a32997f7cd2b93c
import torch import torch.nn as nn from functools import partial class Mlp(nn.Module): def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.0): super().__init__() out_features = out_features or in_features hidden_features = hidden_feat...
ScaleReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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...
IrisDinge/YoloV3_DOTA
ScaleReLU
false
5,355
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
GCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch from torch import nn from torch.nn import functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 Implementatio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 i...
IsmailKent/updown-baseline
GCN
false
5,356
[ "MIT" ]
1
17a09a48e4f30a4a3edc7924f982eb129c583b41
https://github.com/IsmailKent/updown-baseline/tree/17a09a48e4f30a4a3edc7924f982eb129c583b41
from torch.nn import Module import math import torch from torch import nn from torch.nn import functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 Implementatio...
PPReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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...
IrisDinge/YoloV3_DOTA
PPReLU
false
5,357
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
Scale
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Scale(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
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...
IrisDinge/YoloV3_DOTA
Scale
false
5,358
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, nchannels, bias=True, init_scale=1.0): super().__init__() self.nchannels = nchannels self.weight = nn.Parameter(torch.Tensor(1, nchannels, 1, 1)) if bias: self.bias = nn.Parameter(torch.Tenso...
PaddedMaxPool2d
# 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 PaddedMaxPool2d(nn.Module): """ Maxpool layer with a replicating padding. Args: kernel_size (int or tuple): Kernel size for maxpooling stride (int or tuple, optional): The stride of the window; Default ``kernel_size`` ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
IrisDinge/YoloV3_DOTA
PaddedMaxPool2d
false
5,359
[ "MIT" ]
1
cdfe6375a2323e9ee162e50a46478d8a66529e6c
https://github.com/IrisDinge/YoloV3_DOTA/tree/cdfe6375a2323e9ee162e50a46478d8a66529e6c
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Maxpool layer with a replicating padding. Args: kernel_size (int or tuple): Kernel size for maxpooling stride (int or tuple, optional): The stride of the window; Default ``kernel_size`` padd...
GramMatrix
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, y): b, ch, h, w = y.size() features = y.view(b, ch, w * h) features_t = features.transpose(1, 2) gram = features.bmm(features_t) / (ch * h * w) return gram def get_inputs(): return [tor...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
IvoryCandy/neural-style
GramMatrix
false
5,360
[ "Apache-2.0" ]
1
d9d73676479e36c1cbd6c9af36d857f80099504b
https://github.com/IvoryCandy/neural-style/tree/d9d73676479e36c1cbd6c9af36d857f80099504b
import torch import torch.nn as nn class Model(nn.Module): def forward(self, y): b, ch, h, w = y.size() features = y.view(b, ch, w * h) features_t = features.transpose(1, 2) gram = features.bmm(features_t) / (ch * h * w) return gram def get_inputs(): return [torch.ra...
Normalize
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class Normalize(nn.Module): """normalization layer""" def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
JJuOn/Few-shot_Class_Incremental_Learning
Normalize
false
5,362
[ "MIT" ]
1
a2178051a6fefcd73b60f5e4236116bf828a801c
https://github.com/JJuOn/Few-shot_Class_Incremental_Learning/tree/a2178051a6fefcd73b60f5e4236116bf828a801c
import torch from torch import nn class Model(nn.Module): """normalization layer""" def __init__(self, power=2): super().__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm) retur...
Readout
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class Readout(nn.Module): """ This module learns a single graph level representation for a molecule given GraphSAGE generated embeddings """ def __init__(self, attr_dim, embedding_dim, hidden_dim, output_dim, num_cats): super(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
JW9MsjwjnpdRLFw/TSFL
Readout
false
5,363
[ "MIT" ]
1
ccca391348fde270c9d43149a3397ac3cad4c6e0
https://github.com/JW9MsjwjnpdRLFw/TSFL/tree/ccca391348fde270c9d43149a3397ac3cad4c6e0
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): """ This module learns a single graph level representation for a molecule given GraphSAGE generated embeddings """ def __init__(self, attr_dim, embedding_dim, hidden_dim, output_dim, num_cats): super()....
GCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class GCN(nn.Module): """ Graph Convolutional Network based on https://arxiv.org/abs/1609.02907 """ def __init__(self, feat_dim, hidden_dim1, hidden_dim2, dropout, is_sparse=False): """Dense version of GAT.""" super(G...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
JW9MsjwjnpdRLFw/TSFL
GCN
false
5,364
[ "MIT" ]
1
ccca391348fde270c9d43149a3397ac3cad4c6e0
https://github.com/JW9MsjwjnpdRLFw/TSFL/tree/ccca391348fde270c9d43149a3397ac3cad4c6e0
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): """ Graph Convolutional Network based on https://arxiv.org/abs/1609.02907 """ def __init__(self, feat_dim, hidden_dim1, hidden_dim2, dropout, is_sparse=False): """Dense version of GAT.""" super...
Decoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Decoder(nn.Module): def __init__(self, dim_encoding, vocab_size): super().__init__() self.E = nn.Embedding(dim_encoding, vocab_size) self.b = nn.Parameter(torch.zeros(1, vocab_size)) def forward(self, Z, targets): scores = Z @ self.E.w...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
J-zin/Semantic-Hashing-Models
Decoder
false
5,365
[ "MIT" ]
1
2e4a2348bc8399a9739016e1a1a5e25a77babbbd
https://github.com/J-zin/Semantic-Hashing-Models/tree/2e4a2348bc8399a9739016e1a1a5e25a77babbbd
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dim_encoding, vocab_size): super().__init__() self.E = nn.Embedding(dim_encoding, vocab_size) self.b = nn.Parameter(torch.zeros(1, vocab_size)) def forward(self, Z, targets): scores = Z @ self.E.wei...
CenteredLayer
# 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 CenteredLayer(nn.Module): def __init__(self, **kwargs): super(CenteredLayer, self).__init__(**kwargs) def forward(self, x): return x - x.mean() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
JamesWang007/Dive-into-DL-PyTorch
CenteredLayer
false
5,366
[ "Apache-2.0" ]
1
267b54168322ab37da44e83008fba4f24b70fa9f
https://github.com/JamesWang007/Dive-into-DL-PyTorch/tree/267b54168322ab37da44e83008fba4f24b70fa9f
import torch from torch import nn class Model(nn.Module): def __init__(self, **kwargs): super().__init__(**kwargs) def forward(self, x): return x - x.mean() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
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.onnx import torch import torch.nn as nn import torch.utils.data class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super(ConvBlock, self).__init__() self.Mconv = nn.Conv2d(in_channels=in_channels, out_ch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.onnx import torch import torch.nn as nn import torch.utils.data ass...
IrohXu/Infant-Pose-pytorch
ConvBlock
false
5,367
[ "MIT" ]
1
148c43fbfefe06ec2fffa7055049c3ff341154f8
https://github.com/IrohXu/Infant-Pose-pytorch/tree/148c43fbfefe06ec2fffa7055049c3ff341154f8
import torch import torch.onnx import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super().__init__() self.Mconv = nn.Conv2d(in_channels=in_channels, out_channels= ...
StageBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.onnx import torch import torch.nn as nn import torch.utils.data class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super(ConvBlock, self).__init__() self.Mconv = nn.Conv2d(in_channels=in_channels, out_ch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.onnx import torch import torch.nn as nn import torch.utils.data ass...
IrohXu/Infant-Pose-pytorch
StageBlock
false
5,368
[ "MIT" ]
1
148c43fbfefe06ec2fffa7055049c3ff341154f8
https://github.com/IrohXu/Infant-Pose-pytorch/tree/148c43fbfefe06ec2fffa7055049c3ff341154f8
import torch import torch.onnx import torch import torch.nn as nn import torch.utils.data class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, padding=1): super().__init__() self.Mconv = nn.Conv2d(in_channels=in_channels, out_channels= ...
DistillKL
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch import nn class DistillKL(nn.Module): """KL divergence for distillation""" def __init__(self, T): super(DistillKL, self).__init__() self.T = T def forward(self, y_s, y_t): p_s = F.log_softmax(y_s / self.T, dim=1) p_t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
JJuOn/Few-shot_Class_Incremental_Learning
DistillKL
false
5,369
[ "MIT" ]
1
a2178051a6fefcd73b60f5e4236116bf828a801c
https://github.com/JJuOn/Few-shot_Class_Incremental_Learning/tree/a2178051a6fefcd73b60f5e4236116bf828a801c
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): """KL divergence for distillation""" def __init__(self, T): super().__init__() self.T = T def forward(self, y_s, y_t): p_s = F.log_softmax(y_s / self.T, dim=1) p_t = F.softmax(y_t / ...
FastRCNNPredictor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn class FastRCNNPredictor(nn.Module): def __init__(self, in_channels, mid_channels, num_classes): super().__init__() self.fc1 = nn.Linear(in_channels, mid_channels) self.fc2 = nn.Linear(mid_channels, mid_channels) sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
Jaramies/PyTorch-Simple-MaskRCNN
FastRCNNPredictor
false
5,370
[ "MIT" ]
1
21e6c6983b34061800280573ebe705ae17212972
https://github.com/Jaramies/PyTorch-Simple-MaskRCNN/tree/21e6c6983b34061800280573ebe705ae17212972
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, in_channels, mid_channels, num_classes): super().__init__() self.fc1 = nn.Linear(in_channels, mid_channels) self.fc2 = nn.Linear(mid_channels, mid_channels) self.cls_score ...
RPNHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn class RPNHead(nn.Module): def __init__(self, in_channels, num_anchors): super().__init__() self.conv = nn.Conv2d(in_channels, in_channels, 3, 1, 1) self.cls_logits = nn.Conv2d(in_channels, num_anchors, 1) self.bbox_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Jaramies/PyTorch-Simple-MaskRCNN
RPNHead
false
5,371
[ "MIT" ]
1
21e6c6983b34061800280573ebe705ae17212972
https://github.com/Jaramies/PyTorch-Simple-MaskRCNN/tree/21e6c6983b34061800280573ebe705ae17212972
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, in_channels, num_anchors): super().__init__() self.conv = nn.Conv2d(in_channels, in_channels, 3, 1, 1) self.cls_logits = nn.Conv2d(in_channels, num_anchors, 1) self.bbox_pr...
GlobalAvgPool2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F class GlobalAvgPool2d(nn.Module): def __init__(self): super(GlobalAvgPool2d, self).__init__() def forward(self, x): return F.avg_pool2d(x, kernel_size=x.size()[2:]) def get_inputs(): return [torch.rand([4, 4, 4, 4])] d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
JamesWang007/Dive-into-DL-PyTorch
GlobalAvgPool2d
false
5,372
[ "Apache-2.0" ]
1
267b54168322ab37da44e83008fba4f24b70fa9f
https://github.com/JamesWang007/Dive-into-DL-PyTorch/tree/267b54168322ab37da44e83008fba4f24b70fa9f
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return F.avg_pool2d(x, kernel_size=x.size()[2:]) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retur...
ShapePriorLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.cuda.comm class ShapePriorLoss(nn.Module): """Prior loss for body shape parameters. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". loss_weight (float, optional): T...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.cuda.comm assert_size_stride = torch._C._dynamo.guards...
JasonBoy1/mmhuman3d
ShapePriorLoss
false
5,373
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
import torch import torch.nn as nn import torch.cuda.comm class Model(nn.Module): """Prior loss for body shape parameters. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". loss_weight (float, optional): The weight...
stage_block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.onnx import torch import torch.nn as nn import torch.utils.data class dilation_layer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, padding= 'same_padding', dilation=1): super(dilation_layer, self).__init__() if padding == 'same_padding'...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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.onnx import torc...
IrohXu/Infant-Pose-pytorch
stage_block
false
5,374
[ "MIT" ]
1
148c43fbfefe06ec2fffa7055049c3ff341154f8
https://github.com/IrohXu/Infant-Pose-pytorch/tree/148c43fbfefe06ec2fffa7055049c3ff341154f8
import torch import torch.onnx import torch import torch.nn as nn import torch.utils.data class dilation_layer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, padding= 'same_padding', dilation=1): super().__init__() if padding == 'same_padding': paddin...
DBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 def _setup_kernel(k): k = np.asarray(k, dtype=np.float32) if k.ndim == 1: k = np.outer(k, k) k /= np.sum(k) assert k.ndim == 2 assert k.shape[0] == k.shape[1] return k class Conv2d(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 import numpy as np import torch.nn as nn import torch.nn.functional as F assert_...
Iceland-Leo/StyleGAN2_PyTorch
DBlock
false
5,375
[ "MIT" ]
1
3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F def _setup_kernel(k): k = np.asarray(k, dtype=np.float32) if k.ndim == 1: k = np.outer(k, k) k /= np.sum(k) assert k.ndim == 2 assert k.shape[0] == k.shape[1] return k class Conv2d(nn.Module): ...
CameraPriorLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.cuda.comm class CameraPriorLoss(nn.Module): """Prior loss for predicted camera. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". scale (float, optional): The scale c...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda.comm assert_size_stride = torch._...
JasonBoy1/mmhuman3d
CameraPriorLoss
false
5,376
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
import torch import torch.nn as nn import torch.cuda.comm class Model(nn.Module): """Prior loss for predicted camera. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". scale (float, optional): The scale coefficient...
LearnedPositionalEncoding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 LayerNorm(nn.Module): """A layernorm module in the TF style (epsilon inside the square root).""" def __init__(self, d_model, variance_epsilon=1e-12): super().__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torc...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
JamesNgo3781/vietocr
LearnedPositionalEncoding
false
5,377
[ "Apache-2.0" ]
1
9d311bbeb18c51c8ff90022f07c0463b204407dc
https://github.com/JamesNgo3781/vietocr/tree/9d311bbeb18c51c8ff90022f07c0463b204407dc
import torch from torch import nn class LayerNorm(nn.Module): """A layernorm module in the TF style (epsilon inside the square root).""" def __init__(self, d_model, variance_epsilon=1e-12): super().__init__() self.gamma = nn.Parameter(torch.ones(d_model)) self.beta = nn.Parameter(torc...
L1Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn as nn import torch.cuda.comm from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
JasonBoy1/mmhuman3d
L1Loss
false
5,378
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
import functools import torch import torch.nn as nn import torch.cuda.comm from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
MediatorNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MediatorNet(nn.Module): def __init__(self, input_dim): super(MediatorNet, self).__init__() self.fc1 = nn.Linear(input_dim, input_dim * 3) self.fc2 = nn.Linear(input_dim * 3, input_dim * 3) self.fc_last = nn.Linear(input_dim * 3, 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
JasonZuu/Frame-Selection
MediatorNet
false
5,379
[ "BSD-3-Clause" ]
1
3eb6ecdbf8e5695ba53752bdd8446def9c5cfbb9
https://github.com/JasonZuu/Frame-Selection/tree/3eb6ecdbf8e5695ba53752bdd8446def9c5cfbb9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim): super().__init__() self.fc1 = nn.Linear(input_dim, input_dim * 3) self.fc2 = nn.Linear(input_dim * 3, input_dim * 3) self.fc_last = nn.Linear(input_dim * 3, 2) self.relu = nn.ReLU() ...
HSigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class HSigmoid(nn.Module): def forward(self, x): out = F.relu6(x + 3, inplace=True) / 6 return out def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
JasonZuu/Frame-Selection
HSigmoid
false
5,380
[ "BSD-3-Clause" ]
1
3eb6ecdbf8e5695ba53752bdd8446def9c5cfbb9
https://github.com/JasonZuu/Frame-Selection/tree/3eb6ecdbf8e5695ba53752bdd8446def9c5cfbb9
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def forward(self, x): out = F.relu6(x + 3, inplace=True) / 6 return out def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
SmoothTranslationLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.cuda.comm class SmoothTranslationLoss(nn.Module): """Smooth loss for translations. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". loss_weight (float, optional): Th...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.cuda.comm assert_size_stride = torch._...
JasonBoy1/mmhuman3d
SmoothTranslationLoss
false
5,381
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
import torch import torch.nn as nn import torch.cuda.comm class Model(nn.Module): """Smooth loss for translations. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". loss_weight (float, optional): The weight of the ...
GatedConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F class GatedConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation=1): super(GatedConv2d, self).__init__() self.conv = nn.Conv2d(in_channels, 2 * out_channels, kernel_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
JamesRitchie/nsf
GatedConv2d
false
5,382
[ "MIT" ]
1
5628a6f8190c9e3840208da8baf5cf403ca9b892
https://github.com/JamesRitchie/nsf/tree/5628a6f8190c9e3840208da8baf5cf403ca9b892
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation=1): super().__init__() self.conv = nn.Conv2d(in_channels, 2 * out_channels, kernel_size, stride, ...
MSELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn as nn import torch.cuda.comm from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import functools import torch.nn as nn import torch.cuda.comm from torch.nn import functi...
JasonBoy1/mmhuman3d
MSELoss
false
5,383
[ "Apache-2.0" ]
1
79b2665191115f3ed905e6afdf09990a8d484362
https://github.com/JasonBoy1/mmhuman3d/tree/79b2665191115f3ed905e6afdf09990a8d484362
import functools import torch import torch.nn as nn import torch.cuda.comm from torch.nn import functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
GCNClassification
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class Readout(nn.Module): """ This module learns a single graph level representation for a molecule given GraphSAGE generated embeddings """ def __init__(self, attr_dim, embedding_dim, hidden_dim, output_dim, num_cats): super(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
JW9MsjwjnpdRLFw/TSFL
GCNClassification
false
5,384
[ "MIT" ]
1
ccca391348fde270c9d43149a3397ac3cad4c6e0
https://github.com/JW9MsjwjnpdRLFw/TSFL/tree/ccca391348fde270c9d43149a3397ac3cad4c6e0
import torch import torch.nn as nn import torch.utils.data class Readout(nn.Module): """ This module learns a single graph level representation for a molecule given GraphSAGE generated embeddings """ def __init__(self, attr_dim, embedding_dim, hidden_dim, output_dim, num_cats): super(...
RBF_Kernel
# 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 def norm_sq(X, Y): XX = X.matmul(X.t()) XY = X.matmul(Y.t()) YY = Y.matmul(Y.t()) return -2 * XY + XX.diag().unsqueeze(1) + YY.diag().unsqueeze(0) class RBF_Kernel(torch.nn.Module): """ RBF kernel :math:`K(x, y) = exp(||x-v||^2 / (2h)) """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
JeremyAlain/meta_learning_pacoh
RBF_Kernel
false
5,385
[ "MIT" ]
1
b4c2c37d9715e74542bab556ac1f5d778cc3409c
https://github.com/JeremyAlain/meta_learning_pacoh/tree/b4c2c37d9715e74542bab556ac1f5d778cc3409c
import torch import numpy as np def norm_sq(X, Y): XX = X.matmul(X.t()) XY = X.matmul(Y.t()) YY = Y.matmul(Y.t()) return -2 * XY + XX.diag().unsqueeze(1) + YY.diag().unsqueeze(0) class Model(torch.nn.Module): """ RBF kernel :math:`K(x, y) = exp(||x-v||^2 / (2h)) """ def ...
CustomNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CustomNet(nn.Module): """ A network with a fully connected layer followed by a sigmoid layer. This is used for testing customized operation handles. """ def __init__(self, input_dim: 'int', output_dim: 'int') ->None: super(CustomNet, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Jennifer-Rigdon/fvcore
CustomNet
false
5,386
[ "Apache-2.0" ]
1
7e800a86f2df93da017e07380543b4060ab88c94
https://github.com/Jennifer-Rigdon/fvcore/tree/7e800a86f2df93da017e07380543b4060ab88c94
import torch import torch.nn as nn class Model(nn.Module): """ A network with a fully connected layer followed by a sigmoid layer. This is used for testing customized operation handles. """ def __init__(self, input_dim: 'int', output_dim: 'int') ->None: super().__init__() self.con...
Decoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn import torch.hub def overlap_and_add(signal, frame_step): outer_dimensions = signal.size()[:-2] frames, frame_length = signal.size()[-2:] subframe_length = math.gcd(frame_length, frame_step) subframe_step = frame_step // subframe_length subframes_per_f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn import torch.hub assert_size_stride = torch._C....
JavierCane/demucs
Decoder
false
5,387
[ "MIT" ]
1
01d14844a71be7b5d86adf06a8501a951157c3fe
https://github.com/JavierCane/demucs/tree/01d14844a71be7b5d86adf06a8501a951157c3fe
import math import torch from torch import nn import torch.hub def overlap_and_add(signal, frame_step): outer_dimensions = signal.size()[:-2] frames, frame_length = signal.size()[-2:] subframe_length = math.gcd(frame_length, frame_step) subframe_step = frame_step // subframe_length subframes_per_f...
IMQSteinKernel
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch def norm_sq(X, Y): XX = X.matmul(X.t()) XY = X.matmul(Y.t()) YY = Y.matmul(Y.t()) return -2 * XY + XX.diag().unsqueeze(1) + YY.diag().unsqueeze(0) class IMQSteinKernel(torch.nn.Module): """ IMQ (inverse multi-quadratic) kernel :math:`K(x, y) = (\\alpha + ||x-y||...
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 math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda...
JeremyAlain/meta_learning_pacoh
IMQSteinKernel
false
5,388
[ "MIT" ]
1
b4c2c37d9715e74542bab556ac1f5d778cc3409c
https://github.com/JeremyAlain/meta_learning_pacoh/tree/b4c2c37d9715e74542bab556ac1f5d778cc3409c
import math import torch def norm_sq(X, Y): XX = X.matmul(X.t()) XY = X.matmul(Y.t()) YY = Y.matmul(Y.t()) return -2 * XY + XX.diag().unsqueeze(1) + YY.diag().unsqueeze(0) class Model(torch.nn.Module): """ IMQ (inverse multi-quadratic) kernel :math:`K(x, y) = (\\alpha + ||x-y||^2/h)^{\\...
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 numpy as np import torch.nn as nn def fanin_init(size, fanin=None): fanin = fanin or size[0] v = 1.0 / np.sqrt(fanin) return torch.Tensor(size).uniform_(-v, v) class Actor(nn.Module): def __init__(self, nb_states, nb_actions, hidden1=400, hidden2=300, init_w=0.003): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JackYangzg/pytorch-ddpg
Actor
false
5,389
[ "Apache-2.0" ]
1
96838a40dd6992a0a18065a5edafbefc6bb0ac69
https://github.com/JackYangzg/pytorch-ddpg/tree/96838a40dd6992a0a18065a5edafbefc6bb0ac69
import torch import numpy as np import torch.nn as nn def fanin_init(size, fanin=None): fanin = fanin or size[0] v = 1.0 / np.sqrt(fanin) return torch.Tensor(size).uniform_(-v, v) class Model(nn.Module): def __init__(self, nb_states, nb_actions, hidden1=400, hidden2=300, init_w=0.003): ...
MuSigmaEncoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MuSigmaEncoder(nn.Module): """ Maps a representation r to mu and sigma which will define the normal distribution from which we sample the latent variable z. Parameters ---------- r_dim : int Dimension of output representation r. z_dim : 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 import torch.nn as nn assert_...
JeremyAlain/meta_learning_pacoh
MuSigmaEncoder
false
5,390
[ "MIT" ]
1
b4c2c37d9715e74542bab556ac1f5d778cc3409c
https://github.com/JeremyAlain/meta_learning_pacoh/tree/b4c2c37d9715e74542bab556ac1f5d778cc3409c
import torch import torch.nn as nn class Model(nn.Module): """ Maps a representation r to mu and sigma which will define the normal distribution from which we sample the latent variable z. Parameters ---------- r_dim : int Dimension of output representation r. z_dim : int ...
SmallConvNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from numpy import prod class SmallConvNet(nn.Module): """ A network with three conv layers. This is used for testing convolution layers for activation count. """ def __init__(self, input_dim: 'int') ->None: super(SmallConvNet, self).__init__() co...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 numpy import prod assert_size_stride = torch._C._dyna...
Jennifer-Rigdon/fvcore
SmallConvNet
false
5,391
[ "Apache-2.0" ]
1
7e800a86f2df93da017e07380543b4060ab88c94
https://github.com/Jennifer-Rigdon/fvcore/tree/7e800a86f2df93da017e07380543b4060ab88c94
import torch import torch.nn as nn from numpy import prod class Model(nn.Module): """ A network with three conv layers. This is used for testing convolution layers for activation count. """ def __init__(self, input_dim: 'int') ->None: super().__init__() conv_dim1 = 8 conv_...
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 from torch import nn import torch.hub import torch.nn.functional as F class Encoder(nn.Module): """Estimation of the nonnegative mixture weight by a 1-D conv layer. """ def __init__(self, L, N, audio_channels): super(Encoder, self).__init__() self.L, self.N = L, N sel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
JavierCane/demucs
Encoder
false
5,392
[ "MIT" ]
1
01d14844a71be7b5d86adf06a8501a951157c3fe
https://github.com/JavierCane/demucs/tree/01d14844a71be7b5d86adf06a8501a951157c3fe
import torch from torch import nn import torch.hub import torch.nn.functional as F class Model(nn.Module): """Estimation of the nonnegative mixture weight by a 1-D conv layer. """ def __init__(self, L, N, audio_channels): super().__init__() self.L, self.N = L, N self.conv1d_U = nn...
DeConv2dBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 DeConv2dBlock(nn.Module): """ Similar to a LeNet block 4x upsampling, dimension hard-coded """ def __init__(self, in_dim: 'int', hidden_dim: 'int', out_dim: 'int', stride: 'int'=2, kernel_size: 'int'=3, padding: 'int'=2, output_padding: 'int...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
Jimmy-INL/fourier-transformer
DeConv2dBlock
false
5,393
[ "MIT" ]
1
44a6ebc68aef24a4eb9aaa2a8c518ede56ec47ce
https://github.com/Jimmy-INL/fourier-transformer/tree/44a6ebc68aef24a4eb9aaa2a8c518ede56ec47ce
import torch from torch import nn class Model(nn.Module): """ Similar to a LeNet block 4x upsampling, dimension hard-coded """ def __init__(self, in_dim: 'int', hidden_dim: 'int', out_dim: 'int', stride: 'int'=2, kernel_size: 'int'=3, padding: 'int'=2, output_padding: 'int'=1, dro...
DQN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class DQN(nn.Module): """A simple deep Q network implementation. Computes Q values for each (action, object) tuple given an input state vector """ def __init__(self, state_dim, action_dim, object_dim, hidden_size=100): super(D...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Jerimat/MITx-6.86-MachineLearning_EdX
DQN
false
5,394
[ "MIT" ]
1
e454e0646cd923d689d3946ea2ff3432dec920ac
https://github.com/Jerimat/MITx-6.86-MachineLearning_EdX/tree/e454e0646cd923d689d3946ea2ff3432dec920ac
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """A simple deep Q network implementation. Computes Q values for each (action, object) tuple given an input state vector """ def __init__(self, state_dim, action_dim, object_dim, hidden_size=100): super...
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 numpy as np import torch.nn as nn import torch.nn.functional as F class Actor(nn.Module): def __init__(self, state_dim: 'int', action_dim: 'int'): """ Initialize the network param: state_dim : Size of the state space param: action_dim: Size of the action space ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
JiangengDong/ECE276C
Actor
false
5,395
[ "MIT" ]
1
2338b5226d6fed8858402e8d67db7f2eead98221
https://github.com/JiangengDong/ECE276C/tree/2338b5226d6fed8858402e8d67db7f2eead98221
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_dim: 'int', action_dim: 'int'): """ Initialize the network param: state_dim : Size of the state space param: action_dim: Size of the action space ...
FreqUpsample
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class FreqUpsample(nn.Module): def __init__(self, factor: 'int', mode='nearest'): super().__init__() self.f = float(factor) self.mode = mode def forward(self, x: 'Tensor') ->Tensor: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
JinmingChe/DeepFilterNet
FreqUpsample
false
5,396
[ "ECL-2.0", "Apache-2.0", "MIT" ]
1
0e35a24c33c091b4c34afb3599f2945bf5e87adf
https://github.com/JinmingChe/DeepFilterNet/tree/0e35a24c33c091b4c34afb3599f2945bf5e87adf
import torch from torch import Tensor from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, factor: 'int', mode='nearest'): super().__init__() self.f = float(factor) self.mode = mode def forward(self, x: 'Tensor') ->Tensor: retur...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvLayer, self).__init__() reflection_padding = int(np.floor(kernel_size / 2)) self.reflection_pad = nn.ReflectionPad2d(reflection_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....
IvoryCandy/neural-style
ResidualBlock
false
5,397
[ "Apache-2.0" ]
1
d9d73676479e36c1cbd6c9af36d857f80099504b
https://github.com/IvoryCandy/neural-style/tree/d9d73676479e36c1cbd6c9af36d857f80099504b
import torch import numpy as np import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super().__init__() reflection_padding = int(np.floor(kernel_size / 2)) self.reflection_pad = nn.ReflectionPad2d(reflection_padding) ...
SoftDetectionModule
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn class SoftDetectionModule(nn.Module): def __init__(self, soft_local_max_size=3): super(SoftDetectionModule, self).__init__() self.soft_local_max_size = soft_local_max_size self.pad = self.soft_local_max_size // 2 def ...
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 ...
JimmyYourHonor/D2-net-fast-ap
SoftDetectionModule
false
5,398
[ "BSD-3-Clause-Clear" ]
1
c4c0db23eae3aa4e3079b80b57887b4cb963b1e8
https://github.com/JimmyYourHonor/D2-net-fast-ap/tree/c4c0db23eae3aa4e3079b80b57887b4cb963b1e8
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, soft_local_max_size=3): super().__init__() self.soft_local_max_size = soft_local_max_size self.pad = self.soft_local_max_size // 2 def forward(self, batch): b = batch...
ConvNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class ConvNet(nn.Module): """ A network with a single convolution layer. This is used for testing flop count for convolution layers. """ def __init__(self, conv_dim: 'int', input_dim: 'int', output_dim: 'int', kernel_size: 'int', spatial_dim: 'int', stri...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Jennifer-Rigdon/fvcore
ConvNet
false
5,399
[ "Apache-2.0" ]
1
7e800a86f2df93da017e07380543b4060ab88c94
https://github.com/Jennifer-Rigdon/fvcore/tree/7e800a86f2df93da017e07380543b4060ab88c94
import torch import torch.nn as nn class Model(nn.Module): """ A network with a single convolution layer. This is used for testing flop count for convolution layers. """ def __init__(self, conv_dim: 'int', input_dim: 'int', output_dim: 'int', kernel_size: 'int', spatial_dim: 'int', stride...
SiSdr
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from torch import nn class SiSdr(nn.Module): def __init__(self): super().__init__() def forward(self, input: 'Tensor', target: 'Tensor'): eps = torch.finfo(input.dtype).eps Rss: 'Tensor' = torch.einsum('bi,bi->b', target, target).unsqueeze(-1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
JinmingChe/DeepFilterNet
SiSdr
false
5,400
[ "ECL-2.0", "Apache-2.0", "MIT" ]
1
0e35a24c33c091b4c34afb3599f2945bf5e87adf
https://github.com/JinmingChe/DeepFilterNet/tree/0e35a24c33c091b4c34afb3599f2945bf5e87adf
import torch from torch import Tensor from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input: 'Tensor', target: 'Tensor'): eps = torch.finfo(input.dtype).eps Rss: 'Tensor' = torch.einsum('bi,bi->b', target, target).unsqueeze(-1) ...
QuickGELU
# 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 QuickGELU(nn.Module): def forward(self, x: 'torch.Tensor'): return x * torch.sigmoid(1.702 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Jinsu-L/KELIP
QuickGELU
false
5,401
[ "Apache-2.0" ]
1
d3261cbb9ba3c3ad474dd560a5add8b69ed78477
https://github.com/Jinsu-L/KELIP/tree/d3261cbb9ba3c3ad474dd560a5add8b69ed78477
import torch from torch import nn class Model(nn.Module): def forward(self, x: 'torch.Tensor'): return x * torch.sigmoid(1.702 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
DfAlphaLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor from typing import Optional from torch import nn from typing import Final class DfAlphaLoss(nn.Module): """Add a penalty to use DF for very noisy segments. Starting from lsnr_thresh, the penalty is increased and has its maximum at lsnr_min. """ factor: 'Final[flo...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import Tens...
JinmingChe/DeepFilterNet
DfAlphaLoss
false
5,402
[ "ECL-2.0", "Apache-2.0", "MIT" ]
1
0e35a24c33c091b4c34afb3599f2945bf5e87adf
https://github.com/JinmingChe/DeepFilterNet/tree/0e35a24c33c091b4c34afb3599f2945bf5e87adf
import torch from torch import Tensor from typing import Optional from torch import nn from typing import Final class Model(nn.Module): """Add a penalty to use DF for very noisy segments. Starting from lsnr_thresh, the penalty is increased and has its maximum at lsnr_min. """ factor: 'Final[float]' ...
LogsticRegression
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 LogsticRegression(nn.Module): def __init__(self, in_dim, n_class): super().__init__() self.fc1 = nn.Linear(in_dim, in_dim // 2) self.fc2 = nn.Linear(in_dim // 2, n_class) def forward(self, x): x = F.relu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Jie-Yuan/Torchappy
LogsticRegression
false
5,403
[ "Apache-2.0" ]
1
e722db1085fa2ff8e0267f7e6745875531c00f8b
https://github.com/Jie-Yuan/Torchappy/tree/e722db1085fa2ff8e0267f7e6745875531c00f8b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_dim, n_class): super().__init__() self.fc1 = nn.Linear(in_dim, in_dim // 2) self.fc2 = nn.Linear(in_dim // 2, n_class) def forward(self, x): x = F.relu(self.fc1(x)...
ThreeNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ThreeNet(nn.Module): """ A network with three layers. This is used for testing a network with more than one operation. The network has a convolution layer followed by two fully connected layers. """ def __init__(self, input_dim: 'int', conv_dim: 'int',...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Jennifer-Rigdon/fvcore
ThreeNet
false
5,404
[ "Apache-2.0" ]
1
7e800a86f2df93da017e07380543b4060ab88c94
https://github.com/Jennifer-Rigdon/fvcore/tree/7e800a86f2df93da017e07380543b4060ab88c94
import torch import torch.nn as nn class Model(nn.Module): """ A network with three layers. This is used for testing a network with more than one operation. The network has a convolution layer followed by two fully connected layers. """ def __init__(self, input_dim: 'int', conv_dim: 'int', li...
FeatureL2Norm
# 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 class FeatureL2Norm(nn.Module): """ Implementation by Ignacio Rocco paper: https://arxiv.org/abs/1703.05593 project: https://github.com/ignacio-rocco/cnngeometric_pytorch """ def __init__(self): super(FeatureL2Norm, self).__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.gua...
JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching
FeatureL2Norm
false
5,405
[ "MIT" ]
1
b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
https://github.com/JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching/tree/b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
import torch import torch.nn as nn import torch.nn class Model(nn.Module): """ Implementation by Ignacio Rocco paper: https://arxiv.org/abs/1703.05593 project: https://github.com/ignacio-rocco/cnngeometric_pytorch """ def __init__(self): super().__init__() def forward(self, featu...
Flip
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.init class Flip(nn.Module): """Does horizontal or vertical flip on a BCHW tensor. Args: horizontal (bool): If True, applies horizontal flip. Else, vertical flip is applied. Default = True ** Not recommended for CPU (Pillow/OpenCV bas...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.init assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dy...
Johnson-yue/TensorMONK
Flip
false
5,406
[ "MIT" ]
1
1785132b82c685c3b3fc05b00dec46b1fccfc948
https://github.com/Johnson-yue/TensorMONK/tree/1785132b82c685c3b3fc05b00dec46b1fccfc948
import torch import torch.nn as nn import torch.nn.init class Model(nn.Module): """Does horizontal or vertical flip on a BCHW tensor. Args: horizontal (bool): If True, applies horizontal flip. Else, vertical flip is applied. Default = True ** Not recommended for CPU (Pillow/OpenCV ba...
CorrelationVolume
# 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 class CorrelationVolume(nn.Module): """ Implementation by Ignacio Rocco paper: https://arxiv.org/abs/1703.05593 project: https://github.com/ignacio-rocco/cnngeometric_pytorch """ def __init__(self): super(CorrelationVolume, self).__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 import torch.nn as nn import torch.nn assert_size_stride = torch._C._dynamo.guar...
JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching
CorrelationVolume
false
5,407
[ "MIT" ]
1
b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
https://github.com/JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching/tree/b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
import torch import torch.nn as nn import torch.nn class Model(nn.Module): """ Implementation by Ignacio Rocco paper: https://arxiv.org/abs/1703.05593 project: https://github.com/ignacio-rocco/cnngeometric_pytorch """ def __init__(self): super().__init__() def forward(self, featu...
FeatureCorrelation
# 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 def featureL2Norm(feature): epsilon = 1e-06 norm = torch.pow(torch.sum(torch.pow(feature, 2), 1) + epsilon, 0.5 ).unsqueeze(1).expand_as(feature) return torch.div(feature, norm) class FeatureCorrelation(torch.nn.Module): def __init__(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching
FeatureCorrelation
false
5,408
[ "MIT" ]
1
b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
https://github.com/JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching/tree/b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
import torch import torch.nn as nn import torch.nn def featureL2Norm(feature): epsilon = 1e-06 norm = torch.pow(torch.sum(torch.pow(feature, 2), 1) + epsilon, 0.5 ).unsqueeze(1).expand_as(feature) return torch.div(feature, norm) class Model(torch.nn.Module): def __init__(self, shape='3D', n...
GaussianFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
JunHyungKang/SAROD_ICIP
GaussianFocalLoss
false
5,409
[ "MIT" ]
1
71585951f64dc1cc22ed72900eff81f747edec77
https://github.com/JunHyungKang/SAROD_ICIP/tree/71585951f64dc1cc22ed72900eff81f747edec77
import functools import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
PCENlr
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PCENlr(nn.Module): """ A Low-rank version for per-channel energy normalization. """ def __init__(self, N, T): super(PCENlr, self).__init__() self.N = N self.T = T self.lr_enc = nn.Linear(self.T, 1, bias=False) self.l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Js-Mim/wagner_vad
PCENlr
false
5,410
[ "MIT" ]
1
cc682bd7a8f496a26fe4be39ea2b2d68e493c5ba
https://github.com/Js-Mim/wagner_vad/tree/cc682bd7a8f496a26fe4be39ea2b2d68e493c5ba
import torch import torch.nn as nn class Model(nn.Module): """ A Low-rank version for per-channel energy normalization. """ def __init__(self, N, T): super().__init__() self.N = N self.T = T self.lr_enc = nn.Linear(self.T, 1, bias=False) self.lr_dec = nn.Li...
ConvHeadPooling
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ConvHeadPooling(nn.Module): """Adapted from https://github.com/naver-ai/pit/blob/9d97a62e6a2a72a86685003998fcae700f952e18/pit.py#L54-L69 """ def __init__(self, in_feature: 'int', out_feature: 'int', stride: 'int'): super(ConvHeadPooling, 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 assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Justin900429/vision-transformer
ConvHeadPooling
false
5,411
[ "MIT" ]
1
e149092efbb83c166449944137db0ee5200f9325
https://github.com/Justin900429/vision-transformer/tree/e149092efbb83c166449944137db0ee5200f9325
import torch import torch.nn as nn class Model(nn.Module): """Adapted from https://github.com/naver-ai/pit/blob/9d97a62e6a2a72a86685003998fcae700f952e18/pit.py#L54-L69 """ def __init__(self, in_feature: 'int', out_feature: 'int', stride: 'int'): super().__init__() self.conv = nn.Conv2...
AffineGridGen
# 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.nn.functional as F import torch.nn from torch.nn.modules.module import Module class AffineGridGen(Module): def __init__(self, out_h=240, out_w=240, out_ch=3, use_cuda=True): super(AffineGridGen, self).__init__() self.out_h = out_h self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import torch.nn from torch.nn.modules.module import Module assert_size_stride = torch._C._dynamo.guards.assert_s...
JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching
AffineGridGen
false
5,412
[ "MIT" ]
1
b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
https://github.com/JiwonCocoder/-Joint-Learning-of-Feature-Extraction-and-Cost-Aggregation-for-Semantic-Matching/tree/b79e0e20fd5a1a9ddc0ffa9d7a92e0ebd21018b9
from torch.nn import Module import torch import torch.nn.functional as F import torch.nn from torch.nn.modules.module import Module class Model(Module): def __init__(self, out_h=240, out_w=240, out_ch=3, use_cuda=True): super().__init__() self.out_h = out_h self.out_w = out_w self...
CMDS_Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from sklearn.preprocessing import scale as scale def Covariance(m, bias=False, rowvar=True, inplace=False): """ Estimate a covariance matrix given data(tensor). Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, `X = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
Gustoaxel/Statistical-autoencoder
CMDS_Loss
false
5,413
[ "MIT" ]
1
f3328f9c2a45ef0f7fe4adf98af4a64d02d34afc
https://github.com/Gustoaxel/Statistical-autoencoder/tree/f3328f9c2a45ef0f7fe4adf98af4a64d02d34afc
import torch from torch import nn from sklearn.preprocessing import scale as scale def Covariance(m, bias=False, rowvar=True, inplace=False): """ Estimate a covariance matrix given data(tensor). Covariance indicates the level to which two variables vary together. If we examine N-dimensional samples, `X = ...
NNMerge
# 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 NNMerge(nn.Module): def __init__(self): super(NNMerge, self).__init__() def forward(self, x): """ (k,D) -> (D,) """ return torch.sum(x, -2) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Justin-Yuan/learn-to-interact
NNMerge
false
5,414
[ "MIT" ]
1
eb013bb3bab269bda8a8075e64fe3bcd2964d8ae
https://github.com/Justin-Yuan/learn-to-interact/tree/eb013bb3bab269bda8a8075e64fe3bcd2964d8ae
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): """ (k,D) -> (D,) """ return torch.sum(x, -2) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []