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
ResARModule
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils.spectral_norm import spectral_norm from torch.nn.utils.weight_norm import weight_norm def build_norm_layer(norm_type, param=None, num_feats=None): if norm_type == 'bnorm': return nn.BatchNorm1d(num_feats) elif norm_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn from torch.nn.utils.spectral_norm import spectral_norm fro...
mansoorcheema/segan_pytorch
ResARModule
false
10,699
[ "MIT" ]
0
8f3b401e42cadfd1f8ad57a8ba0e89c16cc7ee65
https://github.com/mansoorcheema/segan_pytorch/tree/8f3b401e42cadfd1f8ad57a8ba0e89c16cc7ee65
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils.spectral_norm import spectral_norm from torch.nn.utils.weight_norm import weight_norm def build_norm_layer(norm_type, param=None, num_feats=None): if norm_type == 'bnorm': return nn.BatchNorm1d(num_feats) elif norm_...
ContractiveAutoencoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn class ContractiveAutoencoder(nn.Module): """ Simple contractive autoencoder with a single hidden layer. Constructor parameters: - num_inputs: Number of input features - num_hidden_layer_inputs: Number of input features for the sin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
rocklegende/DL2020_R3
ContractiveAutoencoder
false
10,700
[ "MIT" ]
0
467ed759a9f9935d56863c79f71040e922d72829
https://github.com/rocklegende/DL2020_R3/tree/467ed759a9f9935d56863c79f71040e922d72829
import torch import torch.utils.data import torch.nn as nn class Model(nn.Module): """ Simple contractive autoencoder with a single hidden layer. Constructor parameters: - num_inputs: Number of input features - num_hidden_layer_inputs: Number of input features for the single hidden layer ...
Discrete
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class Discrete(nn.Module): def __init__(self, num_outputs): super(Discrete, self).__init__() def forward(self, x): probs = nn.functional.softmax(x, dim=0) dist = torch.distributions.Categorical(probs=probs) return dist.entropy() 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
rsomani95/client
Discrete
false
10,701
[ "MIT" ]
0
772c6de325b30323397cfb98ab7e126910c5912b
https://github.com/rsomani95/client/tree/772c6de325b30323397cfb98ab7e126910c5912b
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_outputs): super().__init__() def forward(self, x): probs = nn.functional.softmax(x, dim=0) dist = torch.distributions.Categorical(probs=probs) return dist.entropy() def get_inputs(): retur...
TransformerEncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F from typing import Optional class LearnedRelativePositionalEmbedding(nn.Module): """ This module learns relative positional embeddings up to a fixed maximum size. These are masked for decoder and unmasked for encoder self attention. ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
neuroidss/silent_speech
TransformerEncoderLayer
false
10,702
[ "MIT" ]
0
4a6d8e944007071de02261bfd7f8ecedd9a06ccd
https://github.com/neuroidss/silent_speech/tree/4a6d8e944007071de02261bfd7f8ecedd9a06ccd
import torch from torch import nn import torch.nn.functional as F from typing import Optional class LearnedRelativePositionalEmbedding(nn.Module): """ This module learns relative positional embeddings up to a fixed maximum size. These are masked for decoder and unmasked for encoder self attention. ...
LinearLR
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 LinearLR(nn.Module): """[u * v + res] version of torch.nn.Linear""" def __init__(self, in_features, out_features, rank_ratio=0.25, bias= True, device=None, dtype=None): super().__init__() sliced_rank = int(min(in_features, out_features) * rank_...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
razered/alternate
LinearLR
false
10,703
[ "MIT" ]
0
18e876aadc76d5f675cf940549b4bcd6e80a0288
https://github.com/razered/alternate/tree/18e876aadc76d5f675cf940549b4bcd6e80a0288
import torch import torch.nn as nn class Model(nn.Module): """[u * v + res] version of torch.nn.Linear""" def __init__(self, in_features, out_features, rank_ratio=0.25, bias= True, device=None, dtype=None): super().__init__() sliced_rank = int(min(in_features, out_features) * rank_rat...
ProposalNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class ProposalNet(nn.Module): def __init__(self): super(ProposalNet, self).__init__() self.down1 = nn.Conv2d(2048, 128, 3, 1, 1) self.down2 = nn.Conv2d(128, 128, 3, 2, 1) self.down3 = nn.Conv2d(128, 128, 3, 2, 1) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn import t...
mobulan/NTS-Net
ProposalNet
false
10,704
[ "MIT" ]
0
9246c33b9e9aed2514f53fd0aef48c8ed3eb91d3
https://github.com/mobulan/NTS-Net/tree/9246c33b9e9aed2514f53fd0aef48c8ed3eb91d3
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self): super().__init__() self.down1 = nn.Conv2d(2048, 128, 3, 1, 1) self.down2 = nn.Conv2d(128, 128, 3, 2, 1) self.down3 = nn.Conv2d(128, 128, 3, 2, 1) self.ReLU = nn.ReLU() ...
ConvLR
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ConvLR(nn.Module): """[u * v + res] version of torch.nn.ConvLR""" def __init__(self, in_planes, out_planes, kernel_size, stride, padding, rank_ratio=0.25, bias=True, device=None, dtype=None): super().__init__() sliced_rank = int(min(in_planes, ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
razered/alternate
ConvLR
false
10,705
[ "MIT" ]
0
18e876aadc76d5f675cf940549b4bcd6e80a0288
https://github.com/razered/alternate/tree/18e876aadc76d5f675cf940549b4bcd6e80a0288
import torch import torch.nn as nn class Model(nn.Module): """[u * v + res] version of torch.nn.ConvLR""" def __init__(self, in_planes, out_planes, kernel_size, stride, padding, rank_ratio=0.25, bias=True, device=None, dtype=None): super().__init__() sliced_rank = int(min(in_planes, o...
LocationNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 LocationNetwork(nn.Module): """ Uses the internal state `h_t` of the core network to produce the location coordinates `l_t` for the next time step. Concretely, feeds the hidden state `h_t` through a fc layer followed by ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
reinvantveer/topography-detection
LocationNetwork
false
10,706
[ "MIT" ]
0
b471dbaa1bc276584374ed3bb5382e2d63046611
https://github.com/reinvantveer/topography-detection/tree/b471dbaa1bc276584374ed3bb5382e2d63046611
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Uses the internal state `h_t` of the core network to produce the location coordinates `l_t` for the next time step. Concretely, feeds the hidden state `h_t` through a fc layer followed by a tanh to ...
CoreNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CoreNetwork(nn.Module): """ An RNN that maintains an internal state that integrates information extracted from the history of past observations. It encodes the agent's knowledge of the environment through a state vector `h_t`...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
reinvantveer/topography-detection
CoreNetwork
false
10,707
[ "MIT" ]
0
b471dbaa1bc276584374ed3bb5382e2d63046611
https://github.com/reinvantveer/topography-detection/tree/b471dbaa1bc276584374ed3bb5382e2d63046611
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ An RNN that maintains an internal state that integrates information extracted from the history of past observations. It encodes the agent's knowledge of the environment through a state vector `h_t` that ...
Decoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class Decoder(nn.Module): def __init__(self, latent_channel_dim): super(Decoder, self).__init__() self.t_conv1 = nn.ConvTranspose2d(in_channels=latent_channel_dim, out_channels=16, kernel_size=(2, 2), stride=(2, 2)) self.t_conv2 = nn.ConvTrans...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
quickgrid/CodeLab
Decoder
false
10,708
[ "MIT" ]
0
710ebf107b7938f09c055e806c1fed5574d91308
https://github.com/quickgrid/CodeLab/tree/710ebf107b7938f09c055e806c1fed5574d91308
import torch from torch import nn class Model(nn.Module): def __init__(self, latent_channel_dim): super().__init__() self.t_conv1 = nn.ConvTranspose2d(in_channels=latent_channel_dim, out_channels=16, kernel_size=(2, 2), stride=(2, 2)) self.t_conv2 = nn.ConvTranspose2d(in_chann...
PixelShuffle2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import functools import torch from torch import nn import torch.nn.functional as F class PixelShuffle2d(nn.Conv2d): def __init__(self, in_nc, out_nc, kernel_size: 'int', scale: 'int'=2, **kwargs): super().__init__(in_nc, out_nc * scale * scale, kernel_size, **kwargs) self.up = functools.p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import functools from torch import nn import torch.nn.functional as F assert_siz...
pomelyu/ML_HW
PixelShuffle2d
false
10,709
[ "MIT" ]
0
b87697f3ee86592a34d80c8dbf167a5767731630
https://github.com/pomelyu/ML_HW/tree/b87697f3ee86592a34d80c8dbf167a5767731630
import functools import torch from torch import nn import torch.nn.functional as F class Model(nn.Conv2d): def __init__(self, in_nc, out_nc, kernel_size: 'int', scale: 'int'=2, **kwargs): super().__init__(in_nc, out_nc * scale * scale, kernel_size, **kwargs) self.up = functools.partial(F....
AttentionBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 AttentionBlock(nn.Module): def __init__(self, in_nc, out_nc, nd, bias=False): super().__init__() self.in_nc = in_nc self.Wq = nn.Linear(in_nc, nd, bias=bias) self.Wk = nn.Linear(in_nc, nd, bias=bias) self.Wv = nn.Linear(in_nc, out_nc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
pomelyu/ML_HW
AttentionBlock
false
10,710
[ "MIT" ]
0
b87697f3ee86592a34d80c8dbf167a5767731630
https://github.com/pomelyu/ML_HW/tree/b87697f3ee86592a34d80c8dbf167a5767731630
import torch from torch import nn class Model(nn.Module): def __init__(self, in_nc, out_nc, nd, bias=False): super().__init__() self.in_nc = in_nc self.Wq = nn.Linear(in_nc, nd, bias=bias) self.Wk = nn.Linear(in_nc, nd, bias=bias) self.Wv = nn.Linear(in_nc, out_nc, bias=bi...
DeConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import functools import torch from torch import nn from typing import Optional import torch.nn.functional as F class DeConv2d(nn.Conv2d): def __init__(self, in_nc: 'int', out_nc: 'int', kernel_size: 'int', scale: 'int'=2, mode: 'str'='nearest', align_corners: 'Optional[bool]'=None, **kwargs): ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 functools from torch import nn from typing import Optional import torch.n...
pomelyu/ML_HW
DeConv2d
false
10,711
[ "MIT" ]
0
b87697f3ee86592a34d80c8dbf167a5767731630
https://github.com/pomelyu/ML_HW/tree/b87697f3ee86592a34d80c8dbf167a5767731630
import functools import torch from torch import nn from typing import Optional import torch.nn.functional as F class Model(nn.Conv2d): def __init__(self, in_nc: 'int', out_nc: 'int', kernel_size: 'int', scale: 'int'=2, mode: 'str'='nearest', align_corners: 'Optional[bool]'=None, **kwargs): ...
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(1, 16, 5) self.conv2 = nn.Conv2d(16, 32, 3) self.conv3 = nn.Conv2d(32, 64, 2) self.pool = nn.MaxPool2d(2, 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
olbedo/AAIND-Facial-Keypoints
Net
false
10,712
[ "MIT" ]
0
3d11094665d45feb312e375ee57e09ff7f601eb9
https://github.com/olbedo/AAIND-Facial-Keypoints/tree/3d11094665d45feb312e375ee57e09ff7f601eb9
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 16, 5) self.conv2 = nn.Conv2d(16, 32, 3) self.conv3 = nn.Conv2d(32, 64, 2) self.pool = nn.MaxPool2d(2, 2) sel...
LinearNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.nn as nn class LinearNetwork(nn.Module): def __init__(self, input_size: 'int', output_size: 'int', hidden_layers: 'List[int]', activation: 'nn.Module'=nn.LeakyReLU): super(LinearNetwork, self).__init__() self.input_size = input_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 typing import List import torch.nn as nn assert_size_stride = torch._C._dyn...
redvinaa/multiagent-path-finding-continuous
LinearNetwork
false
10,713
[ "MIT" ]
0
2d4ba3388f9b951c443ba72a33bd7af4f461275f
https://github.com/redvinaa/multiagent-path-finding-continuous/tree/2d4ba3388f9b951c443ba72a33bd7af4f461275f
import torch from typing import List import torch.nn as nn class Model(nn.Module): def __init__(self, input_size: 'int', output_size: 'int', hidden_layers: 'List[int]', activation: 'nn.Module'=nn.LeakyReLU): super().__init__() self.input_size = input_size self.output_size = output...
avgpool
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class avgpool(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super(avgpool, self).__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
nathalia-kim/nu_gan
avgpool
false
10,714
[ "MIT" ]
0
c1d0891945bd7ac3d95869db91f490f57f203110
https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class Model(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super().__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2, ::2] + x[:, :...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn class Encoder(nn.Module): def __init__(self, latent_channel_dim): super(Encoder, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size= (3, 3), stride=(1, 1), padding=(1, 1)) self.conv2 = nn.Conv2d(in_channels=16,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
quickgrid/CodeLab
Encoder
false
10,715
[ "MIT" ]
0
710ebf107b7938f09c055e806c1fed5574d91308
https://github.com/quickgrid/CodeLab/tree/710ebf107b7938f09c055e806c1fed5574d91308
import torch from torch import nn class Model(nn.Module): def __init__(self, latent_channel_dim): super().__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size= (3, 3), stride=(1, 1), padding=(1, 1)) self.conv2 = nn.Conv2d(in_channels=16, out_channels= ...
myFeature
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch class myFeature(torch.nn.Module): """ Feature: sin(x) """ def __init__(self): super(myFeature, self).__init__() def forward(self, x): return torch.sin(x[:, 0] * torch.pi) * torch.sin(x[:, 1] * torch.pi) def get_inputs(): return [torch.rand([4, 4, 4, 4])] 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_str...
ndem0/PINA
myFeature
false
10,716
[ "MIT" ]
0
1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
import torch class Model(torch.nn.Module): """ Feature: sin(x) """ def __init__(self): super().__init__() def forward(self, x): return torch.sin(x[:, 0] * torch.pi) * torch.sin(x[:, 1] * torch.pi) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
AdaptiveCos
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn.parameter import Parameter class AdaptiveCos(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.parameter import Parameter assert_size_stride = torch._C._d...
ndem0/PINA
AdaptiveCos
false
10,717
[ "MIT" ]
0
1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
import torch from torch.nn.parameter import Parameter class Model(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: - alp...
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 from torch import nn class Encoder(nn.Module): def __init__(self, latent_channel_dim): super(Encoder, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size= (3, 3), stride=(1, 1), padding=(1, 1)) self.conv2 = nn.Conv2d(in_channels=16,...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
quickgrid/CodeLab
AutoEncoder
false
10,718
[ "MIT" ]
0
710ebf107b7938f09c055e806c1fed5574d91308
https://github.com/quickgrid/CodeLab/tree/710ebf107b7938f09c055e806c1fed5574d91308
import torch from torch import nn class Encoder(nn.Module): def __init__(self, latent_channel_dim): super().__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=16, kernel_size= (3, 3), stride=(1, 1), padding=(1, 1)) self.conv2 = nn.Conv2d(in_channels=16, out_channels...
AdaptiveSquare
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn.parameter import Parameter class AdaptiveSquare(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: ...
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.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
ndem0/PINA
AdaptiveSquare
false
10,719
[ "MIT" ]
0
1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
import torch from torch.nn.parameter import Parameter class Model(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: - alp...
AdaptiveSin
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn.parameter import Parameter class AdaptiveSin(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.parameter import Parameter assert_size_stride = torch._C._d...
ndem0/PINA
AdaptiveSin
false
10,720
[ "MIT" ]
0
1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
import torch from torch.nn.parameter import Parameter class Model(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: - alp...
_netD_Q
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class _netD_Q(nn.Module): """ Second part of auxiliary network Q """ def __init__(self, nd=10): super(_netD_Q, self).__init__() self.linear = nn.Linear(128, nd, bias=True) self.softmax = nn.Log...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
nathalia-kim/nu_gan
_netD_Q
false
10,721
[ "MIT" ]
0
c1d0891945bd7ac3d95869db91f490f57f203110
https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class Model(nn.Module): """ Second part of auxiliary network Q """ def __init__(self, nd=10): super().__init__() self.linear = nn.Linear(128, nd, bias=True) self.softmax = nn.LogSoftmax() ...
TanhGaussianPolicy
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 Tuple import torch.nn as nn class LinearNetwork(nn.Module): def __init__(self, input_size: 'int', output_size: 'int', hidden_layers: 'List[int]', activation: 'nn.Module'=nn.LeakyReLU): super(LinearNetwork, self).__init__() self.input...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
redvinaa/multiagent-path-finding-continuous
TanhGaussianPolicy
false
10,722
[ "MIT" ]
0
2d4ba3388f9b951c443ba72a33bd7af4f461275f
https://github.com/redvinaa/multiagent-path-finding-continuous/tree/2d4ba3388f9b951c443ba72a33bd7af4f461275f
import torch from typing import List from typing import Tuple import torch.nn as nn class LinearNetwork(nn.Module): def __init__(self, input_size: 'int', output_size: 'int', hidden_layers: 'List[int]', activation: 'nn.Module'=nn.LeakyReLU): super().__init__() self.input_size = input_size ...
AuxiliaryConvolutions
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F from itertools import product as product import torch.optim import torch.utils.data class AuxiliaryConvolutions(nn.Module): """ Additional convolutions to produce higher-level feature maps. """ def __init__(self): super(Auxilia...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 from ite...
mosevg/ssd
AuxiliaryConvolutions
false
10,723
[ "MIT" ]
0
8fd9f6cc376c027427531bcf475188ae43c4b2d6
https://github.com/mosevg/ssd/tree/8fd9f6cc376c027427531bcf475188ae43c4b2d6
import torch from torch import nn import torch.nn.functional as F from itertools import product as product import torch.optim import torch.utils.data class Model(nn.Module): """ Additional convolutions to produce higher-level feature maps. """ def __init__(self): super().__init__() se...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class avgpool(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super(avgpool, self).__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
nathalia-kim/nu_gan
ResidualBlock
false
10,724
[ "MIT" ]
0
c1d0891945bd7ac3d95869db91f490f57f203110
https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class avgpool(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super().__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2, ::2] + x[:,...
ResidualBlock_thefirstone
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class avgpool(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super(avgpool, self).__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
nathalia-kim/nu_gan
ResidualBlock_thefirstone
false
10,725
[ "MIT" ]
0
c1d0891945bd7ac3d95869db91f490f57f203110
https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class avgpool(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super().__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2, ::2] + x[:,...
AdaptiveReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn.parameter import Parameter class AdaptiveReLU(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn.parameter import Parameter assert_size_stride = torch._C._dynamo.guards.ass...
ndem0/PINA
AdaptiveReLU
false
10,726
[ "MIT" ]
0
1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
import torch from torch.nn.parameter import Parameter class Model(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: - alp...
AdaptiveTanh
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn.parameter import Parameter class AdaptiveTanh(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.parameter import Parameter assert_size_stride = torch._C._d...
ndem0/PINA
AdaptiveTanh
false
10,727
[ "MIT" ]
0
1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
import torch from torch.nn.parameter import Parameter class Model(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: - alp...
OneParam
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.utils.data class OneParam(nn.Module): def __init__(self, xdim, ydim): """This module computes the dynamics at a point x. That is it return the Jacobian matrix where each element is dy_i/dx_j Output is a matrix of size ydim x xdim """ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.utils.data assert_size_stride = torch._C._dyn...
safwanhossain/grad_constraints
OneParam
false
10,728
[ "MIT" ]
0
fb66f5e01dff6a587e5f1e9b5316f19b4be36ca7
https://github.com/safwanhossain/grad_constraints/tree/fb66f5e01dff6a587e5f1e9b5316f19b4be36ca7
import torch from torch import nn import torch.utils.data class Model(nn.Module): def __init__(self, xdim, ydim): """This module computes the dynamics at a point x. That is it return the Jacobian matrix where each element is dy_i/dx_j Output is a matrix of size ydim x xdim """ ...
FBetaLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn class FBetaLoss(nn.Module): def __init__(self, beta=1): super(FBetaLoss, self).__init__() self.eps = 1e-08 self.beta = beta self.beta2 = beta ** 2 return def forward(self, inputs, target): inputs = torch.sigmoid(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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
quqixun/ECG-MLC
FBetaLoss
false
10,729
[ "MIT" ]
0
582d68200b79e3b2ac322c1ed17630727e283605
https://github.com/quqixun/ECG-MLC/tree/582d68200b79e3b2ac322c1ed17630727e283605
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, beta=1): super().__init__() self.eps = 1e-08 self.beta = beta self.beta2 = beta ** 2 return def forward(self, inputs, target): inputs = torch.sigmoid(inputs) tp = (inputs * t...
AdaptiveSoftplus
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn.parameter import Parameter class AdaptiveSoftplus(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: ...
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 from torch.nn.parameter import Parameter assert_size_stride = ...
ndem0/PINA
AdaptiveSoftplus
false
10,730
[ "MIT" ]
0
1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
https://github.com/ndem0/PINA/tree/1812ddb8d96a9c8aeb80ce35002dbd115e7d7931
import torch from torch.nn.parameter import Parameter class Model(torch.nn.Module): """ Implementation of soft exponential activation. Shape: - Input: (N, *) where * means, any number of additional dimensions - Output: (N, *), same shape as the input Parameters: - alp...
FocalLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, gamma=1, weight=None, balance=0.75): super(FocalLoss, self).__init__() self.gamma = gamma self.weight = weight self.balance = balance return def forward(s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
quqixun/ECG-MLC
FocalLoss
false
10,731
[ "MIT" ]
0
582d68200b79e3b2ac322c1ed17630727e283605
https://github.com/quqixun/ECG-MLC/tree/582d68200b79e3b2ac322c1ed17630727e283605
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, gamma=1, weight=None, balance=0.75): super().__init__() self.gamma = gamma self.weight = weight self.balance = balance return def forward(self, inputs, target...
GeometricLoss
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class GeometricLoss(nn.Module): def __init__(self, num_parameters=2, init=[0.0, -3.0]): self.num_parameters = num_parameters super(GeometricLoss, self).__init__() assert len(init) == num_parameters self.weight = nn.Parameter(to...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np import torch.nn as nn assert_size_stride = torch._C._d...
sanfengliao/DeepNavi
GeometricLoss
false
10,732
[ "Apache-2.0" ]
0
dc405ac0010075c2eea63083528db7cb765ad161
https://github.com/sanfengliao/DeepNavi/tree/dc405ac0010075c2eea63083528db7cb765ad161
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, num_parameters=2, init=[0.0, -3.0]): self.num_parameters = num_parameters super().__init__() assert len(init) == num_parameters self.weight = nn.Parameter(torch.Tensor(np.array(init)))...
BackgroundRelationModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from torch.nn.parameter import Parameter class BackgroundRelationModel(nn.Module): def __init__(self, n_bg, n_ml): """ n_bg: number of background tags n_ml: number of ml tags """ super().__init__() self.config = ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 from torch import nn from torch.nn.parameter import Parameter...
scott0123/psychometrics
BackgroundRelationModel
false
10,733
[ "MIT" ]
0
1caa451c46b4c2a3b5e17da3dc89b8cfbded1d11
https://github.com/scott0123/psychometrics/tree/1caa451c46b4c2a3b5e17da3dc89b8cfbded1d11
import torch import numpy as np from torch import nn from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, n_bg, n_ml): """ n_bg: number of background tags n_ml: number of ml tags """ super().__init__() self.config = {'n_bg': n_bg, 'n_...
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, dropout=False, input_size=4, output_size=2): super().__init__() hidden_layer_size = 32 self.fc1 = nn.Linear(input_size, hidden_layer_size) self.use_dropout = dropout ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
sansastra/clustering_ml
Net
false
10,734
[ "Apache-2.0" ]
0
12f65f86432e51c15dbd1af5208fdfe4e454470a
https://github.com/sansastra/clustering_ml/tree/12f65f86432e51c15dbd1af5208fdfe4e454470a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, dropout=False, input_size=4, output_size=2): super().__init__() hidden_layer_size = 32 self.fc1 = nn.Linear(input_size, hidden_layer_size) self.use_dropout = dropout ...
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 numpy as np class Attention(torch.nn.Module): def __init__(self, d_model, heads): super().__init__() self.d_model = d_model self.heads = heads self.query = torch.nn.Linear(in_features=d_model, out_features= d_model, bias=False) self.key = to...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
santhnm2/TASO
Attention
false
10,735
[ "Apache-2.0" ]
0
f8025dda00922e4313ba6efbca6573421d95cbba
https://github.com/santhnm2/TASO/tree/f8025dda00922e4313ba6efbca6573421d95cbba
import torch import numpy as np class Model(torch.nn.Module): def __init__(self, d_model, heads): super().__init__() self.d_model = d_model self.heads = heads self.query = torch.nn.Linear(in_features=d_model, out_features= d_model, bias=False) self.key = torch....
ILN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.onnx from torch import nn import torch from torch.nn.parameter import Parameter class ILN(nn.Module): def __init__(self, num_features, eps=1e-05): super(ILN, self).__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) self.ga...
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.onnx from torch import nn import torch from torch.nn.parameter imp...
rtolps/Cats2dogs_ONNX
ILN
false
10,736
[ "MIT" ]
0
9c18a9ea9c6ae65feb5c2a1a4c814d31999b6ffc
https://github.com/rtolps/Cats2dogs_ONNX/tree/9c18a9ea9c6ae65feb5c2a1a4c814d31999b6ffc
import torch import torch.onnx from torch import nn import torch from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, num_features, eps=1e-05): super().__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) self.gamma = P...
Baseline_FF_Network
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn import torch.nn.functional as F class Baseline_FF_Network(nn.Module): def __init__(self): super().__init__() h1_dim = 500 h2_dim = 500 self.fc1 = nn.Linear(4, h1_dim) self.fc2 = nn.Linear(h1_dim, h2_dim) self.fc3 = nn.Linear(h1_dim...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math fr...
saulsantos1997/Code
Baseline_FF_Network
false
10,737
[ "MIT" ]
0
fb824e3127c19a66bc9e03a56f9a8766a691bbb9
https://github.com/saulsantos1997/Code/tree/fb824e3127c19a66bc9e03a56f9a8766a691bbb9
import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self): super().__init__() h1_dim = 500 h2_dim = 500 self.fc1 = nn.Linear(4, h1_dim) self.fc2 = nn.Linear(h1_dim, h2_dim) self.fc3 = nn.Linear(h1_dim, h2_dim) ...
FullyConnectedNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F class FullyConnectedNetwork(torch.nn.Module): def __init__(self, input_size, h1, h2, output_size): super().__init__() self.layer_1 = torch.nn.Linear(input_size, h1) self.layer_2 = torch.nn.Linear(h1, h2) self.layer_3 = torch.nn.Linear(h...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C...
saurabhkakade21/AIS_spring2021
FullyConnectedNetwork
false
10,738
[ "MIT" ]
0
784d20670794c405505b09c1feea36e0a504ae5d
https://github.com/saurabhkakade21/AIS_spring2021/tree/784d20670794c405505b09c1feea36e0a504ae5d
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self, input_size, h1, h2, output_size): super().__init__() self.layer_1 = torch.nn.Linear(input_size, h1) self.layer_2 = torch.nn.Linear(h1, h2) self.layer_3 = torch.nn.Linear(h2, output_size) ...
adaILN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.onnx from torch import nn import torch from torch.nn.parameter import Parameter class adaILN(nn.Module): def __init__(self, num_features, eps=1e-05): super(adaILN, self).__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) 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.onnx from torch import nn import torch from torch.nn.parameter imp...
rtolps/Cats2dogs_ONNX
adaILN
false
10,739
[ "MIT" ]
0
9c18a9ea9c6ae65feb5c2a1a4c814d31999b6ffc
https://github.com/rtolps/Cats2dogs_ONNX/tree/9c18a9ea9c6ae65feb5c2a1a4c814d31999b6ffc
import torch import torch.onnx from torch import nn import torch from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, num_features, eps=1e-05): super().__init__() self.eps = eps self.rho = Parameter(torch.Tensor(1, num_features, 1, 1)) self.rho.data....
discriminator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class avgpool(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super(avgpool, self).__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
nathalia-kim/nu_gan
discriminator
false
10,740
[ "MIT" ]
0
c1d0891945bd7ac3d95869db91f490f57f203110
https://github.com/nathalia-kim/nu_gan/tree/c1d0891945bd7ac3d95869db91f490f57f203110
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class avgpool(nn.Module): """ Mean pooling class - downsampling """ def __init__(self, up_size=0): super().__init__() def forward(self, x): out_man = (x[:, :, ::2, ::2] + x[:, :, 1::2, ::2] + x[:,...
SmallMnist
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn import torch.utils.data import torch.utils.tensorboard._pytorch_graph class SmallMnist(nn.Module): def __init__(self): super(SmallMnist, self).__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) self.relu1 = nn.ReLU() 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 import triton_helpers from torch._inductor.runtime....
quic-akhobare/aimet
SmallMnist
false
10,741
[ "BSD-3-Clause" ]
0
1811a0ef58a75d103e173731b436876ee5dc4c49
https://github.com/quic-akhobare/aimet/tree/1811a0ef58a75d103e173731b436876ee5dc4c49
import torch import torch.nn as nn import torch.nn import torch.utils.data import torch.utils.tensorboard._pytorch_graph class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 10, kernel_size=5) self.relu1 = nn.ReLU() self.conv2 = nn.Conv2d(10, 20...
MemoryWriter
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 MemoryWriter(nn.Module): def __init__(self, state_size, memory_size, device): super(MemoryWriter, self).__init__() self.device = device self.state_size = state_size self.memory_size = memory_size self.fc_r = nn.Linear(state_size + 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 ...
rchavan10/Multiple-Intersection-Traffic-Control-using-Reinforcement-Learning
MemoryWriter
false
10,742
[ "MIT" ]
0
3663a1c7a89fe18974d13c9dc78ac7a99dac2300
https://github.com/rchavan10/Multiple-Intersection-Traffic-Control-using-Reinforcement-Learning/tree/3663a1c7a89fe18974d13c9dc78ac7a99dac2300
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, state_size, memory_size, device): super().__init__() self.device = device self.state_size = state_size self.memory_size = memory_size self.fc_r = nn.Linear(state_size + memory_size, memory_size) ...
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 def binary_cross_entropy(inputs, target, weight=None, reduction='mean', smooth_eps=None, from_logits=False): """cross entropy loss, with support for label smoothing https://arxiv.org/abs/1512.00567""" smooth_eps = smooth_eps or 0 if sm...
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...
schokoro/torchutils
BCELoss
false
10,743
[ "MIT" ]
0
bcab35e8c943a1fcd4550fbb023188fa5d688663
https://github.com/schokoro/torchutils/tree/bcab35e8c943a1fcd4550fbb023188fa5d688663
import torch import torch.nn as nn import torch.nn.functional as F def binary_cross_entropy(inputs, target, weight=None, reduction='mean', smooth_eps=None, from_logits=False): """cross entropy loss, with support for label smoothing https://arxiv.org/abs/1512.00567""" smooth_eps = smooth_eps or 0 if sm...
BertOutput
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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 class BertOutput(nn.Module): def __init__(self, config): super(BertOutput, self).__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_siz...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
minjoong507/TVRetrieval
BertOutput
false
10,744
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class Model(nn.Module): def __init__(self, config): super().__init__() self.dense = nn.Linear(config.intermediate_size, config.hidden_size) self.LayerNorm = nn.LayerNorm(config.hidden_size) self.dropo...
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 as nn import torch.nn.functional as F class MaxMarginRankingLoss(nn.Module): def __init__(self, margin=1): super(MaxMarginRankingLoss, self).__init__() self.margin = margin def forward(self, x): n = x.size()[0] x1 = torch.diag(x) x1 = x1.u...
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...
minjoong507/TVRetrieval
MaxMarginRankingLoss
false
10,745
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, margin=1): super().__init__() self.margin = margin def forward(self, x): n = x.size()[0] x1 = torch.diag(x) x1 = x1.unsqueeze(1) x1 = x1.expand(n, n) ...
DepthwiseSeparableConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 DepthwiseSeparableConv(nn.Module): """ Depth-wise separable convolution uses less parameters to generate output by convolution. :Examples: >>> m = DepthwiseSeparableConv(300, 200, 5, dim=1) >>> input_tensor = torch.ra...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
minjoong507/TVRetrieval
DepthwiseSeparableConv
false
10,746
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Depth-wise separable convolution uses less parameters to generate output by convolution. :Examples: >>> m = DepthwiseSeparableConv(300, 200, 5, dim=1) >>> input_tensor = torch.randn(32, 300, 20) ...
StableLayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 StableLayerNorm(nn.Module): def __init__(self, dim): super().__init__() self.norm = nn.LayerNorm(dim) def forward(self, x): x = x / x.amax(dim=-1, keepdim=True).detach() return self.norm(x) def get_inputs(): return [torch.rand([4,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_...
ryok/nuwa-pytorch
StableLayerNorm
false
10,747
[ "MIT" ]
0
6bde90ee6d87bdce8c9aa52c6bbb2ad15a1f5f54
https://github.com/ryok/nuwa-pytorch/tree/6bde90ee6d87bdce8c9aa52c6bbb2ad15a1f5f54
import torch from torch import nn class Model(nn.Module): def __init__(self, dim): super().__init__() self.norm = nn.LayerNorm(dim) def forward(self, x): x = x / x.amax(dim=-1, keepdim=True).detach() return self.norm(x) def get_inputs(): return [torch.rand([4, 4, 4, 4])...
LayerNormChan
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 LayerNormChan(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.eps = eps self.g = nn.Parameter(torch.ones(1, dim, 1, 1)) self.b = nn.Parameter(torch.zeros(1, dim, 1, 1)) def forward(self, x): var = torch.v...
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...
ryok/nuwa-pytorch
LayerNormChan
false
10,748
[ "MIT" ]
0
6bde90ee6d87bdce8c9aa52c6bbb2ad15a1f5f54
https://github.com/ryok/nuwa-pytorch/tree/6bde90ee6d87bdce8c9aa52c6bbb2ad15a1f5f54
import torch from torch import nn class Model(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.eps = eps self.g = nn.Parameter(torch.ones(1, dim, 1, 1)) self.b = nn.Parameter(torch.zeros(1, dim, 1, 1)) def forward(self, x): var = torch.var(x, di...
DeltaGFit
# 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 scipy import constants import torch.nn as nn import torch as t class DeltaGFit(nn.Module): def __init__(self, deltaG): super(DeltaGFit, self).__init__() self.deltaG = deltaG def forward(self, temperature, X, k_int, timepoints): """ # inputs, list of: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
sebaztiano/PyHDX
DeltaGFit
false
10,749
[ "MIT" ]
0
12fc2b5f67200885706226823bd8e1f46e3b5db1
https://github.com/sebaztiano/PyHDX/tree/12fc2b5f67200885706226823bd8e1f46e3b5db1
import torch from scipy import constants import torch.nn as nn import torch as t class Model(nn.Module): def __init__(self, deltaG): super().__init__() self.deltaG = deltaG def forward(self, temperature, X, k_int, timepoints): """ # inputs, list of: temperatures: ...
MemoryReader
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 MemoryReader(nn.Module): def __init__(self, state_size, memory_size, h_size, device): super(MemoryReader, self).__init__() self.device = device self.state_size = state_size self.memory_size = memory_size self.h_size = h_size ...
import torch from torch._inductor.select_algorithm import extern_kernels from torch._C import _cuda_getCurrentRawStream as get_raw_stream import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
rchavan10/Multiple-Intersection-Traffic-Control-using-Reinforcement-Learning
MemoryReader
false
10,750
[ "MIT" ]
0
3663a1c7a89fe18974d13c9dc78ac7a99dac2300
https://github.com/rchavan10/Multiple-Intersection-Traffic-Control-using-Reinforcement-Learning/tree/3663a1c7a89fe18974d13c9dc78ac7a99dac2300
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, state_size, memory_size, h_size, device): super().__init__() self.device = device self.state_size = state_size self.memory_size = memory_size self.h_size = h_size self.fc_h = nn.Linear(st...
Prenet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super(Linear, self).__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
poria-cat/Transformer-TTS-Pytorch
Prenet
false
10,751
[ "MIT" ]
0
1e9e2dccc16c17372bf86ca73001f76645f53338
https://github.com/poria-cat/Transformer-TTS-Pytorch/tree/1e9e2dccc16c17372bf86ca73001f76645f53338
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super().__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=nn.init. ...
GCN
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import math import torch from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.functional as F class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
seanli3/pygcn
GCN
false
10,753
[ "MIT" ]
0
134a17f1dbd7737f8a8b7efca5f20f882ee97144
https://github.com/seanli3/pygcn/tree/134a17f1dbd7737f8a8b7efca5f20f882ee97144
from torch.nn import Module import math import torch from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn as nn import torch.nn.functional as F class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __in...
BertAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class BertSelfAttention(nn.Module): def __init__(self, config): super(BertSelfAttention, self).__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
minjoong507/TVRetrieval
BertAttention
false
10,754
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
from _paritybench_helpers import _mock_config import math import torch import torch.nn as nn class BertSelfAttention(nn.Module): def __init__(self, config): super().__init__() if config.hidden_size % config.num_attention_heads != 0: raise ValueError( 'The hidden size (...
TrainablePositionalEncoding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 TrainablePositionalEncoding(nn.Module): """Construct the embeddings from word, position and token_type embeddings. """ def __init__(self, max_position_embeddings, hidden_size, dropout=0.1): super(TrainablePositionalEncoding, self).__init__() self.p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
minjoong507/TVRetrieval
TrainablePositionalEncoding
false
10,755
[ "MIT" ]
0
919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
https://github.com/minjoong507/TVRetrieval/tree/919e1766ab8aa1ef267bd3b80d4f87b06cde09a9
import torch import torch.nn as nn class Model(nn.Module): """Construct the embeddings from word, position and token_type embeddings. """ def __init__(self, max_position_embeddings, hidden_size, dropout=0.1): super().__init__() self.position_embeddings = nn.Embedding(max_position_embeddin...
FeedForward
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super(Linear, self).__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
poria-cat/Transformer-TTS-Pytorch
FeedForward
false
10,756
[ "MIT" ]
0
1e9e2dccc16c17372bf86ca73001f76645f53338
https://github.com/poria-cat/Transformer-TTS-Pytorch/tree/1e9e2dccc16c17372bf86ca73001f76645f53338
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super().__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=nn.init. ...
StandardizedConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 StandardizedConv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super(StandardizedConv2d, self).__init__(in_channels, out_channels, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
omry/vissl
StandardizedConv2d
false
10,757
[ "MIT" ]
0
7d724869a9aeef8acd8b43f60d8bb4b39199aa3d
https://github.com/omry/vissl/tree/7d724869a9aeef8acd8b43f60d8bb4b39199aa3d
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True): super().__init__(in_channels, out_channels, kernel_size, stride, padding, dilati...
Actor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class Actor(nn.Module): def __init__(self, nb_states, nb_actions, hidden1=400, hidden2=300): super(Actor, self).__init__() self.fc1 = nn.Linear(nb_states, hidden1) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
sergiogcharles/LNAS
Actor
false
10,759
[ "MIT" ]
0
f72eb7d49f139caee54f6a6a9b7c21c1bc230e85
https://github.com/sergiogcharles/LNAS/tree/f72eb7d49f139caee54f6a6a9b7c21c1bc230e85
import torch import torch.nn as nn import torch.nn.parallel import torch.optim import torch.utils.data from typing import * class Model(nn.Module): def __init__(self, nb_states, nb_actions, hidden1=400, hidden2=300): super().__init__() self.fc1 = nn.Linear(nb_states, hidden1) self.fc2 = n...
EncoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn def padding_mask(inputs, padding_idx=0): mask = (inputs == padding_idx).bool() return mask class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super(Linear, self).__init__() self.lin...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
poria-cat/Transformer-TTS-Pytorch
EncoderLayer
false
10,760
[ "MIT" ]
0
1e9e2dccc16c17372bf86ca73001f76645f53338
https://github.com/poria-cat/Transformer-TTS-Pytorch/tree/1e9e2dccc16c17372bf86ca73001f76645f53338
import torch import torch.nn.functional as F import torch.nn as nn def padding_mask(inputs, padding_idx=0): mask = (inputs == padding_idx).bool() return mask class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super().__init__() self.linear = nn.Lin...
DecoderLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super(Linear, self).__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
poria-cat/Transformer-TTS-Pytorch
DecoderLayer
false
10,761
[ "MIT" ]
0
1e9e2dccc16c17372bf86ca73001f76645f53338
https://github.com/poria-cat/Transformer-TTS-Pytorch/tree/1e9e2dccc16c17372bf86ca73001f76645f53338
import torch import torch.nn.functional as F import torch.nn as nn class Linear(nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init='linear'): super().__init__() self.linear = nn.Linear(in_dim, out_dim, bias=bias) nn.init.xavier_uniform_(self.linear.weight, gain=nn.init. ...
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, weight=None, size_average=True): super(DiceLoss, self).__init__() def forward(self, inputs, targets, smooth=1): inputs = torch.sigmoid(inputs) inputs = inputs.view(-1) targets = targets.view(-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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
salem-devloper/Lung-Segmentation-Non-Covid
DiceLoss
false
10,762
[ "MIT" ]
0
11eb87e46014aefaf034239bf68b65c5eb55711d
https://github.com/salem-devloper/Lung-Segmentation-Non-Covid/tree/11eb87e46014aefaf034239bf68b65c5eb55711d
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, weight=None, size_average=True): super().__init__() def forward(self, inputs, targets, smooth=1): inputs = torch.sigmoid(inputs) inputs = inputs.view(-1) targets = targets.view(-1) intersect...
NCELoss
# 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 NCELoss(nn.Module): """ Eq. (12): L_{NCE} """ def __init__(self, temperature, device): super(NCELoss, self).__init__() self.device = device self.criterion = nn.CrossEntropyLoss() self.temperature = temperature self.cossi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
salesforce/CoSeRec
NCELoss
false
10,763
[ "BSD-3-Clause" ]
0
c0bf5e5c3a5fd645efd3d6cdb9ff6a98d1c477ef
https://github.com/salesforce/CoSeRec/tree/c0bf5e5c3a5fd645efd3d6cdb9ff6a98d1c477ef
import torch import torch.nn as nn class Model(nn.Module): """ Eq. (12): L_{NCE} """ def __init__(self, temperature, device): super().__init__() self.device = device self.criterion = nn.CrossEntropyLoss() self.temperature = temperature self.cossim = nn.CosineSi...
QGCNLastLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
from torch.nn import Module import torch from torch.nn import Linear class QGCNLastLayer(Module): def __init__(self, left_in_dim, right_in_dim, out_dim): super(QGCNLastLayer, self).__init__() self._left_linear = Linear(left_in_dim, 1) self._right_linear = Linear(right_in_dim, out_dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch.nn import Linear assert_size_stride = tor...
shovalf/QGCN-better
QGCNLastLayer
false
10,764
[ "MIT" ]
0
9d4f0bc3b08b08ebd7915ba31dda862e42727214
https://github.com/shovalf/QGCN-better/tree/9d4f0bc3b08b08ebd7915ba31dda862e42727214
from torch.nn import Module import torch from torch.nn import Linear class Model(Module): def __init__(self, left_in_dim, right_in_dim, out_dim): super().__init__() self._left_linear = Linear(left_in_dim, 1) self._right_linear = Linear(right_in_dim, out_dim) self._gpu = False ...
NTXent
# 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.nn.functional as F class NTXent(nn.Module): """ Contrastive loss with distributed data parallel support code: https://github.com/AndrewAtanov/simclr-pytorch/blob/master/models/losses.py """ LARGE_NUMBER = 1000000000.0 def __in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
salesforce/CoSeRec
NTXent
false
10,765
[ "BSD-3-Clause" ]
0
c0bf5e5c3a5fd645efd3d6cdb9ff6a98d1c477ef
https://github.com/salesforce/CoSeRec/tree/c0bf5e5c3a5fd645efd3d6cdb9ff6a98d1c477ef
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Contrastive loss with distributed data parallel support code: https://github.com/AndrewAtanov/simclr-pytorch/blob/master/models/losses.py """ LARGE_NUMBER = 1000000000.0 def __ini...
Patch2Image
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data class Patch2Image(nn.Module): """ take in patch and copy n_up times to form the full image""" def __init__(self, patch_sz, n_up): super(Patch2Image, self).__init__() self.patch_sz = patch_sz ...
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.parallel import torch.optim import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert...
nudro/counterfactual_generative_networks
Patch2Image
false
10,766
[ "MIT" ]
0
0d000903ad9da4eab0f4d397395a769c9c7bff5d
https://github.com/nudro/counterfactual_generative_networks/tree/0d000903ad9da4eab0f4d397395a769c9c7bff5d
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data class Model(nn.Module): """ take in patch and copy n_up times to form the full image""" def __init__(self, patch_sz, n_up): super().__init__() self.patch_sz = patch_sz self.n_up = n_u...
FCN_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 numpy as np from torch import nn import torch._utils class FCN_Net(nn.Module): def __init__(self, in_channels=1, n_class=1): super().__init__() self.conv1_1 = nn.Conv3d(in_channels, 8, 3, padding=60) self.relu1_1 = nn.ReLU(inplace=True) self.conv1_2 = nn.Conv3d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import numpy as np from torch...
ilcessadecalcular/segmentation
FCN_Net
false
10,767
[ "MIT" ]
0
24ba499a399efdba212ec5e2235b72ed8270cc24
https://github.com/ilcessadecalcular/segmentation/tree/24ba499a399efdba212ec5e2235b72ed8270cc24
import torch import numpy as np from torch import nn import torch._utils class Model(nn.Module): def __init__(self, in_channels=1, n_class=1): super().__init__() self.conv1_1 = nn.Conv3d(in_channels, 8, 3, padding=60) self.relu1_1 = nn.ReLU(inplace=True) self.conv1_2 = nn.Conv3d(8...
MyElementwiseModule
# 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.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed class MyElementwiseModule(torch.nn.Module): def forward(self, x, y): return x * y + y 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 import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed as...
siaimes/examples
MyElementwiseModule
false
10,768
[ "BSD-3-Clause" ]
0
340d6fac5c4fce827c08b92b8f2aa7152b1a63b3
https://github.com/siaimes/examples/tree/340d6fac5c4fce827c08b92b8f2aa7152b1a63b3
import torch import torch.nn.parallel import torch.utils.data import torch.onnx import torch.fx import torch.optim import torch.utils.data.distributed class Model(torch.nn.Module): def forward(self, x, y): return x * y + y def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])...
HingeLoss
# 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 HingeLoss(nn.Module): """criterion for loss function y: 0/1 ground truth matrix of size: batch_size x output_size f: real number pred matrix of size: batch_size x output_size """ def __init__(self, margin=1.0, squared=True): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
slevineg/X-Transformer
HingeLoss
false
10,769
[ "BSD-3-Clause" ]
0
c7a4341e1a1835960b1c724cbfbff4b3e669e130
https://github.com/slevineg/X-Transformer/tree/c7a4341e1a1835960b1c724cbfbff4b3e669e130
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """criterion for loss function y: 0/1 ground truth matrix of size: batch_size x output_size f: real number pred matrix of size: batch_size x output_size """ def __init__(self, margin=1.0, squared=True): supe...
ClampExp
# 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 ClampExp(torch.nn.Module): """ Nonlinearity min(exp(lam * x), 1) """ def __init__(self): """ Constructor :param lam: Lambda parameter """ super(ClampExp, self).__init__() def forward(self, x): one = torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
mbaddar1/normalizing-flows
ClampExp
false
10,770
[ "MIT" ]
0
d1409464a65234354b29ed9ea0ede2d12100440c
https://github.com/mbaddar1/normalizing-flows/tree/d1409464a65234354b29ed9ea0ede2d12100440c
import torch import torch.utils.data class Model(torch.nn.Module): """ Nonlinearity min(exp(lam * x), 1) """ def __init__(self): """ Constructor :param lam: Lambda parameter """ super().__init__() def forward(self, x): one = torch.tensor(1.0, devic...
RandomCrop
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data def choose_rand_patches(x, patch_sz, dim): assert dim == 2 or dim == 3 batch_sz = x.shape[0] patches = x.unfold(dim, patch_sz, 1) n_patches = patches.shape[2] idx = torch.randint(0, n_patches, (ba...
import torch from torch import device import triton import 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.parallel import torch.optim import torch.utils.data assert_size_stride = torch...
nudro/counterfactual_generative_networks
RandomCrop
false
10,771
[ "MIT" ]
0
0d000903ad9da4eab0f4d397395a769c9c7bff5d
https://github.com/nudro/counterfactual_generative_networks/tree/0d000903ad9da4eab0f4d397395a769c9c7bff5d
import torch from torch import nn import torch.nn.parallel import torch.optim import torch.utils.data def choose_rand_patches(x, patch_sz, dim): assert dim == 2 or dim == 3 batch_sz = x.shape[0] patches = x.unfold(dim, patch_sz, 1) n_patches = patches.shape[2] idx = torch.randint(0, n_patches, (ba...
AffineConstFlow
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn import torch.utils.data class Flow(nn.Module): """ Generic class for flow functions """ def __init__(self): super().__init__() def forward(self, z): """ :param z: input variable, first dimension is batch dim :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 numpy as np import torch.nn as nn import torch.utils.data assert_s...
mbaddar1/normalizing-flows
AffineConstFlow
false
10,772
[ "MIT" ]
0
d1409464a65234354b29ed9ea0ede2d12100440c
https://github.com/mbaddar1/normalizing-flows/tree/d1409464a65234354b29ed9ea0ede2d12100440c
import torch import numpy as np import torch.nn as nn import torch.utils.data class Flow(nn.Module): """ Generic class for flow functions """ def __init__(self): super().__init__() def forward(self, z): """ :param z: input variable, first dimension is batch dim :r...
Invertible1x1Conv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class Flow(nn.Module): """ Generic class for flow functions """ def __init__(self): super().__init__() def forward(self, z): """ :param z: input variable, first dimension is batch dim :return: transformed ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
mbaddar1/normalizing-flows
Invertible1x1Conv
false
10,773
[ "MIT" ]
0
d1409464a65234354b29ed9ea0ede2d12100440c
https://github.com/mbaddar1/normalizing-flows/tree/d1409464a65234354b29ed9ea0ede2d12100440c
import torch import torch.nn as nn import torch.utils.data class Flow(nn.Module): """ Generic class for flow functions """ def __init__(self): super().__init__() def forward(self, z): """ :param z: input variable, first dimension is batch dim :return: transformed ...
Linear
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import Tensor from torch.nn import Linear from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform(tensor, fan, a): if tensor ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import Tensor from torch.nn import Parameter import torch...
pwycl/pytorch_geometric
Linear
false
10,774
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
import math import torch from torch import Tensor from torch.nn import Linear from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform(tensor, fan, a): if tensor ...
WeightedBCE
# 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 WeightedBCE(nn.Module): def __init__(self, weights=None): super().__init__() self.weights = weights def forward(self, inputs, targets): inputs = inputs.view(-1).float() targets = targets.view(-1).float() if self.weights is not N...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
sophmrtn/RectAngle
WeightedBCE
false
10,775
[ "MIT" ]
0
941138fb63bdc3f3cb297a94fa057a16b88b00be
https://github.com/sophmrtn/RectAngle/tree/941138fb63bdc3f3cb297a94fa057a16b88b00be
import torch from torch import nn class Model(nn.Module): def __init__(self, weights=None): super().__init__() self.weights = weights def forward(self, inputs, targets): inputs = inputs.view(-1).float() targets = targets.view(-1).float() if self.weights is not None: ...
Attention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn.functional as F import torch.utils.data def restricted_softmax(src, dim=-1, margin=0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).exp()) return out...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
pwycl/pytorch_geometric
Attention
false
10,776
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
import math import torch import torch.nn.functional as F import torch.utils.data def restricted_softmax(src, dim=-1, margin=0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (margin - src_max).exp()) return out...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Attention(nn.Module): def __init__(self, ft_dim, rnn_dim, attn_dim): super().__init__() self.enc_attn = nn.Linear(ft_dim, attn_dim) self.dec_attn = nn.Linear(rnn_dim, attn_dim) self.attn = nn.Linear(attn_dim, 1) self.relu = nn.ReLU(...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
skasai5296/image_captioning
Attention
false
10,777
[ "MIT" ]
0
b4bb2c015a2bdce2040ab14fe2a53e9b79aa3c30
https://github.com/skasai5296/image_captioning/tree/b4bb2c015a2bdce2040ab14fe2a53e9b79aa3c30
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, ft_dim, rnn_dim, attn_dim): super().__init__() self.enc_attn = nn.Linear(ft_dim, attn_dim) self.dec_attn = nn.Linear(rnn_dim, attn_dim) self.attn = nn.Linear(attn_dim, 1) self.relu = nn.ReLU() ...
DenseSAGEConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class DenseSAGEConv(torch.nn.Module): """See :class:`torch_geometric...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 from torch.nn imp...
pwycl/pytorch_geometric
DenseSAGEConv
false
10,778
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
import math import torch import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) class Model(torch.nn.Module): """See :class:`torch_geometric.nn.conv...
Stalin3000_anal_probe
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 math import * import torch.nn as nn import torch.nn.functional as F class Stalin3000_anal_probe(nn.Module): def __init__(self, n): super(Stalin3000_anal_probe, self).__init__() self.n = n self.insider = nn.Linear(n, n + 2) self.hl1 = nn.Linear(n + 2, n + 2) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from math import * import tor...
skabrits/-
Stalin3000_anal_probe
false
10,779
[ "MIT" ]
0
396ccb457f1f1048377be6a8b8f5e5cf060f9b0d
https://github.com/skabrits/-/tree/396ccb457f1f1048377be6a8b8f5e5cf060f9b0d
import torch from math import * import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, n): super().__init__() self.n = n self.insider = nn.Linear(n, n + 2) self.hl1 = nn.Linear(n + 2, n + 2) self.hl2 = nn.Linear(n + 2, int(n / 2)) ...
Self_Attn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel class Self_Attn(nn.Module): """ Self attention Layer""" def __init__(self, in_dim, activation): super(Self_Attn, self).__init__() self.chanel_in = in_dim self.activation = activation self.query_conv = nn.Conv2d(in_cha...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
qiyuqianxai/debvc
Self_Attn
false
10,780
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """ Self attention Layer""" def __init__(self, in_dim, activation): super().__init__() self.chanel_in = in_dim self.activation = activation self.query_conv = nn.Conv2d(in_channels=in_dim, out_c...
SingleStream
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, 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.functional as F import torch.nn as nn import torch.nn.init as torch_init def calculate_l1_norm(f): f_norm = torch.norm(f, p=2, dim=-1, keepdim=True) f = torch.div(f, f_norm) return f class SingleStream(nn.Module): def __init...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
LeonHLJ/MMSD
SingleStream
false
10,781
[ "MIT" ]
0
e39838e4e38524a670c08cc696a65da8ae01f648
https://github.com/LeonHLJ/MMSD/tree/e39838e4e38524a670c08cc696a65da8ae01f648
from _paritybench_helpers import _mock_config import torch import torch.nn.functional as F import torch.nn as nn import torch.nn.init as torch_init def calculate_l1_norm(f): f_norm = torch.norm(f, p=2, dim=-1, keepdim=True) f = torch.div(f, f_norm) return f class Model(nn.Module): def __init__(self...
DenseGCNConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch.nn import Parameter import torch.utils.data def glorot(tensor): if tensor is not None: stdv = math.sqrt(6.0 / (tensor.size(-2) + tensor.size(-1))) tensor.data.uniform_(-stdv, stdv) def zeros(tensor): if tensor is not None: tensor.data.fill_(0) cl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
pwycl/pytorch_geometric
DenseGCNConv
false
10,782
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
import math import torch from torch.nn import Parameter import torch.utils.data def glorot(tensor): if tensor is not None: stdv = math.sqrt(6.0 / (tensor.size(-2) + tensor.size(-1))) tensor.data.uniform_(-stdv, stdv) def zeros(tensor): if tensor is not None: tensor.data.fill_(0) cl...
MultiHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import Tensor from torch.nn import Linear import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
pwycl/pytorch_geometric
MultiHead
false
10,783
[ "MIT" ]
0
ef7b1add2bb5a36a3a68cae7639c42000f629cac
https://github.com/pwycl/pytorch_geometric/tree/ef7b1add2bb5a36a3a68cae7639c42000f629cac
import math import torch from torch import Tensor from torch.nn import Linear import torch.nn.functional as F from torch.nn import Parameter import torch.utils.data def uniform(size, tensor): bound = 1.0 / math.sqrt(size) if tensor is not None: tensor.data.uniform_(-bound, bound) def kaiming_uniform...
ResidualBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel class ResidualBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, padding=1, stride=1): super(ResidualBlock, self).__init__() self.padding1 = nn.ReflectionPad2d(padding) self.conv1 = nn.Conv2d(i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
qiyuqianxai/debvc
ResidualBlock
false
10,784
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, padding=1, stride=1): super().__init__() self.padding1 = nn.ReflectionPad2d(padding) self.conv1 = nn.Conv2d(in_channels, out_channels, k...
LearnablePositionalEncoding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 LearnablePositionalEncoding(nn.Module): def __init__(self, d_model, dropout=0.1, max_len=1024): super(LearnablePositionalEncoding, self).__init__() self.dropout = nn.Dropout(p=dropout) self.pe = nn.Parameter(torch.empty(max_len, 1, d_model)) ...
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...
saverymax/mvts_transformer
LearnablePositionalEncoding
false
10,785
[ "MIT" ]
0
22796d6977b78d5636f6aad3f7efeb49f2991808
https://github.com/saverymax/mvts_transformer/tree/22796d6977b78d5636f6aad3f7efeb49f2991808
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, d_model, dropout=0.1, max_len=1024): super().__init__() self.dropout = nn.Dropout(p=dropout) self.pe = nn.Parameter(torch.empty(max_len, 1, d_model)) nn.init.uniform_(self.pe, -0.02, 0.02) def forwa...
FeatureCorrelation
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn def featureL2Norm(feature): epsilon = 1e-06 norm = torch.pow(torch.sum(torch.pow(feature, 2), 1) + epsilon, 0.5 ).unsqueeze(1).expand_as(feature) return torch.div(feature, norm) class FeatureCorrelation(torch.nn.Module): def __init__(self, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
sebastian-echeverria/ncnet
FeatureCorrelation
false
10,786
[ "MIT" ]
0
c7249fe8f908813bab6443ebfa4590bd362a0dc2
https://github.com/sebastian-echeverria/ncnet/tree/c7249fe8f908813bab6443ebfa4590bd362a0dc2
import torch import torch.nn as nn import torch.nn def featureL2Norm(feature): epsilon = 1e-06 norm = torch.pow(torch.sum(torch.pow(feature, 2), 1) + epsilon, 0.5 ).unsqueeze(1).expand_as(feature) return torch.div(feature, norm) class Model(torch.nn.Module): def __init__(self, shape='3D', n...
NonlocalWeightedAverage
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel import torch.nn.functional as F def find_local_patch(x, patch_size): N, _C, H, W = x.shape x_unfold = F.unfold(x, kernel_size=(patch_size, patch_size), padding=( patch_size // 2, patch_size // 2), stride=(1, 1)) return x_unfold.view(N, x_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
qiyuqianxai/debvc
NonlocalWeightedAverage
false
10,787
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
import torch import torch.nn as nn import torch.nn.parallel import torch.nn.functional as F def find_local_patch(x, patch_size): N, _C, H, W = x.shape x_unfold = F.unfold(x, kernel_size=(patch_size, patch_size), padding=( patch_size // 2, patch_size // 2), stride=(1, 1)) return x_unfold.view(N, x_...
Xigmoid
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def xigmoid(x, alpha=1.0): cond = x > 0 ax = alpha * x if_x = torch.exp(ax) else_x = 1.0 / if_x if_x = if_x - 1.0 else_x = 1.0 - else_x cond_x = torch.where(cond, if_x, else_x) return torch.sigmoid(alpha * cond_x) class Xigmoid(nn.Module): 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...
privateos/xigmoid
Xigmoid
false
10,788
[ "MIT" ]
0
3d01c65a7f82ce0d851a42d7e38f084eae2b1622
https://github.com/privateos/xigmoid/tree/3d01c65a7f82ce0d851a42d7e38f084eae2b1622
import torch import torch.nn as nn def xigmoid(x, alpha=1.0): cond = x > 0 ax = alpha * x if_x = torch.exp(ax) else_x = 1.0 / if_x if_x = if_x - 1.0 else_x = 1.0 - else_x cond_x = torch.where(cond, if_x, else_x) return torch.sigmoid(alpha * cond_x) class Model(nn.Module): def __...
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 import torch.nn.functional as F import torch.nn as nn class Net(nn.Module): def __init__(self, n_feature, n_hidden1, n_hidden2, n_hidden3, n_hidden4, n_hidden5, n_output): super(Net, self).__init__() self.hidden1 = torch.nn.Linear(n_feature, n_hidden1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 import torch....
smit25/Code-Clone-Detection-Using-Intermediate-Merge-Siamese-Network
Net
false
10,789
[ "MIT" ]
0
73298836b565febf67c2144a4cacdd2a039d8677
https://github.com/smit25/Code-Clone-Detection-Using-Intermediate-Merge-Siamese-Network/tree/73298836b565febf67c2144a4cacdd2a039d8677
import torch import torch.nn import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, n_feature, n_hidden1, n_hidden2, n_hidden3, n_hidden4, n_hidden5, n_output): super().__init__() self.hidden1 = torch.nn.Linear(n_feature, n_hidden1) self.h...
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 from torch import nn from torch.nn import functional as F import torch.utils.data class LayerNorm(nn.Module): def __init__(self, channels, eps=1e-05): super().__init__() self.channels = channels self.eps = eps self.gamma = nn.Parameter(torch.ones(channels)) se...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn import torch.utils.data assert_size_stride = torch._C._dyn...
roedoejet/vits
LayerNorm
false
10,790
[ "MIT" ]
0
982e3632c876562563bc74c37d485eaf53715ecc
https://github.com/roedoejet/vits/tree/982e3632c876562563bc74c37d485eaf53715ecc
import torch from torch import nn from torch.nn import functional as F import torch.utils.data class Model(nn.Module): def __init__(self, channels, eps=1e-05): super().__init__() self.channels = channels self.eps = eps self.gamma = nn.Parameter(torch.ones(channels)) self.b...
AddNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 AddNorm(nn.Module): def __init__(self, features, dropout=0.0, **kwargs): super(AddNorm, self).__init__(**kwargs) self.dropout = nn.Dropout(dropout) self.ln = nn.LayerNorm(features) def forward(self, x, y): return self.ln(self.dropout(y)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
sudarshan85/transformer_tutorial
AddNorm
false
10,791
[ "MIT" ]
0
a7fc327f0d952d38b3f711fe21ba416616ba8d7e
https://github.com/sudarshan85/transformer_tutorial/tree/a7fc327f0d952d38b3f711fe21ba416616ba8d7e
import torch from torch import nn class Model(nn.Module): def __init__(self, features, dropout=0.0, **kwargs): super().__init__(**kwargs) self.dropout = nn.Dropout(dropout) self.ln = nn.LayerNorm(features) def forward(self, x, y): return self.ln(self.dropout(y) + x) def get...
ContextLoss
# 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 ContextLoss(nn.Module): def __init__(self): super(ContextLoss, self).__init__() def forward(self, generated, corrupted, weight_mask): c_loss = weight_mask * F.l1_loss(generated, corrupted) c_loss = c_loss.mean(d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
suhongkim/Image-Inpainting
ContextLoss
false
10,792
[ "MIT" ]
0
6a3f43b95de2c39aaaf60050211ff03856f24456
https://github.com/suhongkim/Image-Inpainting/tree/6a3f43b95de2c39aaaf60050211ff03856f24456
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, generated, corrupted, weight_mask): c_loss = weight_mask * F.l1_loss(generated, corrupted) c_loss = c_loss.mean(dim=[0, 1, 2, 3]) ...
PredictionConvolutions
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from itertools import product as product import torch.optim import torch.utils.data class PredictionConvolutions(nn.Module): """ Convolutions to predict class scores and bounding boxes using lower and higher-level feature maps. The bounding boxes (locations) are predicte...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn from itertools import product as product import torch.optim...
mosevg/ssd
PredictionConvolutions
false
10,793
[ "MIT" ]
0
8fd9f6cc376c027427531bcf475188ae43c4b2d6
https://github.com/mosevg/ssd/tree/8fd9f6cc376c027427531bcf475188ae43c4b2d6
import torch from torch import nn from itertools import product as product import torch.optim import torch.utils.data class Model(nn.Module): """ Convolutions to predict class scores and bounding boxes using lower and higher-level feature maps. The bounding boxes (locations) are predicted as encoded offs...
Resize
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F class Resize(torch.nn.Module): def __init__(self, size, mode='bilinear'): super().__init__() self.size = size self.mode = mode def forward(self, img): return F.interpolate(img, size=self.size, mode=self.mode, align_corn...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
rlmwang/torch-tools
Resize
false
10,794
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
import torch import torch.nn.functional as F class Model(torch.nn.Module): def __init__(self, size, mode='bilinear'): super().__init__() self.size = size self.mode = mode def forward(self, img): return F.interpolate(img, size=self.size, mode=self.mode, align_corne...
ChannelNorm
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def channel_norm(image): img = image.flatten(2) avg = img.mean(-1)[:, :, None, None] var = img.var(-1)[:, :, None, None] return (image - avg) / torch.sqrt(var + 1e-06) class ChannelNorm(nn.Module): def forward(self, image): return channel_norm(image) ...
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_...
rlmwang/torch-tools
ChannelNorm
false
10,795
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
import torch import torch.nn as nn def channel_norm(image): img = image.flatten(2) avg = img.mean(-1)[:, :, None, None] var = img.var(-1)[:, :, None, None] return (image - avg) / torch.sqrt(var + 1e-06) class Model(nn.Module): def forward(self, image): return channel_norm(image) de...
ChannelScale
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn def channel_scale(image): img = image.flatten(2) vmin = img.min(-1)[0][:, :, None, None] vmax = img.max(-1)[0][:, :, None, None] return (image - vmin) / (vmax - vmin + 1e-06) class ChannelScale(nn.Module): def forward(self, image): return channel_scale...
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...
rlmwang/torch-tools
ChannelScale
false
10,796
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
import torch import torch.nn as nn def channel_scale(image): img = image.flatten(2) vmin = img.min(-1)[0][:, :, None, None] vmax = img.max(-1)[0][:, :, None, None] return (image - vmin) / (vmax - vmin + 1e-06) class Model(nn.Module): def forward(self, image): return channel_scale(image)...
SelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SelfAttention(nn.Module): def __init__(self, embed_size, heads): super(SelfAttention, self).__init__() self.embed_size = embed_size self.heads = heads self.head_dimension = embed_size // heads assert self.head_dimension * self.heads...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
shahrukhx01/transformers-bisected
SelfAttention
false
10,797
[ "Apache-2.0" ]
0
a97647aca7963e6f9d4fce5a067ba68d393072d6
https://github.com/shahrukhx01/transformers-bisected/tree/a97647aca7963e6f9d4fce5a067ba68d393072d6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, embed_size, heads): super().__init__() self.embed_size = embed_size self.heads = heads self.head_dimension = embed_size // heads assert self.head_dimension * self.heads == self.embed_size, 'Embed...
Self_Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.modul...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
qiyuqianxai/debvc
Self_Attention
false
10,798
[ "MIT" ]
0
1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
https://github.com/qiyuqianxai/debvc/tree/1d919019a3191d1c6a7da9b8f16e47bca6b3aef9
import torch import torch.nn as nn import torch.nn.parallel from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super().__init__() self.module = module ...
GlobalMaxPool2d
# 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 GlobalMaxPool2d(nn.Module): def forward(self, inputs): return nn.functional.adaptive_max_pool2d(inputs, 1).view(inputs. size(0), -1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
rlmwang/torch-tools
GlobalMaxPool2d
false
10,799
[ "MIT" ]
0
822132534d73414f26045bad38a0a345661b057f
https://github.com/rlmwang/torch-tools/tree/822132534d73414f26045bad38a0a345661b057f
import torch import torch.nn as nn class Model(nn.Module): def forward(self, inputs): return nn.functional.adaptive_max_pool2d(inputs, 1).view(inputs. size(0), -1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
Block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Block(nn.Module): """ A ResNet module. """ def __init__(self, iDim, hDim): super().__init__() self.W0 = nn.Linear(iDim, hDim) self.W1 = nn.Linear(hDim, iDim) def LS(w): return w.weight.numel() + w.bias.numel() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
sparseinference/argmaxnet
Block
false
10,800
[ "MIT" ]
0
ff1e090a662d384f2ba4349494c9630079d2545b
https://github.com/sparseinference/argmaxnet/tree/ff1e090a662d384f2ba4349494c9630079d2545b
import torch import torch.nn as nn class Model(nn.Module): """ A ResNet module. """ def __init__(self, iDim, hDim): super().__init__() self.W0 = nn.Linear(iDim, hDim) self.W1 = nn.Linear(hDim, iDim) def LS(w): return w.weight.numel() + w.bias.numel() ...