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
neuralNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 neuralNet(nn.Module): def __init__(self): super(neuralNet, self).__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=6, kernel_size=5) self.conv2 = nn.Conv2d(in_channels=6, out_channels=12, kernel_size=5) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ayushmaan02/Plant-Disease-Detection
neuralNet
false
3,173
[ "MIT" ]
0
35e5b8112e933fd558a80a1e5350df541c29bd6b
https://github.com/ayushmaan02/Plant-Disease-Detection/tree/35e5b8112e933fd558a80a1e5350df541c29bd6b
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(in_channels=3, out_channels=6, kernel_size=5) self.conv2 = nn.Conv2d(in_channels=6, out_channels=12, kernel_size=5) self.conv3 =...
Splitter
# 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 class Splitter(torch.nn.Module): """ An implementation of "Splitter: Learning Node Representations that Capture Multiple Social Contexts" (WWW 2019). Paper: http://epasto.org/papers/www2019splitter.pdf """ def __init__(self, dimensions, lambd, base_node_count, node...
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 nump...
balla2081/SpliiterPytorch
Splitter
false
3,174
[ "MIT" ]
0
366742166470dc730fe761bae081779d737e1315
https://github.com/balla2081/SpliiterPytorch/tree/366742166470dc730fe761bae081779d737e1315
import torch import numpy as np class Model(torch.nn.Module): """ An implementation of "Splitter: Learning Node Representations that Capture Multiple Social Contexts" (WWW 2019). Paper: http://epasto.org/papers/www2019splitter.pdf """ def __init__(self, dimensions, lambd, base_node_count, node_co...
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 math import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): def __init__(self, heads, d_model, dropout=0.1): super().__init__() self.d_model = d_model self.d_k = d_model // heads self.h = heads self.q_linear = nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
b19e93n/PLC-Pyramid
DecoderLayer
false
3,175
[ "MIT" ]
0
6d5b57be6995a94ef7402144cee965862713b031
https://github.com/b19e93n/PLC-Pyramid/tree/6d5b57be6995a94ef7402144cee965862713b031
import math import torch import torch.nn as nn import torch.nn.functional as F class MultiHeadAttention(nn.Module): def __init__(self, heads, d_model, dropout=0.1): super().__init__() self.d_model = d_model self.d_k = d_model // heads self.h = heads self.q_linear = nn.Line...
StandardWNetDown
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.jit import torch.nn class DepthWiseSeparableConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=1, dilation=1, bias=True): """Depthwise separable 2D convolution. Args: in_channels (int): number ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
ankmathur96/torchsupport
StandardWNetDown
false
3,176
[ "MIT" ]
0
77bf4a90b8770a408665e2604428808c3ed2f979
https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979
import torch import torch.nn as nn import torch.jit import torch.nn class DepthWiseSeparableConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=1, dilation=1, bias=True): """Depthwise separable 2D convolution. Args: in_channels (int): number ...
AdaptiveInstanceNormPP
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.jit import torch.nn class AdaptiveInstanceNorm(nn.Module): def __init__(self, in_size, ada_size): super(AdaptiveInstanceNorm, self).__init__() self.scale = nn.Linear(ada_size, in_size) self.bias = nn.Linear(ada_size, in_size) def forwar...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
ankmathur96/torchsupport
AdaptiveInstanceNormPP
false
3,177
[ "MIT" ]
0
77bf4a90b8770a408665e2604428808c3ed2f979
https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979
import torch import torch.nn as nn import torch.jit import torch.nn class AdaptiveInstanceNorm(nn.Module): def __init__(self, in_size, ada_size): super().__init__() self.scale = nn.Linear(ada_size, in_size) self.bias = nn.Linear(ada_size, in_size) def forward(self, inputs, style): ...
NonLocal
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 func import torch.jit import torch.nn class NonLocal(nn.Module): def __init__(self, in_size, attention_size=32, size=None, scale=None): super(NonLocal, self).__init__() self.size = size self.scale = scale self.attent...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ankmathur96/torchsupport
NonLocal
false
3,178
[ "MIT" ]
0
77bf4a90b8770a408665e2604428808c3ed2f979
https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979
import torch import torch.nn as nn import torch.nn.functional as func import torch.jit import torch.nn class Model(nn.Module): def __init__(self, in_size, attention_size=32, size=None, scale=None): super().__init__() self.size = size self.scale = scale self.attention_size = attent...
MultiheadSimilarity
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data from torch import nn class MultiheadSimilarity(nn.Module): def __init__(self, d_model, num_head, seq_len): super().__init__() self.num_head = num_head self.seq_len = seq_len self.d_head = d_model // num_head self.q_in_proj = nn.Linear(d...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torch import nn assert_size_stride = torch._C._dyna...
bearcatt/SimpleBaseline
MultiheadSimilarity
false
3,179
[ "MIT" ]
0
9ae38f289688c0e671efb50985d3b8fe2da47d69
https://github.com/bearcatt/SimpleBaseline/tree/9ae38f289688c0e671efb50985d3b8fe2da47d69
import torch import torch.utils.data from torch import nn class Model(nn.Module): def __init__(self, d_model, num_head, seq_len): super().__init__() self.num_head = num_head self.seq_len = seq_len self.d_head = d_model // num_head self.q_in_proj = nn.Linear(d_model, seq_le...
ContrastivePairwiseEmbeddingLoss
# 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 from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed class ContrastivePairwiseEmbeddingLoss(nn.Module): """ ContrastivePairwiseEmbeddingLos...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bbradt/catalyst
ContrastivePairwiseEmbeddingLoss
false
3,180
[ "Apache-2.0" ]
0
38a503c8af040906e377b7485d7fe15a7bc1de19
https://github.com/bbradt/catalyst/tree/38a503c8af040906e377b7485d7fe15a7bc1de19
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed class Model(nn.Module): """ ContrastivePairwiseEmbeddingLoss – proof of concept criter...
NormalizedDistance
# 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.jit import torch.nn def normalized_distance(data, distance): data = data.view(data.size(0), -1) reference = data[:, None] comparison = data[None, :] result = distance(reference, comparison) result = result / result.sum(dim=1, keepdim=True).detach() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.jit import torch.nn assert_size_stride = tor...
ankmathur96/torchsupport
NormalizedDistance
false
3,181
[ "MIT" ]
0
77bf4a90b8770a408665e2604428808c3ed2f979
https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979
import torch import torch.nn as nn import torch.jit import torch.nn def normalized_distance(data, distance): data = data.view(data.size(0), -1) reference = data[:, None] comparison = data[None, :] result = distance(reference, comparison) result = result / result.sum(dim=1, keepdim=True).detach() ...
ContrastiveDistanceLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed class ContrastiveDistanceLoss(nn.Module): """ Contrastive distance loss """ def __init__(self, margin=1.0, re...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from torch.nn.modules.loss import * from torch.nn.modules import * ...
bbradt/catalyst
ContrastiveDistanceLoss
false
3,182
[ "Apache-2.0" ]
0
38a503c8af040906e377b7485d7fe15a7bc1de19
https://github.com/bbradt/catalyst/tree/38a503c8af040906e377b7485d7fe15a7bc1de19
import torch import torch.nn as nn from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed class Model(nn.Module): """ Contrastive distance loss """ def __init__(self, margin=1.0, reduction='mean'): ...
ContrastiveEmbeddingLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed class ContrastiveEmbeddingLoss(nn.Module): """ Contrastive embedding loss paper: http://yann.lecun.com/exdb/publi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from t...
bbradt/catalyst
ContrastiveEmbeddingLoss
false
3,183
[ "Apache-2.0" ]
0
38a503c8af040906e377b7485d7fe15a7bc1de19
https://github.com/bbradt/catalyst/tree/38a503c8af040906e377b7485d7fe15a7bc1de19
import torch import torch.nn as nn from torch.nn.modules.loss import * from torch.nn.modules import * from torch.optim import * from torch.optim.lr_scheduler import * import torch.distributed class Model(nn.Module): """ Contrastive embedding loss paper: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopr...
FiLMNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 FiLMNetwork(nn.Module): def __init__(self, in_sz, out_sz): super(FiLMNetwork, self).__init__() self.f = nn.Linear(in_sz, out_sz) self.h = nn.Linear(in_sz, out_sz) def forward(self, inputs, features): gamma = self.f(inputs).unsqueeze(1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bblinn2017/IM-NET-pytorch
FiLMNetwork
false
3,184
[ "MIT" ]
0
82ff646aaf2f93ae1560debb40fe05f1420ff655
https://github.com/bblinn2017/IM-NET-pytorch/tree/82ff646aaf2f93ae1560debb40fe05f1420ff655
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_sz, out_sz): super().__init__() self.f = nn.Linear(in_sz, out_sz) self.h = nn.Linear(in_sz, out_sz) def forward(self, inputs, features): gamma = self.f(inputs).unsqueeze(1) beta = self.h(...
MLP_FiLM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 FiLMNetwork(nn.Module): def __init__(self, in_sz, out_sz): super(FiLMNetwork, self).__init__() self.f = nn.Linear(in_sz, out_sz) self.h = nn.Linear(in_sz, out_sz) def forward(self, inputs, features): gamma = self.f(inputs).unsqueeze(1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
bblinn2017/IM-NET-pytorch
MLP_FiLM
false
3,185
[ "MIT" ]
0
82ff646aaf2f93ae1560debb40fe05f1420ff655
https://github.com/bblinn2017/IM-NET-pytorch/tree/82ff646aaf2f93ae1560debb40fe05f1420ff655
import torch import torch.nn as nn class FiLMNetwork(nn.Module): def __init__(self, in_sz, out_sz): super().__init__() self.f = nn.Linear(in_sz, out_sz) self.h = nn.Linear(in_sz, out_sz) def forward(self, inputs, features): gamma = self.f(inputs).unsqueeze(1) beta = s...
CnnViewModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CnnViewModel(nn.Module): def __init__(self, out_dim=10): super(CnnViewModel, self).__init__() self.cnn1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=5, stride=1, padding=2) self.relu1 = nn.ReLU() self.maxpool1 = nn.Ma...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bbrighttaer/DCCA_demo
CnnViewModel
false
3,186
[ "MIT" ]
0
c5410f2e163c6538899bf8f5f9afe031a517408f
https://github.com/bbrighttaer/DCCA_demo/tree/c5410f2e163c6538899bf8f5f9afe031a517408f
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, out_dim=10): super().__init__() self.cnn1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=5, stride=1, padding=2) self.relu1 = nn.ReLU() self.maxpool1 = nn.MaxPool2d(kernel_size=2) ...
FastestBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def get_operator_from_cfg(operator_cfg): operator_cfg_copy = operator_cfg.copy() construct_str = 'nn.' construct_str += operator_cfg_copy.pop('type') + '(' for k, v in operator_cfg_copy.items(): construct_str += k + '=' + str(v) + ',' construct_str += ')'...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
becauseofAI/DemoHub
FastestBlock
false
3,187
[ "Apache-2.0" ]
0
2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da
https://github.com/becauseofAI/DemoHub/tree/2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da
import torch import torch.nn as nn def get_operator_from_cfg(operator_cfg): operator_cfg_copy = operator_cfg.copy() construct_str = 'nn.' construct_str += operator_cfg_copy.pop('type') + '(' for k, v in operator_cfg_copy.items(): construct_str += k + '=' + str(v) + ',' construct_str += ')'...
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 as nn import torch.nn.functional as F class Resize(nn.Module): def __init__(self, input_size=[224, 224]): super(Resize, self).__init__() self.input_size = input_size def forward(self, input): x = F.interpolate(input, size=self.input_size, mode='bilinear',...
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...
beibuwandeluori/Attack-ImageNet-tianchi
Resize
false
3,188
[ "MIT" ]
0
85294952ac1a190c26bba5e8f141b1c68e72668a
https://github.com/beibuwandeluori/Attack-ImageNet-tianchi/tree/85294952ac1a190c26bba5e8f141b1c68e72668a
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size=[224, 224]): super().__init__() self.input_size = input_size def forward(self, input): x = F.interpolate(input, size=self.input_size, mode='bilinear', ...
ConvGRUCellNd
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.jit import torch.nn class ConvGRUCellNd(nn.Module): def __init__(self, in_size, out_size, kernel_size, N=1, **kwargs): super(ConvGRUCellNd, self).__init__() conv = eval(f'nn.Conv{N}d') self.conv_ir = conv(in_size, out_size, kernel_size, **kw...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
ankmathur96/torchsupport
ConvGRUCellNd
false
3,189
[ "MIT" ]
0
77bf4a90b8770a408665e2604428808c3ed2f979
https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979
import torch import torch.nn as nn import torch.jit import torch.nn class Model(nn.Module): def __init__(self, in_size, out_size, kernel_size, N=1, **kwargs): super().__init__() conv = eval(f'nn.Conv{N}d') self.conv_ir = conv(in_size, out_size, kernel_size, **kwargs) self.conv_hr ...
Unet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.nn import functional as F class ContractingBlock(nn.Module): """ ContractingBlock Class Performs two convolutions followed by a max pool operation. Values: input_channels: the number of channels to expect from a given input """ 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 import nn from tor...
akanametov/unet-pytorch
Unet
false
3,190
[ "MIT" ]
0
6cf0f70674958356ea4ac36fe61b0415921f72ae
https://github.com/akanametov/unet-pytorch/tree/6cf0f70674958356ea4ac36fe61b0415921f72ae
import torch from torch import nn from torch.nn import functional as F class ContractingBlock(nn.Module): """ ContractingBlock Class Performs two convolutions followed by a max pool operation. Values: input_channels: the number of channels to expect from a given input """ def __init__...
SortNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 SortNet(nn.Module): def __init__(self, input_size, hidden_size): super(SortNet, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.fc1 = nn.Linear(input_size, hidden_size, bias=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
bashish101/sort
SortNet
false
3,191
[ "MIT" ]
0
c8f3e4875c039e6eb935c34ed8403c5d439bf8ad
https://github.com/bashish101/sort/tree/c8f3e4875c039e6eb935c34ed8403c5d439bf8ad
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_size, hidden_size): super().__init__() self.input_size = input_size self.hidden_size = hidden_size self.fc1 = nn.Linear(input_size, hidden_size, bias=None) s...
Lambda
# 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 Lambda(nn.Module): def forward(self, t, y): t = t.unsqueeze(0) equation = -1000 * y + 3000 - 2000 * torch.exp(-t) return equation def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): retur...
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...
arnabgho/torchdiffeq
Lambda
false
3,192
[ "MIT" ]
0
d4f73440d0e714b87ea133610e61eefbd673e5f5
https://github.com/arnabgho/torchdiffeq/tree/d4f73440d0e714b87ea133610e61eefbd673e5f5
import torch import torch.nn as nn class Model(nn.Module): def forward(self, t, y): t = t.unsqueeze(0) equation = -1000 * y + 3000 - 2000 * torch.exp(-t) return equation def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(): return...
SineODE
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch class SineODE(torch.nn.Module): def __init__(self, device): super(SineODE, self).__init__() def forward(self, t, y): return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3 def y_exact(self, t): return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math assert_size_stride = torch._C._dynamo.guards.assert_size_stri...
arnabgho/torchdiffeq
SineODE
false
3,193
[ "MIT" ]
0
d4f73440d0e714b87ea133610e61eefbd673e5f5
https://github.com/arnabgho/torchdiffeq/tree/d4f73440d0e714b87ea133610e61eefbd673e5f5
import math import torch class Model(torch.nn.Module): def __init__(self, device): super().__init__() def forward(self, t, y): return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3 def y_exact(self, t): return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * t ** 3 * torch....
generator
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 generator(nn.Module): def __init__(self, z_dim, point_dim, gf_dim): super(generator, self).__init__() self.z_dim = z_dim self.point_dim = point_dim self.gf_dim = gf_dim self.linear_1 = nn.Linear(self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
bblinn2017/IM-NET-pytorch
generator
false
3,194
[ "MIT" ]
0
82ff646aaf2f93ae1560debb40fe05f1420ff655
https://github.com/bblinn2017/IM-NET-pytorch/tree/82ff646aaf2f93ae1560debb40fe05f1420ff655
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, z_dim, point_dim, gf_dim): super().__init__() self.z_dim = z_dim self.point_dim = point_dim self.gf_dim = gf_dim self.linear_1 = nn.Linear(self.z_dim + self.point_...
encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class encoder(nn.Module): def __init__(self, ef_dim, z_dim): super(encoder, self).__init__() self.ef_dim = ef_dim self.z_dim = z_dim self.conv_1 = nn.Conv3d(1, self.ef_dim, 4, stride=2, padding=1, bias=...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
bblinn2017/IM-NET-pytorch
encoder
false
3,195
[ "MIT" ]
0
82ff646aaf2f93ae1560debb40fe05f1420ff655
https://github.com/bblinn2017/IM-NET-pytorch/tree/82ff646aaf2f93ae1560debb40fe05f1420ff655
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, ef_dim, z_dim): super().__init__() self.ef_dim = ef_dim self.z_dim = z_dim self.conv_1 = nn.Conv3d(1, self.ef_dim, 4, stride=2, padding=1, bias=False) ...
Permute
# 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 Permute(nn.Module): def __init__(self, permutation=[2, 1, 0]): super().__init__() self.permutation = permutation def forward(self, input): return input[:, self.permutation] def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
beibuwandeluori/Attack-ImageNet-tianchi
Permute
false
3,196
[ "MIT" ]
0
85294952ac1a190c26bba5e8f141b1c68e72668a
https://github.com/beibuwandeluori/Attack-ImageNet-tianchi/tree/85294952ac1a190c26bba5e8f141b1c68e72668a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, permutation=[2, 1, 0]): super().__init__() self.permutation = permutation def forward(self, input): return input[:, self.permutation] def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init...
FastBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def get_operator_from_cfg(operator_cfg): operator_cfg_copy = operator_cfg.copy() construct_str = 'nn.' construct_str += operator_cfg_copy.pop('type') + '(' for k, v in operator_cfg_copy.items(): construct_str += k + '=' + str(v) + ',' construct_str += ')'...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
becauseofAI/DemoHub
FastBlock
false
3,197
[ "Apache-2.0" ]
0
2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da
https://github.com/becauseofAI/DemoHub/tree/2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da
import torch import torch.nn as nn def get_operator_from_cfg(operator_cfg): operator_cfg_copy = operator_cfg.copy() construct_str = 'nn.' construct_str += operator_cfg_copy.pop('type') + '(' for k, v in operator_cfg_copy.items(): construct_str += k + '=' + str(v) + ',' construct_str += ')'...
DepthWiseSeparableConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.jit import torch.nn class DepthWiseSeparableConv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=1, dilation=1, bias=True): """Depthwise separable 2D convolution. Args: in_channels (int): number ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.jit import torch.nn assert_size_stride = torc...
ankmathur96/torchsupport
DepthWiseSeparableConv2d
false
3,198
[ "MIT" ]
0
77bf4a90b8770a408665e2604428808c3ed2f979
https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979
import torch import torch.nn as nn import torch.jit import torch.nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=1, dilation=1, bias=True): """Depthwise separable 2D convolution. Args: in_channels (int): number of input channels. ...
Decoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class Decoder(nn.Module): def __init__(self, latent_dim=4, obs_dim=2, nhidden=20): super(Decoder, self).__init__() self.relu = nn.ReLU(inplace=True) self.fc1 = nn.Linear(latent_dim, nhidden) self.fc2 = nn.Linear(nhidden, obs_dim) def forward...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
arnabgho/torchdiffeq
Decoder
false
3,199
[ "MIT" ]
0
d4f73440d0e714b87ea133610e61eefbd673e5f5
https://github.com/arnabgho/torchdiffeq/tree/d4f73440d0e714b87ea133610e61eefbd673e5f5
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, latent_dim=4, obs_dim=2, nhidden=20): super().__init__() self.relu = nn.ReLU(inplace=True) self.fc1 = nn.Linear(latent_dim, nhidden) self.fc2 = nn.Linear(nhidden, obs_dim) def forward(self, z): ...
FilterResponseNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 func import torch.jit import torch.nn class FilterResponseNorm(nn.Module): def __init__(self, in_size, eps=1e-16): super().__init__() self.eps = eps self.in_size = in_size self.register_parameter('scale', nn.Paramete...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
ankmathur96/torchsupport
FilterResponseNorm
false
3,200
[ "MIT" ]
0
77bf4a90b8770a408665e2604428808c3ed2f979
https://github.com/ankmathur96/torchsupport/tree/77bf4a90b8770a408665e2604428808c3ed2f979
import torch import torch.nn as nn import torch.nn.functional as func import torch.jit import torch.nn class Model(nn.Module): def __init__(self, in_size, eps=1e-16): super().__init__() self.eps = eps self.in_size = in_size self.register_parameter('scale', nn.Parameter(torch.ones(...
ConstantODE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 class ConstantODE(torch.nn.Module): def __init__(self, device): super(ConstantODE, self).__init__() self.a = torch.nn.Parameter(torch.tensor(0.2)) self.b = torch.nn.Parameter(torch.tensor(3.0)) def forward(self, t, y): return self.a + (y - (self.a * t + self.b)) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
arnabgho/torchdiffeq
ConstantODE
false
3,201
[ "MIT" ]
0
d4f73440d0e714b87ea133610e61eefbd673e5f5
https://github.com/arnabgho/torchdiffeq/tree/d4f73440d0e714b87ea133610e61eefbd673e5f5
import torch class Model(torch.nn.Module): def __init__(self, device): super().__init__() self.a = torch.nn.Parameter(torch.tensor(0.2)) self.b = torch.nn.Parameter(torch.tensor(3.0)) def forward(self, t, y): return self.a + (y - (self.a * t + self.b)) ** 5 def y_exact(s...
FasterBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def get_operator_from_cfg(operator_cfg): operator_cfg_copy = operator_cfg.copy() construct_str = 'nn.' construct_str += operator_cfg_copy.pop('type') + '(' for k, v in operator_cfg_copy.items(): construct_str += k + '=' + str(v) + ',' construct_str += ')'...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
becauseofAI/DemoHub
FasterBlock
false
3,202
[ "Apache-2.0" ]
0
2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da
https://github.com/becauseofAI/DemoHub/tree/2b7fdd1f1c6f229ba326e8c1b78c4e7f5982f3da
import torch import torch.nn as nn def get_operator_from_cfg(operator_cfg): operator_cfg_copy = operator_cfg.copy() construct_str = 'nn.' construct_str += operator_cfg_copy.pop('type') + '(' for k, v in operator_cfg_copy.items(): construct_str += k + '=' + str(v) + ',' construct_str += ')'...
LinearProximal
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 functional from torch import nn class LinearProximal(nn.Module): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` Args: in_features: size of each input sample out_features: size of each output sample b...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn assert_size_stride = torch._C._dynamo.guards.as...
belbahrim/twin-causal-net
LinearProximal
false
3,203
[ "MIT" ]
0
f45d5a61ed9039ae7d0cd615d95212f11a5a2086
https://github.com/belbahrim/twin-causal-net/tree/f45d5a61ed9039ae7d0cd615d95212f11a5a2086
import math import torch import torch.nn.functional as functional from torch import nn class Model(nn.Module): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` Args: in_features: size of each input sample out_features: size of each output sample bias: If s...
TwoLayerNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 class TwoLayerNet(torch.nn.Module): """ This class is copied from PyTorch's documentation and is meant to be the simplest, non-trivial custom NN we can use for testing provenance. See [here](https://pytorch.org/tutorials/beginner/examples_nn/two_layer_net_module.html#sphx-glr-beginner-exa...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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...
benfogelson/provenance
TwoLayerNet
false
3,204
[ "MIT" ]
0
e61095e767e8786943ea76bef9b5dd6dd9575041
https://github.com/benfogelson/provenance/tree/e61095e767e8786943ea76bef9b5dd6dd9575041
import torch class Model(torch.nn.Module): """ This class is copied from PyTorch's documentation and is meant to be the simplest, non-trivial custom NN we can use for testing provenance. See [here](https://pytorch.org/tutorials/beginner/examples_nn/two_layer_net_module.html#sphx-glr-beginner-examples-...
Conv2dBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps self.momentum = mome...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn.functional as...
belphegor2211/KLTN_GANwriting
Conv2dBlock
false
3,205
[ "MIT" ]
0
67d4d5c286ec45ef704b49c5abf9774d38bf65eb
https://github.com/belphegor2211/KLTN_GANwriting/tree/67d4d5c286ec45ef704b49c5abf9774d38bf65eb
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super().__init__() self.num_features = num_features self.eps = eps self.momentum = momentum self.weight = N...
Biaffine
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.checkpoint class Biaffine(nn.Module): def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True): super(Biaffine, self).__init__() self.n_in = n_in self.n_out = n_out self.bias_x = bias_x self.bias_y = bias_y 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 import torch.nn as nn import torch.utils.checkpoint assert_size_stride = torch._...
benjamin-mlr/lightning-language-modeling
Biaffine
false
3,206
[ "Apache-2.0" ]
0
62b497cc2a01bdae0451ebe0f314f7fcb0f7eef3
https://github.com/benjamin-mlr/lightning-language-modeling/tree/62b497cc2a01bdae0451ebe0f314f7fcb0f7eef3
import torch import torch.nn as nn import torch.utils.checkpoint class Model(nn.Module): def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True): super().__init__() self.n_in = n_in self.n_out = n_out self.bias_x = bias_x self.bias_y = bias_y self.weight = nn.P...
ActFirstResBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super(AdaptiveInstanceNorm2d, self).__init__() self.num_features = num_features self.eps = eps self.momentum = mome...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
belphegor2211/KLTN_GANwriting
ActFirstResBlock
false
3,207
[ "MIT" ]
0
67d4d5c286ec45ef704b49c5abf9774d38bf65eb
https://github.com/belphegor2211/KLTN_GANwriting/tree/67d4d5c286ec45ef704b49c5abf9774d38bf65eb
import torch import torch.nn.functional as F from torch import nn class AdaptiveInstanceNorm2d(nn.Module): def __init__(self, num_features, eps=1e-05, momentum=0.1): super().__init__() self.num_features = num_features self.eps = eps self.momentum = momentum self.weight = N...
PrimaryCapsLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def squash(x): lengths2 = x.pow(2).sum(dim=2) lengths = lengths2.sqrt() x = x * (lengths2 / (1 + lengths2) / lengths).view(x.size(0), x.size(1), 1) return x class PrimaryCapsLayer(nn.Module): def __init__(self, input_channels, output_caps, output_dim, kernel_s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
bentrevett/capsules
PrimaryCapsLayer
false
3,208
[ "MIT" ]
0
239273de25c607d7a7504e8c6900772fddd15cd3
https://github.com/bentrevett/capsules/tree/239273de25c607d7a7504e8c6900772fddd15cd3
import torch import torch.nn as nn def squash(x): lengths2 = x.pow(2).sum(dim=2) lengths = lengths2.sqrt() x = x * (lengths2 / (1 + lengths2) / lengths).view(x.size(0), x.size(1), 1) return x class Model(nn.Module): def __init__(self, input_channels, output_caps, output_dim, kernel_size, ...
policy_net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class policy_net(nn.Module): def __init__(self, n_states, n_actions, n_hidden=128): super(policy_net, self).__init__() self.affine1 = nn.Linear(n_states, n_hidden) self.affine2 = nn.Linear(n_hidden, n_actions) def for...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bigtreeljc/force_learning
policy_net
false
3,209
[ "MIT" ]
0
183a7c96c411e282966604e3cb375ba49e91a88c
https://github.com/bigtreeljc/force_learning/tree/183a7c96c411e282966604e3cb375ba49e91a88c
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, n_states, n_actions, n_hidden=128): super().__init__() self.affine1 = nn.Linear(n_states, n_hidden) self.affine2 = nn.Linear(n_hidden, n_actions) def forward(self, x): ...
spectral_model
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class spectral_model(nn.Module): def __init__(self, num_classes): super(spectral_model, self).__init__() self.mlp1 = nn.Conv1d(6, 64, 1) self.mlp2 = nn.Conv1d(64, 128, 1) self.mlp3 = nn.Conv1d(128, 256, 1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
berkbilir/point-cloud-classification
spectral_model
false
3,210
[ "MIT" ]
0
4188b317acc8efccb694831b26a3a8564dee5530
https://github.com/berkbilir/point-cloud-classification/tree/4188b317acc8efccb694831b26a3a8564dee5530
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_classes): super().__init__() self.mlp1 = nn.Conv1d(6, 64, 1) self.mlp2 = nn.Conv1d(64, 128, 1) self.mlp3 = nn.Conv1d(128, 256, 1) self.flatten = nn.Flatten() ...
NSELoss
# 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 NSELoss(torch.nn.Module): """Calculate (batch-wise) NSE Loss. Each sample i is weighted by 1 / (std_i + eps)^2, where std_i is the standard deviation of the discharge from the basin, to which the sample belongs. Parameters: ----------- eps : float Constant, added ...
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...
bernharl/CamelsML
NSELoss
false
3,211
[ "Apache-2.0" ]
0
4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
https://github.com/bernharl/CamelsML/tree/4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
import torch class Model(torch.nn.Module): """Calculate (batch-wise) NSE Loss. Each sample i is weighted by 1 / (std_i + eps)^2, where std_i is the standard deviation of the discharge from the basin, to which the sample belongs. Parameters: ----------- eps : float Constant, added to...
Encoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Encoder(nn.Module): """ VAE encoder """ def __init__(self, img_channels, latent_size): super(Encoder, self).__init__() self.latent_size = latent_size self.img_channels = img_channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
benedictquartey/modified-wm
Encoder
false
3,212
[ "MIT" ]
0
bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
https://github.com/benedictquartey/modified-wm/tree/bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ VAE encoder """ def __init__(self, img_channels, latent_size): super().__init__() self.latent_size = latent_size self.img_channels = img_channels self.conv1 =...
ac_net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class ac_net(nn.Module): def __init__(self, n_states, n_actions, n_hidden=32): super(ac_net, self).__init__() self.fc1 = nn.Linear(n_states, n_hidden) self.action_head = nn.Linear(n_hidden, n_actions) self.value_he...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bigtreeljc/force_learning
ac_net
false
3,213
[ "MIT" ]
0
183a7c96c411e282966604e3cb375ba49e91a88c
https://github.com/bigtreeljc/force_learning/tree/183a7c96c411e282966604e3cb375ba49e91a88c
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, n_states, n_actions, n_hidden=32): super().__init__() self.fc1 = nn.Linear(n_states, n_hidden) self.action_head = nn.Linear(n_hidden, n_actions) self.value_head = nn.Linea...
Decoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Decoder(nn.Module): """ VAE decoder """ def __init__(self, img_channels, latent_size): super(Decoder, self).__init__() self.latent_size = latent_size self.img_channels = img_channels ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
benedictquartey/modified-wm
Decoder
false
3,214
[ "MIT" ]
0
bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
https://github.com/benedictquartey/modified-wm/tree/bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ VAE decoder """ def __init__(self, img_channels, latent_size): super().__init__() self.latent_size = latent_size self.img_channels = img_channels self.fc1 = n...
LSTM
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 Tuple import torch.nn as nn class LSTM(nn.Module): """Implementation of the standard LSTM. Parameters ---------- input_size : int Number of input features hidden_size : int Number of hidden/memory cells. batch_first : bool, optional If ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
bernharl/CamelsML
LSTM
false
3,215
[ "Apache-2.0" ]
0
4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
https://github.com/bernharl/CamelsML/tree/4ec3ea231ba6ed8c9db68f0aa61aba8da32652b8
import torch from typing import Tuple import torch.nn as nn class Model(nn.Module): """Implementation of the standard LSTM. Parameters ---------- input_size : int Number of input features hidden_size : int Number of hidden/memory cells. batch_first : bool, optional If...
TemporalDecayRegression
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def linear(input, weight, bias=None): if input.dim() == 2 and bias is not None: ret = torch.addmm(bias, input, weight.t()) else: output = input.matmul(weight.t()) if bias is not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
asifr/armisc
TemporalDecayRegression
false
3,216
[ "MIT" ]
0
486220ba498353faeb94f70cd8ffe917109526d2
https://github.com/asifr/armisc/tree/486220ba498353faeb94f70cd8ffe917109526d2
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def linear(input, weight, bias=None): if input.dim() == 2 and bias is not None: ret = torch.addmm(bias, input, weight.t()) else: output = input.matmul(weight.t()) if bias is not ...
Hflip
# 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 hflip(input: 'torch.Tensor') ->torch.Tensor: """Horizontally flip a tensor image or a batch of tensor images. .. image:: _static/img/hflip.png Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: input: input tens...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
bkntr/kornia
Hflip
false
3,217
[ "ECL-2.0", "Apache-2.0" ]
0
aa31f8d730864c71948cef32f9d3ed9138401755
https://github.com/bkntr/kornia/tree/aa31f8d730864c71948cef32f9d3ed9138401755
import torch import torch.nn as nn def hflip(input: 'torch.Tensor') ->torch.Tensor: """Horizontally flip a tensor image or a batch of tensor images. .. image:: _static/img/hflip.png Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: input: input tens...
GlobalpoolFC
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 GlobalpoolFC(nn.Module): def __init__(self, num_in, num_class): super(GlobalpoolFC, self).__init__() self.pool = nn.AdaptiveAvgPool2d(output_size=1) self.fc = nn.Linear(num_in, num_class) def forward(self, x): y = self.pool(x) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
blackcow/pytorch-cifar-master
GlobalpoolFC
false
3,218
[ "MIT" ]
0
c571c8fd7fe521907755ca2eacb6aa877abe3493
https://github.com/blackcow/pytorch-cifar-master/tree/c571c8fd7fe521907755ca2eacb6aa877abe3493
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_in, num_class): super().__init__() self.pool = nn.AdaptiveAvgPool2d(output_size=1) self.fc = nn.Linear(num_in, num_class) def forward(self, x): y = self.pool(x) y = y.reshape(y.shape[0],...
FeatureEmbedding
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def linear(input, weight, bias=None): if input.dim() == 2 and bias is not None: ret = torch.addmm(bias, input, weight.t()) else: output = input.matmul(weight.t()) if bias is not ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
asifr/armisc
FeatureEmbedding
false
3,219
[ "MIT" ]
0
486220ba498353faeb94f70cd8ffe917109526d2
https://github.com/asifr/armisc/tree/486220ba498353faeb94f70cd8ffe917109526d2
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter def linear(input, weight, bias=None): if input.dim() == 2 and bias is not None: ret = torch.addmm(bias, input, weight.t()) else: output = input.matmul(weight.t()) if bias is not ...
waspIntrinsicComposer
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class waspIntrinsicComposer(nn.Module): def __init__(self, opt): super(waspIntrinsicComposer, self).__init__() self.ngpu = opt.ngpu self.nc = opt.nc def f...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
bhushan23/illumination-nets
waspIntrinsicComposer
false
3,220
[ "BSD-2-Clause" ]
0
a7e579489e3ed67c926b27113cf65eec2aea6287
https://github.com/bhushan23/illumination-nets/tree/a7e579489e3ed67c926b27113cf65eec2aea6287
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class Model(nn.Module): def __init__(self, opt): super().__init__() self.ngpu = opt.ngpu self.nc = opt.nc def forward(self, shading, albedo): self...
VAE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Decoder(nn.Module): """ VAE decoder """ def __init__(self, img_channels, latent_size): super(Decoder, self).__init__() self.latent_size = latent_size self.img_channels = img_channels ...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
benedictquartey/modified-wm
VAE
false
3,221
[ "MIT" ]
0
bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
https://github.com/benedictquartey/modified-wm/tree/bc6cab1aadff24f4be8bb7b9c183b6ef266cf8ba
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class Decoder(nn.Module): """ VAE decoder """ def __init__(self, img_channels, latent_size): super().__init__() self.latent_size = latent_size self.img_channels = img_channels self.fc1 =...
LexaAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 LexaAttention(nn.Module): def __init__(self, dim): super(LexaAttention, self).__init__() self.query_layer = nn.Linear(dim, dim, bias=False) self.tanh = nn.Tanh() self.v = nn.Linear(dim, 1, bias=False) def forward(self, query, processed_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
blackbawx/LEXA
LexaAttention
false
3,222
[ "Apache-2.0" ]
0
75e5180ca61d3e0bd78c3b8b1ece0b21c8300026
https://github.com/blackbawx/LEXA/tree/75e5180ca61d3e0bd78c3b8b1ece0b21c8300026
import torch from torch import nn class Model(nn.Module): def __init__(self, dim): super().__init__() self.query_layer = nn.Linear(dim, dim, bias=False) self.tanh = nn.Tanh() self.v = nn.Linear(dim, 1, bias=False) def forward(self, query, processed_memory, tau): """ ...
dqn_net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn.functional as F import torch.nn as nn class dqn_net(nn.Module): def __init__(self, n_states, n_actions): super(dqn_net, self).__init__() self.fc1 = nn.Linear(n_states, 50) self.fc1.weight.data.normal_(0, 0.1) self.fc2 = nn.Linear(50, 30) self.f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
bigtreeljc/force_learning
dqn_net
false
3,223
[ "MIT" ]
0
183a7c96c411e282966604e3cb375ba49e91a88c
https://github.com/bigtreeljc/force_learning/tree/183a7c96c411e282966604e3cb375ba49e91a88c
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, n_states, n_actions): super().__init__() self.fc1 = nn.Linear(n_states, 50) self.fc1.weight.data.normal_(0, 0.1) self.fc2 = nn.Linear(50, 30) self.fc2.weight.data....
point_model
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class point_model(nn.Module): def __init__(self, num_classes): super(point_model, self).__init__() self.mlp1 = nn.Conv1d(3, 64, 1) self.mlp2 = nn.Conv1d(64, 128, 1) self.mlp3 = nn.Conv1d(128, 1024, 1) self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
berkbilir/point-cloud-classification
point_model
false
3,224
[ "MIT" ]
0
4188b317acc8efccb694831b26a3a8564dee5530
https://github.com/berkbilir/point-cloud-classification/tree/4188b317acc8efccb694831b26a3a8564dee5530
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_classes): super().__init__() self.mlp1 = nn.Conv1d(3, 64, 1) self.mlp2 = nn.Conv1d(64, 128, 1) self.mlp3 = nn.Conv1d(128, 1024, 1) self.fc1 = nn.Linear(1024, 5...
SigmaL1SmoothLoss
# 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 SigmaL1SmoothLoss(nn.Module): def forward(self, pred, targ): reg_diff = torch.abs(targ - pred) reg_loss = torch.where(torch.le(reg_diff, 1 / 9), 4.5 * torch.pow( reg_diff, 2), reg_diff - 1 / 18) return reg_loss.mean() def get_inputs():...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
bene401/Practical-Deep-Learning-for-Coders-2.0
SigmaL1SmoothLoss
false
3,225
[ "MIT" ]
0
c648afc6113cfca2f16c50cc13d197be0306ff98
https://github.com/bene401/Practical-Deep-Learning-for-Coders-2.0/tree/c648afc6113cfca2f16c50cc13d197be0306ff98
import torch from torch import nn class Model(nn.Module): def forward(self, pred, targ): reg_diff = torch.abs(targ - pred) reg_loss = torch.where(torch.le(reg_diff, 1 / 9), 4.5 * torch.pow( reg_diff, 2), reg_diff - 1 / 18) return reg_loss.mean() def get_inputs(): return ...
DuelingNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 DuelingNetwork(nn.Module): def __init__(self, state_size, action_size, seed): super(DuelingNetwork, self).__init__() self.seed = torch.manual_seed(seed) self.action_size = action_size self.fc1 = nn.Linear(state_size, 64) self.relu1 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bluebibi/rl_book_codes
DuelingNetwork
false
3,226
[ "MIT" ]
0
ef7fc9993eb66618e4b4e80e59cc2879a8db3522
https://github.com/bluebibi/rl_book_codes/tree/ef7fc9993eb66618e4b4e80e59cc2879a8db3522
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, state_size, action_size, seed): super().__init__() self.seed = torch.manual_seed(seed) self.action_size = action_size self.fc1 = nn.Linear(state_size, 64) self.relu1 = nn.ReLU() self.fc2 ...
QNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 QNetwork(nn.Module): def __init__(self, state_size, action_size, seed): super(QNetwork, self).__init__() self.seed = torch.manual_seed(seed) self.fc1 = nn.Linear(state_size, 32) self.relu1 = nn.PReLU() self.fc2 = nn.Linear(32, 32) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
bluebibi/rl_book_codes
QNetwork
false
3,227
[ "MIT" ]
0
ef7fc9993eb66618e4b4e80e59cc2879a8db3522
https://github.com/bluebibi/rl_book_codes/tree/ef7fc9993eb66618e4b4e80e59cc2879a8db3522
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, state_size, action_size, seed): super().__init__() self.seed = torch.manual_seed(seed) self.fc1 = nn.Linear(state_size, 32) self.relu1 = nn.PReLU() self.fc2 = nn.Linear(32, 32) self.relu2...
PolicyNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 PolicyNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size=256): super(PolicyNetwork, self).__init__() self.num_actions = num_actions self.linear1 = nn.Linear(num_inputs, hidden_size) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
bluebibi/rl_book_codes
PolicyNetwork
false
3,228
[ "MIT" ]
0
ef7fc9993eb66618e4b4e80e59cc2879a8db3522
https://github.com/bluebibi/rl_book_codes/tree/ef7fc9993eb66618e4b4e80e59cc2879a8db3522
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size=256): super().__init__() self.num_actions = num_actions self.linear1 = nn.Linear(num_inputs, hidden_size) self.linear2 = nn.Linear(hid...
output
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn class output(nn.Module): def __init__(self, scope=512): super(output, self).__init__() self.conv1 = nn.Conv2d(32, 1, 1) self.sigmoid1 = nn.Sigmoid() self.conv2 = nn.Conv2d(32, 4, 1) self.sigmoid2 = nn.Sigmoid() self.co...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
binzh93/EAST
output
false
3,229
[ "MIT" ]
0
b5f66ab1a5dd37b6a5134336d494000e1add6da1
https://github.com/binzh93/EAST/tree/b5f66ab1a5dd37b6a5134336d494000e1add6da1
import math import torch import torch.nn as nn class Model(nn.Module): def __init__(self, scope=512): super().__init__() self.conv1 = nn.Conv2d(32, 1, 1) self.sigmoid1 = nn.Sigmoid() self.conv2 = nn.Conv2d(32, 4, 1) self.sigmoid2 = nn.Sigmoid() self.conv3 = nn.Conv...
CNN_2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 CNN_2(nn.Module): def __init__(self, input_size, n_feature, output_size): super(CNN_2, self).__init__() self.n_feature = n_feature self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5) self.co...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
berthine/Cat_Dog_project
CNN_2
false
3,230
[ "MIT" ]
0
1ea08c7e8f4b44ded8853ecbb3966590f5aea144
https://github.com/berthine/Cat_Dog_project/tree/1ea08c7e8f4b44ded8853ecbb3966590f5aea144
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, input_size, n_feature, output_size): super().__init__() self.n_feature = n_feature self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=5) self.conv2 = nn.Co...
GramMatrix
# 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 GramMatrix(nn.Module): def forward(self, input): a, b, c, d = input.size() features = input.view(a * b, c * d) G = torch.mm(features, features.t()) return G.div(a * b * c * d) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
booiljung/torchtutorials
GramMatrix
false
3,231
[ "MIT" ]
0
827b1bcd0b701c573d7423de277d78a36f6e20d8
https://github.com/booiljung/torchtutorials/tree/827b1bcd0b701c573d7423de277d78a36f6e20d8
import torch import torch.nn as nn class Model(nn.Module): def forward(self, input): a, b, c, d = input.size() features = input.view(a * b, c * d) G = torch.mm(features, features.t()) return G.div(a * b * c * d) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_i...
ScaleNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ScaleNorm(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.g = nn.Parameter(torch.ones(1)) self.eps = eps def forward(self, x): n = torch.norm(x, dim=-1, keepdim=True).clamp(min=self.eps) return x / n * 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 import torch.nn as nn assert...
blizda/reformer-pytorch
ScaleNorm
false
3,232
[ "MIT" ]
0
f7187d887c3522124d265dd11e4bb42b2f2906c6
https://github.com/blizda/reformer-pytorch/tree/f7187d887c3522124d265dd11e4bb42b2f2906c6
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.g = nn.Parameter(torch.ones(1)) self.eps = eps def forward(self, x): n = torch.norm(x, dim=-1, keepdim=True).clamp(min=self.eps) return x / n * self....
ScaleNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ScaleNorm(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.scale = dim ** -0.5 self.eps = eps self.g = nn.Parameter(torch.ones(1)) def forward(self, x): norm = torch.norm(x, dim=-1, keepdim=True) * self.sc...
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_...
booydar/x-transformers
ScaleNorm
false
3,233
[ "MIT" ]
0
97f0a854fdf4df8a3fbf6a580e2375463af3538c
https://github.com/booydar/x-transformers/tree/97f0a854fdf4df8a3fbf6a580e2375463af3538c
import torch from torch import nn class Model(nn.Module): def __init__(self, dim, eps=1e-05): super().__init__() self.scale = dim ** -0.5 self.eps = eps self.g = nn.Parameter(torch.ones(1)) def forward(self, x): norm = torch.norm(x, dim=-1, keepdim=True) * self.scale ...
RMSNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 RMSNorm(nn.Module): def __init__(self, dim, eps=1e-08): super().__init__() self.scale = dim ** -0.5 self.eps = eps self.g = nn.Parameter(torch.ones(dim)) def forward(self, x): norm = torch.norm(x, dim=-1, keepdim=True) * self.sc...
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_...
booydar/x-transformers
RMSNorm
false
3,234
[ "MIT" ]
0
97f0a854fdf4df8a3fbf6a580e2375463af3538c
https://github.com/booydar/x-transformers/tree/97f0a854fdf4df8a3fbf6a580e2375463af3538c
import torch from torch import nn class Model(nn.Module): def __init__(self, dim, eps=1e-08): super().__init__() self.scale = dim ** -0.5 self.eps = eps self.g = nn.Parameter(torch.ones(dim)) def forward(self, x): norm = torch.norm(x, dim=-1, keepdim=True) * self.scal...
SmoothCrossEntropyLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F from torch.nn.modules.loss import _WeightedLoss class SmoothCrossEntropyLoss(_WeightedLoss): def __init__(self, weight=None, reduction='mean', smoothing=0.0): super().__init__(weight=weight, reduction=reduction) self.smoothing = smoothing self....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch.nn.modules....
bluetyson/archai
SmoothCrossEntropyLoss
false
3,235
[ "MIT" ]
0
b370a7397cb8703a052d82297ae748a35c6a49c7
https://github.com/bluetyson/archai/tree/b370a7397cb8703a052d82297ae748a35c6a49c7
import torch import torch.nn.functional as F from torch.nn.modules.loss import _WeightedLoss class Model(_WeightedLoss): def __init__(self, weight=None, reduction='mean', smoothing=0.0): super().__init__(weight=weight, reduction=reduction) self.smoothing = smoothing self.weight = weight ...
ActorCriticNetwork
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 ActorCriticNetwork(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size=256): super(ActorCriticNetwork, self).__init__() self.num_actions = num_actions self.critic_linear1 = nn.Linear(num_inputs, hidde...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bluebibi/rl_book_codes
ActorCriticNetwork
false
3,236
[ "MIT" ]
0
ef7fc9993eb66618e4b4e80e59cc2879a8db3522
https://github.com/bluebibi/rl_book_codes/tree/ef7fc9993eb66618e4b4e80e59cc2879a8db3522
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, num_inputs, num_actions, hidden_size=256): super().__init__() self.num_actions = num_actions self.critic_linear1 = nn.Linear(num_inputs, hidden_size) self.critic_linear2 =...
AgreementRouting
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F def squash(x): lengths2 = x.pow(2).sum(dim=2) lengths = lengths2.sqrt() x = x * (lengths2 / (1 + lengths2) / lengths).view(x.size(0), x.size(1), 1) return x class AgreementRouting(nn.Module): def __init__(self, input_caps, outpu...
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...
bentrevett/capsules
AgreementRouting
false
3,237
[ "MIT" ]
0
239273de25c607d7a7504e8c6900772fddd15cd3
https://github.com/bentrevett/capsules/tree/239273de25c607d7a7504e8c6900772fddd15cd3
import torch import torch.nn as nn import torch.nn.functional as F def squash(x): lengths2 = x.pow(2).sum(dim=2) lengths = lengths2.sqrt() x = x * (lengths2 / (1 + lengths2) / lengths).view(x.size(0), x.size(1), 1) return x class Model(nn.Module): def __init__(self, input_caps, output_caps, n_i...
SvmLoss
# 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 SvmLoss(torch.nn.Module): def __init__(self): super(SvmLoss, self).__init__() def forward(self, decisions, targets): targets = targets.float() * 2 - 1 projection_dist = 1 - targets * decisions margin = torch.max(torch.zeros_like(projection_dist), projection...
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...
brainsqueeze/Kaggle-competitions
SvmLoss
false
3,238
[ "MIT" ]
0
e734ca71303619fd2c9a6f10aaf98b2c0a800758
https://github.com/brainsqueeze/Kaggle-competitions/tree/e734ca71303619fd2c9a6f10aaf98b2c0a800758
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, decisions, targets): targets = targets.float() * 2 - 1 projection_dist = 1 - targets * decisions margin = torch.max(torch.zeros_like(projection_dist), projection_dist) ...
DPGRUCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the same as a ``torch.nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
bogdan-kulynych/opacus
DPGRUCell
false
3,239
[ "Apache-2.0" ]
0
e2d13003a179f64920835bc585f3729b8148279f
https://github.com/bogdan-kulynych/opacus/tree/e2d13003a179f64920835bc585f3729b8148279f
import math import torch from torch import Tensor from torch import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the same as a ``torch.nn.Line...
GEGLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch.nn import functional as F from torch import nn class GEGLU(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.proj = nn.Linear(dim_in, dim_out * 2) def forward(self, x): x, gate = self.proj(x).chunk(2, dim=-1) return x * F.gelu(ga...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
booydar/x-transformers
GEGLU
false
3,240
[ "MIT" ]
0
97f0a854fdf4df8a3fbf6a580e2375463af3538c
https://github.com/booydar/x-transformers/tree/97f0a854fdf4df8a3fbf6a580e2375463af3538c
import torch from torch.nn import functional as F from torch import nn class Model(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.proj = nn.Linear(dim_in, dim_out * 2) def forward(self, x): x, gate = self.proj(x).chunk(2, dim=-1) return x * F.gelu(ga...
DPRNNCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the same as a ``torch.nn.Line...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
bogdan-kulynych/opacus
DPRNNCell
false
3,241
[ "Apache-2.0" ]
0
e2d13003a179f64920835bc585f3729b8148279f
https://github.com/bogdan-kulynych/opacus/tree/e2d13003a179f64920835bc585f3729b8148279f
import math import torch from torch import Tensor from torch import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the same as a ``torch.nn.Line...
PoolingF
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data impo...
bronemos/contrastive-unpaired-translation-focal
PoolingF
false
3,242
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super().__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm + ...
DPLSTMCell
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional from typing import Tuple class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
bogdan-kulynych/opacus
DPLSTMCell
false
3,243
[ "Apache-2.0" ]
0
e2d13003a179f64920835bc585f3729b8148279f
https://github.com/bogdan-kulynych/opacus/tree/e2d13003a179f64920835bc585f3729b8148279f
import math import torch from torch import Tensor from torch import nn import torch.utils.data import torch.utils.data.distributed from typing import Optional from typing import Tuple class RNNLinear(nn.Linear): """Applies a linear transformation to the incoming data: :math:`y = xA^T + b` This module is the ...
LogisticLoss
# 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 LogisticLoss(torch.nn.Module): def __init__(self): super(LogisticLoss, self).__init__() def forward(self, logits, targets, multi_label=False): y = targets.float() n_plus = torch.sum(y, dim=0) n_minus = torch.sum(1.0 - y, dim=0) n_plus_rate = (n_plus...
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 assert_size_stride = t...
brainsqueeze/Kaggle-competitions
LogisticLoss
false
3,244
[ "MIT" ]
0
e734ca71303619fd2c9a6f10aaf98b2c0a800758
https://github.com/brainsqueeze/Kaggle-competitions/tree/e734ca71303619fd2c9a6f10aaf98b2c0a800758
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, logits, targets, multi_label=False): y = targets.float() n_plus = torch.sum(y, dim=0) n_minus = torch.sum(1.0 - y, dim=0) n_plus_rate = (n_plus + 1.0) / (n_plus + 2.0) ...
MLPDecoder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 MLPDecoder(nn.Module): def __init__(self, input_channels, output_channels, set_size, dim, particle_types): super().__init__() self.output_channels = output_channels self.set_size = set_size self.parti...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
bostdiek/DarkMachinesAutoEncoder
MLPDecoder
false
3,245
[ "MIT" ]
0
f05f482b1bbd79cd777221bfe0d37e75b72c3e2b
https://github.com/bostdiek/DarkMachinesAutoEncoder/tree/f05f482b1bbd79cd777221bfe0d37e75b72c3e2b
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, input_channels, output_channels, set_size, dim, particle_types): super().__init__() self.output_channels = output_channels self.set_size = set_size self.particle_t...
GroupedChannelNorm
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class GroupedChannelNorm(nn.Module): def __init__(self, num_groups): super().__init__() self.num_groups = num_groups def forward(self, x): shape = list(x.shape) new_shape = [shape[0], self.num_groups, sha...
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.utils.data import torch import torch.nn as nn assert_size_stride =...
bronemos/contrastive-unpaired-translation-focal
GroupedChannelNorm
false
3,246
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
import torch import torch.utils.data import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_groups): super().__init__() self.num_groups = num_groups def forward(self, x): shape = list(x.shape) new_shape = [shape[0], self.num_groups, shape[1] // self...
L2Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F class L2Norm(nn.Module): """L2Norm layer across all channels.""" def __init__(self, in_features, scale): super(L2Norm, self).__init__() self.weight = nn.Parameter(torch.Tensor(in_features)) self.reset_parameters(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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
bigh2000/torchcv_edit
L2Norm
false
3,247
[ "MIT" ]
0
999da61b9b7441520280f7977239b6fc21c2f019
https://github.com/bigh2000/torchcv_edit/tree/999da61b9b7441520280f7977239b6fc21c2f019
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """L2Norm layer across all channels.""" def __init__(self, in_features, scale): super().__init__() self.weight = nn.Parameter(torch.Tensor(in_features)) self.reset_parameters(scale) def res...
ReshapeF
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super(Normalize, self).__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.utils.data import torch import torch.nn as nn assert_size_stride =...
bronemos/contrastive-unpaired-translation-focal
ReshapeF
false
3,248
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
import torch import torch.utils.data import torch import torch.nn as nn class Normalize(nn.Module): def __init__(self, power=2): super().__init__() self.power = power def forward(self, x): norm = x.pow(self.power).sum(1, keepdim=True).pow(1.0 / self.power) out = x.div(norm + ...
FusedLeakyReLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.nn as nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return F.leaky_relu(input + bias, negative_slope) * scale class FusedLeakyReLU(nn.Module): def __init__(self, channel, negative_slop...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.asse...
bronemos/contrastive-unpaired-translation-focal
FusedLeakyReLU
false
3,249
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5): return F.leaky_relu(input + bias, negative_slope) * scale class Model(nn.Module): def __init__(self, channel, negative_slope=0.2, sc...
CDFLayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn from torch.nn.parameter import Parameter class CDFLayer(nn.Module): def __init__(self, device='cpu'): super(CDFLayer, self).__init__() self.loc_scale = Parameter(torch.FloatTensor([0.0, 1.0])) def forward(self, x, dim=1): m = torch.distributions.Cau...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn from torch.nn.parameter import Parameter assert_size_stri...
asifr/armisc
CDFLayer
false
3,250
[ "MIT" ]
0
486220ba498353faeb94f70cd8ffe917109526d2
https://github.com/asifr/armisc/tree/486220ba498353faeb94f70cd8ffe917109526d2
import torch import torch.nn as nn from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, device='cpu'): super().__init__() self.loc_scale = Parameter(torch.FloatTensor([0.0, 1.0])) def forward(self, x, dim=1): m = torch.distributions.Cauchy(self.loc_scal...
ToRGB
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.utils.data import torch import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, u...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.utils.data import torch import torch.nn as nn import to...
bronemos/contrastive-unpaired-translation-focal
ToRGB
false
3,251
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
import math import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, u...
SoftmaxWithTemperature
# 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.cuda import torch.distributed class SoftmaxWithTemperature(nn.Module): def __init__(self, dim=0, alpha=1.0): super(SoftmaxWithTemperature, self).__init__() self._softmax = nn.Softmax(dim) self._alpha = alpha def forward(self, x): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
bingrao/Bug-Transformer
SoftmaxWithTemperature
false
3,252
[ "MIT" ]
0
9e39dc553c281f6372b7a8cfc8205aa186645899
https://github.com/bingrao/Bug-Transformer/tree/9e39dc553c281f6372b7a8cfc8205aa186645899
import torch import torch.nn as nn import torch.cuda import torch.distributed class Model(nn.Module): def __init__(self, dim=0, alpha=1.0): super().__init__() self._softmax = nn.Softmax(dim) self._alpha = alpha def forward(self, x): return self._softmax(self._alpha * x) def...
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.functional as F class Attention(nn.Module): """ Applies an attention mechanism on the output features from the decoder. .. math:: \\begin{array}{ll} x = context*output \\\\ attn = exp(x_i) / sum_j exp(x_j) \\\\ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bigheiniu/FakeReviewAll
Attention
false
3,253
[ "Apache-2.0" ]
0
b5efc0fe8ad88b5aff986e900f50d4e0b90fbff1
https://github.com/bigheiniu/FakeReviewAll/tree/b5efc0fe8ad88b5aff986e900f50d4e0b90fbff1
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """ Applies an attention mechanism on the output features from the decoder. .. math:: \\begin{array}{ll} x = context*output \\\\ attn = exp(x_i) / sum_j exp(x_j) \\\\ ...
FcnBinaryClassifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 FcnBinaryClassifier(nn.Module): """ A fully-connected neural network with a single hidden layer and batchnorm for binary classification. Architecture: Linear(input_size, hidden_size) ReLU() BatchNorm() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
breid1313/nlp_hw3_text_fcn_pytorch
FcnBinaryClassifier
false
3,254
[ "Apache-2.0" ]
0
a4234e90d37e94a3043d9715c90bac7543f4b0ae
https://github.com/breid1313/nlp_hw3_text_fcn_pytorch/tree/a4234e90d37e94a3043d9715c90bac7543f4b0ae
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """ A fully-connected neural network with a single hidden layer and batchnorm for binary classification. Architecture: Linear(input_size, hidden_size) ReLU() BatchNorm() Dropout() ...
MegatronGelu
# 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 import torch.onnx class MegatronGelu(torch.nn.Module): def forward(self, x): return x * 0.5 * (torch.erf(x / 1.41421) + 1.0) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch.onnx assert_size_stride = torch._C._dynamo.guards....
carefreekk/onnxruntime
MegatronGelu
false
3,255
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def forward(self, x): return x * 0.5 * (torch.erf(x / 1.41421) + 1.0) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
SigmoidFocalClassificationLoss
# 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 _sigmoid_cross_entropy_with_logits(logits, labels): loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits) loss += torch.log1p(torch.exp(-torch.abs(logits))) return loss class SigmoidFocalClassificationLoss(nn.Module): """Sigmoid focal cross entrop...
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...
brudermueller/PointRCNN
SigmoidFocalClassificationLoss
false
3,256
[ "MIT" ]
0
430bb45d6d512ad4e3eb509d65377511361c300f
https://github.com/brudermueller/PointRCNN/tree/430bb45d6d512ad4e3eb509d65377511361c300f
import torch import torch.nn as nn def _sigmoid_cross_entropy_with_logits(logits, labels): loss = torch.clamp(logits, min=0) - logits * labels.type_as(logits) loss += torch.log1p(torch.exp(-torch.abs(logits))) return loss class Model(nn.Module): """Sigmoid focal cross entropy loss. Focal loss ...
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, ignore_target=-1): super().__init__() self.ignore_target = ignore_target def forward(self, input, target): """ :param input: (N), logit :param target: (N), {0, 1} :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...
brudermueller/PointRCNN
DiceLoss
false
3,257
[ "MIT" ]
0
430bb45d6d512ad4e3eb509d65377511361c300f
https://github.com/brudermueller/PointRCNN/tree/430bb45d6d512ad4e3eb509d65377511361c300f
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, ignore_target=-1): super().__init__() self.ignore_target = ignore_target def forward(self, input, target): """ :param input: (N), logit :param target: (N), {0, 1} :return: ""...
ModulatedConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.utils.data import torch import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, u...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
bronemos/contrastive-unpaired-translation-focal
ModulatedConv2d
false
3,258
[ "BSD-3-Clause" ]
0
50b9008d08a86439ede081a910d02df5da8e32df
https://github.com/bronemos/contrastive-unpaired-translation-focal/tree/50b9008d08a86439ede081a910d02df5da8e32df
import math import torch import torch.utils.data import torch import torch.nn as nn import torch.nn.functional as F def make_kernel(k): k = torch.tensor(k, dtype=torch.float32) if len(k.shape) == 1: k = k[None, :] * k[:, None] k /= k.sum() return k def upfirdn2d_native(input, kernel, up_x, u...
MegatronFastGelu
# 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 import torch.onnx class MegatronFastGelu(torch.nn.Module): def forward(self, x): return 0.5 * x * (1.0 + torch.tanh(0.7978845608028654 * x * (1.0 + 0.044715 * x * x))) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn import torch.onnx assert_size_stride = torch._C._dynamo.guards....
carefreekk/onnxruntime
MegatronFastGelu
false
3,259
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def forward(self, x): return 0.5 * x * (1.0 + torch.tanh(0.7978845608028654 * x * (1.0 + 0.044715 * x * x))) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
CosNorm_Classifier
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.optim import torch.utils.data import torch.nn as nn from torch.nn.parameter import Parameter class CosNorm_Classifier(nn.Module): def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001 ): super(CosNorm_Classifier, self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math import ...
caisarl76/BalancedMetaSoftmax-Classification
CosNorm_Classifier
false
3,260
[ "BSD-3-Clause" ]
0
48b9c8af19de261d95a5ef38f5780cbadf7bb64b
https://github.com/caisarl76/BalancedMetaSoftmax-Classification/tree/48b9c8af19de261d95a5ef38f5780cbadf7bb64b
import math import torch import torch.optim import torch.utils.data import torch.nn as nn from torch.nn.parameter import Parameter class Model(nn.Module): def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001 ): super().__init__() self.in_dims = in_dims self.o...
FSPool
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn def deterministic_sort(s, tau): """ "Stochastic Optimization of Sorting Networks via Continuous Relaxations" https://openreview.net/forum?id=H1eSS3CcKX Aditya Grover, Eric Wang, Aaron Zweig, Stefano Ermon s: input elements to be sorted. Shape: batch_size x n x 1 ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
bostdiek/DarkMachinesAutoEncoder
FSPool
false
3,261
[ "MIT" ]
0
f05f482b1bbd79cd777221bfe0d37e75b72c3e2b
https://github.com/bostdiek/DarkMachinesAutoEncoder/tree/f05f482b1bbd79cd777221bfe0d37e75b72c3e2b
import torch import torch.nn as nn def deterministic_sort(s, tau): """ "Stochastic Optimization of Sorting Networks via Continuous Relaxations" https://openreview.net/forum?id=H1eSS3CcKX Aditya Grover, Eric Wang, Aaron Zweig, Stefano Ermon s: input elements to be sorted. Shape: batch_size x n x 1 ...
FourierFeatures
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 nn class FourierFeatures(nn.Module): def __init__(self, in_features, out_features, std=1.0): super().__init__() assert out_features % 2 == 0 self.weight = nn.Parameter(torch.randn([out_features // 2, in_features]) * std) def forw...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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...
cansakirt/disco-diffusion
FourierFeatures
false
3,262
[ "MIT" ]
0
a7e9cfc098e1c216f8ab04901e3e9c6dc9ca4edb
https://github.com/cansakirt/disco-diffusion/tree/a7e9cfc098e1c216f8ab04901e3e9c6dc9ca4edb
import math import torch from torch import nn class Model(nn.Module): def __init__(self, in_features, out_features, std=1.0): super().__init__() assert out_features % 2 == 0 self.weight = nn.Parameter(torch.randn([out_features // 2, in_features]) * std) def forward(self, ...
Embedder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch import torch.nn as nn import torch.utils.data._utils import torch.nn import torch.optim class Embedder(nn.Module): def __init__(self, dim_in, dim_out): super(Embedder, self).__init__() self.dim_in = dim_in self.dim_out = dim_out self.linear = nn.Linear(sel...
import torch from torch._inductor.select_algorithm import extern_kernels import 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._utils import torch.nn import torc...
badrinarayan/ReAgent
Embedder
false
3,263
[ "BSD-3-Clause" ]
0
d49b02dce53d9a5d5ee077cea7efded507677641
https://github.com/badrinarayan/ReAgent/tree/d49b02dce53d9a5d5ee077cea7efded507677641
import math import torch import torch.nn as nn import torch.utils.data._utils import torch.nn import torch.optim class Model(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.dim_in = dim_in self.dim_out = dim_out self.linear = nn.Linear(self.dim_in, self.di...
NeuralNetPartialNoGradModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.onnx class NeuralNetPartialNoGradModel(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetPartialNoGradModel, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size).requires_grad_( False) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
carefreekk/onnxruntime
NeuralNetPartialNoGradModel
false
3,264
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size).requires_grad_( False) self.relu = torch.nn.ReLU() self.fc2 = t...
SvmProbsLoss
# 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 SvmProbsLoss(torch.nn.Module): def __init__(self): super(SvmProbsLoss, self).__init__() def forward(self, decisions, logits, targets, multi_label=False): y = targets.float() svm_targets = y * 2 - 1 projection_dist = 1 - svm_targets * decisions margi...
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 assert_size_stride = t...
brainsqueeze/Kaggle-competitions
SvmProbsLoss
false
3,265
[ "MIT" ]
0
e734ca71303619fd2c9a6f10aaf98b2c0a800758
https://github.com/brainsqueeze/Kaggle-competitions/tree/e734ca71303619fd2c9a6f10aaf98b2c0a800758
import torch class Model(torch.nn.Module): def __init__(self): super().__init__() def forward(self, decisions, logits, targets, multi_label=False): y = targets.float() svm_targets = y * 2 - 1 projection_dist = 1 - svm_targets * decisions margin = torch.max(torch.zeros...
SelfDisLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn from torch import einsum class SelfDisLoss(nn.Module): def __init__(self): super(SelfDisLoss, self).__init__() def forward(self, feat, mean_feat): sim = einsum('nc,nc->n', [feat, mean_feat]) dis = torch.sqrt(2.0 * (1 - sim)) loss = torch.mean...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
catcodee/cluster-contrast-reid
SelfDisLoss
false
3,266
[ "MIT" ]
0
f6359990a4326375f23c3fd654df3fc6dcc9c579
https://github.com/catcodee/cluster-contrast-reid/tree/f6359990a4326375f23c3fd654df3fc6dcc9c579
import torch from torch import nn from torch import einsum class Model(nn.Module): def __init__(self): super().__init__() def forward(self, feat, mean_feat): sim = einsum('nc,nc->n', [feat, mean_feat]) dis = torch.sqrt(2.0 * (1 - sim)) loss = torch.mean(dis) return lo...
ShapedSineModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data class ShapedSineModel(torch.nn.Module): def __init__(self, theta=None): super(ShapedSineModel, self).__init__() if theta is None: self.freq = torch.nn.Parameter(torch.Tensor([0.1])) else: self.freq = torch.nn.Parameter(torch.Ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.data assert_size_stride = torch._C._dynamo.guards.asse...
bechtle/LearningToLearn
ShapedSineModel
false
3,267
[ "MIT" ]
0
52eed5359e8a42bd99abe1df554a3b035dd3e2d2
https://github.com/bechtle/LearningToLearn/tree/52eed5359e8a42bd99abe1df554a3b035dd3e2d2
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, theta=None): super().__init__() if theta is None: self.freq = torch.nn.Parameter(torch.Tensor([0.1])) else: self.freq = torch.nn.Parameter(torch.Tensor([theta])) self.lear...
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.onnx class NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency(torch .nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency , self).__init__() ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
carefreekk/onnxruntime
NeuralNetMultiplePositionalArgumentsMultiOutputsWithoutDependency
false
3,268
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
import torch import torch.nn import torch.onnx class Model(torch .nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.fc2 = torch.nn.Linear(input_size, hidden_size) self.softmax1 = to...
NeuralNetNonDifferentiableOutput
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.onnx class NeuralNetNonDifferentiableOutput(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetNonDifferentiableOutput, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu = torch....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
carefreekk/onnxruntime
NeuralNetNonDifferentiableOutput
false
3,269
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu = torch.nn.ReLU() self.fc2 = torch.nn.Linear(hidden_size, num_cla...
LearnableTimeDepWeightedCost
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.utils.data class LearnableTimeDepWeightedCost(torch.nn.Module): def __init__(self, time_horizon, dim=9, weights=None): super(LearnableTimeDepWeightedCost, self).__init__() if weights is None: self.weights = torch.nn.Parameter(0.01 * torch.ones([ ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
bechtle/LearningToLearn
LearnableTimeDepWeightedCost
false
3,270
[ "MIT" ]
0
52eed5359e8a42bd99abe1df554a3b035dd3e2d2
https://github.com/bechtle/LearningToLearn/tree/52eed5359e8a42bd99abe1df554a3b035dd3e2d2
import torch import torch.utils.data class Model(torch.nn.Module): def __init__(self, time_horizon, dim=9, weights=None): super().__init__() if weights is None: self.weights = torch.nn.Parameter(0.01 * torch.ones([ time_horizon, dim])) else: self.we...
NeuralNetMultiplePositionalArguments
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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.onnx class NeuralNetMultiplePositionalArguments(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super(NeuralNetMultiplePositionalArguments, self).__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn import torch....
carefreekk/onnxruntime
NeuralNetMultiplePositionalArguments
false
3,271
[ "MIT" ]
0
484e9de55c109dadbeb552cd6ede21bbdd63b830
https://github.com/carefreekk/onnxruntime/tree/484e9de55c109dadbeb552cd6ede21bbdd63b830
import torch import torch.nn import torch.onnx class Model(torch.nn.Module): def __init__(self, input_size, hidden_size, num_classes): super().__init__() self.fc1 = torch.nn.Linear(input_size, hidden_size) self.relu = torch.nn.ReLU() self.fc2 = torch.nn.Linear(hidden_size, num_cla...
Similarity
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 from torch.nn import functional as F class Similarity(nn.Module): def __init__(self, mem_dim, hidden_dim, num_classes): super(Similarity, self).__init__() self.mem_dim = mem_dim self.hidden_dim = hidden_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
carol-hsu/relay-bench
Similarity
false
3,272
[ "Apache-2.0" ]
0
0facffedb3cbb0d5f110769a84bba68718cff72b
https://github.com/carol-hsu/relay-bench/tree/0facffedb3cbb0d5f110769a84bba68718cff72b
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from torch.nn import functional as F class Model(nn.Module): def __init__(self, mem_dim, hidden_dim, num_classes): super().__init__() self.mem_dim = mem_dim self.hidden_dim = hidden_dim self.num_cl...