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
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 import torch.nn as nn from collections import OrderedDict 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....
jefflai108/VGNSL
EncoderImagePrecomp
false
6,931
[ "MIT" ]
1
0edc3db3691abbad2a505b2165bd99e7a62d784f
https://github.com/jefflai108/VGNSL/tree/0edc3db3691abbad2a505b2165bd99e7a62d784f
import torch import numpy as np import torch.nn as nn from collections import OrderedDict 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): ...
BehlerAngular
# 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 as nn class BehlerAngular(nn.Module): """ Compute Behler type angular contribution of the angle spanned by three atoms: :math:`2^{(1-\\zeta)} (1 + \\lambda \\cos( {\\theta}_{ijk} ) )^\\zeta` Sets of zetas with lambdas of -1 and +1 are generated automatically. A...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._emp...
jduerholt/schnetpack
BehlerAngular
false
6,932
[ "MIT" ]
1
228d50fdeba4592b1de54d3a9570d766757c2ee1
https://github.com/jduerholt/schnetpack/tree/228d50fdeba4592b1de54d3a9570d766757c2ee1
import torch from torch import nn as nn class Model(nn.Module): """ Compute Behler type angular contribution of the angle spanned by three atoms: :math:`2^{(1-\\zeta)} (1 + \\lambda \\cos( {\\theta}_{ijk} ) )^\\zeta` Sets of zetas with lambdas of -1 and +1 are generated automatically. Args: ...
Mult
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 from torch import nn class Mult(nn.Module): def __init__(self, nc): super(Mult, self).__init__() self.register_parameter(name='exp', param=torch.nn.Parameter(torch. diag(torch.ones(nc)).unsqueeze(-1).unsqueeze(-1))) """self.reg...
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...
jayin92/vae-pix2pix-terrain-generator
Mult
false
6,933
[ "BSD-3-Clause" ]
1
805ea0b053dc9d9c22301af7f536a8fb7e2118d1
https://github.com/jayin92/vae-pix2pix-terrain-generator/tree/805ea0b053dc9d9c22301af7f536a8fb7e2118d1
import torch import torch.utils.data import torch from torch import nn class Model(nn.Module): def __init__(self, nc): super().__init__() self.register_parameter(name='exp', param=torch.nn.Parameter(torch. diag(torch.ones(nc)).unsqueeze(-1).unsqueeze(-1))) """self.register_par...
VectorQuantizeLayer_GB
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class VectorQuantizeLayer_GB(nn.Module): def __init__(self, input_dim, vq_size, vq_dim, temp=(1.0, 0.1, 0.99), groups=1, combine_groups=True, time_first=True, activation=nn.GELU( ), weight_proj_depth=1, weight_proj_factor=1): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
jefflai108/Self-Supervised-Speech-Pretraining-and-Representation-Learning
VectorQuantizeLayer_GB
false
6,934
[ "MIT" ]
1
bb8df008397d5a0360ab7d4b68e91588ed648270
https://github.com/jefflai108/Self-Supervised-Speech-Pretraining-and-Representation-Learning/tree/bb8df008397d5a0360ab7d4b68e91588ed648270
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, vq_size, vq_dim, temp=(1.0, 0.1, 0.99), groups=1, combine_groups=True, time_first=True, activation=nn.GELU( ), weight_proj_depth=1, weight_proj_factor=1): """Vector quan...
Accuracy
# 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 accuracy(logits: 'torch.Tensor', labels: 'torch.Tensor', ignore_index: 'int'=-100) ->torch.Tensor: with torch.no_grad(): valid_mask = labels != ignore_index predictions = logits.float().argmax(-1) correct = (predictions == labels) * valid_mask ...
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...
jgoodson/TraGeC
Accuracy
false
6,935
[ "BSD-3-Clause" ]
1
3370e29ba0639745055cbee726a40181a4dd61df
https://github.com/jgoodson/TraGeC/tree/3370e29ba0639745055cbee726a40181a4dd61df
import torch from torch import nn def accuracy(logits: 'torch.Tensor', labels: 'torch.Tensor', ignore_index: 'int'=-100) ->torch.Tensor: with torch.no_grad(): valid_mask = labels != ignore_index predictions = logits.float().argmax(-1) correct = (predictions == labels) * valid_mask ...
ComboLossOnlyPos
# 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 SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super(SoftDiceLoss, self).__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.siz...
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...
jchen42703/reproducing-cloud-3rd-place
ComboLossOnlyPos
false
6,936
[ "Apache-2.0" ]
1
25571f53efd48f68735d7fe2991e3ad783cbd4b1
https://github.com/jchen42703/reproducing-cloud-3rd-place/tree/25571f53efd48f68735d7fe2991e3ad783cbd4b1
import torch import torch.nn as nn class SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super().__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.size(0) probs...
MultiLabelDiceLoss
# 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 SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super(SoftDiceLoss, self).__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.siz...
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...
jchen42703/reproducing-cloud-3rd-place
MultiLabelDiceLoss
false
6,937
[ "Apache-2.0" ]
1
25571f53efd48f68735d7fe2991e3ad783cbd4b1
https://github.com/jchen42703/reproducing-cloud-3rd-place/tree/25571f53efd48f68735d7fe2991e3ad783cbd4b1
import torch import torch.nn as nn class SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super().__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.size(0) probs...
ConvPlus
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class ConvPlus(nn.Module): def __init__(self, c1, c2, k=3, s=1, g=1, bias=True): super(ConvPlus, self).__init__() self.cv1 = nn.Conv2d(c1, c2, (k, 1), s, (k // 2, 0), groups=g, bias =bias) self.cv2 = nn.Conv2d(c1, c2, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
jiangbestone/detect_rcnn
ConvPlus
false
6,938
[ "MIT" ]
1
41c4f4d3f8409cc146314c41a3d02ceafa9a7477
https://github.com/jiangbestone/detect_rcnn/tree/41c4f4d3f8409cc146314c41a3d02ceafa9a7477
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, c1, c2, k=3, s=1, g=1, bias=True): super().__init__() self.cv1 = nn.Conv2d(c1, c2, (k, 1), s, (k // 2, 0), groups=g, bias =bias) self.cv2 = nn.Conv2d(c1, c2, (1, k), s, (0, k ...
PredictionHeadTransform
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 typing from torch import nn from torch.nn import LayerNorm def gelu(x: 'torch.Tensor') ->torch.Tensor: return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) def swish(x: 'torch.Tensor') ->torch.Tensor: return x * torch.sigmoid(x) def get_activation_fn(name: 'str') ->typing...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
jgoodson/TraGeC
PredictionHeadTransform
false
6,939
[ "BSD-3-Clause" ]
1
3370e29ba0639745055cbee726a40181a4dd61df
https://github.com/jgoodson/TraGeC/tree/3370e29ba0639745055cbee726a40181a4dd61df
import math import torch import typing from torch import nn from torch.nn import LayerNorm def gelu(x: 'torch.Tensor') ->torch.Tensor: return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) def swish(x: 'torch.Tensor') ->torch.Tensor: return x * torch.sigmoid(x) def get_activation_fn(name: 'str') ->typing...
AddCoords
# 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 AddCoords(nn.Module): def __init__(self, with_r=False): super().__init__() self.with_r = with_r def forward(self, input_tensor): """ Args: input_tensor: shape(batch, channel, x_dim, y_dim) """ batch_size, _,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
jiangxiluning/TCPN
AddCoords
false
6,940
[ "Apache-2.0" ]
1
916bd8455be5c784068b7bb5bd6226da3f2d95c7
https://github.com/jiangxiluning/TCPN/tree/916bd8455be5c784068b7bb5bd6226da3f2d95c7
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, with_r=False): super().__init__() self.with_r = with_r def forward(self, input_tensor): """ Args: input_tensor: shape(batch, channel, x_dim, y_dim) """ batch_size, _, x_d...
NegativeCosineSimilarity
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F class NegativeCosineSimilarity(torch.nn.Module): """Implementation of the Negative Cosine Simililarity used in the SimSiam[0] paper. [0] SimSiam, 2020, https://arxiv.org/abs/2011.10566 Examples: >>> # initialize loss function >>> loss_fn ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice assert_size_stride = torch._...
jianzhnie/self_supervised
NegativeCosineSimilarity
false
6,941
[ "Apache-2.0" ]
1
d1e0f31ab032150ab0ad007c1e19773135a5fb79
https://github.com/jianzhnie/self_supervised/tree/d1e0f31ab032150ab0ad007c1e19773135a5fb79
import torch import torch.nn.functional as F class Model(torch.nn.Module): """Implementation of the Negative Cosine Simililarity used in the SimSiam[0] paper. [0] SimSiam, 2020, https://arxiv.org/abs/2011.10566 Examples: >>> # initialize loss function >>> loss_fn = NegativeCosineSim...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.utils.data.distributed import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jesterhazy/sagemaker-pytorch-container
Net
false
6,942
[ "Apache-2.0" ]
1
2eb4ba9216e5d72cd4d61eadc173764a41dea6b9
https://github.com/jesterhazy/sagemaker-pytorch-container/tree/2eb4ba9216e5d72cd4d61eadc173764a41dea6b9
import torch import torch.utils.data import torch.utils.data.distributed 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, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) ...
GCNModelVAE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): def __init__(self, input_dim, output_dim, dropout, bias=False): super(GraphConvolution, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.weig...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
jiangnanboy/gcn_for_prediction_of_protein_interactions
GCNModelVAE
false
6,943
[ "Apache-2.0" ]
1
b2a9eb06cdfe0971d0c352299db1075ec4827dd9
https://github.com/jiangnanboy/gcn_for_prediction_of_protein_interactions/tree/b2a9eb06cdfe0971d0c352299db1075ec4827dd9
import torch import torch.nn as nn from torch.nn.parameter import Parameter class GraphConvolution(nn.Module): def __init__(self, input_dim, output_dim, dropout, bias=False): super().__init__() self.input_dim = input_dim self.output_dim = output_dim self.weight = Parameter(torch.F...
GraphAttentionLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.parameter import Parameter import torch.nn.functional as F class GraphAttentionLayer(nn.Module): def __init__(self, input_dim, output_dim, dropout, alpha): super(GraphAttentionLayer, self).__init__() self.input_dim = input_dim self.output_d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
jiangnanboy/gcn_for_prediction_of_protein_interactions
GraphAttentionLayer
false
6,944
[ "Apache-2.0" ]
1
b2a9eb06cdfe0971d0c352299db1075ec4827dd9
https://github.com/jiangnanboy/gcn_for_prediction_of_protein_interactions/tree/b2a9eb06cdfe0971d0c352299db1075ec4827dd9
import torch import torch.nn as nn from torch.nn.parameter import Parameter import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, output_dim, dropout, alpha): super().__init__() self.input_dim = input_dim self.output_dim = output_dim self.weight = P...
ComboLoss
# 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 SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super(SoftDiceLoss, self).__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.siz...
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...
jchen42703/reproducing-cloud-3rd-place
ComboLoss
false
6,945
[ "Apache-2.0" ]
1
25571f53efd48f68735d7fe2991e3ad783cbd4b1
https://github.com/jchen42703/reproducing-cloud-3rd-place/tree/25571f53efd48f68735d7fe2991e3ad783cbd4b1
import torch import torch.nn as nn class SoftDiceLoss(nn.Module): """Differentiable soft dice loss. Note: Sigmoid is automatically applied here! """ def __init__(self): super().__init__() def forward(self, logits, targets): eps = 1e-09 num = targets.size(0) probs...
DomainCNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn import functional as F import torch.utils.data class DomainCNN(torch.nn.Module): def __init__(self, domains): super(DomainCNN, self).__init__() self.conv1 = torch.nn.Conv1d(1, 32, kernel_size=5) self.pool1 = torch.nn.MaxPool1d(kernel_size=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....
jenchen1398/artistic-music-style-transfer
DomainCNN
false
6,946
[ "BSD-3-Clause" ]
1
aa02bcf9c27cb6124c6316a756f7fd77d42be11a
https://github.com/jenchen1398/artistic-music-style-transfer/tree/aa02bcf9c27cb6124c6316a756f7fd77d42be11a
import torch from torch.nn import functional as F import torch.utils.data class Model(torch.nn.Module): def __init__(self, domains): super().__init__() self.conv1 = torch.nn.Conv1d(1, 32, kernel_size=5) self.pool1 = torch.nn.MaxPool1d(kernel_size=2) self.conv2 = torch.nn.Conv1d(32...
GeCEmbeddings
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 torch import typing from torch import nn def create_sinusoidal_embeddings(n_pos, dim, out): out.requires_grad = False positions = torch.arange(0, n_pos)[:, None] dimensions = torch.arange(0, dim) position_enc = positions / torch.pow(10000, 2 * (dime...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
jgoodson/TraGeC
GeCEmbeddings
false
6,947
[ "BSD-3-Clause" ]
1
3370e29ba0639745055cbee726a40181a4dd61df
https://github.com/jgoodson/TraGeC/tree/3370e29ba0639745055cbee726a40181a4dd61df
from _paritybench_helpers import _mock_config import torch import typing from torch import nn def create_sinusoidal_embeddings(n_pos, dim, out): out.requires_grad = False positions = torch.arange(0, n_pos)[:, None] dimensions = torch.arange(0, dim) position_enc = positions / torch.pow(10000, 2 * (dime...
RoutingBase
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch.nn import functional as F import torch.nn as nn def cal_normal(v, dim=-1, keepdim=False): """ :return: """ normal = torch.sum(v ** 2, dim=dim, keepdim=keepdim) ** 0.5 return normal def squash(sr, dim=1): """ :param dim: :param sr:(bs, dim) :return: "...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 fr...
jiangzhiwei2018/Pytorch_CapsNet
RoutingBase
false
6,948
[ "Apache-2.0" ]
1
b8931d65d5a99a4ff18fd209c16d3ff7d094d1ad
https://github.com/jiangzhiwei2018/Pytorch_CapsNet/tree/b8931d65d5a99a4ff18fd209c16d3ff7d094d1ad
import torch from torch.nn import functional as F import torch.nn as nn def cal_normal(v, dim=-1, keepdim=False): """ :return: """ normal = torch.sum(v ** 2, dim=dim, keepdim=keepdim) ** 0.5 return normal def squash(sr, dim=1): """ :param dim: :param sr:(bs, dim) :return: "...
MCDropout2d
# 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 import torch.nn as nn from torch.functional import F import torch.nn.functional as F class MCDropout2d(nn.Dropout2d): """2D dropout that stays on during training and testing """ def forward(self, input: 'Tensor') ->Tensor: return F.dropout2d(input, self.p, T...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
jiwoncpark/ex-con
MCDropout2d
false
6,949
[ "MIT" ]
1
6775d11ec1c3e7005890e58d16dd07b711861cdf
https://github.com/jiwoncpark/ex-con/tree/6775d11ec1c3e7005890e58d16dd07b711861cdf
import torch from torch import Tensor import torch.nn as nn from torch.functional import F import torch.nn.functional as F class Model(nn.Dropout2d): """2D dropout that stays on during training and testing """ def forward(self, input: 'Tensor') ->Tensor: return F.dropout2d(input, self.p, True, s...
BarlowTwinLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F def off_diagonal(x): """Return a flattened view of the off-diagonal elements of a square matrix. >>> x = np.array([[1,2,3],[4,5,6],[7,8,9]]) array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> x.flatten() array([1, 2, 3, 4, 5, 6, 7, 8,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jianzhnie/self_supervised
BarlowTwinLoss
false
6,950
[ "Apache-2.0" ]
1
d1e0f31ab032150ab0ad007c1e19773135a5fb79
https://github.com/jianzhnie/self_supervised/tree/d1e0f31ab032150ab0ad007c1e19773135a5fb79
import torch import torch.nn.functional as F def off_diagonal(x): """Return a flattened view of the off-diagonal elements of a square matrix. >>> x = np.array([[1,2,3],[4,5,6],[7,8,9]]) array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> x.flatten() array([1, 2, 3, 4, 5, 6, 7, 8,...
SamePadConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn import functional as F import torch.nn as nn class SamePadConv2d(nn.Conv2d): """ Conv with TF padding='same' https://github.com/pytorch/pytorch/issues/3867#issuecomment-349279036 """ def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
jjeamin/obJDetection
SamePadConv2d
false
6,951
[ "MIT" ]
1
eb7fbc410beb00fad1a6477e827e9ce2d8efbac5
https://github.com/jjeamin/obJDetection/tree/eb7fbc410beb00fad1a6477e827e9ce2d8efbac5
import torch from torch.nn import functional as F import torch.nn as nn class Model(nn.Conv2d): """ Conv with TF padding='same' https://github.com/pytorch/pytorch/issues/3867#issuecomment-349279036 """ def __init__(self, in_channels, out_channels, kernel_size, stride=1, dilation=1, groups...
Conv2dWithConstraint
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Conv2dWithConstraint(nn.Conv2d): def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super(Conv2dWithConstraint, self).__init__(*args, **kwargs) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=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.triton_helpers import libdevice import torch.nn as ...
jiuney/XAI606-EEGNet
Conv2dWithConstraint
false
6,952
[ "MIT" ]
1
45ff28630ed1b09d0853f2cfb148a5dd2693e5ab
https://github.com/jiuney/XAI606-EEGNet/tree/45ff28630ed1b09d0853f2cfb148a5dd2693e5ab
import torch import torch.nn as nn class Model(nn.Conv2d): def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super().__init__(*args, **kwargs) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=2, dim=0, maxnorm=self.max_norm...
CrossEntropyLossSoft
# 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 CrossEntropyLossSoft(torch.nn.modules.loss._Loss): """ inplace distillation for image classification """ def forward(self, output, target): output_log_prob = torch.nn.functional.log_softmax(output, dim=1) target = target.unsqueeze(1) output_log_prob = output_log_pro...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jiuyecao/Opt-CoInfer
CrossEntropyLossSoft
false
6,953
[ "MIT" ]
1
60f29a28c34d3bf9b2f23c98bb8e98caf1abc4f0
https://github.com/jiuyecao/Opt-CoInfer/tree/60f29a28c34d3bf9b2f23c98bb8e98caf1abc4f0
import torch class Model(torch.nn.modules.loss._Loss): """ inplace distillation for image classification """ def forward(self, output, target): output_log_prob = torch.nn.functional.log_softmax(output, dim=1) target = target.unsqueeze(1) output_log_prob = output_log_prob.unsqueeze(2) ...
Selector
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class Selector(nn.Module): def __init__(self): super(Selector, self).__init__() self.conv1 = nn.Conv2d(2048 + 256, 256, 3) self.relu1 = nn.ReLU(inplace=True) self.conv2 = nn.Conv2d(256, 16, 3) self.relu2 = nn.ReLU(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
hsuanchuu/maskrcnn-benchmark
Selector
false
6,954
[ "MIT" ]
1
39429eca800fb912418c34d104ff6f3f2ea07bbd
https://github.com/hsuanchuu/maskrcnn-benchmark/tree/39429eca800fb912418c34d104ff6f3f2ea07bbd
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(2048 + 256, 256, 3) self.relu1 = nn.ReLU(inplace=True) self.conv2 = nn.Conv2d(256, 16, 3) self.relu2 = nn.ReLU(inplace=True) ...
ShuffleCatChunk
# 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 ShuffleCatChunk(nn.Module): def forward(self, a, b): assert a.size() == b.size() _n, c, _h, _w = a.size() a = torch.chunk(a, chunks=c, dim=1) b = torch.chunk(b, chunks=c, dim=1) x = [None] * (c * 2) x[::2] = a x[1::2...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
jjkennedy3/PINTO_model_zoo
ShuffleCatChunk
false
6,955
[ "MIT" ]
1
a181c3015a6241873798c4ad3eadd4ce97024f70
https://github.com/jjkennedy3/PINTO_model_zoo/tree/a181c3015a6241873798c4ad3eadd4ce97024f70
import torch import torch.nn as nn class Model(nn.Module): def forward(self, a, b): assert a.size() == b.size() _n, c, _h, _w = a.size() a = torch.chunk(a, chunks=c, dim=1) b = torch.chunk(b, chunks=c, dim=1) x = [None] * (c * 2) x[::2] = a x[1::2] = b ...
ShuffleCat
# 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 ShuffleCat(nn.Module): def forward(self, a, b): assert a.size() == b.size() n, c, h, w = a.size() a = a.permute(0, 2, 3, 1).contiguous().view(-1, c) b = b.permute(0, 2, 3, 1).contiguous().view(-1, c) x = torch.cat((a, b), dim=0).tra...
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...
jjkennedy3/PINTO_model_zoo
ShuffleCat
false
6,956
[ "MIT" ]
1
a181c3015a6241873798c4ad3eadd4ce97024f70
https://github.com/jjkennedy3/PINTO_model_zoo/tree/a181c3015a6241873798c4ad3eadd4ce97024f70
import torch import torch.nn as nn class Model(nn.Module): def forward(self, a, b): assert a.size() == b.size() n, c, h, w = a.size() a = a.permute(0, 2, 3, 1).contiguous().view(-1, c) b = b.permute(0, 2, 3, 1).contiguous().view(-1, c) x = torch.cat((a, b), dim=0).transpos...
BatchNormDense
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.parameter import Parameter class BatchNormDense(nn.Module): def __init__(self, num_features, eps=1e-08): super().__init__() self.num_features = num_features self.eps = eps self.gamma = Parameter(torch.Tensor(num_features)) s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
jkoscialkowski/dnn-exercises
BatchNormDense
false
6,957
[ "MIT" ]
1
5d1616fce1b461e39858c68279d2fafefab00a56
https://github.com/jkoscialkowski/dnn-exercises/tree/5d1616fce1b461e39858c68279d2fafefab00a56
import torch import torch.nn as nn from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, num_features, eps=1e-08): super().__init__() self.num_features = num_features self.eps = eps self.gamma = Parameter(torch.Tensor(num_features)) self.beta ...
BasicBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jinwoo1225/MichiGAN-HAiR
BasicBlock
false
6,958
[ "MIT" ]
1
dece2ad2e93de3a7c52b4a657ecc0f1a667ccc7e
https://github.com/jinwoo1225/MichiGAN-HAiR/tree/dece2ad2e93de3a7c52b4a657ecc0f1a667ccc7e
import torch import torch.nn as nn import torch.utils.data def conv1x1(in_planes, out_planes, stride=1): """1x1 convolution""" return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): """3x3 convolution ...
ShuffleCatAlt
# 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 ShuffleCatAlt(nn.Module): def forward(self, a, b): assert a.size() == b.size() n, c, h, w = a.size() x = torch.zeros(n, c * 2, h, w, dtype=a.dtype, device=a.device) x[:, ::2] = a x[:, 1::2] = b return x def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
jjkennedy3/PINTO_model_zoo
ShuffleCatAlt
false
6,959
[ "MIT" ]
1
a181c3015a6241873798c4ad3eadd4ce97024f70
https://github.com/jjkennedy3/PINTO_model_zoo/tree/a181c3015a6241873798c4ad3eadd4ce97024f70
import torch import torch.nn as nn class Model(nn.Module): def forward(self, a, b): assert a.size() == b.size() n, c, h, w = a.size() x = torch.zeros(n, c * 2, h, w, dtype=a.dtype, device=a.device) x[:, ::2] = a x[:, 1::2] = b return x def get_inputs(): retur...
DummyMCObjective
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.nn import Module import torch from torch import Tensor from abc import ABC from abc import abstractmethod class AcquisitionObjective(Module, ABC): """Abstract base class for objectives.""" ... class MCAcquisitionObjective(AcquisitionObjective): """Abstract base class for MC-based objectives."...
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 from torch import Tensor from abc import ABC from abc import abstractmethod assert_size_stride = torch._C._dynam...
jmren168/botorch
DummyMCObjective
false
6,960
[ "MIT" ]
1
6c067185f56d3a244c4093393b8a97388fb1c0b3
https://github.com/jmren168/botorch/tree/6c067185f56d3a244c4093393b8a97388fb1c0b3
from torch.nn import Module import torch from torch import Tensor from abc import ABC from abc import abstractmethod class AcquisitionObjective(Module, ABC): """Abstract base class for objectives.""" ... class MCAcquisitionObjective(AcquisitionObjective): """Abstract base class for MC-based objectives."...
PolicyNetworkGridworld
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PolicyNetworkGridworld(nn.Module): """ Deep neural network which represents policy network. """ def __init__(self, input_size, num_actions): super(PolicyNetworkGridworld, self).__init__() self.linear1 = nn.Linear...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jlebensold/flrl-ddpg
PolicyNetworkGridworld
false
6,961
[ "MIT" ]
1
d91e9f4aedf48d0614e33bd22c7f684ecda089b1
https://github.com/jlebensold/flrl-ddpg/tree/d91e9f4aedf48d0614e33bd22c7f684ecda089b1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Deep neural network which represents policy network. """ def __init__(self, input_size, num_actions): super().__init__() self.linear1 = nn.Linear(input_size, 50) self.linear2 = nn.Li...
DQNGridworld
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 DQNGridworld(nn.Module): """ Deep neural network with represents an agent. """ def __init__(self, input_size, num_actions): super(DQNGridworld, self).__init__() self.linear1 = nn.Linear(input_size, 50) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
jlebensold/flrl-ddpg
DQNGridworld
false
6,962
[ "MIT" ]
1
d91e9f4aedf48d0614e33bd22c7f684ecda089b1
https://github.com/jlebensold/flrl-ddpg/tree/d91e9f4aedf48d0614e33bd22c7f684ecda089b1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Deep neural network with represents an agent. """ def __init__(self, input_size, num_actions): super().__init__() self.linear1 = nn.Linear(input_size, 50) self.linear2 = nn.Linear(50...
ProjectionHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 as nn class ProjectionHead(nn.Module): def __init__(self, embedding_dim, projection_dim, dropout): super().__init__() self.projection = nn.Linear(embedding_dim, projection_dim) self.gelu = nn.GELU() self.fc = nn.Linear(projection_dim, projection_d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
jianzhnie/MultimodalTransformer
ProjectionHead
false
6,963
[ "Apache-2.0" ]
1
6cd4ca8034a53da361149745aecead68fbe304a0
https://github.com/jianzhnie/MultimodalTransformer/tree/6cd4ca8034a53da361149745aecead68fbe304a0
import torch from torch import nn as nn class Model(nn.Module): def __init__(self, embedding_dim, projection_dim, dropout): super().__init__() self.projection = nn.Linear(embedding_dim, projection_dim) self.gelu = nn.GELU() self.fc = nn.Linear(projection_dim, projection_dim) ...
FFDNN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch as tc import torch.nn as nn class FFDNN(nn.Module): def __init__(self, insize, action_space): super(FFDNN, self).__init__() self.input = nn.Linear(insize, 64) self.layer1 = nn.Linear(64, 32) self.layer2 = nn.Linear(32, action_space) def forward(self,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
johan-gras/rl-camb-kaggle-connect-x
FFDNN
false
6,964
[ "Apache-2.0" ]
1
764463e556c5aea6f61390d2fec83f363510d029
https://github.com/johan-gras/rl-camb-kaggle-connect-x/tree/764463e556c5aea6f61390d2fec83f363510d029
import torch import torch as tc import torch.nn as nn class Model(nn.Module): def __init__(self, insize, action_space): super().__init__() self.input = nn.Linear(insize, 64) self.layer1 = nn.Linear(64, 32) self.layer2 = nn.Linear(32, action_space) def forward(self, x): ...
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): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=1).sqrt() X = torch.div(X, norm.unsqueeze(1).expand_as(X)) return X class EncoderImagePrecomp(nn.Module): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
joannezhouyi/visual_textual_cross_retrieval
EncoderImagePrecomp
false
6,965
[ "Apache-2.0" ]
1
6d5c55a475af74bba63887fff0774d5597830a2b
https://github.com/joannezhouyi/visual_textual_cross_retrieval/tree/6d5c55a475af74bba63887fff0774d5597830a2b
import torch import numpy as np from collections import OrderedDict import torch.nn as nn import torch.nn.init def l2norm(X): """L2-normalize columns of X """ norm = torch.pow(X, 2).sum(dim=1).sqrt() X = torch.div(X, norm.unsqueeze(1).expand_as(X)) return X class Model(nn.Module): def __ini...
BatchNormConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.parameter import Parameter class BatchNormConv(nn.Module): def __init__(self, num_channels, eps=1e-08): super().__init__() self.num_channels = num_channels self.eps = eps self.gamma = Parameter(torch.Tensor(num_channels)) 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 from torch.nn.parameter import Parameter assert_size_stri...
jkoscialkowski/dnn-exercises
BatchNormConv
false
6,966
[ "MIT" ]
1
5d1616fce1b461e39858c68279d2fafefab00a56
https://github.com/jkoscialkowski/dnn-exercises/tree/5d1616fce1b461e39858c68279d2fafefab00a56
import torch import torch.nn as nn from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, num_channels, eps=1e-08): super().__init__() self.num_channels = num_channels self.eps = eps self.gamma = Parameter(torch.Tensor(num_channels)) self.beta ...
LinearWithConstraint
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 LinearWithConstraint(nn.Linear): def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super(LinearWithConstraint, self).__init__(*args, **kwargs) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=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.triton_helpers import libdevice import torch.nn as ...
jiuney/XAI606-EEGNet
LinearWithConstraint
false
6,967
[ "MIT" ]
1
45ff28630ed1b09d0853f2cfb148a5dd2693e5ab
https://github.com/jiuney/XAI606-EEGNet/tree/45ff28630ed1b09d0853f2cfb148a5dd2693e5ab
import torch import torch.nn as nn class Model(nn.Linear): def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super().__init__(*args, **kwargs) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=2, dim=0, maxnorm=self.max_norm...
patch_extractor
# 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 patch_extractor(nn.Module): """ Module for creating custom patch extractor """ def __init__(self, patch_size, pad=False, center=False, dim=2): super(patch_extractor, self).__init__() self.dim = dim self.im2pat = nn.Unfold(kernel_size=pat...
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...
johertrich/Wasserstein_Patch_Prior
patch_extractor
false
6,968
[ "MIT" ]
1
70877a6f1031e51b7868984b97027951d1d190d3
https://github.com/johertrich/Wasserstein_Patch_Prior/tree/70877a6f1031e51b7868984b97027951d1d190d3
import torch from torch import nn class Model(nn.Module): """ Module for creating custom patch extractor """ def __init__(self, patch_size, pad=False, center=False, dim=2): super().__init__() self.dim = dim self.im2pat = nn.Unfold(kernel_size=patch_size) self.pad = pad...
UpsampleConvLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 UpsampleConvLayer(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(UpsampleConvLayer, self).__init__() reflection_padding = kernel_size // 2 self.reflection_pad = torch.nn.ReflectionPad2d(reflection_paddin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
joaquingv12/Solving-Image-Processing-Problems-with-Python-Part1
UpsampleConvLayer
false
6,969
[ "MIT" ]
1
42512672d1dc660dabc2d4570e891315f5264b12
https://github.com/joaquingv12/Solving-Image-Processing-Problems-with-Python-Part1/tree/42512672d1dc660dabc2d4570e891315f5264b12
import torch import torch.nn as nn class Model(torch.nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super().__init__() reflection_padding = kernel_size // 2 self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding) self.conv2d = nn.ConvTra...
GATModelVAE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.parameter import Parameter import torch.nn.functional as F class GraphConvolution(nn.Module): def __init__(self, input_dim, output_dim, dropout, bias=False): super(GraphConvolution, self).__init__() self.input_dim = input_dim self.output_di...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
jiangnanboy/gcn_for_prediction_of_protein_interactions
GATModelVAE
false
6,970
[ "Apache-2.0" ]
1
b2a9eb06cdfe0971d0c352299db1075ec4827dd9
https://github.com/jiangnanboy/gcn_for_prediction_of_protein_interactions/tree/b2a9eb06cdfe0971d0c352299db1075ec4827dd9
import torch import torch.nn as nn from torch.nn.parameter import Parameter import torch.nn.functional as F class GraphConvolution(nn.Module): def __init__(self, input_dim, output_dim, dropout, bias=False): super().__init__() self.input_dim = input_dim self.output_dim = output_dim ...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super(ConvLayer, self).__init__() reflection_padding = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(reflection_padding) self.conv2d = nn....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
joaquingv12/Solving-Image-Processing-Problems-with-Python-Part1
ResidualBlock
false
6,971
[ "MIT" ]
1
42512672d1dc660dabc2d4570e891315f5264b12
https://github.com/joaquingv12/Solving-Image-Processing-Problems-with-Python-Part1/tree/42512672d1dc660dabc2d4570e891315f5264b12
import torch import torch.nn as nn class ConvLayer(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride): super().__init__() reflection_padding = kernel_size // 2 self.reflection_pad = nn.ReflectionPad2d(reflection_padding) self.conv2d = nn.Conv2d(in_chann...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F class Net(torch.nn.Module): def __init__(self): super(Net, self).__init__() self.l1 = torch.nn.Linear(784, 512) self.l2 = torch.nn.Linear(512, 256) self.l3 = torch.nn.Linear(256, 128) self.l4 = torch.nn.Linear(128, 64) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
jobsfan/pytorch
Net
false
6,972
[ "Apache-2.0" ]
1
221ae8e3673f8d2fbf0a58f40a30553c76084831
https://github.com/jobsfan/pytorch/tree/221ae8e3673f8d2fbf0a58f40a30553c76084831
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self): super().__init__() self.l1 = torch.nn.Linear(784, 512) self.l2 = torch.nn.Linear(512, 256) self.l3 = torch.nn.Linear(256, 128) self.l4 = torch.nn.Linear(128, 64) self.l5 ...
ElectraClassificationHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 torch from torch import nn import torch.nn.functional as F class ElectraClassificationHead(nn.Module): """CLS分类""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.dr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
johnson7788/TextBrewer
ElectraClassificationHead
false
6,973
[ "Apache-2.0" ]
1
fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a
https://github.com/johnson7788/TextBrewer/tree/fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a
from _paritybench_helpers import _mock_config import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): """CLS分类""" def __init__(self, config): super().__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.dropout = nn.Dropout(c...
ComboLoss
# 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 ComboLoss(nn.Module): def __init__(self, weight=None, size_average=True, alpha=0.5, ce_ratio=0.5 ): super(ComboLoss, self).__init__() self.alpha = alpha self.ce_ratio = ce_ratio def forward(self, inputs, targets, smooth=1): e =...
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 ...
johnugeorge/medperf
ComboLoss
false
6,974
[ "Apache-2.0" ]
1
5bc3f643064df14e9476bd4d4c1a4c0cce5337d5
https://github.com/johnugeorge/medperf/tree/5bc3f643064df14e9476bd4d4c1a4c0cce5337d5
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, weight=None, size_average=True, alpha=0.5, ce_ratio=0.5 ): super().__init__() self.alpha = alpha self.ce_ratio = ce_ratio def forward(self, inputs, targets, smooth=1): e = 1e-07 inpu...
ImagenetNorm
# 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 ImagenetNorm(nn.Module): def __init__(self, from_raw=True): """ :param from_raw: whether the input image lies in the range of [0, 255] """ super().__init__() self.from_raw = from_raw self.mean = nn.Parameter(torch.tensor([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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
jokingbear/DM
ImagenetNorm
false
6,975
[ "MIT" ]
1
9c4dada1756f3d866455a397511d4f3bacfadc60
https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, from_raw=True): """ :param from_raw: whether the input image lies in the range of [0, 255] """ super().__init__() self.from_raw = from_raw self.mean = nn.Parameter(torch.tensor([0.485, 0....
GlobalAverage
# 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 GlobalAverage(nn.Module): def __init__(self, rank=2, keepdims=False): """ :param rank: dimension of image :param keepdims: whether to preserve shape after averaging """ super().__init__() self.axes = list(range(2, 2 + rank))...
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...
jokingbear/DM
GlobalAverage
false
6,976
[ "MIT" ]
1
9c4dada1756f3d866455a397511d4f3bacfadc60
https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, rank=2, keepdims=False): """ :param rank: dimension of image :param keepdims: whether to preserve shape after averaging """ super().__init__() self.axes = list(range(2, 2 + rank)) ...
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 def _assert_inputs(pred, true): assert pred.shape == true.shape, f'predition shape {pred.shape} is not the same as label shape {true.shape}' class FocalLoss(nn.Module): def __init__(self, gamma=2, binary=False): super().__init__() self.gamma = gamma ...
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...
jokingbear/DM
FocalLoss
false
6,977
[ "MIT" ]
1
9c4dada1756f3d866455a397511d4f3bacfadc60
https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60
import torch import torch.nn as nn def _assert_inputs(pred, true): assert pred.shape == true.shape, f'predition shape {pred.shape} is not the same as label shape {true.shape}' class Model(nn.Module): def __init__(self, gamma=2, binary=False): super().__init__() self.gamma = gamma se...
FbetaLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def _assert_inputs(pred, true): assert pred.shape == true.shape, f'predition shape {pred.shape} is not the same as label shape {true.shape}' class FbetaLoss(nn.Module): def __init__(self, beta=1, axes=(0,), binary=False, smooth=1e-07): super().__init__() 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
jokingbear/DM
FbetaLoss
false
6,978
[ "MIT" ]
1
9c4dada1756f3d866455a397511d4f3bacfadc60
https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60
import torch import torch.nn as nn def _assert_inputs(pred, true): assert pred.shape == true.shape, f'predition shape {pred.shape} is not the same as label shape {true.shape}' class Model(nn.Module): def __init__(self, beta=1, axes=(0,), binary=False, smooth=1e-07): super().__init__() self....
Accuracy
# 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 Accuracy(nn.Module): def __init__(self, binary=False): super().__init__() self.binary = binary def forward(self, preds, trues): if self.binary: preds = preds >= 0.5 else: preds = preds.argmax(dim=1) resu...
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...
jokingbear/DM
Accuracy
false
6,979
[ "MIT" ]
1
9c4dada1756f3d866455a397511d4f3bacfadc60
https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, binary=False): super().__init__() self.binary = binary def forward(self, preds, trues): if self.binary: preds = preds >= 0.5 else: preds = preds.argmax(dim=1) result ...
GCN_encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.init as init class GraphConv(nn.Module): def __init__(self, input_dim, output_dim): super(GraphConv, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.weight = nn.Parameter(torch.FloatTensor(input_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 import torch.nn as nn import ...
jonathangomesselman/graph-generation
GCN_encoder
false
6,980
[ "MIT" ]
1
72a8be30d54a414fcca9ea0fad1a62e38b85ee2f
https://github.com/jonathangomesselman/graph-generation/tree/72a8be30d54a414fcca9ea0fad1a62e38b85ee2f
import torch import torch.nn as nn import torch.nn.init as init class GraphConv(nn.Module): def __init__(self, input_dim, output_dim): super().__init__() self.input_dim = input_dim self.output_dim = output_dim self.weight = nn.Parameter(torch.FloatTensor(input_dim, output_dim)) ...
PolicyNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PolicyNet(nn.Module): def __init__(self, state_dim, actions_dim, hidden_dim=64): super(PolicyNet, self).__init__() self.input_layer = nn.Linear(state_dim, hidden_dim) self.hidden = nn.Linear(hidden_dim, actions_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 import torch.nn as nn assert_...
johntiger1/vaal_querying
PolicyNet
false
6,981
[ "BSD-2-Clause" ]
1
c20da3b0b5ca9f25334523f831d0ba8a11f710ca
https://github.com/johntiger1/vaal_querying/tree/c20da3b0b5ca9f25334523f831d0ba8a11f710ca
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, state_dim, actions_dim, hidden_dim=64): super().__init__() self.input_layer = nn.Linear(state_dim, hidden_dim) self.hidden = nn.Linear(hidden_dim, actions_dim) def forward(se...
LabelSmoothingLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn class LabelSmoothingLoss(nn.Module): def __init__(self, smoothing=0.0): super(LabelSmoothingLoss, self).__init__() self.smoothing = smoothing def smooth_one_hot(self, target: 'torch.Tensor', classes: 'int', smoothing:...
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 ...
jordiae/DeepLearning-MAI
LabelSmoothingLoss
false
6,982
[ "MIT" ]
1
e12b6975d8de6cbe89f812bf691a7f7e95213552
https://github.com/jordiae/DeepLearning-MAI/tree/e12b6975d8de6cbe89f812bf691a7f7e95213552
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, smoothing=0.0): super().__init__() self.smoothing = smoothing def smooth_one_hot(self, target: 'torch.Tensor', classes: 'int', smoothing: 'float'=0.0): assert 0 <= sm...
BertSelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch from torch import nn class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
johnson7788/TextBrewer
BertSelfAttention
false
6,983
[ "Apache-2.0" ]
1
fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a
https://github.com/johnson7788/TextBrewer/tree/fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a
from _paritybench_helpers import _mock_config import math import torch from torch import nn class Model(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hidden size (%d) is not a ...
TVLoss
# 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 TVLoss(nn.Module): def __init__(self, norm=2): super().__init__() self.norm = norm def forward(self, x): rank = len(x.shape[2:]) shift_h = torch.cat([x[:, :, 1:], x[:, :, :1]], dim=2) shift_w = torch.cat([x[:...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
jokingbear/DM
TVLoss
false
6,984
[ "MIT" ]
1
9c4dada1756f3d866455a397511d4f3bacfadc60
https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, norm=2): super().__init__() self.norm = norm def forward(self, x): rank = len(x.shape[2:]) shift_h = torch.cat([x[:, :, 1:], x[:, :, :1]], dim=2) shift_w = torch.cat([x[:,...
ActNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ActNorm(nn.Module): """ ActNorm layer. [Kingma and Dhariwal, 2018.] """ def __init__(self, dim): super().__init__() self.dim = dim self.mu = nn.Parameter(torch.zeros(dim, dtype=torch.float)) self.log_sigma = nn.Parameter(to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
jsk389/RGB-PowerSpectra-v2
ActNorm
false
6,985
[ "MIT" ]
1
47ca7cae256ad09a7e5a40fe9da82d48c32ff7cc
https://github.com/jsk389/RGB-PowerSpectra-v2/tree/47ca7cae256ad09a7e5a40fe9da82d48c32ff7cc
import torch import torch.nn as nn class Model(nn.Module): """ ActNorm layer. [Kingma and Dhariwal, 2018.] """ def __init__(self, dim): super().__init__() self.dim = dim self.mu = nn.Parameter(torch.zeros(dim, dtype=torch.float)) self.log_sigma = nn.Parameter(torc...
ConvEncoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 from typing import Tuple def to_sate_tensor(s, device): """ converts a numpy array to a Tensor suitable for passing through DQNs """ return torch.from_numpy(s) class ConvEncoder(nn.Module): def __init__(self, state_shape: 'Tuple', device=None): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from ty...
jondeaton/AgarAI
ConvEncoder
false
6,986
[ "MIT" ]
1
0c60896465a969ba6832a4b417cf6199715799a1
https://github.com/jondeaton/AgarAI/tree/0c60896465a969ba6832a4b417cf6199715799a1
import torch import numpy as np import torch.nn as nn from typing import Tuple def to_sate_tensor(s, device): """ converts a numpy array to a Tensor suitable for passing through DQNs """ return torch.from_numpy(s) class Model(nn.Module): def __init__(self, state_shape: 'Tuple', device=None): su...
UpSample
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class UpSample(nn.Module): def __init__(self, feat_in, feat_out, out_shape=None, scale=2): super().__init__() self.conv = nn.Conv2d(feat_in, feat_out, kernel_size=(3, 3), stride =1, padding=1) self.out_shape, self.scale = out_shape, scale ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
jpjuvo/deepfake-video-detector
UpSample
false
6,987
[ "MIT" ]
1
7c5ea5f36277ff5405d8466e48e68d00a085fa7e
https://github.com/jpjuvo/deepfake-video-detector/tree/7c5ea5f36277ff5405d8466e48e68d00a085fa7e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, feat_in, feat_out, out_shape=None, scale=2): super().__init__() self.conv = nn.Conv2d(feat_in, feat_out, kernel_size=(3, 3), stride =1, padding=1) self.out_shape, self.scale = out_shape, scale d...
TestNet2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 TestNet2(nn.Module): def __init__(self): super(TestNet2, self).__init__() self.conv1 = nn.Conv2d(3, 18, 7, padding=3) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(18, 36, 5, padding=2) self.c...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
jjmachan/Cifar-pytorch
TestNet2
false
6,988
[ "Apache-2.0" ]
1
11268af2f9f5230b721ac554a2ce83496c41d06c
https://github.com/jjmachan/Cifar-pytorch/tree/11268af2f9f5230b721ac554a2ce83496c41d06c
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(3, 18, 7, padding=3) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(18, 36, 5, padding=2) self.conv3 = nn.Conv2d(...
SReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SReLU(nn.Module): """Shifted ReLU""" def __init__(self, nc): super(SReLU, self).__init__() self.srelu_bias = nn.Parameter(torch.Tensor(1, nc, 1, 1)) self.srelu_relu = nn.ReLU(inplace=True) nn.init.constant_(self.srelu_bias, -1.0) 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...
juancprzs/ISONet
SReLU
false
6,989
[ "MIT" ]
1
a0422942b53255d093197aa93c77cc3fa941bcdf
https://github.com/juancprzs/ISONet/tree/a0422942b53255d093197aa93c77cc3fa941bcdf
import torch import torch.nn as nn class Model(nn.Module): """Shifted ReLU""" def __init__(self, nc): super().__init__() self.srelu_bias = nn.Parameter(torch.Tensor(1, nc, 1, 1)) self.srelu_relu = nn.ReLU(inplace=True) nn.init.constant_(self.srelu_bias, -1.0) def forward(...
LOGMSELoss
# 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 LOGMSELoss(nn.Module): def __init__(self): super().__init__() self.mse = nn.MSELoss() def forward(self, input, target): return torch.log(self.mse(input, target)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
julschoen/Latent-Space-Exploration-CT
LOGMSELoss
false
6,990
[ "MIT" ]
1
39440c83362181efc48cad69777e5671a7bf3de9
https://github.com/julschoen/Latent-Space-Exploration-CT/tree/39440c83362181efc48cad69777e5671a7bf3de9
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.mse = nn.MSELoss() def forward(self, input, target): return torch.log(self.mse(input, target)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] ...
NavigatorUnit
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. stride : int or tuple/list...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
iofthetiger/pkuad
NavigatorUnit
false
6,991
[ "Apache-2.0" ]
1
07496d108c614c84be028f344830becc9cac8fe5
https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5
import torch import torch.nn as nn def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False): """ Convolution 1x1 layer. Parameters: ---------- in_channels : int Number of input channels. out_channels : int Number of output channels. stride : int or tuple/list...
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 as nn import torch.nn.functional as F class GAT(nn.Module): def __init__(self, num_feats): super(GAT, self).__init__() self.num_feats = num_feats self.weight_key = nn.Parameter(torch.zeros(size=(self.num_feats, 1))) self.weight_query = nn.Parameter(tor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
juaduan/babybrainguardian
GAT
false
6,992
[ "MIT" ]
1
b871e3a83fef98c2e05dd8857721a3c964a46418
https://github.com/juaduan/babybrainguardian/tree/b871e3a83fef98c2e05dd8857721a3c964a46418
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_feats): super().__init__() self.num_feats = num_feats self.weight_key = nn.Parameter(torch.zeros(size=(self.num_feats, 1))) self.weight_query = nn.Parameter(torch.zero...
GeneralizedDiceLoss
# 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 as nn from torch.autograd import Variable def expand_as_one_hot(input, C, ignore_index=None): """ Converts NxDxHxW label image to NxCxDxHxW, where each label is stored in a separate channel :param input: 4D input image (NxDxHxW) :param C: number of channels/labels ...
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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_strid...
junweiy/pcs_seg
GeneralizedDiceLoss
false
6,993
[ "MIT" ]
1
38ed98130b34a6d3d0b986cad98b08b791760f0b
https://github.com/junweiy/pcs_seg/tree/38ed98130b34a6d3d0b986cad98b08b791760f0b
import torch from torch import nn as nn from torch.autograd import Variable def expand_as_one_hot(input, C, ignore_index=None): """ Converts NxDxHxW label image to NxCxDxHxW, where each label is stored in a separate channel :param input: 4D input image (NxDxHxW) :param C: number of channels/labels ...
LinearScale
# 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 LinearScale(nn.Module): def __init__(self, scale, bias): super(LinearScale, self).__init__() self.scale_v = scale self.bias_v = bias pass def forward(self, x): out = x * self.scale_v + self.bias_v return out def __...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
justinjohn0306/CIPS-3D
LinearScale
false
6,994
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, scale, bias): super().__init__() self.scale_v = scale self.bias_v = bias pass def forward(self, x): out = x * self.scale_v + self.bias_v return out def __repr__(self): r...
EqualLinear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 EqualLinear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1.0, activation=None): """ :param in_dim: :param out_dim: :param bias: :param bias_init: :param lr_m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
justinjohn0306/CIPS-3D
EqualLinear
false
6,995
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1.0, activation=None): """ :param in_dim: :param out_dim: :param bias: :param bias_init: :param lr_mul: 0....
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn as nn from torch.autograd import Variable def expand_as_one_hot(input, C, ignore_index=None): """ Converts NxDxHxW label image to NxCxDxHxW, where each label is stored in a separate channel :param input: 4D input image (NxDxHxW) :param C: number of channels/labels ...
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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_strid...
junweiy/pcs_seg
DiceLoss
false
6,997
[ "MIT" ]
1
38ed98130b34a6d3d0b986cad98b08b791760f0b
https://github.com/junweiy/pcs_seg/tree/38ed98130b34a6d3d0b986cad98b08b791760f0b
import torch from torch import nn as nn from torch.autograd import Variable def expand_as_one_hot(input, C, ignore_index=None): """ Converts NxDxHxW label image to NxCxDxHxW, where each label is stored in a separate channel :param input: 4D input image (NxDxHxW) :param C: number of channels/labels ...
AdvResNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class AdvLinearNet(nn.Module): """ Adversarial linear network. """ def __init__(self, n_inputs: 'int', n_outputs: 'int', epsilon: 'float'= 0.0, q: 'int'=1): """ Initialize a linear network. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np import tor...
jtkhim/tree_transform
AdvResNet
false
6,998
[ "MIT" ]
1
f0bf85ede0e28f3d16de5b8b0826be38fe2d89bf
https://github.com/jtkhim/tree_transform/tree/f0bf85ede0e28f3d16de5b8b0826be38fe2d89bf
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class AdvLinearNet(nn.Module): """ Adversarial linear network. """ def __init__(self, n_inputs: 'int', n_outputs: 'int', epsilon: 'float'= 0.0, q: 'int'=1): """ Initialize a linear network. ...
FiLMLayer_PreSin
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class FiLMLayer_PreSin(nn.Module): def __init__(self, in_dim, out_dim, style_dim, use_style_fc=True, which_linear=nn.Linear, **kwargs): super(FiLMLayer_PreSin, self).__init__() self.in_dim = in_dim self.out_dim = out_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.triton_helpers import math as tl_math import numpy ...
justinjohn0306/CIPS-3D
FiLMLayer_PreSin
false
6,999
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, in_dim, out_dim, style_dim, use_style_fc=True, which_linear=nn.Linear, **kwargs): super().__init__() self.in_dim = in_dim self.out_dim = out_dim self.style_dim = style_dim ...
ResidualBlock_noBN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaimin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
jtang98/FFDNet-speckle
ResidualBlock_noBN
false
7,000
[ "MIT" ]
1
084fa2782f0197d0e01ee8c595a16414aaf4ab8d
https://github.com/jtang98/FFDNet-speckle/tree/084fa2782f0197d0e01ee8c595a16414aaf4ab8d
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaimin...
CoordConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 AddCoords(nn.Module): """ Source: https://github.com/mkocabas/CoordConv-pytorch/blob/master/CoordConv.py """ def __init__(self, with_r=False): super().__init__() self.with_r = with_r def forward(self, input_tensor): """ Arg...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
justinjohn0306/CIPS-3D
CoordConv
false
7,001
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import torch import torch.nn as nn class AddCoords(nn.Module): """ Source: https://github.com/mkocabas/CoordConv-pytorch/blob/master/CoordConv.py """ def __init__(self, with_r=False): super().__init__() self.with_r = with_r def forward(self, input_tensor): """ Arg...
EqualConvTranspose2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 EqualConvTranspose2d(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True): super().__init__() self.weight = nn.Parameter(torch.randn(in_channel, out_channel...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.a...
justinjohn0306/CIPS-3D
EqualConvTranspose2d
false
7,002
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, in_channel, out_channel, kernel_size, stride=1, padding=0, bias=True): super().__init__() self.weight = nn.Parameter(torch.randn(in_channel, out_channel, k...
FiLMLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 FiLMLayer(nn.Module): def __init__(self, input_dim, hidden_dim): super().__init__() self.layer = nn.Linear(input_dim, hidden_dim) def forward(self, x, freq, phase_shift): x = self.layer(x) freq = freq.unsqueeze(1).expand_as(x) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
justinjohn0306/CIPS-3D
FiLMLayer
false
7,003
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, hidden_dim): super().__init__() self.layer = nn.Linear(input_dim, hidden_dim) def forward(self, x, freq, phase_shift): x = self.layer(x) freq = freq.unsqueeze(1).expand_as(x) phas...
CoordConvSinAct
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SinAct(nn.Module): def __init__(self): super(SinAct, self).__init__() def forward(self, x): return torch.sin(x) class CoordConvSinAct(nn.Module): """ Source: https://github.com/mkocabas/CoordConv-pytorch/blob/master/CoordConv.py """ def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
justinjohn0306/CIPS-3D
CoordConvSinAct
false
7,004
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import torch import torch.nn as nn class SinAct(nn.Module): def __init__(self): super().__init__() def forward(self, x): return torch.sin(x) class Model(nn.Module): """ Source: https://github.com/mkocabas/CoordConv-pytorch/blob/master/CoordConv.py """ def __init__(self, in_cha...
Sine
# 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 Sine(nn.Module): """Sine Activation Function.""" def __init__(self): super().__init__() def forward(self, x): return torch.sin(30.0 * 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
justinjohn0306/CIPS-3D
Sine
false
7,005
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import torch import torch.nn as nn class Model(nn.Module): """Sine Activation Function.""" def __init__(self): super().__init__() def forward(self, x): return torch.sin(30.0 * x) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
FiLMLayerEqualFC
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 EqualLinear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1.0, activation=None): """ :param in_dim: :param out_dim: :param bias: :param bias_init: :param lr_m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math i...
justinjohn0306/CIPS-3D
FiLMLayerEqualFC
false
7,006
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import math import torch import torch.nn as nn import torch.nn.functional as F class EqualLinear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1.0, activation=None): """ :param in_dim: :param out_dim: :param bias: :param bias_init: :param lr_m...
CLNLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CLN(nn.Module): def __init__(self, in_dim, use_style_fc=False, style_dim=None, which_linear=nn.Linear, spectral_norm=False, eps=1e-05, **kwargs): super(CLN, self).__init__() self.in_dim = in_dim self.use_styl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
justinjohn0306/CIPS-3D
CLNLayer
false
7,007
[ "MIT" ]
1
69a910a7841846419a6b5e03182c8cf061a82584
https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584
import torch import torch.nn as nn import torch.nn.functional as F class CLN(nn.Module): def __init__(self, in_dim, use_style_fc=False, style_dim=None, which_linear=nn.Linear, spectral_norm=False, eps=1e-05, **kwargs): super().__init__() self.in_dim = in_dim self.use_style_fc = us...
TVLoss
# 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 TVLoss(nn.Module): def __init__(self, weight=1.0): super(TVLoss, self).__init__() self.weight = weight self.l1 = nn.L1Loss(reduction='mean') def forward(self, out, gt): grad_out_x = out[:, :, :, 1:] - out[:, :, :, :-1] grad_out...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
juyongjiang/Simple-SR
TVLoss
false
7,008
[ "MIT" ]
1
76820511abc04fbe6e4a79d23c67aee97406d563
https://github.com/juyongjiang/Simple-SR/tree/76820511abc04fbe6e4a79d23c67aee97406d563
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, weight=1.0): super().__init__() self.weight = weight self.l1 = nn.L1Loss(reduction='mean') def forward(self, out, gt): grad_out_x = out[:, :, :, 1:] - out[:, :, :, :-1] grad_out_y = out[:, :...
ResidualBlock_noBN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaimin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
juyongjiang/Simple-SR
ResidualBlock_noBN
false
7,009
[ "MIT" ]
1
76820511abc04fbe6e4a79d23c67aee97406d563
https://github.com/juyongjiang/Simple-SR/tree/76820511abc04fbe6e4a79d23c67aee97406d563
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init def initialize_weights(net_l, scale=1): if not isinstance(net_l, list): net_l = [net_l] for net in net_l: for m in net.modules(): if isinstance(m, nn.Conv2d): init.kaimin...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Attention(nn.Module): """ Implements Bahdanau Attention. Arguments: encoder_dim (int): Size of the encoder. decoder_dim (int): Size of the decoder. attention_dim (int): Size of the attention layer. """ def __init__(self, encoder...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
kad99kev/Image-Captioning
Attention
false
7,010
[ "MIT" ]
1
a38d7c6469306d7f226d8003bba92f21b3d9a06c
https://github.com/kad99kev/Image-Captioning/tree/a38d7c6469306d7f226d8003bba92f21b3d9a06c
import torch import torch.nn as nn class Model(nn.Module): """ Implements Bahdanau Attention. Arguments: encoder_dim (int): Size of the encoder. decoder_dim (int): Size of the decoder. attention_dim (int): Size of the attention layer. """ def __init__(self, encoder_dim...
CNN_decoder_attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.init as init class CNN_decoder_attention(nn.Module): def __init__(self, input_size, output_size, stride=2): super(CNN_decoder_attention, self).__init__() self.input_size = input_size self.output_size = output_size self.relu = nn.R...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
jonathangomesselman/graph-generation
CNN_decoder_attention
false
7,011
[ "MIT" ]
1
72a8be30d54a414fcca9ea0fad1a62e38b85ee2f
https://github.com/jonathangomesselman/graph-generation/tree/72a8be30d54a414fcca9ea0fad1a62e38b85ee2f
import torch import torch.nn as nn import torch.nn.init as init class Model(nn.Module): def __init__(self, input_size, output_size, stride=2): super().__init__() self.input_size = input_size self.output_size = output_size self.relu = nn.ReLU() self.deconv = nn.ConvTranspos...
PreNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PreNet(nn.Module): def __init__(self): super(PreNet, self).__init__() self.conv1 = nn.Conv2d(4, 8, 3, padding=1) self.act1 = nn.LeakyReLU(0.2, inplace=False) self.conv2 = nn.Conv2d(8, 16, 3, padding=1) self.act2 = nn.LeakyReLU(0.2, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
karavik18/Federated_Learning_for_Missing_MRI_Sequence
PreNet
false
7,012
[ "Apache-2.0" ]
1
42924f8475f354e6b429d05867f99530aa485b96
https://github.com/karavik18/Federated_Learning_for_Missing_MRI_Sequence/tree/42924f8475f354e6b429d05867f99530aa485b96
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(4, 8, 3, padding=1) self.act1 = nn.LeakyReLU(0.2, inplace=False) self.conv2 = nn.Conv2d(8, 16, 3, padding=1) self.act2 = nn.LeakyReLU(0.2, inplace=False...
TransformerFFN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 torch from torch import nn 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, self).__init__() s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
katsura-jp/generate-syosetu-title
TransformerFFN
false
7,014
[ "MIT" ]
1
f1db8f87d6ebd58117df1e7c0b76a4fe92cae810
https://github.com/katsura-jp/generate-syosetu-title/tree/f1db8f87d6ebd58117df1e7c0b76a4fe92cae810
from _paritybench_helpers import _mock_config import torch from torch import nn 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__() self.weight = nn.Par...
SurfaceLoss
# 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 SurfaceLoss(nn.Module): def __init__(self, epsilon=1e-05, softmax=True): super(SurfaceLoss, self).__init__() self.weight_map = [] def forward(self, x, distmap): x = torch.softmax(x, dim=1) self.weight_map = distmap score = x.fl...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
kbarkevich/RITnet
SurfaceLoss
false
7,015
[ "MIT" ]
1
5df66c656734aecd2987cf27d9359416b136af2e
https://github.com/kbarkevich/RITnet/tree/5df66c656734aecd2987cf27d9359416b136af2e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, epsilon=1e-05, softmax=True): super().__init__() self.weight_map = [] def forward(self, x, distmap): x = torch.softmax(x, dim=1) self.weight_map = distmap score = x.flatten(start_dim=2) * di...
GlobalMaxPooling
# 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 GlobalMaxPooling(nn.Module): def __init__(self, dim=0): super(self.__class__, self).__init__() self.dim = dim def forward(self, x): return x.max(dim=self.dim)[0] def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs()...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
kbrodt/clog-loss
GlobalMaxPooling
false
7,016
[ "MIT" ]
1
0831b3a01b079609a71490bb921633110927206c
https://github.com/kbrodt/clog-loss/tree/0831b3a01b079609a71490bb921633110927206c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dim=0): super(self.__class__, self).__init__() self.dim = dim def forward(self, x): return x.max(dim=self.dim)[0] def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): retur...
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 class BertLayerNorm(nn.Module): """ LayerNorm层 """ def __init__(self, hidden_size, eps=1e-12): super(BertLayerNorm, self).__init__() self.gamma = nn.Parameter(torch.ones(hidden_size)) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
kalanile/JDQA
BertAttention
false
7,017
[ "MIT" ]
1
68e1d0259d316b3577a1f2fafa773b50f1885762
https://github.com/kalanile/JDQA/tree/68e1d0259d316b3577a1f2fafa773b50f1885762
from _paritybench_helpers import _mock_config import math import torch from torch import nn class BertLayerNorm(nn.Module): """ LayerNorm层 """ def __init__(self, hidden_size, eps=1e-12): super().__init__() self.gamma = nn.Parameter(torch.ones(hidden_size)) self.beta = nn.Param...
GlobalSoftMaxPooling
# 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 GlobalSoftMaxPooling(nn.Module): def __init__(self, dim=0): super(self.__class__, self).__init__() self.dim = dim def forward(self, x): return torch.sum(x * torch.softmax(x, dim=self.dim), dim=self.dim) def get_inputs(): return [torch.ra...
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 ...
kbrodt/clog-loss
GlobalSoftMaxPooling
false
7,018
[ "MIT" ]
1
0831b3a01b079609a71490bb921633110927206c
https://github.com/kbrodt/clog-loss/tree/0831b3a01b079609a71490bb921633110927206c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dim=0): super(self.__class__, self).__init__() self.dim = dim def forward(self, x): return torch.sum(x * torch.softmax(x, dim=self.dim), dim=self.dim) def get_inputs(): return [torch.rand([4, 4, 4, 4]...
TemporalFusion
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 TemporalFusion(nn.Module): def __init__(self, nf, n_frame): super(TemporalFusion, self).__init__() self.n_frame = n_frame self.ref_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True) self.nbr_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True) 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
juyongjiang/Simple-SR
TemporalFusion
false
7,019
[ "MIT" ]
1
76820511abc04fbe6e4a79d23c67aee97406d563
https://github.com/juyongjiang/Simple-SR/tree/76820511abc04fbe6e4a79d23c67aee97406d563
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, nf, n_frame): super().__init__() self.n_frame = n_frame self.ref_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True) self.nbr_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True) self.up_conv = nn.Conv2d(nf * n...
ConvRelu
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F import torch.cuda import torch.backends.cudnn import torch.backends.mkl import torch.backends.cuda import torch.backends.quantized class ConvRelu(nn.Module): def __init__(self): super(ConvRelu, self).__init__() self.conv = torch.nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
kevin-14/intel-extension-for-pytorch
ConvRelu
false
7,020
[ "Apache-2.0" ]
1
f0cdcc602658340a957a964447d8e76bf413f66a
https://github.com/kevin-14/intel-extension-for-pytorch/tree/f0cdcc602658340a957a964447d8e76bf413f66a
import torch from torch import nn import torch.nn.functional as F import torch.cuda import torch.backends.cudnn import torch.backends.mkl import torch.backends.cuda import torch.backends.quantized class Model(nn.Module): def __init__(self): super().__init__() self.conv = torch.nn.Conv2d(16, 33, (...
DenseNet2D_up_block_concat
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 DenseNet2D_up_block_concat(nn.Module): def __init__(self, skip_channels, input_channels, output_channels, up_stride, dropout=False, prob=0): super(DenseNet2D_up_block_concat, self).__init__() self.conv11 = nn.Conv2d(skip_channels + input_channels, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
kbarkevich/RITnet
DenseNet2D_up_block_concat
false
7,021
[ "MIT" ]
1
5df66c656734aecd2987cf27d9359416b136af2e
https://github.com/kbarkevich/RITnet/tree/5df66c656734aecd2987cf27d9359416b136af2e
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, skip_channels, input_channels, output_channels, up_stride, dropout=False, prob=0): super().__init__() self.conv11 = nn.Conv2d(skip_channels + input_channels, output_channels, kernel_size=(1, 1), padd...
BiLinearSim
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 torch from torch.optim.lr_scheduler import * class BiLinearSim(torch.nn.Module): def __init__(self, config): super().__init__() self.linear = torch.nn.Linear(config.hidden_size, config. hidden_size, bias=False) def forward(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.optim.lr_scheduler import * assert_size_stride = torch._C._dynamo.gua...
kiminh/mt-dnn
BiLinearSim
false
7,022
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
from _paritybench_helpers import _mock_config import torch from torch.optim.lr_scheduler import * class Model(torch.nn.Module): def __init__(self, config): super().__init__() self.linear = torch.nn.Linear(config.hidden_size, config. hidden_size, bias=False) def forward(self, src,...
FreqEncoder
# 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 FreqEncoder(nn.Module): def __init__(self, input_dim, max_freq_log2, N_freqs, log_sampling=True, include_input=True, periodic_fns=(torch.sin, torch.cos)): super().__init__() self.input_dim = input_dim self.include_input = include_input ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
kevin-thankyou-lin/torch-ngp
FreqEncoder
false
7,023
[ "MIT" ]
1
2bb55fb09512e7e8680db434d787c6bea1fa1cda
https://github.com/kevin-thankyou-lin/torch-ngp/tree/2bb55fb09512e7e8680db434d787c6bea1fa1cda
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, max_freq_log2, N_freqs, log_sampling=True, include_input=True, periodic_fns=(torch.sin, torch.cos)): super().__init__() self.input_dim = input_dim self.include_input = include_input se...
Discriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Discriminator(nn.Module): def __init__(self): super(Discriminator, self).__init__() self.conv1 = nn.Conv2d(2, 16, 4, 2, 1, bias=False) self.act1 = nn.LeakyReLU(0.2, inplace=False) self.conv2 = nn.Conv2d(16, 32, 4, 2, 1, bias=False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
karavik18/Federated_Learning_for_Missing_MRI_Sequence
Discriminator
false
7,024
[ "Apache-2.0" ]
1
42924f8475f354e6b429d05867f99530aa485b96
https://github.com/karavik18/Federated_Learning_for_Missing_MRI_Sequence/tree/42924f8475f354e6b429d05867f99530aa485b96
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(2, 16, 4, 2, 1, bias=False) self.act1 = nn.LeakyReLU(0.2, inplace=False) self.conv2 = nn.Conv2d(16, 32, 4, 2, 1, bias=False) self.act2 = nn.LeakyReLU(0....
CeCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules....
kiminh/mt-dnn
CeCriterion
false
7,025
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
FC
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 FC(nn.Module): def __init__(self, cin, cout): super(FC, self).__init__() self.fc1 = nn.Linear(cin, 200) self.fc2 = nn.Linear(200, 100) self.fc3 = nn.Linear(100, 40) self.fc4 = nn.Linear(40, 10) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
kim-younghan/Instance3D
FC
false
7,026
[ "MIT" ]
1
2b7fc3f68594763c47033b55d692ab8ef6d0304a
https://github.com/kim-younghan/Instance3D/tree/2b7fc3f68594763c47033b55d692ab8ef6d0304a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, cin, cout): super().__init__() self.fc1 = nn.Linear(cin, 200) self.fc2 = nn.Linear(200, 100) self.fc3 = nn.Linear(100, 40) self.fc4 = nn.Linear(40, 10) sel...
MseCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * assert_siz...
kiminh/mt-dnn
MseCriterion
false
7,027
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
Conv3D
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Conv3D(nn.Module): def __init__(self, cin, cout): super(Conv3D, self).__init__() self.conv1 = nn.Conv2d(cin, 8, 3, 1, 1) self.conv2 = nn.Conv2d(8, 16, 3, 1, 1) self.conv3 = nn.Conv2d(16, 32, 3, 1, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
kim-younghan/Instance3D
Conv3D
false
7,028
[ "MIT" ]
1
2b7fc3f68594763c47033b55d692ab8ef6d0304a
https://github.com/kim-younghan/Instance3D/tree/2b7fc3f68594763c47033b55d692ab8ef6d0304a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, cin, cout): super().__init__() self.conv1 = nn.Conv2d(cin, 8, 3, 1, 1) self.conv2 = nn.Conv2d(8, 16, 3, 1, 1) self.conv3 = nn.Conv2d(16, 32, 3, 1, 1) self.conv4 = ...
KlCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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....
kiminh/mt-dnn
KlCriterion
false
7,029
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
HLCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
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....
kiminh/mt-dnn
HLCriterion
false
7,030
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * class Criterion(_Loss): def __init__(self, alpha=1.0, name='criterion'): super().__init__() """Alpha is used to weight each loss term """ self.alpha = alpha ...
NsKlCriterion
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * def stable_kl(logit, target, epsilon=1e-06, reduce=True): logit = logit.view(-1, logit.size(-1)).float() target = target.view(-1, target.size(-1)).float() bs = logit.size(0) p = ...
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.functi...
kiminh/mt-dnn
NsKlCriterion
false
7,031
[ "MIT" ]
1
133884b380244dbe74acc4d7507e551b2c5035b3
https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3
import torch import torch.nn.functional as F from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import * def stable_kl(logit, target, epsilon=1e-06, reduce=True): logit = logit.view(-1, logit.size(-1)).float() target = target.view(-1, target.size(-1)).float() bs = logit.size(0) p = ...
SelfAttentionWide
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 def mask_(matrices, maskval=0.0, mask_diagonal=True): """ Masks out all values in the given batch of matrices where i <= j holds, i < j if mask_diagonal is false In place operation :param tns: :return: """ _b, h, w = m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
kewlcoder/former
SelfAttentionWide
false
7,032
[ "MIT" ]
1
975cbdeedc69dd4fc3df6732fffbeb1c020b6982
https://github.com/kewlcoder/former/tree/975cbdeedc69dd4fc3df6732fffbeb1c020b6982
import torch from torch import nn import torch.nn.functional as F def mask_(matrices, maskval=0.0, mask_diagonal=True): """ Masks out all values in the given batch of matrices where i <= j holds, i < j if mask_diagonal is false In place operation :param tns: :return: """ _b, h, w = m...