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
BasicModel5_MultiArgs
# 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 BasicModel5_MultiArgs(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) * x3[0] - ReLU(x2) * x3[1]) """ def __init__(self): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel5_MultiArgs
false
417
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) * x3[0] - ReLU(x2) * x3[1]) """ def __init__(self): super().__in...
RecursiveNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 RecursiveNet(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(64, 64, 3, 1, 1) def forward(self, x, args1=None, args2=None): del args1, args2 for _ in range(3): out = self.conv1(x) out =...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
EarthLab-Luxembourg/torch-summary
RecursiveNet
false
418
[ "MIT" ]
0
8ef25aea5e9fb075df27e1e0c77bad56a7254397
https://github.com/EarthLab-Luxembourg/torch-summary/tree/8ef25aea5e9fb075df27e1e0c77bad56a7254397
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(64, 64, 3, 1, 1) def forward(self, x, args1=None, args2=None): del args1, args2 for _ in range(3): out = self.conv1(x) out = self.c...
BasicModel4_MultiArgs
# 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 BasicModel4_MultiArgs(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2) / x3) """ def __init__(self): super()...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel4_MultiArgs
false
419
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Slightly modified example model from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1 - 1) - ReLU(x2) / x3) """ def __init__(self): super().__init__() ...
LanguageModelCriterion
# 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 LanguageModelCriterion(nn.Module): def __init__(self): super(LanguageModelCriterion, self).__init__() def forward(self, input, target, mask): input = input.contiguous().view(-1, input.size(2)) target = target.contiguous().view(-1, 1) m...
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...
FYJNEVERFOLLOWS/hw_NLP
LanguageModelCriterion
false
420
[ "MIT" ]
0
c9d72804128dfed3a53e9df40e94b2d53cccacae
https://github.com/FYJNEVERFOLLOWS/hw_NLP/tree/c9d72804128dfed3a53e9df40e94b2d53cccacae
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input, target, mask): input = input.contiguous().view(-1, input.size(2)) target = target.contiguous().view(-1, 1) mask = mask.contiguous().view(-1, 1) o...
BasicModel
# 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 BasicModel(nn.Module): def __init__(self): super().__init__() def forward(self, input): input = 1 - F.relu(1 - input) return input def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel
false
421
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input): input = 1 - F.relu(1 - input) return input def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
ClassificationModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class ClassificationModel(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256): super(ClassificationModel, self).__init__() self.num_classes = num_classes self.num_anchors = num_anchors ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
DvdNss/FaceMaskDetection
ClassificationModel
false
422
[ "Apache-2.0" ]
0
3a4efe2bf8fb224d72636c853684a563b4e7a2e4
https://github.com/DvdNss/FaceMaskDetection/tree/3a4efe2bf8fb224d72636c853684a563b4e7a2e4
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_features_in, num_anchors=9, num_classes=80, prior=0.01, feature_size=256): super().__init__() self.num_classes = num_classes self.num_anchors = num_anchors self.conv1 = nn.Conv2d(num_features...
ReLUDeepLiftModel
# 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 ReLUDeepLiftModel(nn.Module): """ https://www.youtube.com/watch?v=f_iAM0NPwnM """ def __init__(self): super().__init__() self.relu1 = nn.ReLU() self.relu2 = nn.ReLU() def forward(self, x1, x2, x3=2): return 2 * self.rel...
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...
Europium248/captum
ReLUDeepLiftModel
false
423
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn class Model(nn.Module): """ https://www.youtube.com/watch?v=f_iAM0NPwnM """ def __init__(self): super().__init__() self.relu1 = nn.ReLU() self.relu2 = nn.ReLU() def forward(self, x1, x2, x3=2): return 2 * self.relu1(x1) + x3 ...
eSEModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.nn.parallel class Hsigmoid(nn.Module): def __init__(self, inplace=True): super(Hsigmoid, self).__init__() self.inplace = inplace def forward(self, x): return F.relu6(x + 3.0, inplace=self.inplace) / 6.0 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
EllisHui/outOfRailWay
eSEModule
false
424
[ "BSD-2-Clause" ]
0
e3bf9aaa18879bee5536740d55006c872f06278f
https://github.com/EllisHui/outOfRailWay/tree/e3bf9aaa18879bee5536740d55006c872f06278f
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel class Hsigmoid(nn.Module): def __init__(self, inplace=True): super().__init__() self.inplace = inplace def forward(self, x): return F.relu6(x + 3.0, inplace=self.inplace) / 6.0 class Model(nn...
TemporalEmbedding
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn as nn class FixedEmbedding(nn.Module): def __init__(self, c_in, d_model): super(FixedEmbedding, self).__init__() w = torch.zeros(c_in, d_model).float() w.require_grad = False position = torch.arange(0, c_in).float().unsqueeze(1) 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 import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guar...
Fanxingye/Informer2020
TemporalEmbedding
false
425
[ "Apache-2.0" ]
0
94fd05f82ff0882681a9716ae3e980a574fdcbed
https://github.com/Fanxingye/Informer2020/tree/94fd05f82ff0882681a9716ae3e980a574fdcbed
import math import torch import torch.nn as nn class FixedEmbedding(nn.Module): def __init__(self, c_in, d_model): super().__init__() w = torch.zeros(c_in, d_model).float() w.require_grad = False position = torch.arange(0, c_in).float().unsqueeze(1) div_term = (torch.arang...
TanhDeepLiftModel
# 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 TanhDeepLiftModel(nn.Module): """ Same as the ReLUDeepLiftModel, but with activations that can have negative outputs """ def __init__(self): super().__init__() self.tanh1 = nn.Tanh() self.tanh2 = nn.Tanh() def forward(s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
Europium248/captum
TanhDeepLiftModel
false
426
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn class Model(nn.Module): """ Same as the ReLUDeepLiftModel, but with activations that can have negative outputs """ def __init__(self): super().__init__() self.tanh1 = nn.Tanh() self.tanh2 = nn.Tanh() def forward(self, x1, x2)...
NaiveGroupNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 torch from torch.nn import Parameter from torch.nn import init import torch.nn.parallel class NaiveGroupNorm(Module): """NaiveGroupNorm implements Group Normalization with the high-level matrix operations in PyTorch. It is a temporary solution to export GN by ONNX before the...
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.nn import Module from torch.nn import Parameter from torch.nn import...
EllisHui/outOfRailWay
NaiveGroupNorm
false
427
[ "BSD-2-Clause" ]
0
e3bf9aaa18879bee5536740d55006c872f06278f
https://github.com/EllisHui/outOfRailWay/tree/e3bf9aaa18879bee5536740d55006c872f06278f
from torch.nn import Module import torch from torch.nn import Parameter from torch.nn import init import torch.nn.parallel class Model(Module): """NaiveGroupNorm implements Group Normalization with the high-level matrix operations in PyTorch. It is a temporary solution to export GN by ONNX before the official...
GEGLU
# 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 import torch.utils.checkpoint class GEGLU(nn.Module): def forward(self, x): x, gate = x.chunk(2, dim=-1) return F.gelu(gate) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.utils.checkpoint assert_size_stride = torch._...
ClashLuke/gpt-neox
GEGLU
false
428
[ "MIT" ]
0
3291d0e6c867d9d328b96e8377f5b77c6f66c323
https://github.com/ClashLuke/gpt-neox/tree/3291d0e6c867d9d328b96e8377f5b77c6f66c323
import torch from torch import nn import torch.nn.functional as F import torch.utils.checkpoint class Model(nn.Module): def forward(self, x): x, gate = x.chunk(2, dim=-1) return F.gelu(gate) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
MultiRelu
# 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 Tuple import torch.nn as nn from typing import no_type_check class MultiRelu(nn.Module): def __init__(self, inplace: 'bool'=False): super().__init__() self.relu1 = nn.ReLU(inplace=inplace) self.relu2 = nn.ReLU(inplace=inplace) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
MultiRelu
false
429
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch from torch import Tensor from typing import Tuple import torch.nn as nn from typing import no_type_check class Model(nn.Module): def __init__(self, inplace: 'bool'=False): super().__init__() self.relu1 = nn.ReLU(inplace=inplace) self.relu2 = nn.ReLU(inplace=inplace) @no_...
BasicModel_MaxPool_ReLU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class BasicModel_MaxPool_ReLU(nn.Module): def __init__(self, inplace=False): super().__init__() self.maxpool = nn.MaxPool1d(3) self.relu = nn.ReLU(inplace=inplace) def forward(self, x): return self.relu(self.maxpool(x)).sum(dim=1) def get_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Europium248/captum
BasicModel_MaxPool_ReLU
false
430
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, inplace=False): super().__init__() self.maxpool = nn.MaxPool1d(3) self.relu = nn.ReLU(inplace=inplace) def forward(self, x): return self.relu(self.maxpool(x)).sum(dim=1) def get_inputs(): retu...
AdaptiveCatAvgMaxPool2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def adaptive_catavgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_pool2d(x, output_size) return torch.cat((x_avg, x_max), 1) class AdaptiveCatAvgMaxPool2d(...
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 from torch.nn import functional as F import torch.nn.parallel asser...
Fanzhongjie/ARFE
AdaptiveCatAvgMaxPool2d
false
431
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def adaptive_catavgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_pool2d(x, output_size) return torch.cat((x_avg, x_max), 1) class Model(nn.Module): d...
GCN_Linear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch import torch.nn.functional as F from torch import nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class sparse_dropout(Module): """ Sparse dropout implementation """ def __init__(self): super(sparse_dr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module i...
Eudialyte/SepGAT
GCN_Linear
false
432
[ "MIT" ]
0
6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
https://github.com/Eudialyte/SepGAT/tree/6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
from torch.nn import Module import math import torch import torch.nn.functional as F from torch import nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class sparse_dropout(Module): """ Sparse dropout implementation """ def __init__(self): super().__init_...
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 from torch import nn import torch.nn.functional as F import torch.nn.parallel class Conv2D(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', stride=1, dilation=1, groups=1): super(Conv2D, self).__init__() assert type(kernel_size) in [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 import torch.nn.functional as F import torch.nn.parallel as...
EllisHui/outOfRailWay
GCN
false
433
[ "BSD-2-Clause" ]
0
e3bf9aaa18879bee5536740d55006c872f06278f
https://github.com/EllisHui/outOfRailWay/tree/e3bf9aaa18879bee5536740d55006c872f06278f
import torch from torch import nn import torch.nn.functional as F import torch.nn.parallel class Conv2D(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, padding= 'same', stride=1, dilation=1, groups=1): super().__init__() assert type(kernel_size) in [int, tuple ...
Linear2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Linear2(nn.Module): def __init__(self, nfeat, nhid, nclass, dropout): super(Linear2, self).__init__() self.linear1 = nn.Linear(nfeat, nhid, bias=True) self.linear2 = nn.Linear(nhid, nclass, bias=True) self.dro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Eudialyte/SepGAT
Linear2
false
434
[ "MIT" ]
0
6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
https://github.com/Eudialyte/SepGAT/tree/6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, nfeat, nhid, nclass, dropout): super().__init__() self.linear1 = nn.Linear(nfeat, nhid, bias=True) self.linear2 = nn.Linear(nhid, nclass, bias=True) self.dropout = dropout ...
BalancedL1Loss
# 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 numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "su...
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...
Fanzhongjie/ARFE
BalancedL1Loss
false
435
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import functools import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "su...
LinearMaxPoolLinearModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 LinearMaxPoolLinearModel(nn.Module): def __init__(self): super().__init__() self.lin1 = nn.Linear(4, 4, bias=False) self.lin1.weight = nn.Parameter(torch.eye(4, 4)) self.pool1 = nn.MaxPool1d(4) self.lin2 = nn.Linear(1, 1, bias=False...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Europium248/captum
LinearMaxPoolLinearModel
false
436
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.lin1 = nn.Linear(4, 4, bias=False) self.lin1.weight = nn.Parameter(torch.eye(4, 4)) self.pool1 = nn.MaxPool1d(4) self.lin2 = nn.Linear(1, 1, bias=False) self.lin2...
AdaptiveAvgMaxPool2d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def adaptive_avgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_pool2d(x, output_size) return 0.5 * (x_avg + x_max) class AdaptiveAvgMaxPool2d(nn.Module): ...
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 from torch.nn import functional as F import torch.nn.parallel asser...
Fanzhongjie/ARFE
AdaptiveAvgMaxPool2d
false
437
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def adaptive_avgmax_pool2d(x, output_size=1): x_avg = F.adaptive_avg_pool2d(x, output_size) x_max = F.adaptive_max_pool2d(x, output_size) return 0.5 * (x_avg + x_max) class Model(nn.Module): def __init_...
TinyCnn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 TinyCnn(nn.Module): def __init__(self, feature_extraction=False): super().__init__() self.feature_extraction = feature_extraction self.conv1 = nn.Conv2d(3, 3, 5) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2, 2) if not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Europium248/captum
TinyCnn
false
438
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, feature_extraction=False): super().__init__() self.feature_extraction = feature_extraction self.conv1 = nn.Conv2d(3, 3, 5) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2, 2) if not se...
ConvNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data class ConvNorm(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=None, dilation=1, bias=True, w_init_gain='linear'): super(ConvNorm, self).__init__() if padding is None: assert kernel_size % 2 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size...
FadyKhalaf/tacotron2
ConvNorm
false
439
[ "BSD-3-Clause" ]
0
d9bf28a6d286aab42bce46df9f26a9a3d7c2f01f
https://github.com/FadyKhalaf/tacotron2/tree/d9bf28a6d286aab42bce46df9f26a9a3d7c2f01f
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=None, dilation=1, bias=True, w_init_gain='linear'): super().__init__() if padding is None: assert kernel_size % 2 == 1 ...
TokenEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 TokenEmbedding(nn.Module): def __init__(self, c_in, d_model): super(TokenEmbedding, self).__init__() padding = 1 if torch.__version__ >= '1.5.0' else 2 self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model, kernel_size=3, pa...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
Fanxingye/Informer2020
TokenEmbedding
false
440
[ "Apache-2.0" ]
0
94fd05f82ff0882681a9716ae3e980a574fdcbed
https://github.com/Fanxingye/Informer2020/tree/94fd05f82ff0882681a9716ae3e980a574fdcbed
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, c_in, d_model): super().__init__() padding = 1 if torch.__version__ >= '1.5.0' else 2 self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model, kernel_size=3, padding=padding, padding_mode='...
BasicModel_ConvNet_MaxPool3d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 BasicModel_ConvNet_MaxPool3d(nn.Module): """Same as above, but with the MaxPool1d replaced with a MaxPool3d. This is useful because the MaxPool modules behave differently to other modules from the perspective of the DeepLift Attributions """ def __init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Europium248/captum
BasicModel_ConvNet_MaxPool3d
false
441
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn class Model(nn.Module): """Same as above, but with the MaxPool1d replaced with a MaxPool3d. This is useful because the MaxPool modules behave differently to other modules from the perspective of the DeepLift Attributions """ def __init__(self): super...
CrossEntropyLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Red...
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 ...
Fanzhongjie/ARFE
CrossEntropyLoss
false
442
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Red...
h_sigmoid
# 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 h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def g...
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...
Felicia980317/mytorch
h_sigmoid
false
443
[ "Apache-2.0" ]
0
e463122c0d402878ec5b4c5a823a0feeba8fdbfe
https://github.com/Felicia980317/mytorch/tree/e463122c0d402878ec5b4c5a823a0feeba8fdbfe
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, inplace=True): super().__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
MedianPool2d
# 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.utils import _pair import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel from torch.nn.modules.utils import _quadruple class MedianPool2d(nn.Module): """ Median pool (usable as median filter when stride=1) module. Args: kernel_size: si...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules.utils import _pair import torch.nn as nn import tor...
Fanzhongjie/ARFE
MedianPool2d
false
444
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch from torch.nn.modules.utils import _pair import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel from torch.nn.modules.utils import _quadruple class Model(nn.Module): """ Median pool (usable as median filter when stride=1) module. Args: kernel_size: size of p...
BasicModel_ConvNet_One_Conv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor import torch.nn as nn from typing import Optional from typing import no_type_check class BasicModel_ConvNet_One_Conv(nn.Module): def __init__(self, inplace: 'bool'=False): super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU(inpl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Europium248/captum
BasicModel_ConvNet_One_Conv
false
445
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch from torch import Tensor import torch.nn as nn from typing import Optional from typing import no_type_check class Model(nn.Module): def __init__(self, inplace: 'bool'=False): super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU(inplace=inplace) s...
GCN1
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch import torch.nn.functional as F from torch import nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class sparse_dropout(Module): """ Sparse dropout implementation """ def __init__(self): super(sparse_dr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import math import torch.nn.functional as F from tor...
Eudialyte/SepGAT
GCN1
false
446
[ "MIT" ]
0
6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
https://github.com/Eudialyte/SepGAT/tree/6ea77714d1b2f2f5d0857cddcc9f1f5f9c0bcf50
from torch.nn import Module import math import torch import torch.nn.functional as F from torch import nn from torch.nn.parameter import Parameter from torch.nn.modules.module import Module class sparse_dropout(Module): """ Sparse dropout implementation """ def __init__(self): super().__init_...
Tanh
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel class Tanh(nn.Module): def __init__(self, inplace: 'bool'=False): super(Tanh, self).__init__() self.inplace = inplace def forward(self, x): return x.tanh_() if self.inplace else x.tanh() def get_inputs(): return [torch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._d...
Fanzhongjie/ARFE
Tanh
false
448
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): def __init__(self, inplace: 'bool'=False): super().__init__() self.inplace = inplace def forward(self, x): return x.tanh_() if self.inplace else x.tanh() def get_inputs(): return [torch.rand([4,...
SoftmaxDeepLiftModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SoftmaxDeepLiftModel(nn.Module): """ Model architecture from: https://adventuresinmachinelearning.com/pytorch-tutorial-deep-learning/ """ def __init__(self, num_in, num_hidden, num_out): super().__init__() self.num_in = num_in ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Europium248/captum
SoftmaxDeepLiftModel
false
449
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn class Model(nn.Module): """ Model architecture from: https://adventuresinmachinelearning.com/pytorch-tutorial-deep-learning/ """ def __init__(self, num_in, num_hidden, num_out): super().__init__() self.num_in = num_in self.num_hid...
SEModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel class SEModule(nn.Module): def __init__(self, channels, reduction=16, act_layer=nn.ReLU): super(SEModule, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) reduction_channels = max(channels // reduction, 8) self.fc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
Fanzhongjie/ARFE
SEModule
false
450
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): def __init__(self, channels, reduction=16, act_layer=nn.ReLU): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d(1) reduction_channels = max(channels // reduction, 8) self.fc1 = nn.Conv2d(cha...
MockModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.optim class MockModule(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(3, 16, kernel_size=1) def forward(self, x: 'torch.Tensor'): return self.conv(x).mean(3).mean(2) def get_inputs(): retu...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 import torch.optim assert_size_stride = to...
FebruaryBreeze/torch-parameter-groups
MockModule
false
451
[ "MIT" ]
0
e90c3d451c1afcfe5267801d5cfcc5413777b1d8
https://github.com/FebruaryBreeze/torch-parameter-groups/tree/e90c3d451c1afcfe5267801d5cfcc5413777b1d8
import torch import torch.nn as nn import torch.nn import torch.optim class Model(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(3, 16, kernel_size=1) def forward(self, x: 'torch.Tensor'): return self.conv(x).mean(3).mean(2) def get_inputs(): return [t...
ShuffleBlock
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ShuffleBlock(nn.Module): def __init__(self, groups=2): super(ShuffleBlock, self).__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.size(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Fede112/pytorch-cifar
ShuffleBlock
false
452
[ "MIT" ]
0
2e89028e9aaabb22dd944f0002d29548059c24df
https://github.com/Fede112/pytorch-cifar/tree/2e89028e9aaabb22dd944f0002d29548059c24df
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, groups=2): super().__init__() self.groups = groups def forward(self, x): """Channel shuffle: [N,C,H,W] -> [N,g,C/g,H,W] -> [N,C/g,g,H,w] -> [N,C,H,W]""" N, C, H, W = x.size() g = self.groups...
SplitAttnConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel class RadixSoftmax(nn.Module): def __init__(self, radix, cardinality): super(RadixSoftmax, self).__init__() self.radix = radix self.cardinality = cardinality 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....
Fanzhongjie/ARFE
SplitAttnConv2d
false
453
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel class RadixSoftmax(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self, x): batch = x.size(0)...
CNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class CNN(nn.Module): def __init__(self, input_size=50, hidden_size=256, dropout=0, kernel_size=3, padding=1, activation_function=F.relu): """ Args: input_size: dimention of input embedding kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Fatead/NER
CNN
false
454
[ "MIT" ]
0
142fabb2fcb1b730042da7acfde10199c62537d5
https://github.com/Fatead/NER/tree/142fabb2fcb1b730042da7acfde10199c62537d5
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size=50, hidden_size=256, dropout=0, kernel_size=3, padding=1, activation_function=F.relu): """ Args: input_size: dimention of input embedding kernel...
BasicModel_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 from torch import Tensor import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2) self.conv2 = nn.C...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Europium248/captum
BasicModel_ConvNet
false
455
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch from torch import Tensor import torch.nn as nn from typing import no_type_check class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2) self.conv2 = nn.Conv2d(2, 4, 3...
SmoothL1Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel 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...
Fanzhongjie/ARFE
SmoothL1Loss
false
456
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import functools import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
BasicModel_ConvNet_MaxPool1d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Tensor import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet_MaxPool1d(nn.Module): """Same as above, but with the MaxPool2d replaced with a MaxPool1d. This is useful because the MaxPool modules behave differently to other modules from the perspectiv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Europium248/captum
BasicModel_ConvNet_MaxPool1d
false
457
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch from torch import Tensor import torch.nn as nn from typing import no_type_check class Model(nn.Module): """Same as above, but with the MaxPool2d replaced with a MaxPool1d. This is useful because the MaxPool modules behave differently to other modules from the perspective of the DeepLift A...
HardSwish
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def hard_swish(x, inplace: 'bool'=False): inner = F.relu6(x + 3.0).div_(6.0) return x.mul_(inner) if inplace else x.mul(inner) class HardSwish(nn.Module): def __init__(self, inplace: 'bool'=False): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel asser...
Fanzhongjie/ARFE
HardSwish
false
458
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def hard_swish(x, inplace: 'bool'=False): inner = F.relu6(x + 3.0).div_(6.0) return x.mul_(inner) if inplace else x.mul(inner) class Model(nn.Module): def __init__(self, inplace: 'bool'=False): supe...
CecaModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from torch.nn import functional as F import torch.nn.parallel class CecaModule(nn.Module): """Constructs a circular ECA module. ECA module where the conv uses circular padding rather than zero padding. Unlike the spatial dimension, the channels do not have i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn import torch.nn.parallel assert_size_stride = ...
Fanzhongjie/ARFE
CecaModule
false
459
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import math import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel class Model(nn.Module): """Constructs a circular ECA module. ECA module where the conv uses circular padding rather than zero padding. Unlike the spatial dimension, the channels do not have inhere...
EcaModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.parallel class EcaModule(nn.Module): """Constructs an ECA module. Args: channels: Number of channels of the input feature map for use in adaptive kernel sizes for actual calculations according to channel. gamma, be...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn import torch.nn.parallel assert_size_stride = ...
Fanzhongjie/ARFE
EcaModule
false
460
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import math import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """Constructs an ECA module. Args: channels: Number of channels of the input feature map for use in adaptive kernel sizes for actual calculations according to channel. gamma, beta: ...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Encoder(nn.Module): """ This class defines the encoder architecture """ def __init__(self, input_size, hidden_size, bottleneck): super().__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.mean = nn.Linear(hidden_size, bottlen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
FaisalAhmed0/variational-autoencoder
Encoder
false
461
[ "MIT" ]
0
a6c1c96da8063d822aef2e2bdd69d7cb1b35c2cd
https://github.com/FaisalAhmed0/variational-autoencoder/tree/a6c1c96da8063d822aef2e2bdd69d7cb1b35c2cd
import torch import torch.nn as nn class Model(nn.Module): """ This class defines the encoder architecture """ def __init__(self, input_size, hidden_size, bottleneck): super().__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.mean = nn.Linear(hidden_size, bottlenec...
Sigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel class Sigmoid(nn.Module): def __init__(self, inplace: 'bool'=False): super(Sigmoid, self).__init__() self.inplace = inplace def forward(self, x): return x.sigmoid_() if self.inplace else x.sigmoid() def get_inputs(): r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
Fanzhongjie/ARFE
Sigmoid
false
462
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): def __init__(self, inplace: 'bool'=False): super().__init__() self.inplace = inplace def forward(self, x): return x.sigmoid_() if self.inplace else x.sigmoid() def get_inputs(): return [torch.ra...
LocationLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data from torch import nn class LinearNorm(torch.nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super(LinearNorm, self).__init__() self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias) torch.nn.init.xavier_unifor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torch import nn assert_size_stride = torch._C._dyna...
FadyKhalaf/tacotron2
LocationLayer
false
463
[ "BSD-3-Clause" ]
0
d9bf28a6d286aab42bce46df9f26a9a3d7c2f01f
https://github.com/FadyKhalaf/tacotron2/tree/d9bf28a6d286aab42bce46df9f26a9a3d7c2f01f
import torch import torch.utils.data from torch import nn class LinearNorm(torch.nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super().__init__() self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias) torch.nn.init.xavier_uniform_(self.linear_l...
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 from torch.nn import functional as F import torch.nn.parallel 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 from torch.nn import functional as F import torch....
Fanzhongjie/ARFE
MSELoss
false
464
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import functools import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
Aggregator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Aggregator(nn.Module): def __init__(self, hidden_dim, num_node): super(Aggregator, self).__init__() self.W_q = nn.Linear(hidden_dim, hidden_dim) self.W_k = nn.Linear(hidden_dim, hidden_dim) self.fc = 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....
FANTASTPATR/STST
Aggregator
false
465
[ "Apache-2.0" ]
0
8f969fcfe31f9555b19e783fb14eecf72def4122
https://github.com/FANTASTPATR/STST/tree/8f969fcfe31f9555b19e783fb14eecf72def4122
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, hidden_dim, num_node): super().__init__() self.W_q = nn.Linear(hidden_dim, hidden_dim) self.W_k = nn.Linear(hidden_dim, hidden_dim) self.fc = nn.Linear(num_node, 1) d...
Conv2dSame
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from torch.nn import functional as F import torch.nn.parallel from typing import Tuple from typing import Optional from typing import List def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 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 import math import torch.nn as nn from torch.nn import functional as F import to...
Fanzhongjie/ARFE
Conv2dSame
false
466
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import math import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel from typing import Tuple from typing import Optional from typing import List def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 0) ...
h_swish
# 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 h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 class h_swish(nn.Module): def __init__(self, inplace=True)...
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...
Felicia980317/mytorch
h_swish
false
467
[ "Apache-2.0" ]
0
e463122c0d402878ec5b4c5a823a0feeba8fdbfe
https://github.com/Felicia980317/mytorch/tree/e463122c0d402878ec5b4c5a823a0feeba8fdbfe
import torch import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True): super().__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 class Model(nn.Module): def __init__(self, inplace=True): super()...
SigmoidDeepLiftModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SigmoidDeepLiftModel(nn.Module): """ Model architecture from: https://medium.com/coinmonks/create-a-neural-network-in -pytorch-and-make-your-life-simpler-ec5367895199 """ def __init__(self, num_in, num_hidden, num_out): 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 assert_...
Europium248/captum
SigmoidDeepLiftModel
false
468
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
import torch import torch.nn as nn class Model(nn.Module): """ Model architecture from: https://medium.com/coinmonks/create-a-neural-network-in -pytorch-and-make-your-life-simpler-ec5367895199 """ def __init__(self, num_in, num_hidden, num_out): super().__init__() ...
L1Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import functools import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel 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...
Fanzhongjie/ARFE
L1Loss
false
469
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import functools import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: ...
Scale1Minus1
# 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 Scale1Minus1(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): x = x / 254.0 * 2 - 1 return 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Filco306/WASP-GANs
Scale1Minus1
false
470
[ "Apache-2.0" ]
0
e50cf096a5e3eb26d33a3cbf164d728b9789e41b
https://github.com/Filco306/WASP-GANs/tree/e50cf096a5e3eb26d33a3cbf164d728b9789e41b
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): x = x / 254.0 * 2 - 1 return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RMSELoss
# 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 RMSELoss(nn.Module): def __init__(self): super(RMSELoss, self).__init__() def forward(self, x, y): criterion = nn.MSELoss() loss = torch.sqrt(criterion(x, y)) return loss def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
FizzerYu/CollaborativeVAE
RMSELoss
false
471
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x, y): criterion = nn.MSELoss() loss = torch.sqrt(criterion(x, y)) return loss def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]...
Rescale
# 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 Rescale(torch.nn.Module): def __init__(self, old_min, old_max, new_min, new_max): super(Rescale, self).__init__() self.old_min = old_min self.old_max = old_max self.new_min = new_min self.new_max = new_max def forward(self, x): x = (x - 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Filco306/WASP-GANs
Rescale
false
472
[ "Apache-2.0" ]
0
e50cf096a5e3eb26d33a3cbf164d728b9789e41b
https://github.com/Filco306/WASP-GANs/tree/e50cf096a5e3eb26d33a3cbf164d728b9789e41b
import torch class Model(torch.nn.Module): def __init__(self, old_min, old_max, new_min, new_max): super().__init__() self.old_min = old_min self.old_max = old_max self.new_min = new_min self.new_max = new_max def forward(self, x): x = (x - self.old_min) / (se...
LRN
# 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.optim import torch.nn as nn class LRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS=True ): super(LRN, self).__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if ACROSS_CHANNELS: self.average = nn.AvgPool3d...
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.optim import torch.nn as nn assert_size_stride = torch._C._dynamo....
Fyy10/UESTC-Thesis-DA
LRN
false
473
[ "MIT" ]
0
6cb16efd1f80aa569c90874a806a62dec8afaec4
https://github.com/Fyy10/UESTC-Thesis-DA/tree/6cb16efd1f80aa569c90874a806a62dec8afaec4
import torch import torch.optim import torch.nn as nn class Model(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS=True ): super().__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if ACROSS_CHANNELS: self.average = nn.AvgPool3d(kernel...
MMDLoss
# 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.optim import torch.nn as nn class MMDLoss(nn.Module): def __init__(self): """ Maximum Mean Discrepancy Loss """ super(MMDLoss, self).__init__() self.eps = 1e-08 def forward(self, f1: 'torch.Tensor', f2: 'torch.Tensor') ->torch.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.optim import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
Fyy10/UESTC-Thesis-DA
MMDLoss
false
474
[ "MIT" ]
0
6cb16efd1f80aa569c90874a806a62dec8afaec4
https://github.com/Fyy10/UESTC-Thesis-DA/tree/6cb16efd1f80aa569c90874a806a62dec8afaec4
import torch import torch.optim import torch.nn as nn class Model(nn.Module): def __init__(self): """ Maximum Mean Discrepancy Loss """ super().__init__() self.eps = 1e-08 def forward(self, f1: 'torch.Tensor', f2: 'torch.Tensor') ->torch.Tensor: loss = 0.0 ...
ConvWS2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-05): c_in = weight.size(0) weight_flat = weight.view(c_in, -1) mean = weight_flat.mean(dim=1, keepdim=True).view(c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Fanzhongjie/ARFE
ConvWS2d
false
475
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-05): c_in = weight.size(0) weight_flat = weight.view(c_in, -1) mean = weight_flat.mean(dim=1, keepdim=True).view(c...
selfVLoss
# 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 selfVLoss(nn.Module): def __init__(self, lambda_v, lambda_r): super(selfVLoss, self).__init__() self.lambda_v = lambda_v self.lambda_r = lambda_r def forward(self, v, z): return 1.0 * self.lambda_v / self.lambda_r * torch.mean(torch.su...
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...
FizzerYu/CollaborativeVAE
selfVLoss
false
476
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, lambda_v, lambda_r): super().__init__() self.lambda_v = lambda_v self.lambda_r = lambda_r def forward(self, v, z): return 1.0 * self.lambda_v / self.lambda_r * torch.mean(torch.sum( torc...
ConvLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.module = module self.n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn import Parameter assert_size_stride = torch....
GEN418/EventGAN
ConvLayer
false
477
[ "MIT" ]
0
372318bc8f285f513db4babf7786b5c04e97c86d
https://github.com/GEN418/EventGAN/tree/372318bc8f285f513db4babf7786b5c04e97c86d
import torch import torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super().__init__() self.module = module self.name = name ...
GeM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class GeM(nn.Module): def __init__(self, p=3, eps=1e-06, requires_grad: 'bool'=True): super().__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn.functional a...
Fkaneko/kaggle_g2net_gravitational_wave_detection-
GeM
false
478
[ "Apache-2.0" ]
0
8bb32cc675e6b56171da8a3754fffeda41e934bb
https://github.com/Fkaneko/kaggle_g2net_gravitational_wave_detection-/tree/8bb32cc675e6b56171da8a3754fffeda41e934bb
import torch import torch.nn.functional as F from torch import nn def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class Model(nn.Module): def __init__(self, p=3, eps=1e-06, requires_grad: 'bool'=True): super().__init__() ...
FakeReLUM
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class FakeReLU(torch.autograd.Function): @staticmethod def forward(ctx, input): return input.clamp(min=0) @staticmethod def backward(ctx, grad_output): return grad_output class FakeReLUM(nn.Module): def forward(self, x...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
GeoffNN/robustness
FakeReLUM
false
479
[ "MIT" ]
0
2cefabb5b0ceab62a77e0572f209144d7124cc9f
https://github.com/GeoffNN/robustness/tree/2cefabb5b0ceab62a77e0572f209144d7124cc9f
import torch import torch.nn as nn import torch.utils.data class FakeReLU(torch.autograd.Function): @staticmethod def forward(ctx, input): return input.clamp(min=0) @staticmethod def backward(ctx, grad_output): return grad_output class Model(nn.Module): def forward(self, x): ...
NetVLAD
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.utils.data import torch import torch.nn.functional as F from torch import nn class NetVLAD(nn.Module): """NetVLAD layer implementation""" def __init__(self, num_clusters=64, dim=128, normalize_input=True): """ Args: num_clusters : 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._inductor.runtime import triton_helpers from torch._inductor.runtime....
DanielPollithy/UncertainToDayGAN
NetVLAD
false
480
[ "BSD-2-Clause" ]
0
bd16fa1a34878dbdc765d548169b7058a56864ff
https://github.com/DanielPollithy/UncertainToDayGAN/tree/bd16fa1a34878dbdc765d548169b7058a56864ff
import torch import numpy as np import torch.utils.data import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): """NetVLAD layer implementation""" def __init__(self, num_clusters=64, dim=128, normalize_input=True): """ Args: num_clusters : int ...
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 class Encoder(nn.Module): def __init__(self, input_dim, hidden_dim, latent_dim): super(Encoder, self).__init__() self.FC_input = nn.Linear(input_dim, hidden_dim) self.FC_mean = nn.Linear(hidden_dim, latent_dim) self.FC_var = nn.Linear(hidden_dim, ...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
FrederikKromann/dtu_mlops
Encoder
false
481
[ "Apache-2.0" ]
0
b82e43e1a1b58f0ba208414092e4c0ea63c5d4ff
https://github.com/FrederikKromann/dtu_mlops/tree/b82e43e1a1b58f0ba208414092e4c0ea63c5d4ff
import torch from torch import nn class Model(nn.Module): def __init__(self, input_dim, hidden_dim, latent_dim): super().__init__() self.FC_input = nn.Linear(input_dim, hidden_dim) self.FC_mean = nn.Linear(hidden_dim, latent_dim) self.FC_var = nn.Linear(hidden_dim, latent_dim) ...
LinearTextualHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 typing import Optional class TextualHead(nn.Module): """ Base class for all textual heads. All child classes can simply inherit from :class:`~torch.nn.Module`, however this is kept here for uniform type annotations. Args: visual_feature_size: Size (n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
GeorgeBatch/arch-pre-training
LinearTextualHead
false
482
[ "MIT" ]
0
7ed75868689e9283d61d11360fdbf4e77d4ebd2e
https://github.com/GeorgeBatch/arch-pre-training/tree/7ed75868689e9283d61d11360fdbf4e77d4ebd2e
import torch from torch import nn from typing import Optional class TextualHead(nn.Module): """ Base class for all textual heads. All child classes can simply inherit from :class:`~torch.nn.Module`, however this is kept here for uniform type annotations. Args: visual_feature_size: Size (n...
LinearRegression
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 LinearRegression(nn.Module): def __init__(self, in_features: 'int', out_features: 'int', bias: 'bool'=True): super().__init__() self.weights = nn.Parameter(torch.randn(out_features, in_features)) self.bias = bias if bias: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
GaspardLeMarque/Competition-Models
LinearRegression
false
483
[ "MIT" ]
0
3bd0b75de369420ac3a3011659f1de5942a867e1
https://github.com/GaspardLeMarque/Competition-Models/tree/3bd0b75de369420ac3a3011659f1de5942a867e1
import torch from torch import nn class Model(nn.Module): def __init__(self, in_features: 'int', out_features: 'int', bias: 'bool'=True): super().__init__() self.weights = nn.Parameter(torch.randn(out_features, in_features)) self.bias = bias if bias: self.bias_...
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 torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.module = module self.n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from to...
GEN418/EventGAN
ResidualBlock
false
484
[ "MIT" ]
0
372318bc8f285f513db4babf7786b5c04e97c86d
https://github.com/GEN418/EventGAN/tree/372318bc8f285f513db4babf7786b5c04e97c86d
import torch import torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super().__init__() self.module = module self.name = name ...
MyNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MyNet(nn.Module): def __init__(self): super(MyNet, self).__init__() self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=8, kernel_size =5, stride=2, padding=0) self.conv2_1 = nn.Conv2d(8, 16, 3, 1, 0) self.conv2_2 = nn.Conv2d(1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DeepDuke/Face_Keypoints_Dectection
MyNet
false
485
[ "MIT" ]
0
9f09e1ad113734a9ba5d006d3f817a497db572aa
https://github.com/DeepDuke/Face_Keypoints_Dectection/tree/9f09e1ad113734a9ba5d006d3f817a497db572aa
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=8, kernel_size =5, stride=2, padding=0) self.conv2_1 = nn.Conv2d(8, 16, 3, 1, 0) self.conv2_2 = nn.Conv2d(16, 16, 3, 1...
CAM_Module
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch._utils class CAM_Module(nn.Module): """ Channel attention module""" def __init__(self, in_dim): super(CAM_Module, self).__init__() self.chanel_in = in_dim self.gamma = nn.Parameter(torch.zeros(1)) self.softmax = nn.Softmax(dim=-1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
GhadeerElmkaiel/Trans2Seg
CAM_Module
false
486
[ "Apache-2.0" ]
0
6717db602205cbed494ae1913ac7cbbca8e83463
https://github.com/GhadeerElmkaiel/Trans2Seg/tree/6717db602205cbed494ae1913ac7cbbca8e83463
import torch import torch.nn as nn import torch._utils class Model(nn.Module): """ Channel attention module""" def __init__(self, in_dim): super().__init__() self.chanel_in = in_dim self.gamma = nn.Parameter(torch.zeros(1)) self.softmax = nn.Softmax(dim=-1) def forward(se...
HistogramLayerUNET
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 HistogramLayerUNET(nn.Module): def __init__(self, in_channels, kernel_size, dim=2, num_bins=4, stride= None, padding=0, normalize_count=True, normalize_bins=True, count_include_pad=False, ceil_mode=False, skip_connection=False): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
GatorSense/Histological_Segmentation
HistogramLayerUNET
false
487
[ "MIT" ]
0
12849fff3d9d58c1fe419b18dba49294db375488
https://github.com/GatorSense/Histological_Segmentation/tree/12849fff3d9d58c1fe419b18dba49294db375488
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, kernel_size, dim=2, num_bins=4, stride= None, padding=0, normalize_count=True, normalize_bins=True, count_include_pad=False, ceil_mode=False, skip_connection=False): super().__ini...
selfCrossEntropy
# 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 selfCrossEntropy(nn.Module): def __init__(self): super(selfCrossEntropy, self).__init__() def forward(self, output, target): output = nn.functional.softmax(output, dim=0) return -torch.mean(torch.sum(target * torch.log(torch.clamp(output, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
FizzerYu/CollaborativeVAE
selfCrossEntropy
false
488
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, output, target): output = nn.functional.softmax(output, dim=0) return -torch.mean(torch.sum(target * torch.log(torch.clamp(output, min=1e-10)) + (1 - target...
ChannelPool
# 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 ChannelPool(nn.Module): def forward(self, x): return torch.mean(x, 1).unsqueeze(1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GhadeerElmkaiel/MirrorNet
ChannelPool
false
489
[ "BSD-3-Clause" ]
0
1a0389abc5b1ccbe7fde7bd1df772cb9df30c072
https://github.com/GhadeerElmkaiel/MirrorNet/tree/1a0389abc5b1ccbe7fde7bd1df772cb9df30c072
import torch from torch import nn class Model(nn.Module): def forward(self, x): return torch.mean(x, 1).unsqueeze(1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
run_latent
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 run_latent(nn.Module): def __init__(self, in_dim, hidden_dim): super(run_latent, self).__init__() self.fc_z_mean = nn.Linear(in_dim, hidden_dim) self.fc_z_log_sigma = nn.Linear(in_dim, hidden_dim) self.fc_gen = nn.Linear(hidden_dim, in_dim)...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
FizzerYu/CollaborativeVAE
run_latent
false
490
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_dim, hidden_dim): super().__init__() self.fc_z_mean = nn.Linear(in_dim, hidden_dim) self.fc_z_log_sigma = nn.Linear(in_dim, hidden_dim) self.fc_gen = nn.Linear(hidden_dim, in_dim) self.weights...
Attention_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 import torch._utils class Attention_Decoder(nn.Module): def __init__(self, dim, num_heads=1, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0): super().__init__() self.num_heads = num_heads head_dim = dim // num_heads self.scal...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
GhadeerElmkaiel/Trans2Seg
Attention_Decoder
false
491
[ "Apache-2.0" ]
0
6717db602205cbed494ae1913ac7cbbca8e83463
https://github.com/GhadeerElmkaiel/Trans2Seg/tree/6717db602205cbed494ae1913ac7cbbca8e83463
import torch import torch.nn as nn import torch._utils class Model(nn.Module): def __init__(self, dim, num_heads=1, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0): super().__init__() self.num_heads = num_heads head_dim = dim // num_heads self.scale = qk_scale...
ParsingRelationLoss
# 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.modules import torch.nn as nn class ParsingRelationLoss(nn.Module): def __init__(self): super(ParsingRelationLoss, self).__init__() def forward(self, logits): _n, _c, h, _w = logits.shape loss_all = [] for i in range(0, h - 1): loss_al...
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.modules import torch.nn as nn assert_size_stride = torch....
Glutamat42/Ultra-Fast-Lane-Detection
ParsingRelationLoss
false
492
[ "MIT" ]
0
175448f39574d64a7cc6fd35ec92e3c5539c9837
https://github.com/Glutamat42/Ultra-Fast-Lane-Detection/tree/175448f39574d64a7cc6fd35ec92e3c5539c9837
import torch import torch.nn.modules import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, logits): _n, _c, h, _w = logits.shape loss_all = [] for i in range(0, h - 1): loss_all.append(logits[:, :, i, :] - logits[:,...
selfLatentLoss
# 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 selfLatentLoss(nn.Module): def __init__(self): super(selfLatentLoss, self).__init__() def forward(self, z_mean, z_log_sigma_sq): return torch.mean(torch.sum(torch.pow(z_mean, 2) + torch.exp( z_log_sigma_sq) - z_log_sigma_sq - 1, 1)) 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.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
FizzerYu/CollaborativeVAE
selfLatentLoss
false
493
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, z_mean, z_log_sigma_sq): return torch.mean(torch.sum(torch.pow(z_mean, 2) + torch.exp( z_log_sigma_sq) - z_log_sigma_sq - 1, 1)) def get_inputs(): return [tor...
OneLayerFCBodyWithAction
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class OneLayerFCBodyWithAction(nn.Module): def __init__(self, state_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Fieps1/p3-tennis
OneLayerFCBodyWithAction
false
494
[ "MIT" ]
0
29f3dab5810d7cd7f84120416a615956d266c256
https://github.com/Fieps1/p3-tennis/tree/29f3dab5810d7cd7f84120416a615956d266c256
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class Model(nn.Module): def __init__(self, state_dim, action_dim, hidd...
GRUCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn.functional as F import torch.utils.data import torch.nn as nn class GRUCell(nn.Module): def __init__(self, input_size, hidden_size, bias=True): super(GRUCell, self).__init__() self.input_size = input_size self.hidden_size = hidden_size ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
GregoryLand/PyGrid
GRUCell
false
495
[ "Apache-2.0" ]
0
00271f73db825eaf378095ea5c4363d4a04d38a6
https://github.com/GregoryLand/PyGrid/tree/00271f73db825eaf378095ea5c4363d4a04d38a6
import torch import numpy as np import torch.nn.functional as F import torch.utils.data import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, hidden_size, bias=True): super().__init__() self.input_size = input_size self.hidden_size = hidden_size self.bias = ...
VarifocalLoss
# 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 def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Guoning-Chen/mmdetection
VarifocalLoss
false
496
[ "Apache-2.0" ]
0
f1d1c5a19dbe6aa2e74fc9ca2e9578db4532fc64
https://github.com/Guoning-Chen/mmdetection/tree/f1d1c5a19dbe6aa2e74fc9ca2e9578db4532fc64
import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
CrossEntropy
# 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 torch.nn import functional as F class CrossEntropy(nn.Module): def __init__(self, ignore_label=-1, weight=None): super(CrossEntropy, self).__init__() self.ignore_label = ignore_label self.criterion = nn.CrossEntropyLoss(weight=weight, ignore_index= ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
Gummary/Pytorch-Project-Template
CrossEntropy
false
497
[ "MIT" ]
0
56bc5e253627d40fb8771eccdb2bb663c833beb3
https://github.com/Gummary/Pytorch-Project-Template/tree/56bc5e253627d40fb8771eccdb2bb663c833beb3
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, ignore_label=-1, weight=None): super().__init__() self.ignore_label = ignore_label self.criterion = nn.CrossEntropyLoss(weight=weight, ignore_index= ignore_label) ...
FeatureSelect
# 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.optim import torch.nn as nn class FeatureSelect(nn.Module): def __init__(self, in_dim=84, ratio=0.5): """ Feature Select via Sorting Args: in_dim: the number of dimensions of raw features ratio: the portion of selected features ""...
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.optim import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.ass...
Fyy10/UESTC-Thesis-DA
FeatureSelect
false
498
[ "MIT" ]
0
6cb16efd1f80aa569c90874a806a62dec8afaec4
https://github.com/Fyy10/UESTC-Thesis-DA/tree/6cb16efd1f80aa569c90874a806a62dec8afaec4
import torch import torch.optim import torch.nn as nn class Model(nn.Module): def __init__(self, in_dim=84, ratio=0.5): """ Feature Select via Sorting Args: in_dim: the number of dimensions of raw features ratio: the portion of selected features """ ...
GeM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.parameter import Parameter class GeM(nn.Module): def __init__(self, p=3, eps=1e-06): """ Args: p : int Number of the pooling parameter eps : float lower-bound o...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from t...
GiaVit97/project_vg
GeM
false
499
[ "MIT" ]
0
410de0861f479a86e9c4611bd4f0e270566bcd49
https://github.com/GiaVit97/project_vg/tree/410de0861f479a86e9c4611bd4f0e270566bcd49
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, p=3, eps=1e-06): """ Args: p : int Number of the pooling parameter eps : float lower-bound...
L2Norm
# 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 class L2Norm(Module): def forward(self, input): return F.normalize(input) 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._inductor.runtime.triton_helpers import libdevice from torch.nn import Module ...
HAOCHENYE/Silent-Face-Anti-Spoofing-master-yehc
L2Norm
false
500
[ "Apache-2.0" ]
0
014c781d4109733f87a50b10d10508ba5e431581
https://github.com/HAOCHENYE/Silent-Face-Anti-Spoofing-master-yehc/tree/014c781d4109733f87a50b10d10508ba5e431581
from torch.nn import Module import torch import torch.nn.functional as F class Model(Module): def forward(self, input): return F.normalize(input) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
SIG_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 class SIG_LOSS(nn.Module): def __init__(self, device): super(SIG_LOSS, self).__init__() self.m_device = device self.m_criterion = nn.BCEWithLogitsLoss(reduction='mean') def forward(self, preds, targets): loss = self.m_criterion(preds, targets...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
HCDM/XRec
SIG_LOSS
false
501
[ "MIT" ]
0
dae7d3e1237b8e41913656eb33d81e78c61424ea
https://github.com/HCDM/XRec/tree/dae7d3e1237b8e41913656eb33d81e78c61424ea
import torch from torch import nn class Model(nn.Module): def __init__(self, device): super().__init__() self.m_device = device self.m_criterion = nn.BCEWithLogitsLoss(reduction='mean') def forward(self, preds, targets): loss = self.m_criterion(preds, targets) return ...
SigmoidFocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data.distributed import torch import torch.nn as nn from numpy import int64 as int64 import torch.utils class SigmoidFocalLoss(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super(SigmoidFocalLoss, self).__init__() self.ignor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
HRTNet/HRTNet
SigmoidFocalLoss
false
502
[ "MIT" ]
0
6a51c9c34568988ea6125a1638794c63d8fadbea
https://github.com/HRTNet/HRTNet/tree/6a51c9c34568988ea6125a1638794c63d8fadbea
import torch import torch.utils.data.distributed import torch import torch.nn as nn from numpy import int64 as int64 import torch.utils class Model(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super().__init__() self.ignore_label = ignore_label se...
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 def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
Guoning-Chen/mmdetection
GaussianFocalLoss
false
503
[ "Apache-2.0" ]
0
f1d1c5a19dbe6aa2e74fc9ca2e9578db4532fc64
https://github.com/Guoning-Chen/mmdetection/tree/f1d1c5a19dbe6aa2e74fc9ca2e9578db4532fc64
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
InnerProductDecoder
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.fx import torch.utils.data class InnerProductDecoder(torch.nn.Module): """The inner product decoder from the `"Variational Graph Auto-Encoders" <https://arxiv.org/abs/1611.07308>`_ paper .. math:: \\sigma(\\mathbf{Z}\\mathbf{Z}^{\\top}) where :math:`\\mathbf{Z} \\in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.fx import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
HWSelf/pytorch_geometric
InnerProductDecoder
false
504
[ "MIT" ]
0
c1214de674079b5e39e57c045d0f844b60caf590
https://github.com/HWSelf/pytorch_geometric/tree/c1214de674079b5e39e57c045d0f844b60caf590
import torch import torch.fx import torch.utils.data class Model(torch.nn.Module): """The inner product decoder from the `"Variational Graph Auto-Encoders" <https://arxiv.org/abs/1611.07308>`_ paper .. math:: \\sigma(\\mathbf{Z}\\mathbf{Z}^{\\top}) where :math:`\\mathbf{Z} \\in \\mathbb{R}^{...
SeparableConv2d_same
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 def fixed_padding(inputs, kernel_size, rate): kernel_size_effective = kernel_size + (kernel_size - 1) * (rate - 1) pad_total = kernel_size_effective - 1 pad_beg = pad_total // 2 pad_end = pad_total - pad_beg padded_inputs = F.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 import nn from torch.nn import functional as F assert_size_stride = t...
Gummary/Pytorch-Project-Template
SeparableConv2d_same
false
505
[ "MIT" ]
0
56bc5e253627d40fb8771eccdb2bb663c833beb3
https://github.com/Gummary/Pytorch-Project-Template/tree/56bc5e253627d40fb8771eccdb2bb663c833beb3
import torch from torch import nn from torch.nn import functional as F def fixed_padding(inputs, kernel_size, rate): kernel_size_effective = kernel_size + (kernel_size - 1) * (rate - 1) pad_total = kernel_size_effective - 1 pad_beg = pad_total // 2 pad_end = pad_total - pad_beg padded_inputs = F.p...
perceptron
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 perceptron(nn.Module): def __init__(self, n_channels): super(perceptron, self).__init__() self.L = nn.Linear(n_channels, 10) def forward(self, x): x = self.L(x) x = F.softmax(x, dim=1) return 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....
GuilhermeSenna/Testes-TCC
perceptron
false
506
[ "MIT" ]
0
ed38baf864d8993685427affa1f009e6cf7c5dcb
https://github.com/GuilhermeSenna/Testes-TCC/tree/ed38baf864d8993685427affa1f009e6cf7c5dcb
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n_channels): super().__init__() self.L = nn.Linear(n_channels, 10) def forward(self, x): x = self.L(x) x = F.softmax(x, dim=1) return x def get_inputs(): ...
Invertible1x1Conv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch.autograd import Variable import torch.utils.data import torch.nn class Invertible1x1Conv(torch.nn.Module): """ The layer outputs both the convolution, and the log determinant of its weight matrix. If reverse=True it does convolution with inverse...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn.functional as F from torch.autograd import Variable import torch...
GreyZzzzzzXh/TensorRT
Invertible1x1Conv
false
507
[ "Apache-2.0" ]
0
ba5b1b4f1ade5896c7fae206e43570a2712498d4
https://github.com/GreyZzzzzzXh/TensorRT/tree/ba5b1b4f1ade5896c7fae206e43570a2712498d4
import torch import torch.nn.functional as F from torch.autograd import Variable import torch.utils.data import torch.nn class Model(torch.nn.Module): """ The layer outputs both the convolution, and the log determinant of its weight matrix. If reverse=True it does convolution with inverse """ ...
IdentityMessage
# 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.fx import torch.utils.data class IdentityMessage(torch.nn.Module): def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'): super(IdentityMessage, self).__init__() self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim def forward(self, z_src...
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.fx import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
HWSelf/pytorch_geometric
IdentityMessage
false
508
[ "MIT" ]
0
c1214de674079b5e39e57c045d0f844b60caf590
https://github.com/HWSelf/pytorch_geometric/tree/c1214de674079b5e39e57c045d0f844b60caf590
import torch import torch.fx import torch.utils.data class Model(torch.nn.Module): def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'): super().__init__() self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim def forward(self, z_src, z_dst, raw_msg, t_enc): ...
wide_basic
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def get_norm(n_filters, norm): if norm is None: return Identity() elif norm == 'batch': return nn.BatchNorm2d(n_filters, momentum=0.9) elif norm == 'instance': return nn.InstanceNorm2d(n_filters, affine=True) elif norm == 'layer': retu...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
FloralZhao/unlimited_labeled_data_project_strong_augmen
wide_basic
false
509
[ "MIT" ]
0
caf90d70145e5d841a38b2e2f18a710703264a28
https://github.com/FloralZhao/unlimited_labeled_data_project_strong_augmen/tree/caf90d70145e5d841a38b2e2f18a710703264a28
import torch import torch.nn as nn def get_norm(n_filters, norm): if norm is None: return Identity() elif norm == 'batch': return nn.BatchNorm2d(n_filters, momentum=0.9) elif norm == 'instance': return nn.InstanceNorm2d(n_filters, affine=True) elif norm == 'layer': retu...
DeConvNet2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 spectral_norm(module, init=True, std=1, bound=False): if init: nn.init.normal_(module.weight, 0, std) if hasattr(module, 'bias') and module.bias is not None: module.bias.data.zero_() SpectralNorm.apply(module, 'weight',...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
GloryyrolG/normalized-autoencoders
DeConvNet2
false
510
[ "MIT" ]
0
27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
https://github.com/GloryyrolG/normalized-autoencoders/tree/27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
import torch import torch.nn as nn import torch.nn.functional as F def spectral_norm(module, init=True, std=1, bound=False): if init: nn.init.normal_(module.weight, 0, std) if hasattr(module, 'bias') and module.bias is not None: module.bias.data.zero_() SpectralNorm.apply(module, 'weight',...
KMomentLoss
# 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.optim import torch.nn as nn class KMomentLoss(nn.Module): def __init__(self, k: 'int'=4): """ k moment distance, where `k` represents the highest order of moment. """ super(KMomentLoss, self).__init__() self.eps = 1e-08 self.k = k 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.triton_helpers import libdevice import torch.optim import torch.nn as nn assert_size_stride = torch._C._dynamo....
Fyy10/UESTC-Thesis-DA
KMomentLoss
false
511
[ "MIT" ]
0
6cb16efd1f80aa569c90874a806a62dec8afaec4
https://github.com/Fyy10/UESTC-Thesis-DA/tree/6cb16efd1f80aa569c90874a806a62dec8afaec4
import torch import torch.optim import torch.nn as nn class Model(nn.Module): def __init__(self, k: 'int'=4): """ k moment distance, where `k` represents the highest order of moment. """ super().__init__() self.eps = 1e-08 self.k = k def euclidean_dist(self, d...
DDPGConvBody
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class DDPGConvBody(nn.Module): def __init__(self, in_channels=4): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Fieps1/p3-tennis
DDPGConvBody
false
512
[ "MIT" ]
0
29f3dab5810d7cd7f84120416a615956d266c256
https://github.com/Fieps1/p3-tennis/tree/29f3dab5810d7cd7f84120416a615956d266c256
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class Model(nn.Module): def __init__(self, in_channels=4): sup...
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...
Halo1236/Dive-into-DL-PyTorch
CenteredLayer
false
513
[ "Apache-2.0" ]
0
586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
https://github.com/Halo1236/Dive-into-DL-PyTorch/tree/586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
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 []
DenseBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2): super().__init__() self.padding = dilation self.causal_conv = nn.Conv1d(in_channels, out_channels, kernel_size, padding=self.padding, dil...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
Hao-Kailong/DisFeb
DenseBlock
false
514
[ "MIT" ]
0
2877edd587556e127d6648ee211ed22838c8d015
https://github.com/Hao-Kailong/DisFeb/tree/2877edd587556e127d6648ee211ed22838c8d015
import torch import torch.nn as nn class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2): super().__init__() self.padding = dilation self.causal_conv = nn.Conv1d(in_channels, out_channels, kernel_size, padding=self.padding, dil...
WordAVGModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 WordAVGModel(nn.Module): def __init__(self, vocab_size, embedding_dim, output_dim, dropout=0.5): super().__init__() self.embedding = nn.Embedding(vocab_size, embedding_dim) self.fc1 = nn.Linear(embedding_dim, int((em...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
HanielF/siRNA-Predict-and-RSC-Test-System
WordAVGModel
false
515
[ "Apache-2.0" ]
0
59c41558e0c579ee03168ee860490770ecb0a7a3
https://github.com/HanielF/siRNA-Predict-and-RSC-Test-System/tree/59c41558e0c579ee03168ee860490770ecb0a7a3
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, vocab_size, embedding_dim, output_dim, dropout=0.5): super().__init__() self.embedding = nn.Embedding(vocab_size, embedding_dim) self.fc1 = nn.Linear(embedding_dim, int((embedding...
Attention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn.functional as F import torch.fx import torch.utils.data def restricted_softmax(src, dim: 'int'=-1, margin: 'float'=0.0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0.0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (mar...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
HWSelf/pytorch_geometric
Attention
false
516
[ "MIT" ]
0
c1214de674079b5e39e57c045d0f844b60caf590
https://github.com/HWSelf/pytorch_geometric/tree/c1214de674079b5e39e57c045d0f844b60caf590
import math import torch import torch.nn.functional as F import torch.fx import torch.utils.data def restricted_softmax(src, dim: 'int'=-1, margin: 'float'=0.0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0.0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (mar...
PreNormTransformerDecoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PreNormTransformerDecoderLayer(nn.TransformerDecoderLayer): """ A variant of :class:`torch.nn.TransformerDecoderLayer` where layer normalization is included inside the residual branch, and performed before self-attention and feedforward layers. Refer docume...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
GeorgeBatch/arch-pre-training
PreNormTransformerDecoderLayer
false
517
[ "MIT" ]
0
7ed75868689e9283d61d11360fdbf4e77d4ebd2e
https://github.com/GeorgeBatch/arch-pre-training/tree/7ed75868689e9283d61d11360fdbf4e77d4ebd2e
import torch from torch import nn class Model(nn.TransformerDecoderLayer): """ A variant of :class:`torch.nn.TransformerDecoderLayer` where layer normalization is included inside the residual branch, and performed before self-attention and feedforward layers. Refer documentation of :class:`torch....