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
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 from torch.nn import functional as F class TVLoss(nn.Module): def forward(self, input): input = F.pad(input, (0, 1, 0, 1), 'replicate') x_diff = input[..., :-1, 1:] - input[..., :-1, :-1] y_diff = input[..., 1:, :-1] - input[..., :-1, :-1] diff =...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
aradalienzzzz/vqgan-clip-app
TVLoss
false
6,227
[ "MIT" ]
1
f5a16d792da5ad0ede855254fe393f6b990c8e1d
https://github.com/aradalienzzzz/vqgan-clip-app/tree/f5a16d792da5ad0ede855254fe393f6b990c8e1d
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def forward(self, input): input = F.pad(input, (0, 1, 0, 1), 'replicate') x_diff = input[..., :-1, 1:] - input[..., :-1, :-1] y_diff = input[..., 1:, :-1] - input[..., :-1, :-1] diff = ...
StdConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class StdConv2d(nn.Conv2d): def forward(self, x): w = self.weight v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False) w = (w - m) / torch.sqrt(v + 1e-05) return F.conv2d(x, w, self.bias, self.stri...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
aris-mukherjee/TransUNet-modified
StdConv2d
false
6,228
[ "Apache-2.0" ]
1
185307b677fd6ee05604213c90e14e028fab476a
https://github.com/aris-mukherjee/TransUNet-modified/tree/185307b677fd6ee05604213c90e14e028fab476a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Conv2d): def forward(self, x): w = self.weight v, m = torch.var_mean(w, dim=[1, 2, 3], keepdim=True, unbiased=False) w = (w - m) / torch.sqrt(v + 1e-05) return F.conv2d(x, w, self.bias, self.stride, ...
LearnedPositionalEmbedding1D
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.autograd class LearnedPositionalEmbedding1D(nn.Module): """Adds (optionally learned) positional embeddings to the inputs.""" def __init__(self, seq_len, dim): super().__init__() self.pos_embedding = nn.Parameter(torch.zeros(1, seq...
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 import torch.nn import torch.autograd assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
arkel23/yuwu
LearnedPositionalEmbedding1D
false
6,229
[ "MIT" ]
1
4dcf0e18693e09a947569ddcc7cb3ff00c7c674a
https://github.com/arkel23/yuwu/tree/4dcf0e18693e09a947569ddcc7cb3ff00c7c674a
import torch from torch import nn import torch.nn import torch.autograd class Model(nn.Module): """Adds (optionally learned) positional embeddings to the inputs.""" def __init__(self, seq_len, dim): super().__init__() self.pos_embedding = nn.Parameter(torch.zeros(1, seq_len, dim)) def fo...
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 math import torch import torch.nn as nn from torch.nn.parameter import Parameter class GraphConv(nn.Module): def __init__(self, in_features, out_features, bias=False): super(GraphConv, self).__init__() self.in_features = in_features self.out_features = out_features self.wei...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import math import torch.nn a...
ardihikaru/learn-to-cluster
BasicBlock
false
6,230
[ "MIT" ]
1
d7a5ea0946f7b402f8878bfd608bf3e0dc9a26ca
https://github.com/ardihikaru/learn-to-cluster/tree/d7a5ea0946f7b402f8878bfd608bf3e0dc9a26ca
import math import torch import torch.nn as nn from torch.nn.parameter import Parameter class GraphConv(nn.Module): def __init__(self, in_features, out_features, bias=False): super().__init__() self.in_features = in_features self.out_features = out_features self.weight = Parameter...
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.nn.functional as F import torch.utils.data.distributed class FilterResponseNormNd(nn.Module): def __init__(self, ndim, num_features, eps=1e-06, learnable_eps=False): """ Input Variables: ---------------- ndim: An integer indicati...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
aouedions11/SSFL-Benchmarking-Semi-supervised-Federated-Learning
BasicBlock
false
6,231
[ "MIT" ]
1
78aec81919bf95ed4677d0e0a4ebbbe3be455742
https://github.com/aouedions11/SSFL-Benchmarking-Semi-supervised-Federated-Learning/tree/78aec81919bf95ed4677d0e0a4ebbbe3be455742
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data.distributed class FilterResponseNormNd(nn.Module): def __init__(self, ndim, num_features, eps=1e-06, learnable_eps=False): """ Input Variables: ---------------- ndim: An integer indicati...
Embedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 as t import torch.nn as nn import torch.utils.data class Embedding(nn.Module): """ Redefining torch.nn.Embedding (see docs for that function) """ def __init__(self, num_embeddings, embedding_dim, padding_idx=None, _weight=None): super().__i...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch as t import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_...
arjunsesh/lrr-neurips
Embedding
false
6,232
[ "MIT" ]
1
d78106daec1e729b02a0452f74a37bf004ed243c
https://github.com/arjunsesh/lrr-neurips/tree/d78106daec1e729b02a0452f74a37bf004ed243c
import torch import numpy as np import torch as t import torch.nn as nn import torch.utils.data class Model(nn.Module): """ Redefining torch.nn.Embedding (see docs for that function) """ def __init__(self, num_embeddings, embedding_dim, padding_idx=None, _weight=None): super().__init_...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn class Attention(nn.Module): """Attention Layer merging Encoder and Decoder Attributes: hidden_size (int): The number of features in the hidden state h Reference: * https://github.com/bentrevett/pytorch-seq2seq ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
appleparan/mise.py
Attention
false
6,233
[ "MIT" ]
1
a77ea51be37a739928600c66d168d69b78bc0c4b
https://github.com/appleparan/mise.py/tree/a77ea51be37a739928600c66d168d69b78bc0c4b
import torch import torch.nn.functional as F from torch import nn class Model(nn.Module): """Attention Layer merging Encoder and Decoder Attributes: hidden_size (int): The number of features in the hidden state h Reference: * https://github.com/bentrevett/pytorch-seq2seq ...
FilterResponseNormNd
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data.distributed class FilterResponseNormNd(nn.Module): def __init__(self, ndim, num_features, eps=1e-06, learnable_eps=False): """ Input Variables: ---------------- ndim: An integer indicating the number of dimensions of t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
aouedions11/SSFL-Benchmarking-Semi-supervised-Federated-Learning
FilterResponseNormNd
false
6,234
[ "MIT" ]
1
78aec81919bf95ed4677d0e0a4ebbbe3be455742
https://github.com/aouedions11/SSFL-Benchmarking-Semi-supervised-Federated-Learning/tree/78aec81919bf95ed4677d0e0a4ebbbe3be455742
import torch import torch.nn as nn import torch.utils.data.distributed class Model(nn.Module): def __init__(self, ndim, num_features, eps=1e-06, learnable_eps=False): """ Input Variables: ---------------- ndim: An integer indicating the number of dimensions of the expected inp...
PrimaryCapsules
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 squash(x, dim=-1, epsilon=1e-08): norm = (x ** 2).sum(dim=dim, keepdim=True) x = norm / (norm + 1) * x / (torch.sqrt(norm) + epsilon) return x class PrimaryCapsules(nn.Module): def __init__(self, in_features, capsules_num, capsules_dim): super(PrimaryC...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
ashawkey/CapsNet.pytorch
PrimaryCapsules
false
6,235
[ "MIT" ]
1
3b796b572bbabe79cc445c35913cd3584733aedf
https://github.com/ashawkey/CapsNet.pytorch/tree/3b796b572bbabe79cc445c35913cd3584733aedf
import torch import torch.nn as nn def squash(x, dim=-1, epsilon=1e-08): norm = (x ** 2).sum(dim=dim, keepdim=True) x = norm / (norm + 1) * x / (torch.sqrt(norm) + epsilon) return x class Model(nn.Module): def __init__(self, in_features, capsules_num, capsules_dim): super().__init__() ...
MNL
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 MNL(nn.Module): """ Implementation of MNL choice model as a Pytorch module """ def __init__(self, n): super(MNL, self).__init__() self.u = nn.Parameter(torch.nn.init.normal(torch.Tensor(n))) self.n = n 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 import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
arjunsesh/lrr-neurips
MNL
false
6,236
[ "MIT" ]
1
d78106daec1e729b02a0452f74a37bf004ed243c
https://github.com/arjunsesh/lrr-neurips/tree/d78106daec1e729b02a0452f74a37bf004ed243c
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): """ Implementation of MNL choice model as a Pytorch module """ def __init__(self, n): super().__init__() self.u = nn.Parameter(torch.nn.init.normal(torch.Tensor(n))) self.n = n self.m = ...
ConcatELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class ConcatELU(nn.Module): """Activation function that applies ELU in both direction (inverted and plain). Allows non-linearity while providing strong gradients for any input (important for final convolution) """ def forward(self, x...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
ashutoshml/lightning-tutorials
ConcatELU
false
6,237
[ "Apache-2.0" ]
1
898b8b6f9852c0b80f034a3187bc1cd34dd521ce
https://github.com/ashutoshml/lightning-tutorials/tree/898b8b6f9852c0b80f034a3187bc1cd34dd521ce
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Activation function that applies ELU in both direction (inverted and plain). Allows non-linearity while providing strong gradients for any input (important for final convolution) """ def forward(self, x): ...
MLP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SharedDropout(nn.Module): """ SharedDropout differs from the vanilla dropout strategy in that the dropout mask is shared across one dimension. Args: p (float): The probability of an element to be zeroed. Default: 0.5. batch_first (b...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ashim95/parser
MLP
false
6,238
[ "MIT" ]
1
61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
https://github.com/ashim95/parser/tree/61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
import torch import torch.nn as nn class SharedDropout(nn.Module): """ SharedDropout differs from the vanilla dropout strategy in that the dropout mask is shared across one dimension. Args: p (float): The probability of an element to be zeroed. Default: 0.5. batch_first (b...
BP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 BP(nn.Module): """ Implementation of the Bastell-Polking k-th order model as a pytorch module """ def __init__(self, n, k, d): """ Initializes a k-th order Batsell-Polking model Args: n- number of items ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
arjunsesh/lrr-neurips
BP
false
6,239
[ "MIT" ]
1
d78106daec1e729b02a0452f74a37bf004ed243c
https://github.com/arjunsesh/lrr-neurips/tree/d78106daec1e729b02a0452f74a37bf004ed243c
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): """ Implementation of the Bastell-Polking k-th order model as a pytorch module """ def __init__(self, n, k, d): """ Initializes a k-th order Batsell-Polking model Args: n- number of ite...
ScalarMix
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ScalarMix(nn.Module): """ Computes a parameterised scalar mixture of :math:`N` tensors, :math:`mixture = \\gamma * \\sum_{k}(s_k * tensor_k)` where :math:`s = \\mathrm{softmax}(w)`, with :math:`w` and :math:`\\gamma` scalar parameters. Args: n_layers (...
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...
ashim95/parser
ScalarMix
false
6,240
[ "MIT" ]
1
61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
https://github.com/ashim95/parser/tree/61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
import torch import torch.nn as nn class Model(nn.Module): """ Computes a parameterised scalar mixture of :math:`N` tensors, :math:`mixture = \\gamma * \\sum_{k}(s_k * tensor_k)` where :math:`s = \\mathrm{softmax}(w)`, with :math:`w` and :math:`\\gamma` scalar parameters. Args: n_layers (int)...
CapsuleLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class CapsuleLoss(nn.Module): def __init__(self): super(CapsuleLoss, self).__init__() def forward(self, inputs, labels, logits, recons): batch_size = inputs.shape[0] left = F.relu(0.9 - logits, inplace=True) ** 2 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
ashawkey/CapsNet.pytorch
CapsuleLoss
false
6,241
[ "MIT" ]
1
3b796b572bbabe79cc445c35913cd3584733aedf
https://github.com/ashawkey/CapsNet.pytorch/tree/3b796b572bbabe79cc445c35913cd3584733aedf
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, inputs, labels, logits, recons): batch_size = inputs.shape[0] left = F.relu(0.9 - logits, inplace=True) ** 2 right = F.relu(logi...
BCEIoULoss
# 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 typing import Callable from functools import partial from torch import nn import torch.distributed from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.backends def get_activation_fn(activation: 'str'=None): ...
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 typing...
arjunshibu/catalyst
BCEIoULoss
false
6,242
[ "Apache-2.0" ]
1
7160540f09530b803e5664e57db3e951fdc4dab3
https://github.com/arjunshibu/catalyst/tree/7160540f09530b803e5664e57db3e951fdc4dab3
import torch from typing import Callable from functools import partial from torch import nn import torch.distributed from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.backends def get_activation_fn(activation: 'str'=None): ...
Sigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class Sigmoid(ActivationFunction): def forward(self, x): return 1 / (1 + torch.exp(-x)) def...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ashutoshml/lightning-tutorials
Sigmoid
false
6,243
[ "Apache-2.0" ]
1
898b8b6f9852c0b80f034a3187bc1cd34dd521ce
https://github.com/ashutoshml/lightning-tutorials/tree/898b8b6f9852c0b80f034a3187bc1cd34dd521ce
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class Model(ActivationFunction): def forward(self, x): return 1 / (1 + torch.exp(-x)) def g...
L2Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class L2Norm(nn.Module): def __init__(self, n_channels, scale=1.0): super(L2Norm, self).__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(torch.Tensor(self.n_channels)) self.wei...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
ashuk203/face-alignment
L2Norm
false
6,244
[ "BSD-3-Clause" ]
1
1f6452ae05ede0db9bbc48331d67d8b239fa9994
https://github.com/ashuk203/face-alignment/tree/1f6452ae05ede0db9bbc48331d67d8b239fa9994
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_channels, scale=1.0): super().__init__() self.n_channels = n_channels self.scale = scale self.eps = 1e-10 self.weight = nn.Parameter(torch.Tensor(self.n_channels)) self.weight.data *= 0...
Biaffine
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Biaffine(nn.Module): """ Biaffine layer for first-order scoring. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y)` of the vector pair :math:`(x, y)` is computed as :math:`x^T W y`, in which :math:`x` and :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 torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ashim95/parser
Biaffine
false
6,245
[ "MIT" ]
1
61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
https://github.com/ashim95/parser/tree/61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
import torch import torch.nn as nn class Model(nn.Module): """ Biaffine layer for first-order scoring. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y)` of the vector pair :math:`(x, y)` is computed as :math:`x^T W y`, in which :math:`x` and :math...
CDM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CDM(nn.Module): """ Implementation of the CDM choice model as a Pytorch module """ def __init__(self, n, d): """ Initializes a CDM model Args: n- number of items in the universe d- number of 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 import triton_helpers from torch._inductor.runtime....
arjunsesh/lrr-neurips
CDM
false
6,246
[ "MIT" ]
1
d78106daec1e729b02a0452f74a37bf004ed243c
https://github.com/arjunsesh/lrr-neurips/tree/d78106daec1e729b02a0452f74a37bf004ed243c
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): """ Implementation of the CDM choice model as a Pytorch module """ def __init__(self, n, d): """ Initializes a CDM model Args: n- number of items in the universe d- number of di...
Tanh
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class Tanh(ActivationFunction): def forward(self, x): x_exp, neg_x_exp = torch.exp(x), torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ashutoshml/lightning-tutorials
Tanh
false
6,247
[ "Apache-2.0" ]
1
898b8b6f9852c0b80f034a3187bc1cd34dd521ce
https://github.com/ashutoshml/lightning-tutorials/tree/898b8b6f9852c0b80f034a3187bc1cd34dd521ce
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class Model(ActivationFunction): def forward(self, x): x_exp, neg_x_exp = torch.exp(x), torch...
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.optim.lr_scheduler import * from torch.nn import Parameter from torch.nn.parameter import Parameter class LayerNorm(nn.Module): def __init__(self, hidden_size, eps=0.0001): super(LayerNorm, self).__init__() self.alpha = Parameter(torch.ones(1, 1, hidd...
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.optim.lr_scheduler import * from torch.nn impo...
ashishbaghudana/san_mrc
LayerNorm
false
6,248
[ "BSD-3-Clause" ]
1
03ed7d94c735f1fe2854bb9c208385b5fde44905
https://github.com/ashishbaghudana/san_mrc/tree/03ed7d94c735f1fe2854bb9c208385b5fde44905
import torch import torch.nn as nn from torch.optim.lr_scheduler import * from torch.nn import Parameter from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, hidden_size, eps=0.0001): super().__init__() self.alpha = Parameter(torch.ones(1, 1, hidden_size)) s...
ReLU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class ReLU(ActivationFunction): def forward(self, x): return x * (x > 0).float() def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ashutoshml/lightning-tutorials
ReLU
false
6,249
[ "Apache-2.0" ]
1
898b8b6f9852c0b80f034a3187bc1cd34dd521ce
https://github.com/ashutoshml/lightning-tutorials/tree/898b8b6f9852c0b80f034a3187bc1cd34dd521ce
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class Model(ActivationFunction): def forward(self, x): return x * (x > 0).float() def get_i...
ELU
# 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 ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class ELU(ActivationFunction): def forward(self, x): return torch.where(x > 0, x, torch.exp(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.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ashutoshml/lightning-tutorials
ELU
false
6,250
[ "Apache-2.0" ]
1
898b8b6f9852c0b80f034a3187bc1cd34dd521ce
https://github.com/ashutoshml/lightning-tutorials/tree/898b8b6f9852c0b80f034a3187bc1cd34dd521ce
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class Model(ActivationFunction): def forward(self, x): return torch.where(x > 0, x, torch.exp...
LeakyReLU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class LeakyReLU(ActivationFunction): def __init__(self, alpha=0.1): super().__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ashutoshml/lightning-tutorials
LeakyReLU
false
6,251
[ "Apache-2.0" ]
1
898b8b6f9852c0b80f034a3187bc1cd34dd521ce
https://github.com/ashutoshml/lightning-tutorials/tree/898b8b6f9852c0b80f034a3187bc1cd34dd521ce
import torch import torch.nn as nn class ActivationFunction(nn.Module): def __init__(self): super().__init__() self.name = self.__class__.__name__ self.config = {'name': self.name} class Model(ActivationFunction): def __init__(self, alpha=0.1): super().__init__() se...
MultiplyLuminance
# 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 class MultiplyLuminance(torch.nn.Module): def __init__(self): super(MultiplyLuminance, self).__init__() def forward(self, color, luminance): return color * (1 + luminance) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def g...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_...
ashwinpn/Computer-Vision
MultiplyLuminance
false
6,252
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, color, luminance): return color * (1 + luminance) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
GCNLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 GCNLayer(nn.Module): def __init__(self, c_in, c_out): super().__init__() self.projection = nn.Linear(c_in, c_out) def forward(self, node_feats, adj_matrix): """ Args: node_feats: Tensor with node features of shape [batch_si...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ashutoshml/lightning-tutorials
GCNLayer
false
6,253
[ "Apache-2.0" ]
1
898b8b6f9852c0b80f034a3187bc1cd34dd521ce
https://github.com/ashutoshml/lightning-tutorials/tree/898b8b6f9852c0b80f034a3187bc1cd34dd521ce
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, c_in, c_out): super().__init__() self.projection = nn.Linear(c_in, c_out) def forward(self, node_feats, adj_matrix): """ Args: node_feats: Tensor with node features of shape [batch_size,...
FillUpLuminance
# 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 class FillUpLuminance(torch.nn.Module): def __init__(self): super(FillUpLuminance, self).__init__() def forward(self, color, luminance): return color + (1 - color) * luminance def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_...
ashwinpn/Computer-Vision
FillUpLuminance
false
6,254
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, color, luminance): return color + (1 - color) * luminance def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): retur...
Triaffine
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Triaffine(nn.Module): """ Triaffine layer for second-order scoring. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y, z)` of the vector triple :math:`(x, y, z)` is computed as :math:`x^T z^T W y`. Usually, :...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ashim95/parser
Triaffine
false
6,255
[ "MIT" ]
1
61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
https://github.com/ashim95/parser/tree/61e9cd6bf16dcf1aa2b9d51b3a6c04ed048b3199
import torch import torch.nn as nn class Model(nn.Module): """ Triaffine layer for second-order scoring. This function has a tensor of weights :math:`W` and bias terms if needed. The score :math:`s(x, y, z)` of the vector triple :math:`(x, y, z)` is computed as :math:`x^T z^T W y`. Usually, :math...
AvgReducePool1d
# 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 AvgReducePool1d(nn.Module): """A subclass of :torch_nn:`Module`. Avg Pool layer for 1D inputs. The same as :torch_nn:`AvgPool1d` except that the pooling dimension is entirely reduced (i.e., `pool_size=input_length`). """ def forward(self, input: 'torch.Tens...
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...
atif93/texar-pytorch
AvgReducePool1d
false
6,256
[ "Apache-2.0" ]
1
88163619ec69382e1bbe57fa8bce06260bfc76a2
https://github.com/atif93/texar-pytorch/tree/88163619ec69382e1bbe57fa8bce06260bfc76a2
import torch from torch import nn class Model(nn.Module): """A subclass of :torch_nn:`Module`. Avg Pool layer for 1D inputs. The same as :torch_nn:`AvgPool1d` except that the pooling dimension is entirely reduced (i.e., `pool_size=input_length`). """ def forward(self, input: 'torch.Tensor') ->tor...
CoSirenModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 class CoSirenModule(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super(CoSirenModule, self).__init__() self.linear = torch.nn.Linear(in_features, out_features // 2) init_bounds = math.sqrt(24 / in_features...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math i...
ashwinpn/Computer-Vision
CoSirenModule
false
6,257
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import math import torch import torch.nn class Model(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super().__init__() self.linear = torch.nn.Linear(in_features, out_features // 2) init_bounds = math.sqrt(24 / in_features) * weight_multiplier ...
PotCoSirenModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 class PotCoSirenModule(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super(PotCoSirenModule, self).__init__() self.linear = torch.nn.Linear(in_features, out_features // 2) torch.nn.init.uniform_(self.linear.weight, a=-...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
ashwinpn/Computer-Vision
PotCoSirenModule
false
6,258
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super().__init__() self.linear = torch.nn.Linear(in_features, out_features // 2) torch.nn.init.uniform_(self.linear.weight, a=-weight_multiplier, b= ...
Autoencoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Autoencoder(nn.Module): def __init__(self): super(Autoencoder, self).__init__() self.conv1 = nn.Conv2d(3, 6, padding=2, kernel_size=5) self.maxpool1 = nn.MaxPool2d(4, stride=1, return_indices=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
aoxolotl/slr
Autoencoder
false
6,259
[ "MIT" ]
1
20a4a9036f2dc3a61745072f89b0f5bb1cc51e1b
https://github.com/aoxolotl/slr/tree/20a4a9036f2dc3a61745072f89b0f5bb1cc51e1b
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 6, padding=2, kernel_size=5) self.maxpool1 = nn.MaxPool2d(4, stride=1, return_indices=True) self.conv...
Embbed2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 class Embbed2(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super(Embbed2, self).__init__() self.b = 2.0 ** torch.linspace(0, weight_multiplier, out_features // in_features) - 1 self.b = torch.nn.Parameter(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
ashwinpn/Computer-Vision
Embbed2
false
6,260
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super().__init__() self.b = 2.0 ** torch.linspace(0, weight_multiplier, out_features // in_features) - 1 self.b = torch.nn.Parameter(torch.reshape(t...
SkipModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 class SkipModule(torch.nn.Module): def __init__(self, in_features, out_features, activation=torch.nn.ReLU()): super(SkipModule, self).__init__() self.linear1 = torch.nn.Linear(in_features, out_features, activation) self.linear2 = torch.nn.Linear(out_features, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
ashwinpn/Computer-Vision
SkipModule
false
6,261
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, in_features, out_features, activation=torch.nn.ReLU()): super().__init__() self.linear1 = torch.nn.Linear(in_features, out_features, activation) self.linear2 = torch.nn.Linear(out_features, out_features, activat...
BarlowTwinsLoss
# 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 BarlowTwinsLoss(nn.Module): def __init__(self, batch_size, lambda_coeff=0.005, z_dim=128): super().__init__() self.z_dim = z_dim self.batch_size = batch_size self.lambda_coeff = lambda_coeff def off_diagonal_ele(self, x): n, 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 libdevice import torch.nn as ...
ashutoshml/lightning-tutorials
BarlowTwinsLoss
false
6,262
[ "Apache-2.0" ]
1
898b8b6f9852c0b80f034a3187bc1cd34dd521ce
https://github.com/ashutoshml/lightning-tutorials/tree/898b8b6f9852c0b80f034a3187bc1cd34dd521ce
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, batch_size, lambda_coeff=0.005, z_dim=128): super().__init__() self.z_dim = z_dim self.batch_size = batch_size self.lambda_coeff = lambda_coeff def off_diagonal_ele(self, x): n, m = x.shape ...
L2Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product import torch.nn.init as init class L2Norm(nn.Module): def __init__(self, n_channels, scale): super(L2Norm, self).__init__() self.n_channels = n_channels self.gamma = scale or None ...
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 math import sqrt as sqrt from itertools import produ...
ashwath007/amenity-detection
L2Norm
false
6,263
[ "Apache-2.0" ]
1
acb885eb4d791acc6e65237445a4fc6830e4d30c
https://github.com/ashwath007/amenity-detection/tree/acb885eb4d791acc6e65237445a4fc6830e4d30c
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product import torch.nn.init as init class Model(nn.Module): def __init__(self, n_channels, scale): super().__init__() self.n_channels = n_channels self.gamma = scale or None self.eps...
SirenModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 class SirenModule(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super(SirenModule, self).__init__() self.linear = torch.nn.Linear(in_features, out_features) init_bounds = math.sqrt(6 / in_features) * weight...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math i...
ashwinpn/Computer-Vision
SirenModule
false
6,264
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import math import torch import torch.nn class Model(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super().__init__() self.linear = torch.nn.Linear(in_features, out_features) init_bounds = math.sqrt(6 / in_features) * weight_multiplier tor...
Normalization
# 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 Normalization(nn.Module): def __init__(self, mean=torch.zeros(3), std=torch.ones(3)): super(Normalization, self).__init__() self.mean = nn.Parameter(mean.view(-1, 1, 1), requires_grad=False) self.std = nn.Parameter(std.view(-1, 1, 1), requires_grad=...
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...
asjir/adain
Normalization
false
6,265
[ "MIT" ]
1
1d0f70f161e485ce61ea57ab619d66e8f4ccadde
https://github.com/asjir/adain/tree/1d0f70f161e485ce61ea57ab619d66e8f4ccadde
import torch from torch import nn class Model(nn.Module): def __init__(self, mean=torch.zeros(3), std=torch.ones(3)): super().__init__() self.mean = nn.Parameter(mean.view(-1, 1, 1), requires_grad=False) self.std = nn.Parameter(std.view(-1, 1, 1), requires_grad=False) def forward(sel...
BCELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class BCELoss(nn.Module): """Binary Cross Entropy loss.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.binary_cross_entropy self.use_target_weight = use_target_we...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
atoaiari/mmpose
BCELoss
false
6,266
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Binary Cross Entropy loss.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.binary_cross_entropy self.use_target_weight = use_target_weig...
KLDLossWithStandardGaussian
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class KLDLossWithStandardGaussian(nn.Module): def forward(self, mu, logvar): return -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp()) def get_inputs(): return [torch.rand([4, 4, 4, 4]), 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 from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
atmacvit/meronymnet
KLDLossWithStandardGaussian
false
6,267
[ "MIT" ]
1
47e1a7caadc0f770439bb26a93b885f790f62804
https://github.com/atmacvit/meronymnet/tree/47e1a7caadc0f770439bb26a93b885f790f62804
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def forward(self, mu, logvar): return -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp()) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
KLDLossWithStandardGaussianNoReduction
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class KLDLossWithStandardGaussianNoReduction(nn.Module): def forward(self, mu, logvar): KLD = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp(), dim=-1) return KLD def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.utils.data assert_size_stride = torch....
atmacvit/meronymnet
KLDLossWithStandardGaussianNoReduction
false
6,268
[ "MIT" ]
1
47e1a7caadc0f770439bb26a93b885f790f62804
https://github.com/atmacvit/meronymnet/tree/47e1a7caadc0f770439bb26a93b885f790f62804
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def forward(self, mu, logvar): KLD = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp(), dim=-1) return KLD def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inp...
MSELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class MSELoss(nn.Module): """MSE loss for coordinate regression.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.mse_loss self.use_target_weight = use_target_weigh...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dyna...
atoaiari/mmpose
MSELoss
false
6,269
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """MSE loss for coordinate regression.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.mse_loss self.use_target_weight = use_target_weight ...
SpatialEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 class SpatialEmbedding(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super(SpatialEmbedding, self).__init__() self.b = torch.zeros((in_features, out_features)) self.b.normal_(0, weight_multiplier) self.b = torc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
ashwinpn/Computer-Vision
SpatialEmbedding
false
6,270
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super().__init__() self.b = torch.zeros((in_features, out_features)) self.b.normal_(0, weight_multiplier) self.b = torch.nn.Parameter(2.0 ** self.b - 1)...
KLDLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class KLDLoss(nn.Module): def forward(self, mu1, logvar1, mu2, logvar2): batch_size = mu1.shape[0] sigma1 = logvar1.mul(0.5).exp() sigma2 = logvar2.mul(0.5).exp() kld = torch.log(sigma2 / sigma1 + 1e-08) + (torch.exp(logva...
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 ...
atmacvit/meronymnet
KLDLoss
false
6,271
[ "MIT" ]
1
47e1a7caadc0f770439bb26a93b885f790f62804
https://github.com/atmacvit/meronymnet/tree/47e1a7caadc0f770439bb26a93b885f790f62804
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def forward(self, mu1, logvar1, mu2, logvar2): batch_size = mu1.shape[0] sigma1 = logvar1.mul(0.5).exp() sigma2 = logvar2.mul(0.5).exp() kld = torch.log(sigma2 / sigma1 + 1e-08) + (torch.exp(logvar1...
CuboidPoseHead
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class CuboidPoseHead(nn.Module): def __init__(self, beta): """Get results from the 3D human pose heatmap. Instead of obtaining maximums on the heatmap, this module regresses the coordinates of keypoints via integral pose r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
atoaiari/mmpose
CuboidPoseHead
false
6,272
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, beta): """Get results from the 3D human pose heatmap. Instead of obtaining maximums on the heatmap, this module regresses the coordinates of keypoints via integral pose regression...
KLDLossNoReduction
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class KLDLossNoReduction(nn.Module): def forward(self, mu1, logvar1, mu2, logvar2): sigma1 = logvar1.mul(0.5).exp() sigma2 = logvar2.mul(0.5).exp() kld = torch.log(sigma2 / sigma1 + 1e-08) + (torch.exp(logvar1) + ( mu1...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.utils.data assert_size_stride = torch....
atmacvit/meronymnet
KLDLossNoReduction
false
6,273
[ "MIT" ]
1
47e1a7caadc0f770439bb26a93b885f790f62804
https://github.com/atmacvit/meronymnet/tree/47e1a7caadc0f770439bb26a93b885f790f62804
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def forward(self, mu1, logvar1, mu2, logvar2): sigma1 = logvar1.mul(0.5).exp() sigma2 = logvar2.mul(0.5).exp() kld = torch.log(sigma2 / sigma1 + 1e-08) + (torch.exp(logvar1) + ( mu1 - mu2) ** 2)...
SimpleSpatialEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 class SimpleSpatialEmbedding(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super(SimpleSpatialEmbedding, self).__init__() self.b = torch.zeros((in_features, out_features)) self.b.normal_(0, weight_multiplier) 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 math as tl_math import torch....
ashwinpn/Computer-Vision
SimpleSpatialEmbedding
false
6,274
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super().__init__() self.b = torch.zeros((in_features, out_features)) self.b.normal_(0, weight_multiplier) self.b = torch.nn.Parameter(2.0 ** self.b - 1)...
MPJPELoss
# 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 MPJPELoss(nn.Module): """MPJPE (Mean Per Joint Position Error) loss. Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the loss. Default:...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
atoaiari/mmpose
MPJPELoss
false
6,275
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import torch import torch.nn as nn class Model(nn.Module): """MPJPE (Mean Per Joint Position Error) loss. Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the loss. Default: 1.0...
SelfGate
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn import functional as F class SelfGate(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.proj = nn.Linear(dim_in, dim_out * 2) def forward(self, x): x = self.proj(x) x, gate = x.chunk(2, dim=-1) x ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
awesome-archive/AI-Writer
SelfGate
false
6,276
[ "BSD-3-Clause" ]
1
abdcd5582f81fca2f677a020360654865bf82065
https://github.com/awesome-archive/AI-Writer/tree/abdcd5582f81fca2f677a020360654865bf82065
import torch import torch.nn as nn from torch.nn import functional as F class Model(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.proj = nn.Linear(dim_in, dim_out * 2) def forward(self, x): x = self.proj(x) x, gate = x.chunk(2, dim=-1) x = x...
GELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn import torch.nn.functional as F class GELU(nn.Module): def __init__(self): super(GELU, self).__init__() def forward(self, x): return 0.5 * x * (1 + F.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) def get_inputs...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
au55555/classification-pytorch
GELU
false
6,277
[ "MIT" ]
1
1937599ae6e688ed7af7470f69964fb6f97241c4
https://github.com/au55555/classification-pytorch/tree/1937599ae6e688ed7af7470f69964fb6f97241c4
import torch import numpy as np from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): return 0.5 * x * (1 + F.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) def get_inputs(): r...
Selection
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Selection(nn.Module): """ Selection neurons to sample from a latent representation for a decoder agent. An abstract representation :math:`l_i` is disturbed by a value :math:`r_i` sampled from a normal standard distribution which is scaled by the selection neur...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
aswanthkrishna/reinforced_scinet
Selection
false
6,278
[ "Apache-2.0" ]
1
b520f0c73bb1cdf0d0595f0df32372c96946d963
https://github.com/aswanthkrishna/reinforced_scinet/tree/b520f0c73bb1cdf0d0595f0df32372c96946d963
import torch import torch.nn as nn class Model(nn.Module): """ Selection neurons to sample from a latent representation for a decoder agent. An abstract representation :math:`l_i` is disturbed by a value :math:`r_i` sampled from a normal standard distribution which is scaled by the selection neuron :...
SmoothL1Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class SmoothL1Loss(nn.Module): """SmoothL1Loss loss. Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the loss...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
atoaiari/mmpose
SmoothL1Loss
false
6,279
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """SmoothL1Loss loss. Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the loss. Defau...
L1Loss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class L1Loss(nn.Module): """L1Loss loss .""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.l1_loss self.use_target_weight = use_target_weight self.loss_weig...
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 ...
atoaiari/mmpose
L1Loss
false
6,280
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """L1Loss loss .""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.l1_loss self.use_target_weight = use_target_weight self.loss_weigh...
Postnet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class Postnet(nn.Module): """Postnet is a simple linear layer for predicting the target frames given the RNN context during training. We don't need the Postnet for feature extraction. """ def __init__(self, input_size, output_size=80): super(Postnet, 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
aviasd/Mockingjay-Speech-Representation
Postnet
false
6,281
[ "MIT" ]
1
c01aef3f98bbb3fd4b0fc1b61e77fb5d02a0e453
https://github.com/aviasd/Mockingjay-Speech-Representation/tree/c01aef3f98bbb3fd4b0fc1b61e77fb5d02a0e453
import torch from torch import nn class Model(nn.Module): """Postnet is a simple linear layer for predicting the target frames given the RNN context during training. We don't need the Postnet for feature extraction. """ def __init__(self, input_size, output_size=80): super().__init__() ...
DivideMax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.utils.data class DivideMax(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): maxes = x.amax(dim=self.dim, keepdim=True) return x / maxes def get_inputs(): return [torch.rand([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 import nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards...
avihu111/viewpoint_disentanglement
DivideMax
false
6,282
[ "MIT" ]
1
07aa4e119426a500fb1e5b5929909cd791982f27
https://github.com/avihu111/viewpoint_disentanglement/tree/07aa4e119426a500fb1e5b5929909cd791982f27
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): maxes = x.amax(dim=self.dim, keepdim=True) return x / maxes def get_inputs(): return [torch.rand([4, 4, 4, ...
Mlp
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 torch import nn import torch.nn.functional as F class GELU(nn.Module): def __init__(self): super(GELU, self).__init__() def forward(self, x): return 0.5 * x * (1 + F.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) class Mlp(nn.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 libdevice import numpy as np ...
au55555/classification-pytorch
Mlp
false
6,283
[ "MIT" ]
1
1937599ae6e688ed7af7470f69964fb6f97241c4
https://github.com/au55555/classification-pytorch/tree/1937599ae6e688ed7af7470f69964fb6f97241c4
import torch import numpy as np from torch import nn import torch.nn.functional as F class GELU(nn.Module): def __init__(self): super().__init__() def forward(self, x): return 0.5 * x * (1 + F.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) class Model(nn.Module): ...
AllocatingLayer
# 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.nn.modules.module import Module class AllocatingLayer(Module): """The actor NN base its output for the case of full CSI on a continuous relaxation of the problem. Specifically it gives a value for every user. This layer will start allocating to the most val...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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.nn.modules.module import Module assert_si...
avranasa/DRL_Scheduling_Communications
AllocatingLayer
false
6,284
[ "MIT" ]
1
2e6cb3a9599e43b73547f4281d82b1e5999271b7
https://github.com/avranasa/DRL_Scheduling_Communications/tree/2e6cb3a9599e43b73547f4281d82b1e5999271b7
from torch.nn import Module import torch from torch.nn.modules.module import Module class Model(Module): """The actor NN base its output for the case of full CSI on a continuous relaxation of the problem. Specifically it gives a value for every user. This layer will start allocating to the most valuable bw u...
TauSTE
# 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 typing import Any import torch.nn.functional as F class TauSTEFunction(torch.autograd.Function): @staticmethod def forward(ctx: 'Any', tau_threshold: 'float', input: 'Any') ->Any: return (input > tau_threshold).float() @staticmethod def backward(...
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 typing import Any import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.assert_size_...
atreyasha/spp-explainability
TauSTE
false
6,285
[ "MIT" ]
1
c959b837591cc1980d057a67f682e00b1f3e8e37
https://github.com/atreyasha/spp-explainability/tree/c959b837591cc1980d057a67f682e00b1f3e8e37
from torch.nn import Module import torch from typing import Any import torch.nn.functional as F class TauSTEFunction(torch.autograd.Function): @staticmethod def forward(ctx: 'Any', tau_threshold: 'float', input: 'Any') ->Any: return (input > tau_threshold).float() @staticmethod def backward(...
RoutingCapsules
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F def squash(x, dim=-1, epsilon=1e-08): norm = (x ** 2).sum(dim=dim, keepdim=True) x = norm / (norm + 1) * x / (torch.sqrt(norm) + epsilon) return x class RoutingCapsules(nn.Module): """ input capsules_num: new feature, num...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ashawkey/CapsNet.pytorch
RoutingCapsules
false
6,286
[ "MIT" ]
1
3b796b572bbabe79cc445c35913cd3584733aedf
https://github.com/ashawkey/CapsNet.pytorch/tree/3b796b572bbabe79cc445c35913cd3584733aedf
import torch import torch.nn as nn import torch.nn.functional as F def squash(x, dim=-1, epsilon=1e-08): norm = (x ** 2).sum(dim=dim, keepdim=True) x = norm / (norm + 1) * x / (torch.sqrt(norm) + epsilon) return x class Model(nn.Module): """ input capsules_num: new feature, num to duplic...
MaxMarginRankingLoss
# 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 import torch as th import torch.optim import torch.utils.data class MaxMarginRankingLoss(nn.Module): def __init__(self, margin=1): super(MaxMarginRankingLoss, self).__init__() self.loss = th.nn.MarginRankingLoss(margin) 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 import triton_helpers import torch.nn as nn import torch as th import torch.optim import torch.utils.data asser...
awesome-archive/Video-to-Online-Platform
MaxMarginRankingLoss
false
6,287
[ "Apache-2.0" ]
1
4f91724133a817e79bce91e0abbd46cf38a31167
https://github.com/awesome-archive/Video-to-Online-Platform/tree/4f91724133a817e79bce91e0abbd46cf38a31167
import torch import torch.nn.functional as F import torch.nn as nn import torch as th import torch.optim import torch.utils.data class Model(nn.Module): def __init__(self, margin=1): super().__init__() self.loss = th.nn.MarginRankingLoss(margin) self.margin = margin def forward(self,...
WingLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn as nn class WingLoss(nn.Module): """Wing Loss. paper ref: 'Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks' Feng et al. CVPR'2018. Args: omega (float): Also referred to as width. epsilon (float): Also referred t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
atoaiari/mmpose
WingLoss
false
6,288
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import math import torch import torch.nn as nn class Model(nn.Module): """Wing Loss. paper ref: 'Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks' Feng et al. CVPR'2018. Args: omega (float): Also referred to as width. epsilon (float): Also referred to a...
SoftWingLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn as nn class SoftWingLoss(nn.Module): """Soft Wing Loss 'Structure-Coherent Deep Feature Learning for Robust Face Alignment' Lin et al. TIP'2021. loss = 1. |x| , if |x| < omega1 2. omega2*ln(1+|x|/epsilon) + B, if |x| >= om...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
atoaiari/mmpose
SoftWingLoss
false
6,289
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import math import torch import torch.nn as nn class Model(nn.Module): """Soft Wing Loss 'Structure-Coherent Deep Feature Learning for Robust Face Alignment' Lin et al. TIP'2021. loss = 1. |x| , if |x| < omega1 2. omega2*ln(1+|x|/epsilon) + B, if |x| >= omega1 ...
SSLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=True): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn import torch.utils.data import torch assert_size_stride = torch._C._dynamo.guards.assert_size_strid...
ayanglab/HDL
SSLoss
false
6,290
[ "Apache-2.0" ]
1
5ff778d713331671ffa85e9fb63378d8c0a57769
https://github.com/ayanglab/HDL/tree/5ff778d713331671ffa85e9fb63378d8c0a57769
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=True): ...
ScaledDotProductAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
awesome-archive/FEAT
ScaledDotProductAttention
false
6,291
[ "MIT" ]
1
940d525fcbf2a40528d284392a03e4b0193344a7
https://github.com/awesome-archive/FEAT/tree/940d525fcbf2a40528d284392a03e4b0193344a7
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropout) self.sof...
GraphConvolution
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, dropout=0.3): super(GraphConvolution, self).__init__() self.in_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ayyyq/T-LSTM
GraphConvolution
false
6,292
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, dropout=0.3): super().__init__() self.in_features = in_features self.o...
LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.optim class LayerNorm(nn.Module): """A Layer Normalization layer. Lei Ba, Jimmy, Jamie Ryan Kiros, and Geoffrey E. Hinton. arXiv preprint arXiv:1607.06450 (2016). """ def __init__(self, dim): super(LayerNorm, self).__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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo....
awesome-archive/nmtpytorch
LayerNorm
false
6,293
[ "MIT" ]
1
7c0ea21b29fc85a1f30ef4400d62b9d8e3d88be4
https://github.com/awesome-archive/nmtpytorch/tree/7c0ea21b29fc85a1f30ef4400d62b9d8e3d88be4
import torch import torch.nn as nn import torch.optim class Model(nn.Module): """A Layer Normalization layer. Lei Ba, Jimmy, Jamie Ryan Kiros, and Geoffrey E. Hinton. arXiv preprint arXiv:1607.06450 (2016). """ def __init__(self, dim): super().__init__() self.bias = nn.Param...
AttentionModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 AttentionModule(nn.Module): """ A neural module that takes a feature map, attends to the features, and produces an attention. """ def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim, kerne...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
aymenx17/ShapeCount
AttentionModule
false
6,294
[ "Apache-2.0" ]
1
6d2fb780684335ccd0127b3084bf40674203bcf1
https://github.com/aymenx17/ShapeCount/tree/6d2fb780684335ccd0127b3084bf40674203bcf1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ A neural module that takes a feature map, attends to the features, and produces an attention. """ def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, ...
GDiceLossV2
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data import torch from torch.autograd import Variable def flatten(tensor): """Flattens a given tensor such that the channel axis is first. The shapes are transformed as follows: (N, C, D, H, W) -> (C, N * D * H * W) """ C = tensor.size(1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torch assert_size_stride = torch._C....
ayanglab/HDL
GDiceLossV2
false
6,295
[ "Apache-2.0" ]
1
5ff778d713331671ffa85e9fb63378d8c0a57769
https://github.com/ayanglab/HDL/tree/5ff778d713331671ffa85e9fb63378d8c0a57769
import torch import torch.nn as nn import torch.utils.data import torch from torch.autograd import Variable def flatten(tensor): """Flattens a given tensor such that the channel axis is first. The shapes are transformed as follows: (N, C, D, H, W) -> (C, N * D * H * W) """ C = tensor.size(1) ...
BCELoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class BCELoss(nn.BCELoss): def __init__(self, **kwargs): super(BCELoss, self).__init__(**kwargs) def forward(self, input, target): input = input.squeeze(1) target = target.float() return super(BCELoss, self).forward(input, target) def get_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
azxj/BRRNet
BCELoss
false
6,296
[ "MIT" ]
1
274068efd5453f2c1fb07bfaad448d048b9c793b
https://github.com/azxj/BRRNet/tree/274068efd5453f2c1fb07bfaad448d048b9c793b
import torch import torch.nn as nn class Model(nn.BCELoss): def __init__(self, **kwargs): super().__init__(**kwargs) def forward(self, input, target): input = input.squeeze(1) target = target.float() return super(BCELoss, self).forward(input, target) def get_inputs(): r...
LogLoss
# 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 MSELoss class LogLoss(MSELoss): def __init__(self): super(LogLoss, self).__init__() self.loss = torch.nn.MSELoss() self.loss2 = torch.nn.MSELoss() def forward(self, input, target): tgt = torch.atan(target) inp = torch.atan(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 import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import MSELoss...
aykuttasil/mindsdb
LogLoss
false
6,297
[ "MIT" ]
1
2c36b6f75f13d7104fe4d3dbb7ca307fa84f45ad
https://github.com/aykuttasil/mindsdb/tree/2c36b6f75f13d7104fe4d3dbb7ca307fa84f45ad
import torch from torch.nn import MSELoss class Model(MSELoss): def __init__(self): super().__init__() self.loss = torch.nn.MSELoss() self.loss2 = torch.nn.MSELoss() def forward(self, input, target): tgt = torch.atan(target) inp = torch.atan(input) loss = torc...
QueryModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 QueryModule(nn.Module): """ A neural module that takes as input a feature map and an attention and produces a feature map as output. """ def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
aymenx17/ShapeCount
QueryModule
false
6,298
[ "Apache-2.0" ]
1
6d2fb780684335ccd0127b3084bf40674203bcf1
https://github.com/aymenx17/ShapeCount/tree/6d2fb780684335ccd0127b3084bf40674203bcf1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ A neural module that takes as input a feature map and an attention and produces a feature map as output. """ def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim, kern...
GCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, dropout=0.3): super(GraphConvolution, self).__init__() self.in_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ayyyq/T-LSTM
GCN
false
6,299
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
import torch import torch.nn as nn import torch.nn.functional as F class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, dropout=0.3): super().__init__() self.in_features = in_features ...
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 as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 94 * 94, 120) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
arefmalek/Demographics_Disenfranchisement
Net
false
6,300
[ "MIT" ]
1
f4ae8c0965cf1b1cab9b245c3f5f54d3b5fe9aba
https://github.com/arefmalek/Demographics_Disenfranchisement/tree/f4ae8c0965cf1b1cab9b245c3f5f54d3b5fe9aba
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, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 94 * 94, 120) ...
ExgLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ExgLayer(nn.Module): def __init__(self, x_size, h_size, g_size, out_size): super(ExgLayer, self).__init__() self.h_size = h_size self.g_size = g_size self.out_size = out_size self.x_size = x_size self.linear_x2 = nn.Linear(x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ayyyq/T-LSTM
ExgLayer
false
6,301
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, x_size, h_size, g_size, out_size): super().__init__() self.h_size = h_size self.g_size = g_size self.out_size = out_size self.x_size = x_size self.linear_x2 = nn.Linear(x_size, out_size) ...
myCustomModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import logging import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class BaseModel(nn.Module): """ Base class for all models All models require an initialization a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
awoloshuk/NephNet
myCustomModel
false
6,302
[ "MIT" ]
1
562431364874fef1680069c7a5235c67b96504b8
https://github.com/awoloshuk/NephNet/tree/562431364874fef1680069c7a5235c67b96504b8
import logging import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class BaseModel(nn.Module): """ Base class for all models All models require an initialization a...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=1.0): super(DiceLoss, self).__init__() self.smooth = smooth def forward(self, input, target): n = input.shape[0] input = input.view(n, -1) target = target.view(n, -1) inter...
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...
azxj/BRRNet
DiceLoss
false
6,303
[ "MIT" ]
1
274068efd5453f2c1fb07bfaad448d048b9c793b
https://github.com/azxj/BRRNet/tree/274068efd5453f2c1fb07bfaad448d048b9c793b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, smooth=1.0): super().__init__() self.smooth = smooth def forward(self, input, target): n = input.shape[0] input = input.view(n, -1) target = target.view(n, -1) intersection = input *...
CombinedTargetMSELoss
# 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 CombinedTargetMSELoss(nn.Module): """MSE loss for combined target. CombinedTarget: The combination of classification target (response map) and regression target (offset map). Paper ref: Huang et al. The Devil is in the Details: Delving into ...
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...
atoaiari/mmpose
CombinedTargetMSELoss
false
6,304
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
import torch import torch.nn as nn class Model(nn.Module): """MSE loss for combined target. CombinedTarget: The combination of classification target (response map) and regression target (offset map). Paper ref: Huang et al. The Devil is in the Details: Delving into Unbiased Data Pr...
DiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data import torch class DiceLoss(nn.Module): def __init__(self): super(DiceLoss, self).__init__() def forward(self, pred, target): pred = pred.squeeze(dim=1) dice = 2 * (pred * target).sum(dim=1).sum(dim=1).sum(dim=1) / (pred ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
ayanglab/HDL
DiceLoss
false
6,305
[ "Apache-2.0" ]
1
5ff778d713331671ffa85e9fb63378d8c0a57769
https://github.com/ayanglab/HDL/tree/5ff778d713331671ffa85e9fb63378d8c0a57769
import torch import torch.nn as nn import torch.utils.data import torch class Model(nn.Module): def __init__(self): super().__init__() def forward(self, pred, target): pred = pred.squeeze(dim=1) dice = 2 * (pred * target).sum(dim=1).sum(dim=1).sum(dim=1) / (pred .pow(2).s...
SigmoidBCELoss
# 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 SigmoidBCELoss(nn.BCEWithLogitsLoss): def __init__(self, **kwargs): super(SigmoidBCELoss, self).__init__(**kwargs) def forward(self, input, target): input = input.squeeze(1) target = target.float() return super(SigmoidBCELoss, self).fo...
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...
azxj/BRRNet
SigmoidBCELoss
false
6,306
[ "MIT" ]
1
274068efd5453f2c1fb07bfaad448d048b9c793b
https://github.com/azxj/BRRNet/tree/274068efd5453f2c1fb07bfaad448d048b9c793b
import torch import torch.nn as nn class Model(nn.BCEWithLogitsLoss): def __init__(self, **kwargs): super().__init__(**kwargs) def forward(self, input, target): input = input.squeeze(1) target = target.float() return super(SigmoidBCELoss, self).forward(input, target) def ge...
SqueezeExcitation
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor import torch.nn.functional as F from torch import nn from torchvision.models.mobilenetv2 import _make_divisible class SqueezeExcitation(nn.Module): def __init__(self, input_channels: 'int', squeeze_factor: 'int'=4): super().__init__() squeeze_channels = _make...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 Tensor impo...
ayrna/ordinal-cnn-ecoc
SqueezeExcitation
false
6,307
[ "BSD-3-Clause" ]
1
2b7909d036612727a45a174c891c4e749c3b60c4
https://github.com/ayrna/ordinal-cnn-ecoc/tree/2b7909d036612727a45a174c891c4e749c3b60c4
import torch from torch import Tensor import torch.nn.functional as F from torch import nn from torchvision.models.mobilenetv2 import _make_divisible class Model(nn.Module): def __init__(self, input_channels: 'int', squeeze_factor: 'int'=4): super().__init__() squeeze_channels = _make_divisible(i...
templateModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import logging import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class BaseModel(nn.Module): """ Base class for all models All models require an initialization a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 logging import numpy a...
awoloshuk/NephNet
templateModel
false
6,308
[ "MIT" ]
1
562431364874fef1680069c7a5235c67b96504b8
https://github.com/awoloshuk/NephNet/tree/562431364874fef1680069c7a5235c67b96504b8
import logging import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class BaseModel(nn.Module): """ Base class for all models All models require an initialization a...
ScaledDotProductAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention --baseline version""" def __init__(self, dropout=0.3): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, q, k, v, mask=Non...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ayyyq/T-LSTM
ScaledDotProductAttention
false
6,309
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Scaled Dot-Product Attention --baseline version""" def __init__(self, dropout=0.3): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, q, k, v, mask=None): attn = t...
SentenceMatrixLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SentenceMatrixLayer(nn.Module): def __init__(self, in_size, out_size=1, p_Asem=0.6): super(SentenceMatrixLayer, self).__init__() self.in_size = in_size self.out_size = out_size self.p_Asem = p_Asem self.linear = nn.Linear(in_size * ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ayyyq/T-LSTM
SentenceMatrixLayer
false
6,310
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_size, out_size=1, p_Asem=0.6): super().__init__() self.in_size = in_size self.out_size = out_size self.p_Asem = p_Asem self.linear = nn.Linear(in_size * 2, out_size) def forward(self, x, ...
SplitDim
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 SplitDim(nn.Module): def __init__(self, nonlin_col=1, nonlin_type=torch.nn.functional. softplus, correction=True): super(SplitDim, self).__init__() self.nonlinearity = nonlin_type self.col = nonlin_col if correction: sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
b4thesunrise/drbayes
SplitDim
false
6,311
[ "BSD-2-Clause" ]
1
9bc827aea2c7f084fb1ee77a4bd9f3c9726ecf8c
https://github.com/b4thesunrise/drbayes/tree/9bc827aea2c7f084fb1ee77a4bd9f3c9726ecf8c
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, nonlin_col=1, nonlin_type=torch.nn.functional. softplus, correction=True): super().__init__() self.nonlinearity = nonlin_type self.col = nonlin_col if correction: self.var = torch.nn....
ReSentenceMatrixLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ReSentenceMatrixLayer(nn.Module): def __init__(self, in_size, out_size=1): super(ReSentenceMatrixLayer, self).__init__() self.in_size = in_size self.out_size = out_size self.a_Asem = nn.Parameter(torch.tensor(0.0)) self.linear = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ayyyq/T-LSTM
ReSentenceMatrixLayer
false
6,312
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_size, out_size=1): super().__init__() self.in_size = in_size self.out_size = out_size self.a_Asem = nn.Parameter(torch.tensor(0.0)) self.linear = nn.Linear(in_size * 2, out_size) def forw...
Qnet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import random import torch import torch.nn as nn import torch.nn.functional as F class Qnet(nn.Module): def __init__(self): super(Qnet, self).__init__() self.fc1 = nn.Linear(4, 128) self.fc2 = nn.Linear(128, 128) self.fc3 = nn.Linear(128, 2) def forward(self, x): x = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import random import torch.nn...
azeye/QuickstartRL
Qnet
false
6,313
[ "MIT" ]
1
ae1a9eb8bc0c5f52700fa0ac19ce5abcf3ccdefa
https://github.com/azeye/QuickstartRL/tree/ae1a9eb8bc0c5f52700fa0ac19ce5abcf3ccdefa
import random import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(4, 128) self.fc2 = nn.Linear(128, 128) self.fc3 = nn.Linear(128, 2) def forward(self, x): x = F.relu(se...
HardSwish
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.functional as F def hard_swish(x: 'torch.Tensor', inplace: 'bool'=False): """Hard swish.""" inner = F.relu6(x + 3.0).div_(6.0) return x.mul_(inner) if inplace else x.mul(inner) class HardSwish(nn.Module): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.funct...
bcaitech1/p4-mod-model_diet
HardSwish
false
6,314
[ "MIT" ]
1
36d8a747e12c375b07d132ed4d08f9fc77126a8b
https://github.com/bcaitech1/p4-mod-model_diet/tree/36d8a747e12c375b07d132ed4d08f9fc77126a8b
import torch import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.functional as F def hard_swish(x: 'torch.Tensor', inplace: 'bool'=False): """Hard swish.""" inner = F.relu6(x + 3.0).div_(6.0) return x.mul_(inner) if inplace else x.mul(inner) class Model(nn.Module): ""...
PoswiseFeedForwardNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 torch.nn as nn import torch.nn.functional as F class PoswiseFeedForwardNet(nn.Module): """ feed forward """ def __init__(self, config): super().__init__() self.config = config self.conv1 = nn.Conv1d(in_channels=self.con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
bage79/transformer-evolution-bage
PoswiseFeedForwardNet
false
6,315
[ "Apache-2.0" ]
1
715bdf61421dc19e21fb0f66bfa4b564305987f8
https://github.com/bage79/transformer-evolution-bage/tree/715bdf61421dc19e21fb0f66bfa4b564305987f8
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ feed forward """ def __init__(self, config): super().__init__() self.config = config self.conv1 = nn.Conv1d(in_channels=self.config.d_hidn, out_...
CNNHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CNNHead(nn.Module): def __init__(self, input_dim): super().__init__() self.conv = nn.Conv1d(in_channels=input_dim, out_channels=2, kernel_size=3, padding=1) self.relu = nn.ReLU() def forward(self, x): return self.relu(self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
baseballChatbot7/KBO_MRC
CNNHead
false
6,316
[ "MIT" ]
1
ad11318d785bacdf29a12adfd25afe90d7ff2779
https://github.com/baseballChatbot7/KBO_MRC/tree/ad11318d785bacdf29a12adfd25afe90d7ff2779
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim): super().__init__() self.conv = nn.Conv1d(in_channels=input_dim, out_channels=2, kernel_size=3, padding=1) self.relu = nn.ReLU() def forward(self, x): return self.relu(self.co...
IdentityMessage
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data class IdentityMessage(torch.nn.Module): def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'): super(IdentityMessage, self).__init__() self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim def forward(self, z_src, z_dst, raw_msg...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
beneisner/pytorch_geometric
IdentityMessage
false
6,317
[ "MIT" ]
1
53d44a96bd2de2753b1ab1d7153c026c92606a81
https://github.com/beneisner/pytorch_geometric/tree/53d44a96bd2de2753b1ab1d7153c026c92606a81
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'): super().__init__() self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim def forward(self, z_src, z_dst, raw_msg, t_enc): return torch....
SigmoidDiceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=1.0): super(DiceLoss, self).__init__() self.smooth = smooth def forward(self, input, target): n = input.shape[0] input = input.view(n, -1) target = target.view(n, -1) inter...
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...
azxj/BRRNet
SigmoidDiceLoss
false
6,318
[ "MIT" ]
1
274068efd5453f2c1fb07bfaad448d048b9c793b
https://github.com/azxj/BRRNet/tree/274068efd5453f2c1fb07bfaad448d048b9c793b
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=1.0): super().__init__() self.smooth = smooth def forward(self, input, target): n = input.shape[0] input = input.view(n, -1) target = target.view(n, -1) intersection = inpu...
PolicyModuleAlt
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 PolicyModuleAlt(nn.Module): def __init__(self, input_dim, hid_dim, n_actions): super().__init__() self.fc_1 = nn.Linear(input_dim, hid_dim) self.fc_2 = nn.Linear(hid_dim, hid_dim) self.fc_a = nn.Linear(hid_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
bentrevett/task-oriented-language-grounding
PolicyModuleAlt
false
6,319
[ "MIT" ]
1
812a7bc21ee622030eb0594c576c7d60dc630148
https://github.com/bentrevett/task-oriented-language-grounding/tree/812a7bc21ee622030eb0594c576c7d60dc630148
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_dim, hid_dim, n_actions): super().__init__() self.fc_1 = nn.Linear(input_dim, hid_dim) self.fc_2 = nn.Linear(hid_dim, hid_dim) self.fc_a = nn.Linear(hid_dim, n_actio...
feedforwardLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class feedforwardLayer(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.3): super().__init__() self.w_1 = nn.Linear(d_in, d_hid) self.w_2 = nn.Linear(d_hid, d_in) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ayyyq/T-LSTM
feedforwardLayer
false
6,320
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.3): super().__init__() self.w_1 = nn.Linear(d_in, d_hid) self.w_2 = nn.Linear(d_hid, d_in) self.layer_no...
Envelope
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data class Envelope(torch.nn.Module): def __init__(self, exponent): super(Envelope, self).__init__() self.p = exponent + 1 self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) self.c = -self.p * (self.p + 1) / 2 def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
beneisner/pytorch_geometric
Envelope
false
6,321
[ "MIT" ]
1
53d44a96bd2de2753b1ab1d7153c026c92606a81
https://github.com/beneisner/pytorch_geometric/tree/53d44a96bd2de2753b1ab1d7153c026c92606a81
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, exponent): super().__init__() self.p = exponent + 1 self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) self.c = -self.p * (self.p + 1) / 2 def forward(self, x):...
CR
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 typing import List from typing import Union import torch.nn as nn def autopad(kernel_size: 'Union[int, List[int]]', padding: 'Union[int, None]'=None) ->Union[int, List[int]]: """Auto padding calculation for pad='same' in TensorFlow.""" if isinstance(kernel_size, int): kernel_size...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from typing import List from ...
bcaitech1/p4-mod-model_diet
CR
false
6,322
[ "MIT" ]
1
36d8a747e12c375b07d132ed4d08f9fc77126a8b
https://github.com/bcaitech1/p4-mod-model_diet/tree/36d8a747e12c375b07d132ed4d08f9fc77126a8b
import torch from typing import List from typing import Union import torch.nn as nn def autopad(kernel_size: 'Union[int, List[int]]', padding: 'Union[int, None]'=None) ->Union[int, List[int]]: """Auto padding calculation for pad='same' in TensorFlow.""" if isinstance(kernel_size, int): kernel_size...
bodypose_model
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from collections import OrderedDict import torch.nn as nn def make_layers(block, no_relu_layers): layers = [] for layer_name, v in block.items(): if 'pool' in layer_name: layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2]) layers.append((layer_name, l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from collections import Order...
alanlee-chn/handpose-est
bodypose_model
false
6,323
[ "MIT" ]
1
241a6beb45e045e65a328aade22ce536f4dcd893
https://github.com/alanlee-chn/handpose-est/tree/241a6beb45e045e65a328aade22ce536f4dcd893
import torch from collections import OrderedDict import torch.nn as nn def make_layers(block, no_relu_layers): layers = [] for layer_name, v in block.items(): if 'pool' in layer_name: layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2]) layers.append((layer_name, l...
ShiftedSoftplus
# 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.utils.data class ShiftedSoftplus(torch.nn.Module): def __init__(self): super(ShiftedSoftplus, self).__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def get_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.utils.data assert_size_stride = torch._C._dynamo....
beneisner/pytorch_geometric
ShiftedSoftplus
false
6,324
[ "MIT" ]
1
53d44a96bd2de2753b1ab1d7153c026c92606a81
https://github.com/beneisner/pytorch_geometric/tree/53d44a96bd2de2753b1ab1d7153c026c92606a81
import torch import torch.nn.functional as F import torch.utils.data class Model(torch.nn.Module): def __init__(self): super().__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def get_inputs(): return [torch.ran...
ImageProcessingModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ImageProcessingModule(nn.Module): def __init__(self, n_filters): super().__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=n_filters, kernel_size=7, stride=7) def forward(self, observation): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bentrevett/task-oriented-language-grounding
ImageProcessingModule
false
6,325
[ "MIT" ]
1
812a7bc21ee622030eb0594c576c7d60dc630148
https://github.com/bentrevett/task-oriented-language-grounding/tree/812a7bc21ee622030eb0594c576c7d60dc630148
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n_filters): super().__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=n_filters, kernel_size=7, stride=7) def forward(self, observation): observation ...
BinaryChunk
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch class BinaryChunk(torch.nn.Module): def __init__(self, nCls, isLogit=False, pooling='max', chunk_dim=-1): super(BinaryChunk, self).__init__() self.nClass = nCls self.nChunk = int(math.ceil(math.log2(self.nClass))) self.pooling = pooling self.isLogi...
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 math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided...
azopticsinc/optical-neural-network
BinaryChunk
false
6,326
[ "MIT" ]
1
28280014a6c1fc717a5077ed5e3c3496a4b103ac
https://github.com/azopticsinc/optical-neural-network/tree/28280014a6c1fc717a5077ed5e3c3496a4b103ac
import math import torch class Model(torch.nn.Module): def __init__(self, nCls, isLogit=False, pooling='max', chunk_dim=-1): super().__init__() self.nClass = nCls self.nChunk = int(math.ceil(math.log2(self.nClass))) self.pooling = pooling self.isLogit = isLogit def __...