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
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.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) + (margin - src_max).e...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
THinnerichs/pytorch_geometric
Attention
false
11,915
[ "MIT" ]
0
90c2126895b21313a23657f4e845acc782d11bf5
https://github.com/THinnerichs/pytorch_geometric/tree/90c2126895b21313a23657f4e845acc782d11bf5
import math import torch import torch.nn.functional as F 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) + (margin - src_max).e...
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...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def keep_variance_fn(x): return x + 0.001 class Linear(nn.Module): def __init__(self, in_features, out_features, bias=True, keep_variance_fn=None): super(Linear, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.parameter import Parameter assert_size_strid...
THAKAORI/SalsaNext
Linear
false
11,916
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def keep_variance_fn(x): return x + 0.001 class Model(nn.Module): def __init__(self, in_features, out_features, bias=True, keep_variance_fn=None): super().__init__() self._kee...
LeakyReLU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0)))...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
THAKAORI/SalsaNext
LeakyReLU
false
11,917
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
import torch import numpy as np import torch.nn as nn from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0)))...
ResizeModule
# 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 ResizeModule(torch.nn.Module): def __init__(self): super(ResizeModule, self).__init__() def forward(self, x): return torch.nn.functional.interpolate(x, size=(3, 4)) 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...
MichaelZhero/nncase
ResizeModule
false
11,918
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.nn.functional.interpolate(x, size=(3, 4)) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
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 numpy as np import torch.nn as nn from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0)))...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import numpy as np import torch.nn as nn from numbers import N...
THAKAORI/SalsaNext
ReLU
false
11,919
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
import torch import numpy as np import torch.nn as nn from numbers import Number def keep_variance_fn(x): return x + 0.001 def normcdf(value, mu=0.0, stddev=1.0): sinv = 1.0 / stddev if isinstance(stddev, Number) else stddev.reciprocal() return 0.5 * (1.0 + torch.erf((value - mu) * sinv / np.sqrt(2.0)))...
AvgPool2d
# 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 def keep_variance_fn(x): return x + 0.001 class AvgPool2d(nn.Module): def __init__(self, keep_variance_fn=None, kernel_size=2): super(AvgPool2d, self).__init__() self._keep_variance_fn = keep_variance_fn self.kernel_...
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...
THAKAORI/SalsaNext
AvgPool2d
false
11,920
[ "MIT" ]
0
855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
https://github.com/THAKAORI/SalsaNext/tree/855cd7e9ebb83ee62538ba4753a011ada7bbfb6c
import torch import torch.nn as nn import torch.nn.functional as F def keep_variance_fn(x): return x + 0.001 class Model(nn.Module): def __init__(self, keep_variance_fn=None, kernel_size=2): super().__init__() self._keep_variance_fn = keep_variance_fn self.kernel_size = kernel_size ...
Bias
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Bias(nn.Module): def __init__(self): super(Bias, self).__init__() self.bias = nn.Parameter(torch.zeros(1)) def forward(self, feat_img, feat_sound): B, C, H, W = feat_sound.size() feat_img = feat_img.view(B, 1, C) z = torch.bmm(...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
TaoStarlit/Sound-of-Pixels
Bias
false
11,921
[ "MIT" ]
0
06cd37a75836e22208f2e59bcc263b89938e065e
https://github.com/TaoStarlit/Sound-of-Pixels/tree/06cd37a75836e22208f2e59bcc263b89938e065e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.bias = nn.Parameter(torch.zeros(1)) def forward(self, feat_img, feat_sound): B, C, H, W = feat_sound.size() feat_img = feat_img.view(B, 1, C) z = torch.bmm(feat_img,...
CAModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CAModule(nn.Module): """ Re-implementation of Squeeze-and-Excitation (SE) block described in: *Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507* code reference: https://github.com/kobiso/CBAM-keras/blob/master/models/attention_module.py """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Tarandro/Chexpert
CAModule
false
11,922
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
import torch from torch import nn class Model(nn.Module): """ Re-implementation of Squeeze-and-Excitation (SE) block described in: *Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507* code reference: https://github.com/kobiso/CBAM-keras/blob/master/models/attention_module.py """ ...
InnerProd
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 InnerProd(nn.Module): def __init__(self, fc_dim): super(InnerProd, self).__init__() self.scale = nn.Parameter(torch.ones(fc_dim)) self.bias = nn.Parameter(torch.zeros(1)) def forward(self, feat_img, feat_sound): sound_size = feat_sound...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
TaoStarlit/Sound-of-Pixels
InnerProd
false
11,923
[ "MIT" ]
0
06cd37a75836e22208f2e59bcc263b89938e065e
https://github.com/TaoStarlit/Sound-of-Pixels/tree/06cd37a75836e22208f2e59bcc263b89938e065e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, fc_dim): super().__init__() self.scale = nn.Parameter(torch.ones(fc_dim)) self.bias = nn.Parameter(torch.zeros(1)) def forward(self, feat_img, feat_sound): sound_size = feat_sound.size() B, ...
LinearPool
# 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 LinearPool(nn.Module): def __init__(self): super(LinearPool, self).__init__() def forward(self, feat_map): """ Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) return(Tensor): tensor with shape (N, C, 1, 1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Tarandro/Chexpert
LinearPool
false
11,924
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, feat_map): """ Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) return(Tensor): tensor with shape (N, C, 1, 1) """ EPS...
PcamPool
# 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 PcamPool(nn.Module): def __init__(self): super(PcamPool, self).__init__() def forward(self, feat_map, logit_map): assert logit_map is not None prob_map = torch.sigmoid(logit_map) weight_map = prob_map / prob_map.sum(dim=2, keepdim=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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Tarandro/Chexpert
PcamPool
false
11,925
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, feat_map, logit_map): assert logit_map is not None prob_map = torch.sigmoid(logit_map) weight_map = prob_map / prob_map.sum(dim=2, keepdim=True).sum(dim=3, ...
MaxMarginCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class MaxMarginCriterion(nn.Module): def __init__(self, visual_rank_weight, lang_rank_weight, margin): super(MaxMarginCriterion, self).__init__() self.visual_rank = visual_rank_weight > 0 self.lang_rank = lang_rank_weight > 0 self.visual_rank_wei...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
TheShadow29/MAttNet
MaxMarginCriterion
false
11,926
[ "MIT" ]
0
2fe44667bc9254daef8be77bb4c896f10c2f665b
https://github.com/TheShadow29/MAttNet/tree/2fe44667bc9254daef8be77bb4c896f10c2f665b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, visual_rank_weight, lang_rank_weight, margin): super().__init__() self.visual_rank = visual_rank_weight > 0 self.lang_rank = lang_rank_weight > 0 self.visual_rank_weight = visual_rank_weight self...
LogSumExpPool
# 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 LogSumExpPool(nn.Module): def __init__(self, gamma): super(LogSumExpPool, self).__init__() self.gamma = gamma def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Te...
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...
Tarandro/Chexpert
LogSumExpPool
false
11,927
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
import torch from torch import nn class Model(nn.Module): def __init__(self, gamma): super().__init__() self.gamma = gamma def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Tensor): tensor with shape (N...
LogModule
# 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 LogModule(torch.nn.Module): def __init__(self): super(LogModule, self).__init__() def forward(self, x): return torch.log(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 math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
MichaelZhero/nncase
LogModule
false
11,928
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.log(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
AbsModule
# 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 AbsModule(torch.nn.Module): def __init__(self): super(AbsModule, self).__init__() def forward(self, x): return torch.abs(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 math as tl_math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
MichaelZhero/nncase
AbsModule
false
11,929
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.abs(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
CeilModule
# 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 CeilModule(torch.nn.Module): def __init__(self): super(CeilModule, self).__init__() def forward(self, x): return torch.ceil(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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
MichaelZhero/nncase
CeilModule
false
11,930
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.ceil(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
ExpPool
# 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 ExpPool(nn.Module): def __init__(self): super(ExpPool, self).__init__() def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) ...
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...
Tarandro/Chexpert
ExpPool
false
11,931
[ "Apache-2.0" ]
0
6bc51f899a479f8dbad8a64c92f35ed4632377b3
https://github.com/Tarandro/Chexpert/tree/6bc51f899a479f8dbad8a64c92f35ed4632377b3
import torch from torch import nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, feat_map): """ Numerically stable implementation of the operation Arguments: feat_map(Tensor): tensor with shape (N, C, H, W) return(Tens...
ReduceMinModule
# 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 ReduceMinModule(torch.nn.Module): def __init__(self): super(ReduceMinModule, self).__init__() def forward(self, x): return torch.min(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 import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
MichaelZhero/nncase
ReduceMinModule
false
11,932
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.min(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
ReduceMaxModule
# 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 ReduceMaxModule(torch.nn.Module): def __init__(self): super(ReduceMaxModule, self).__init__() def forward(self, x): return torch.max(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 import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
MichaelZhero/nncase
ReduceMaxModule
false
11,933
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.max(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
FloorModule
# 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 FloorModule(torch.nn.Module): def __init__(self): super(FloorModule, self).__init__() def forward(self, x): return torch.floor(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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
MichaelZhero/nncase
FloorModule
false
11,934
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.floor(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
ReduceSumModule
# 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 ReduceSumModule(torch.nn.Module): def __init__(self): super(ReduceSumModule, self).__init__() def forward(self, x): return torch.sum(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 import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
MichaelZhero/nncase
ReduceSumModule
false
11,935
[ "Apache-2.0" ]
0
0fae6ce90d7adff386e1a286cd2b42422f4b850a
https://github.com/MichaelZhero/nncase/tree/0fae6ce90d7adff386e1a286cd2b42422f4b850a
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.sum(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
GuidedBackpropReLUasModule
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.autograd import Function import torch import torch.cuda class GuidedBackpropReLU(Function): @staticmethod def forward(self, input_img): positive_mask = (input_img > 0).type_as(input_img) output = torch.addcmul(torch.zeros(input_img.size()).type_as( input_img), input_img...
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.autograd import Function import torch.cuda assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = t...
TigerKinger/pytorch-grad-cam
GuidedBackpropReLUasModule
false
11,936
[ "MIT" ]
0
adb3c56e274fde782bf84d2a77454046bd4c5be4
https://github.com/TigerKinger/pytorch-grad-cam/tree/adb3c56e274fde782bf84d2a77454046bd4c5be4
from torch.autograd import Function import torch import torch.cuda class GuidedBackpropReLU(Function): @staticmethod def forward(self, input_img): positive_mask = (input_img > 0).type_as(input_img) output = torch.addcmul(torch.zeros(input_img.size()).type_as( input_img), input_img...
DivideMax
# 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 DivideMax(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): maxes = x.amax(dim=self.dim, keepdim=True).detach() return x / maxes def get_inputs(): return [torch.rand([4, 4, 4, 4, 4])] d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Tiamat-Tech/DALLE-pytorch
DivideMax
false
11,937
[ "MIT" ]
0
d7bd745b23424e5a47c0db7e7ab093542427b22d
https://github.com/Tiamat-Tech/DALLE-pytorch/tree/d7bd745b23424e5a47c0db7e7ab093542427b22d
import torch from torch import nn class Model(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): maxes = x.amax(dim=self.dim, keepdim=True).detach() return x / maxes def get_inputs(): return [torch.rand([4, 4, 4, 4, 4])] def g...
UNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class down(nn.Module): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU This is used in the UNet Class to create a UNet like NN architecture. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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.functional as...
Remosy/v2e
UNet
false
11,938
[ "MIT" ]
0
efc81cbcc113ca55d1631603323150be5ef8eb30
https://github.com/Remosy/v2e/tree/efc81cbcc113ca55d1631603323150be5ef8eb30
import torch import torch.nn.functional as F import torch.nn as nn class down(nn.Module): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution + Leaky ReLU This is used in the UNet Class to create a UNet like NN architecture. ...
Fusion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Fusion(nn.Module): """ Crazy multi-modal fusion: negative squared difference minus relu'd sum """ def __init__(self): super().__init__() def forward(self, x, y): return -(x - y) ** 2 + F....
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...
TranTony/DFAF-for-VQA.pytorch
Fusion
false
11,939
[ "MIT" ]
0
eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
https://github.com/TranTony/DFAF-for-VQA.pytorch/tree/eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): """ Crazy multi-modal fusion: negative squared difference minus relu'd sum """ def __init__(self): super().__init__() def forward(self, x, y): return -(x - y) ** 2 + F.r...
Network
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Network(nn.Module): def __init__(self, inS, outS): super().__init__() self.input_size = inS self.fc1 = nn.Linear(in_features=inS, out_features=120) self.fc2 = nn.Linear(in_features=120, out_features=60) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Thytu/MLOPS
Network
false
11,940
[ "MIT" ]
0
08e07e8fbe7621da1407276f68dff2dbcc2d8097
https://github.com/Thytu/MLOPS/tree/08e07e8fbe7621da1407276f68dff2dbcc2d8097
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, inS, outS): super().__init__() self.input_size = inS self.fc1 = nn.Linear(in_features=inS, out_features=120) self.fc2 = nn.Linear(in_features=120, out_features=60) ...
BertAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch from torch import nn import torch.utils.data class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super(BertLayerNorm,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Stephen0808/WebQA
BertAttention
false
11,941
[ "Apache-2.0" ]
0
b9758932a9d0d75167ec837bb6ee8bc571c64681
https://github.com/Stephen0808/WebQA/tree/b9758932a9d0d75167ec837bb6ee8bc571c64681
from _paritybench_helpers import _mock_config import math import torch from torch import nn import torch.utils.data class BertLayerNorm(nn.Module): def __init__(self, hidden_size, eps=1e-05): """Construct a layernorm module in the TF style (epsilon inside the square root).""" super().__init__() ...
RNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 RNN(nn.Module): def __init__(self, intput_size, hidden_size, output_size): super().__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(intput_size + hidden_size, hidden_size) self.i2o = nn.Linear(intput_size + hidden_size, output...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Thytu/earthquakePrediction
RNN
false
11,942
[ "MIT" ]
0
95777022e492bd21aa2107c2b5af7a80b38abc2f
https://github.com/Thytu/earthquakePrediction/tree/95777022e492bd21aa2107c2b5af7a80b38abc2f
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, intput_size, hidden_size, output_size): super().__init__() self.hidden_size = hidden_size self.i2h = nn.Linear(intput_size + hidden_size, hidden_size) self.i2o = nn.Linear(intput_size + hidden_size, outp...
GAT
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super(GraphAttentionLayer, self).__init__(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
StellaAthena/Graph-Universal-Attack
GAT
false
11,943
[ "MIT" ]
0
38c85d54df0aca22a06731a8dff8bcf2f5bc8004
https://github.com/StellaAthena/Graph-Universal-Attack/tree/38c85d54df0aca22a06731a8dff8bcf2f5bc8004
import torch import torch.nn.functional as F import torch.nn as nn class GraphAttentionLayer(nn.Module): """ Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 """ def __init__(self, in_features, out_features, dropout, alpha, concat=True): super().__init__() self.dropout = ...
TorchDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn def soft_dice_loss(outputs, targets, per_image=False): batch_size = outputs.size()[0] eps = 1e-05 if not per_image: batch_size = 1 dice_target = targets.contiguous().view(batch_size, -1).float() dice_output = outputs.contiguous().view(batch_size, -1) i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
Spiruel/solaris
TorchDiceLoss
false
11,944
[ "Apache-2.0" ]
0
eb2ce05265a462d69b01ee2b621a85a3e9082402
https://github.com/Spiruel/solaris/tree/eb2ce05265a462d69b01ee2b621a85a3e9082402
import torch from torch import nn def soft_dice_loss(outputs, targets, per_image=False): batch_size = outputs.size()[0] eps = 1e-05 if not per_image: batch_size = 1 dice_target = targets.contiguous().view(batch_size, -1).float() dice_output = outputs.contiguous().view(batch_size, -1) i...
LinearFBSP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from typing import Tuple import torch.nn.functional as F from typing import cast def scale(old_value, old_min, old_max, new_min, new_max): old_range = old_max - old_min new_range = new_max - new_min new_value = (old_value - old_min) * new_range / old_range + new_min ret...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Taekyoon/executors
LinearFBSP
false
11,945
[ "Apache-2.0" ]
0
567f12c4193bb7be814f84540ea31585cd35b344
https://github.com/Taekyoon/executors/tree/567f12c4193bb7be814f84540ea31585cd35b344
import torch import numpy as np from typing import Tuple import torch.nn.functional as F from typing import cast def scale(old_value, old_min, old_max, new_min, new_max): old_range = old_max - old_min new_range = new_max - new_min new_value = (old_value - old_min) * new_range / old_range + new_min ret...
LqLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn def lq_loss(y_pred, y_true, q): eps = 1e-07 loss = y_pred * y_true loss = (1 - (loss + eps) ** q) / q return loss.mean() class LqLoss(nn.Module): def __init__(self, q=0.5): super().__init__() self.q = q def forward(self, output, target): ...
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 import nn assert_...
Vanova/argus-freesound
LqLoss
false
11,946
[ "MIT" ]
0
55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
https://github.com/Vanova/argus-freesound/tree/55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
import torch from torch import nn def lq_loss(y_pred, y_true, q): eps = 1e-07 loss = y_pred * y_true loss = (1 - (loss + eps) ** q) / q return loss.mean() class Model(nn.Module): def __init__(self, q=0.5): super().__init__() self.q = q def forward(self, output, target): ...
NN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 NN(nn.Module): def __init__(self, input_size, num_classes): super(NN, self).__init__() self.fc1 = nn.Linear(input_size, 128) self.fc2 = nn.Linear(128, 64) self.fc3 = nn.Linear(64, 32) self.fc4 = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Toygarr/magically-basic-modeling-with-pytorch
NN
false
11,947
[ "MIT" ]
0
e68b65abcbecbf3eaf4e0e2fb0cf82686811549e
https://github.com/Toygarr/magically-basic-modeling-with-pytorch/tree/e68b65abcbecbf3eaf4e0e2fb0cf82686811549e
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size, num_classes): super().__init__() self.fc1 = nn.Linear(input_size, 128) self.fc2 = nn.Linear(128, 64) self.fc3 = nn.Linear(64, 32) self.fc4 = nn.Linear(...
LSoftLoss
# 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 def l_soft(y_pred, y_true, beta): eps = 1e-07 y_pred = torch.clamp(y_pred, eps, 1.0) with torch.no_grad(): y_true_update = beta * y_true + (1 - beta) * y_pred loss = F.binary_cross_entropy(y_pred, y_true_update) return loss ...
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 ...
Vanova/argus-freesound
LSoftLoss
false
11,948
[ "MIT" ]
0
55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
https://github.com/Vanova/argus-freesound/tree/55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
import torch from torch import nn import torch.nn.functional as F def l_soft(y_pred, y_true, beta): eps = 1e-07 y_pred = torch.clamp(y_pred, eps, 1.0) with torch.no_grad(): y_true_update = beta * y_true + (1 - beta) * y_pred loss = F.binary_cross_entropy(y_pred, y_true_update) return loss ...
SEScale
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SEScale(nn.Module): def __init__(self, in_channels, reduction=16): super().__init__() channel = in_channels self.fc1 = nn.Linear(channel, reduction) self.fc2 = nn.Linear(reduction, channel) def forward(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
Vanova/argus-freesound
SEScale
false
11,949
[ "MIT" ]
0
55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
https://github.com/Vanova/argus-freesound/tree/55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channels, reduction=16): super().__init__() channel = in_channels self.fc1 = nn.Linear(channel, reduction) self.fc2 = nn.Linear(reduction, channel) def forward(self...
CharbonnierLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch.nn as nn class CharbonnierLoss(nn.Module): """Charbonnier Loss (L1)""" def __init__(self, eps=1e-06): super(CharbonnierLoss, self).__init__() self.eps = eps def forward(self, x, y): diff = x - y loss = torch.sum(torch.sqrt...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data impo...
WenlongZhang0724/mmsr
CharbonnierLoss
false
11,950
[ "Apache-2.0" ]
0
375ce9207c2b8586101406577faea285885b8009
https://github.com/WenlongZhang0724/mmsr/tree/375ce9207c2b8586101406577faea285885b8009
import torch import torch.utils.data import torch.nn as nn class Model(nn.Module): """Charbonnier Loss (L1)""" def __init__(self, eps=1e-06): super().__init__() self.eps = eps def forward(self, x, y): diff = x - y loss = torch.sum(torch.sqrt(diff * diff + self.eps)) ...
LinearModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 LinearModel(nn.Module): def __init__(self, input_size, output_size, hidden_size): super(LinearModel, self).__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) self.linear3 = nn.Lin...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
VVKot/mlinseconds-find-me
LinearModel
false
11,951
[ "MIT" ]
0
f50ec09ef5cef23b694970a9a975f7a0f8c59b76
https://github.com/VVKot/mlinseconds-find-me/tree/f50ec09ef5cef23b694970a9a975f7a0f8c59b76
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, output_size, hidden_size): super().__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.linear2 = nn.Linear(hidden_size, hidden_size) self.linear3 = nn.Linear(hidden_size, output...
PatchEmbed
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PatchEmbed(nn.Module): """ Image to Patch Embedding """ def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768): super().__init__() num_patches = img_size // patch_size * (img_size // patch_size) self.img_size = img_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
WangFeng18/deit
PatchEmbed
false
11,952
[ "Apache-2.0" ]
0
62a2c54faf683af8316fbec2e99f666879949cb4
https://github.com/WangFeng18/deit/tree/62a2c54faf683af8316fbec2e99f666879949cb4
import torch import torch.nn as nn class Model(nn.Module): """ Image to Patch Embedding """ def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768): super().__init__() num_patches = img_size // patch_size * (img_size // patch_size) self.img_size = img_size ...
SpatialAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class SpatialAttention(nn.Module): def __init__(self, kernel_size=7): super(SpatialAttention, self).__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv2d(2, 1, kernel_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
Vanova/argus-freesound
SpatialAttention
false
11,953
[ "MIT" ]
0
55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
https://github.com/Vanova/argus-freesound/tree/55f6e1b5ca1fd95c985f88a3e3fb0c81f8317b9d
import torch from torch import nn class Model(nn.Module): def __init__(self, kernel_size=7): super().__init__() assert kernel_size in (3, 7), 'kernel size must be 3 or 7' padding = 3 if kernel_size == 7 else 1 self.conv1 = nn.Conv2d(2, 1, kernel_size, padding=padding, bias=False) ...
RBFExpansion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn class RBFExpansion(nn.Module): """Expand distances between nodes by radial basis functions. .. math:: \\exp(- \\gamma * ||d - \\mu||^2) where :math:`d` is the distance between two nodes and :math:`\\mu` helps centralizes the distances. We...
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 numpy as np import torch.nn as nn assert_size_stride = torch._C._d...
VoVAllen/dgl-lifesci
RBFExpansion
false
11,954
[ "Apache-2.0" ]
0
96895f2bddf255ad326f0bc4e8064bc3ed5c3044
https://github.com/VoVAllen/dgl-lifesci/tree/96895f2bddf255ad326f0bc4e8064bc3ed5c3044
import torch import numpy as np import torch.nn as nn class Model(nn.Module): """Expand distances between nodes by radial basis functions. .. math:: \\exp(- \\gamma * ||d - \\mu||^2) where :math:`d` is the distance between two nodes and :math:`\\mu` helps centralizes the distances. We use mu...
SqueezeEmbedding
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class SqueezeEmbedding(nn.Module): """ Squeeze sequence embedding length to the longest one in the batch """ def __init__(self, batch_first=True): super(SqueezeEmbedding, self).__init__() self.batch_first = batch_first def forward(self, x, x_len...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
WeiLi9811/PyABSA
SqueezeEmbedding
false
11,955
[ "MIT" ]
0
e1595784b8c978c1e91c0d8139a0a4dc36ac5965
https://github.com/WeiLi9811/PyABSA/tree/e1595784b8c978c1e91c0d8139a0a4dc36ac5965
import torch import torch.nn as nn class Model(nn.Module): """ Squeeze sequence embedding length to the longest one in the batch """ def __init__(self, batch_first=True): super().__init__() self.batch_first = batch_first def forward(self, x, x_len): """ sequence -...
QuickGELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn class QuickGELU(nn.Module): def forward(self, x: 'torch.Tensor'): return x * torch.sigmoid(1.702 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Taekyoon/executors
QuickGELU
false
11,956
[ "Apache-2.0" ]
0
567f12c4193bb7be814f84540ea31585cd35b344
https://github.com/Taekyoon/executors/tree/567f12c4193bb7be814f84540ea31585cd35b344
import torch from torch import nn class Model(nn.Module): def forward(self, x: 'torch.Tensor'): return x * torch.sigmoid(1.702 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
WeiLi9811/PyABSA
Attention
false
11,957
[ "MIT" ]
0
e1595784b8c978c1e91c0d8139a0a4dc36ac5965
https://github.com/WeiLi9811/PyABSA/tree/e1595784b8c978c1e91c0d8139a0a4dc36ac5965
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, embed_dim, hidden_dim=None, out_dim=None, n_head=1, score_function='dot_product', dropout=0): """ Attention Mechanism :param embed_dim: :param hidden_dim: ...
FaceMask
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 accuracy(outputs, labels): _, preds = torch.max(outputs, dim=1) return torch.tensor(torch.sum(preds == labels).item() / len(preds)) class FaceMask(nn.Module): def __init__(self, input_size, out_size): super().__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
VrajeshPatel20/FaceMask-Detection
FaceMask
false
11,958
[ "MIT" ]
0
1527f47a94a1b40b470eab633cf4a655c9a3e44e
https://github.com/VrajeshPatel20/FaceMask-Detection/tree/1527f47a94a1b40b470eab633cf4a655c9a3e44e
import torch import torch.nn as nn import torch.nn.functional as F def accuracy(outputs, labels): _, preds = torch.max(outputs, dim=1) return torch.tensor(torch.sum(preds == labels).item() / len(preds)) class Model(nn.Module): def __init__(self, input_size, out_size): super().__init__() ...
MultiHeadAttn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super(MultiHeadAttn, self).__init__() self.n_head = n_head self.d_model = d_model self.d_hea...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
UoMfzp/transformer-xl-Chinese-Pytorch
MultiHeadAttn
false
11,959
[ "Apache-2.0" ]
0
435641ed138e81f949c5b557b5a13c0a09fb6018
https://github.com/UoMfzp/transformer-xl-Chinese-Pytorch/tree/435641ed138e81f949c5b557b5a13c0a09fb6018
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super().__init__() self.n_head = n_head self.d_model = d_model self.d_head = d_head self.dro...
MultiHeadAttn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.collect_env class MultiHeadAttn(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super(MultiHeadAttn, self).__init__() self.n_head = n_head self.d_mod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Vatican-X-Formers/xl
MultiHeadAttn
false
11,960
[ "Apache-2.0" ]
0
216b16cdf0af6a8244e9494a60f870972c2a2524
https://github.com/Vatican-X-Formers/xl/tree/216b16cdf0af6a8244e9494a60f870972c2a2524
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.collect_env class Model(nn.Module): def __init__(self, n_head, d_model, d_head, dropout, dropatt=0, pre_lnorm=False): super().__init__() self.n_head = n_head self.d_model = d_model self.d...
ConvolModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ConvolModel(nn.Module): def __init__(self): super(ConvolModel, self).__init__() self.conv1 = nn.Conv2d(1, 5, 2) self.conv2 = nn.Conv2d(5, 10, 2) self.conv3 = nn.Conv2d(10, 10, 2) 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 import torch.nn as nn assert_...
VVKot/mlinseconds-find-me
ConvolModel
false
11,961
[ "MIT" ]
0
f50ec09ef5cef23b694970a9a975f7a0f8c59b76
https://github.com/VVKot/mlinseconds-find-me/tree/f50ec09ef5cef23b694970a9a975f7a0f8c59b76
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 5, 2) self.conv2 = nn.Conv2d(5, 10, 2) self.conv3 = nn.Conv2d(10, 10, 2) def forward(self, x): x = F.relu(F.max_...
FeedForwardLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import LayerNorm class FeedForwardLayer(nn.Module): def __init__(self, d_model, dim_feedforward=2048, dropout=0.1): super(FeedForwardLayer, self).__init__() self.linear1 = nn.Linear(d_model, dim_feedforward) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
WeightsandBiases/deeplearningposeestimation
FeedForwardLayer
false
11,962
[ "BSD-3-Clause" ]
0
406761ba3e0b66ed8640c99bcd28e2b232c92a4f
https://github.com/WeightsandBiases/deeplearningposeestimation/tree/406761ba3e0b66ed8640c99bcd28e2b232c92a4f
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import LayerNorm class Model(nn.Module): def __init__(self, d_model, dim_feedforward=2048, dropout=0.1): super().__init__() self.linear1 = nn.Linear(d_model, dim_feedforward) self.dropout = nn.Dropout(dropout...
InterModalityUpdate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class InterModalityUpdate(nn.Module): """ Inter-modality Attention Flow """ def __init__(self, v_size, q_size, output_size, num_head, drop=0.0): super(InterModalityUpdate, self).__init__() self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TranTony/DFAF-for-VQA.pytorch
InterModalityUpdate
false
11,963
[ "MIT" ]
0
eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
https://github.com/TranTony/DFAF-for-VQA.pytorch/tree/eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): """ Inter-modality Attention Flow """ def __init__(self, v_size, q_size, output_size, num_head, drop=0.0): super().__init__() self.v_size = v_size self.q_size = q...
DyIntraModalityUpdate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class DyIntraModalityUpdate(nn.Module): """ Dynamic Intra-modality Attention Flow """ def __init__(self, v_size, q_size, output_size, num_head, drop=0.0): super(DyIntraModalityUpdate, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
TranTony/DFAF-for-VQA.pytorch
DyIntraModalityUpdate
false
11,964
[ "MIT" ]
0
eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
https://github.com/TranTony/DFAF-for-VQA.pytorch/tree/eba1a893e8e5d3d8bf85078611b0bcf4d56eea86
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): """ Dynamic Intra-modality Attention Flow """ def __init__(self, v_size, q_size, output_size, num_head, drop=0.0): super().__init__() self.v_size = v_size self.q_...
GaussianKernel
# 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 GaussianKernel(nn.Module): """ Gaussian kernel module. :param mu: Float, mean of the kernel. :param sigma: Float, sigma of the kernel. Examples: >>> import torch >>> kernel = GaussianKernel() >>> x = torch.randn(4, 5, 10) >...
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...
ThuYShao/MatchZoo-py
GaussianKernel
false
11,965
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
import torch import torch.nn as nn class Model(nn.Module): """ Gaussian kernel module. :param mu: Float, mean of the kernel. :param sigma: Float, sigma of the kernel. Examples: >>> import torch >>> kernel = GaussianKernel() >>> x = torch.randn(4, 5, 10) >>> x.shap...
UpBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 UpBlock(nn.Module): """Upsample block for DRRG and TextSnake.""" def __init__(self, in_channels, out_channels): super().__init__() assert isinstance(in_channels, int) assert isinstance(out_channels, 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 import torch.nn as nn assert_...
Whatsetsthisend/mmocr
UpBlock
false
11,966
[ "Apache-2.0" ]
0
6444b3226a10162378b5ed3109991cc618e89fa4
https://github.com/Whatsetsthisend/mmocr/tree/6444b3226a10162378b5ed3109991cc618e89fa4
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Upsample block for DRRG and TextSnake.""" def __init__(self, in_channels, out_channels): super().__init__() assert isinstance(in_channels, int) assert isinstance(out_channels, int) se...
ZeroConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F class ZeroConv2d(nn.Module): def __init__(self, in_channel, out_channel, padding=1): super(ZeroConv2d, self).__init__() self.conv = nn.Conv2d(in_channel, out_channel, 3, padding=0) self.conv.weight.data.zero_() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 im...
XeniaLLL/glow-pytorch
ZeroConv2d
false
11,967
[ "MIT" ]
0
66d434e57853de1aaafaa5a5533d21705dc92e10
https://github.com/XeniaLLL/glow-pytorch/tree/66d434e57853de1aaafaa5a5533d21705dc92e10
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_channel, out_channel, padding=1): super().__init__() self.conv = nn.Conv2d(in_channel, out_channel, 3, padding=0) self.conv.weight.data.zero_() self.conv.bias.data....
layer_normalization
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 layer_normalization(nn.Module): def __init__(self, features, epsilon=1e-08): """Applies layer normalization. Args: epsilon: A floating number. A very small number for preventing ZeroDivision Error. """ super(layer_normalization, ...
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_...
Woodytse/transformer
layer_normalization
false
11,968
[ "MIT" ]
0
56f7c3051765e8cb3c34d2e9a41d483cec162256
https://github.com/Woodytse/transformer/tree/56f7c3051765e8cb3c34d2e9a41d483cec162256
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, features, epsilon=1e-08): """Applies layer normalization. Args: epsilon: A floating number. A very small number for preventing ZeroDivision Error. """ super().__init__() self.epsilon =...
label_smoothing
# 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 label_smoothing(nn.Module): def __init__(self, epsilon=0.1): """Applies label smoothing. See https://arxiv.org/abs/1512.00567. Args: epsilon: Smoothing rate. """ super(label_smoothing, self).__init__() self.epsilon = ep...
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...
Woodytse/transformer
label_smoothing
false
11,969
[ "MIT" ]
0
56f7c3051765e8cb3c34d2e9a41d483cec162256
https://github.com/Woodytse/transformer/tree/56f7c3051765e8cb3c34d2e9a41d483cec162256
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, epsilon=0.1): """Applies label smoothing. See https://arxiv.org/abs/1512.00567. Args: epsilon: Smoothing rate. """ super().__init__() self.epsilon = epsilon def forward(self, in...
LayerScale_Block_CA
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): if drop_prob == 0.0 or not training: return x keep_prob = 1 - drop_prob shape = (x.shape[0],) + (1,) * (x.ndim - 1) random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=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....
WangFeng18/deit
LayerScale_Block_CA
false
11,970
[ "Apache-2.0" ]
0
62a2c54faf683af8316fbec2e99f666879949cb4
https://github.com/WangFeng18/deit/tree/62a2c54faf683af8316fbec2e99f666879949cb4
import torch import torch.nn as nn def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): if drop_prob == 0.0 or not training: return x keep_prob = 1 - drop_prob shape = (x.shape[0],) + (1,) * (x.ndim - 1) random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=x. ...
Dropout2d
# 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.backends import torch.nn.functional as F from torch.nn.modules.dropout import _DropoutNd class Dropout2d(_DropoutNd): """Randomly zero out entire channels (a channel is a 2D feature map, e.g., the :math:`j`-th channel of the :math:`i`-th sample in the batched input is a 2D 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.backends from torch.nn.modules.dropout import _DropoutNd assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_...
ThierryJudge/baal
Dropout2d
false
11,971
[ "Apache-2.0" ]
0
8c1b1e2a47e5dd6c6b75d57b8c2152a00ba6b323
https://github.com/ThierryJudge/baal/tree/8c1b1e2a47e5dd6c6b75d57b8c2152a00ba6b323
import torch import torch.backends import torch.nn.functional as F from torch.nn.modules.dropout import _DropoutNd class Model(_DropoutNd): """Randomly zero out entire channels (a channel is a 2D feature map, e.g., the :math:`j`-th channel of the :math:`i`-th sample in the batched input is a 2D tensor :ma...
Discrete
# 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 Discrete(nn.Module): def __init__(self): super(Discrete, self).__init__() def forward(self, x): return nn.functional.softmax(x, dim=0) 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 math as tl_math import torch.nn as nn ...
WillDudley/client
Discrete
false
11,972
[ "MIT" ]
0
957f93c43eb8e5b0f51fabf3b47c362bce25389e
https://github.com/WillDudley/client/tree/957f93c43eb8e5b0f51fabf3b47c362bce25389e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return nn.functional.softmax(x, dim=0) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
RobustScannerFusionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 RobustScannerFusionLayer(nn.Module): def __init__(self, dim_model, dim=-1): super().__init__() self.dim_model = dim_model self.dim = dim self.linear_layer = nn.Linear(dim_model * 2, dim_model * 2) self.glu_layer = nn.GLU(dim=dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
Whatsetsthisend/mmocr
RobustScannerFusionLayer
false
11,973
[ "Apache-2.0" ]
0
6444b3226a10162378b5ed3109991cc618e89fa4
https://github.com/Whatsetsthisend/mmocr/tree/6444b3226a10162378b5ed3109991cc618e89fa4
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dim_model, dim=-1): super().__init__() self.dim_model = dim_model self.dim = dim self.linear_layer = nn.Linear(dim_model * 2, dim_model * 2) self.glu_layer = nn.GLU(dim=dim) def forward(self...
InvConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F class InvConv2d(nn.Module): def __init__(self, in_channel): """ a flow contains the equivalent of a permutation that reverses the ordering of the channels replact the fixed permutation with a (learned) invertible 1x1 c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from torch.nn import functional as F assert_size_stride = t...
XeniaLLL/glow-pytorch
InvConv2d
false
11,974
[ "MIT" ]
0
66d434e57853de1aaafaa5a5533d21705dc92e10
https://github.com/XeniaLLL/glow-pytorch/tree/66d434e57853de1aaafaa5a5533d21705dc92e10
import torch from torch import nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, in_channel): """ a flow contains the equivalent of a permutation that reverses the ordering of the channels replact the fixed permutation with a (learned) invertible 1x1 conv,...
ResidualBlock_noBN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
WenlongZhang0724/mmsr
ResidualBlock_noBN
false
11,975
[ "Apache-2.0" ]
0
375ce9207c2b8586101406577faea285885b8009
https://github.com/WenlongZhang0724/mmsr/tree/375ce9207c2b8586101406577faea285885b8009
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): ...
MatchingTensor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MatchingTensor(nn.Module): """ Module that captures the basic interactions between two tensors. :param matching_dims: Word dimension of two interaction texts. :param channels: Number of word interaction tensor channels. :par...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ThuYShao/MatchZoo-py
MatchingTensor
false
11,976
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Module that captures the basic interactions between two tensors. :param matching_dims: Word dimension of two interaction texts. :param channels: Number of word interaction tensor channels. :param normal...
RankCrossEntropyLoss
# 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 RankCrossEntropyLoss(nn.Module): """Creates a criterion that measures rank cross entropy loss.""" __constants__ = ['num_neg'] def __init__(self, num_neg: 'int'=1): """ :class:`RankCrossEntropyLoss` constructor. ...
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 ...
ThuYShao/MatchZoo-py
RankCrossEntropyLoss
false
11,977
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Creates a criterion that measures rank cross entropy loss.""" __constants__ = ['num_neg'] def __init__(self, num_neg: 'int'=1): """ :class:`RankCrossEntropyLoss` constructor. :param num_...
rSoftMax
# 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 rSoftMax(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self, x): batch = x.size(0) if self.radix > 1: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
XuYongi/KiNet
rSoftMax
false
11,978
[ "MIT" ]
0
fab8865a09e3779baf0daf1db1bf59a9cfbde450
https://github.com/XuYongi/KiNet/tree/fab8865a09e3779baf0daf1db1bf59a9cfbde450
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self, x): batch = x.size(0) if self.radix > 1: ...
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) ->None: 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_...
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...
YNNEKUW/captum
BasicModel
false
11,979
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self) ->None: 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_input...
LayerScale_Block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): if drop_prob == 0.0 or not training: return x keep_prob = 1 - drop_prob shape = (x.shape[0],) + (1,) * (x.ndim - 1) random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=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....
WangFeng18/deit
LayerScale_Block
false
11,980
[ "Apache-2.0" ]
0
62a2c54faf683af8316fbec2e99f666879949cb4
https://github.com/WangFeng18/deit/tree/62a2c54faf683af8316fbec2e99f666879949cb4
import torch import torch.nn as nn def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): if drop_prob == 0.0 or not training: return x keep_prob = 1 - drop_prob shape = (x.shape[0],) + (1,) * (x.ndim - 1) random_tensor = keep_prob + torch.rand(shape, dtype=x.dtype, device=x. ...
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) ->None: super().__init__() self.relu1 = nn.ReLU() self.relu2 = nn.ReLU() def forward(self, x1, x2, x3=2): return 2 * 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...
YNNEKUW/captum
ReLUDeepLiftModel
false
11,981
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch import torch.nn as nn class Model(nn.Module): """ https://www.youtube.com/watch?v=f_iAM0NPwnM """ def __init__(self) ->None: super().__init__() self.relu1 = nn.ReLU() self.relu2 = nn.ReLU() def forward(self, x1, x2, x3=2): return 2 * self.relu1(x1) + ...
MatchModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MatchModule(nn.Module): """ Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> impo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ThuYShao/MatchZoo-py
MatchModule
false
11,982
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Computing the match representation for Match LSTM. :param hidden_size: Size of hidden vectors. :param dropout_rate: Dropout rate of the projection layer. Defaults to 0. Examples: >>> import tor...
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) ->None: super().__in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel4_MultiArgs
false
11,983
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
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) ->None: super().__init__() def ...
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) ->None: 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 import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel5_MultiArgs
false
11,984
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
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) ->None: super().__init__(...
ResidualBlockNoBN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.utils import data as data import torch.nn as nn from torch.nn import init as init from torch.nn.modules.batchnorm import _BatchNorm @torch.no_grad() def default_init_weights(module_list, scale=1, bias_fill=0, **kwargs): """Initialize network weights. Args: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data from ...
Xjg-0216/DCSNet
ResidualBlockNoBN
false
11,985
[ "MIT" ]
0
0ed27d01ef1d3dbff7613ab3b145f95a32c071eb
https://github.com/Xjg-0216/DCSNet/tree/0ed27d01ef1d3dbff7613ab3b145f95a32c071eb
import torch import torch.utils.data from torch.utils import data as data import torch.nn as nn from torch.nn import init as init from torch.nn.modules.batchnorm import _BatchNorm @torch.no_grad() def default_init_weights(module_list, scale=1, bias_fill=0, **kwargs): """Initialize network weights. Args: ...
SemanticComposite
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SemanticComposite(nn.Module): """ SemanticComposite module. Apply a self-attention layer and a semantic composite fuse gate to compute the encoding result of one tensor. :param in_features: Feature size of input. :param dropout_rate: The dropout rate....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ThuYShao/MatchZoo-py
SemanticComposite
false
11,986
[ "Apache-2.0" ]
0
dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
https://github.com/ThuYShao/MatchZoo-py/tree/dd8ff1328af58d3d14aacd1a7d56d79bbf847c15
import torch import torch.nn as nn class Model(nn.Module): """ SemanticComposite module. Apply a self-attention layer and a semantic composite fuse gate to compute the encoding result of one tensor. :param in_features: Feature size of input. :param dropout_rate: The dropout rate. Exampl...
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) ->None: 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) d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel_MaxPool_ReLU
false
11,987
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, inplace=False) ->None: 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(): ...
SkipLastTargetChannelWrapper
# 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 MSELoss class SkipLastTargetChannelWrapper(nn.Module): """ Loss wrapper which removes additional target channel """ def __init__(self, loss, squeeze_channel=False): super(SkipLastTargetChannelWrapper, self).__init__() self.loss = ...
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...
YinanZYN/pytorch-3dunet
SkipLastTargetChannelWrapper
false
11,988
[ "MIT" ]
0
d1494f421a836af54c3dde65c54e3e62d5c00800
https://github.com/YinanZYN/pytorch-3dunet/tree/d1494f421a836af54c3dde65c54e3e62d5c00800
import torch from torch import nn from torch.nn import MSELoss class Model(nn.Module): """ Loss wrapper which removes additional target channel """ def __init__(self, loss, squeeze_channel=False): super().__init__() self.loss = loss self.squeeze_channel = squeeze_channel ...
GELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class GELU(nn.Module): def forward(self, x): cdf = 0.5 * (1.0 + torch.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) ...
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.utils.data import torch.onnx.operators impor...
YNNEKUW/fairseq
GELU
false
11,989
[ "MIT" ]
0
ef145b330ef26e7fb76609524504ab7933b88172
https://github.com/YNNEKUW/fairseq/tree/ef145b330ef26e7fb76609524504ab7933b88172
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Model(nn.Module): def forward(self, x): cdf = 0.5 * (1.0 + torch.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) ...
BasicModel2
# 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 BasicModel2(nn.Module): """ Example model one from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1) - 1 - ReLU(x2)) """ def __init__(self) ->None: super().__init__() def forward(self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel2
false
11,990
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Example model one from the paper https://arxiv.org/pdf/1703.01365.pdf f(x1, x2) = RELU(ReLU(x1) - 1 - ReLU(x2)) """ def __init__(self) ->None: super().__init__() def forward(self, inpu...
BasicModel6_MultiTensor
# 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 BasicModel6_MultiTensor(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, input1, input2): input = input1 + input2 return 1 - F.relu(1 - input)[:, 1] def get_inputs(): return [tor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
YNNEKUW/captum
BasicModel6_MultiTensor
false
11,991
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, input1, input2): input = input1 + input2 return 1 - F.relu(1 - input)[:, 1] def get_inputs(): return [torch.rand([4, 4, 4, ...
adder2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.autograd import Function import math import torch import torch.nn as nn def adder2d_function(X, W, stride=1, padding=0): n_filters, _d_filter, h_filter, w_filter = W.size() n_x, _d_x, h_x, w_x = X.size() h_out = (h_x - h_filter + 2 * padding) / stride + 1 w_out = (w_x - w_filter + 2 * paddi...
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.autograd import Function import math import torch.nn as nn ass...
Xyfuture/AdderNet
adder2d
false
11,992
[ "BSD-3-Clause" ]
0
62f567164175558622748464fb2f47d37d579b29
https://github.com/Xyfuture/AdderNet/tree/62f567164175558622748464fb2f47d37d579b29
from torch.autograd import Function import math import torch import torch.nn as nn def adder2d_function(X, W, stride=1, padding=0): n_filters, _d_filter, h_filter, w_filter = W.size() n_x, _d_x, h_x, w_x = X.size() h_out = (h_x - h_filter + 2 * padding) / stride + 1 w_out = (w_x - w_filter + 2 * paddi...
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) ->None: 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...
YNNEKUW/captum
MultiRelu
false
11,993
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
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) ->None: super().__init__() self.relu1 = nn.ReLU(inplace=inplace) self.relu2 = nn.ReLU(inplace=inplace) ...
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) ->None: super().__init__() self.tanh1 = nn.Tanh() self.tanh2 = nn.Tanh() def forward(se...
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_...
YNNEKUW/captum
TanhDeepLiftModel
false
11,994
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
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) ->None: super().__init__() self.tanh1 = nn.Tanh() self.tanh2 = nn.Tanh() def forward(self, x1, x2):...
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) ->None: super().__ini...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
YNNEKUW/captum
SigmoidDeepLiftModel
false
11,995
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
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) ->None: super().__init__() s...
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) ->None: 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, bia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
YNNEKUW/captum
LinearMaxPoolLinearModel
false
11,996
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self) ->None: 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) se...
BCEDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn def flatten(tensor): """Flattens a given tensor such that the channel axis is first. The shapes are transformed as follows: (N, C, D, H, W) -> (C, N * D * H * W) """ C = tensor.size(1) axis_order = (1, 0) + tuple(range(2, tensor.dim())) transposed = 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 libdevice, math as tl_math from torch ...
YinanZYN/pytorch-3dunet
BCEDiceLoss
false
11,997
[ "MIT" ]
0
d1494f421a836af54c3dde65c54e3e62d5c00800
https://github.com/YinanZYN/pytorch-3dunet/tree/d1494f421a836af54c3dde65c54e3e62d5c00800
import torch from torch import nn def flatten(tensor): """Flattens a given tensor such that the channel axis is first. The shapes are transformed as follows: (N, C, D, H, W) -> (C, N * D * H * W) """ C = tensor.size(1) axis_order = (1, 0) + tuple(range(2, tensor.dim())) transposed = ten...
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F 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...
YangfeiLiu/mmclassification
FocalLoss
false
11,998
[ "Apache-2.0" ]
0
422c757e287a45aae5049b90238fbe038ee766aa
https://github.com/YangfeiLiu/mmclassification/tree/422c757e287a45aae5049b90238fbe038ee766aa
import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss tensor. """ ...
Dense
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler def get_einsum_string(ndims, einsum_symbols=None): if einsum_symbols is None: einsum_symbols = ['u', 'v', 'w', 'x', 'y', 'z'] assert ndims <= len...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn import torch.utils.data import torch.on...
YNNEKUW/fairseq
Dense
false
11,999
[ "MIT" ]
0
ef145b330ef26e7fb76609524504ab7933b88172
https://github.com/YNNEKUW/fairseq/tree/ef145b330ef26e7fb76609524504ab7933b88172
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler def get_einsum_string(ndims, einsum_symbols=None): if einsum_symbols is None: einsum_symbols = ['u', 'v', 'w', 'x', 'y', 'z'] assert ndims <= len...
ClassificationNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ClassificationNet(nn.Module): def __init__(self, num_classes=10, num_digits=2): super(ClassificationNet, self).__init__() self.conv1 = nn.Conv2d(1, 64, 3, padding=1) self.conv2 = nn.Conv2d(64, 64, 3, padding=1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
YIFEI-MA/MultiDigitRecognition
ClassificationNet
false
12,000
[ "MIT" ]
0
f1f9567c31102ccdc7464a35b8a7c533b5d46734
https://github.com/YIFEI-MA/MultiDigitRecognition/tree/f1f9567c31102ccdc7464a35b8a7c533b5d46734
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): def __init__(self, num_classes=10, num_digits=2): super().__init__() self.conv1 = nn.Conv2d(1, 64, 3, padding=1) self.conv2 = nn.Conv2d(64, 64, 3, padding=1) self.conv3 = nn.Conv2d(64, 64, 3,...
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 from typing import Optional import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet_One_Conv(nn.Module): def __init__(self, inplace: 'bool'=False) ->None: super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.Re...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
YNNEKUW/captum
BasicModel_ConvNet_One_Conv
false
12,001
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch from torch import Tensor from typing import Optional import torch.nn as nn from typing import no_type_check class Model(nn.Module): def __init__(self, inplace: 'bool'=False) ->None: super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU(inplace=inplace) ...
ToTensor
# 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 class ToTensor(Module): def __init__(self): super(ToTensor, self).__init__() def forward(self, x): x = x / 255 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 from torch.nn import Module assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._em...
Yu-Zhewen/finn
ToTensor
false
12,002
[ "BSD-3-Clause" ]
0
5c1be584d47edfe4b43976a32a5c537f4037b017
https://github.com/Yu-Zhewen/finn/tree/5c1be584d47edfe4b43976a32a5c537f4037b017
from torch.nn import Module import torch class Model(Module): def __init__(self): super().__init__() def forward(self, x): x = x / 255 return x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
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) ->None: super().__init__() self.feature_extraction = feature_extraction self.conv1 = nn.Conv2d(3, 3, 5) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2, 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
YNNEKUW/captum
TinyCnn
false
12,003
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, feature_extraction=False) ->None: 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...
TSA_Fusion
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class TSA_Fusion(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super(TSA_Fusion, self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
WenlongZhang0724/mmsr
TSA_Fusion
false
12,004
[ "Apache-2.0" ]
0
375ce9207c2b8586101406577faea285885b8009
https://github.com/WenlongZhang0724/mmsr/tree/375ce9207c2b8586101406577faea285885b8009
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super().__init__() ...
StdConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 StdConv2d(nn.Conv2d): def forward(self, x): w = self.weight v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False) w = (w - m) / torch.sqrt(v + 1e-05) return F.conv2d(x, w, self.bias, self.stri...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Yifanfanfanfan/ViT-pytorch
StdConv2d
false
12,005
[ "MIT" ]
0
0f975aa7d3fd0aba6f74260c2b5a91786f1211ba
https://github.com/Yifanfanfanfan/ViT-pytorch/tree/0f975aa7d3fd0aba6f74260c2b5a91786f1211ba
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Conv2d): def forward(self, x): w = self.weight v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False) w = (w - m) / torch.sqrt(v + 1e-05) return F.conv2d(x, w, self.bias, self.stride, ...
DupCNN2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 DupCNN2(nn.Module): def __init__(self, input_shape, output_size, conv_layers, fc_layers): super(DupCNN2, self).__init__() self.input_shape = input_shape self.output_size = output_size self.conv_layers = conv_layers self.fc_layers = f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
WillieMaddox/Airbus_SDC_dup
DupCNN2
false
12,006
[ "MIT" ]
0
09be904cf3c8050086f07538f5e2954282de5d62
https://github.com/WillieMaddox/Airbus_SDC_dup/tree/09be904cf3c8050086f07538f5e2954282de5d62
import torch from torch import nn class Model(nn.Module): def __init__(self, input_shape, output_size, conv_layers, fc_layers): super().__init__() self.input_shape = input_shape self.output_size = output_size self.conv_layers = conv_layers self.fc_layers = fc_layers ...
DupCNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 DupCNN(nn.Module): def __init__(self, input_shape, output_size, conv_layers, fc_layers): super(DupCNN, self).__init__() self.input_shape = input_shape self.output_size = output_size self.conv_layers = conv_layers self.fc_layers = 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 from torch import nn assert_s...
WillieMaddox/Airbus_SDC_dup
DupCNN
false
12,007
[ "MIT" ]
0
09be904cf3c8050086f07538f5e2954282de5d62
https://github.com/WillieMaddox/Airbus_SDC_dup/tree/09be904cf3c8050086f07538f5e2954282de5d62
import torch from torch import nn class Model(nn.Module): def __init__(self, input_shape, output_size, conv_layers, fc_layers): super().__init__() self.input_shape = input_shape self.output_size = output_size self.conv_layers = conv_layers self.fc_layers = fc_layers ...
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 from torch import nn class SigmoidFocalLoss(nn.Module): def __init__(self, gamma, alpha): super().__init__() self.gamma = gamma self.alpha = alpha def forward(self, out, target): n_class = out.shape[1] class_ids = torch.arange(1, n_class + 1, dtype=target...
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...
YinlinHu/fcos-pytorch
SigmoidFocalLoss
false
12,008
[ "MIT" ]
0
a0f8b321a7330710e5e8ce5adb92364f381e9e85
https://github.com/YinlinHu/fcos-pytorch/tree/a0f8b321a7330710e5e8ce5adb92364f381e9e85
import torch from torch import nn class Model(nn.Module): def __init__(self, gamma, alpha): super().__init__() self.gamma = gamma self.alpha = alpha def forward(self, out, target): n_class = out.shape[1] class_ids = torch.arange(1, n_class + 1, dtype=target.dtype, dev...
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) ->None: super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2) self.conv2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
YNNEKUW/captum
BasicModel_ConvNet
false
12,009
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
import torch from torch import Tensor import torch.nn as nn from typing import no_type_check class Model(nn.Module): def __init__(self) ->None: super().__init__() self.conv1 = nn.Conv2d(1, 2, 3, 1) self.relu1 = nn.ReLU() self.pool1 = nn.MaxPool2d(2) self.conv2 = nn.Conv2d(...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F from torch.nn import Parameter from torch import FloatTensor def new_parameter(*size): out = Parameter(FloatTensor(*size)) torch.nn.init.xavier_normal(out) return out class Attention(nn.Module): def __init__(self, attention_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Yucao42/DeepLearning2019
Attention
false
12,010
[ "MIT" ]
0
90421a85686655e969bc473c60dfafc3558b6f33
https://github.com/Yucao42/DeepLearning2019/tree/90421a85686655e969bc473c60dfafc3558b6f33
import torch from torch import nn from torch.nn import functional as F from torch.nn import Parameter from torch import FloatTensor def new_parameter(*size): out = Parameter(FloatTensor(*size)) torch.nn.init.xavier_normal(out) return out class Model(nn.Module): def __init__(self, attention_size): ...
EncoderImagePrecomp
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(x, dim=-1): return x / x.norm(2, dim=dim, keepdim=True).clamp(min=1e-06) class EncoderImagePrecomp(nn.Module): """ image encoder """ def __init__(self, img_dim, embed_size, no_imgno...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Yoark/VG-NSL_ext
EncoderImagePrecomp
false
12,011
[ "MIT" ]
0
fea8155076020d294e840cf06ca5a8689c82a20e
https://github.com/Yoark/VG-NSL_ext/tree/fea8155076020d294e840cf06ca5a8689c82a20e
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(x, dim=-1): return x / x.norm(2, dim=dim, keepdim=True).clamp(min=1e-06) class Model(nn.Module): """ image encoder """ def __init__(self, img_dim, embed_size, no_imgnorm=False): ...
SmoothL1Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class SmoothL1Loss(nn.Module): """SmoothL1Loss loss . Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the los...
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 ...
ZephyrII/mmpose_charger
SmoothL1Loss
false
12,012
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """SmoothL1Loss loss . Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the loss. Defa...
MSELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class MSELoss(nn.Module): """MSE loss for coordinate regression.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.mse_loss self.use_target_weight = use_target_weigh...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dyna...
ZephyrII/mmpose_charger
MSELoss
false
12,013
[ "Apache-2.0" ]
0
ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
https://github.com/ZephyrII/mmpose_charger/tree/ca5f7ab439ae40c4ceab2c6fd1d58112dc0ea7cd
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """MSE loss for coordinate regression.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.mse_loss self.use_target_weight = use_target_weight ...
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....
YNNEKUW/captum
BasicModel_ConvNet_MaxPool3d
false
12,014
[ "BSD-3-Clause" ]
0
c8b5357b21f2ddf440e5f0ce25635977292aa5d1
https://github.com/YNNEKUW/captum/tree/c8b5357b21f2ddf440e5f0ce25635977292aa5d1
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) ->None: ...