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
WeightedMCEloss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F def centercrop(image, w, h): _nt, _ct, ht, wt = image.size() padw, padh = (wt - w) // 2, (ht - h) // 2 if padw > 0 and padh > 0: image = image[:, :, padh:-padh, padw:-padw] return image class WeightedMCEloss(nn.Module): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
CarlosPena00/pytorch-unet
WeightedMCEloss
false
210
[ "MIT" ]
0
8365bace23e4b04b9c5b75cd6720807ea8cac5ab
https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab
import torch import torch.nn as nn import torch.nn.functional as F def centercrop(image, w, h): _nt, _ct, ht, wt = image.size() padw, padh = (wt - w) // 2, (ht - h) // 2 if padw > 0 and padh > 0: image = image[:, :, padh:-padh, padw:-padw] return image class Model(nn.Module): def __init...
SkipConnection
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.checkpoint class SkipConnection(nn.Module): """Linearize gradients, to make learning easier.""" def __init__(self, *fn): super().__init__() self.fn = nn.Sequential(*fn) def forward(self, x): y = self.fn(x) return y if ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.checkpoint assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = tor...
Antipurity/sensor-network
SkipConnection
false
211
[ "MIT" ]
0
c5cc67dee408da831c3ab60a03374da3c4789bd2
https://github.com/Antipurity/sensor-network/tree/c5cc67dee408da831c3ab60a03374da3c4789bd2
import torch import torch.nn as nn import torch.utils.checkpoint class Model(nn.Module): """Linearize gradients, to make learning easier.""" def __init__(self, *fn): super().__init__() self.fn = nn.Sequential(*fn) def forward(self, x): y = self.fn(x) return y if x.shape[-...
AvgPoolPad
# 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 import torch.nn as nn class AvgPoolPad(nn.Module): def __init__(self, stride=2, padding=1): super(AvgPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_includ...
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.functional import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch....
CarlosPena00/pytorchvision
AvgPoolPad
false
212
[ "MIT" ]
0
824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
import torch import torch.nn.functional import torch.nn as nn class Model(nn.Module): def __init__(self, stride=2, padding=1): super().__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.AvgPool2d(3, stride=stride, padding=padding, count_include_pad=False) def...
conv2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 conv2(nn.Module): def __init__(self, num_classes=2, in_channels=3, is_deconv=False, is_batchnorm=False, *args, **kwargs): super(conv2, self).__init__() self.is_deconv = is_deconv self.in_channels = in_channels self.is_batchnorm = is...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
CarlosPena00/pytorch-unet
conv2
false
213
[ "MIT" ]
0
8365bace23e4b04b9c5b75cd6720807ea8cac5ab
https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, num_classes=2, in_channels=3, is_deconv=False, is_batchnorm=False, *args, **kwargs): super().__init__() self.is_deconv = is_deconv self.in_channels = in_channels self.is_batchnorm = is_batchnorm ...
MultiHeadAttn
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F def seq_dropout(x, p=0, training=False): """ x: batch * len * input_size """ if training is False or p == 0: return x dropout_mask = 1.0 / (1 - p) * torch.bernoulli((1 - p) * (x.new_zeros(x .size(0), x.size(2)) + 1)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
CallMeSp/My_flowQA
MultiHeadAttn
false
214
[ "Apache-2.0" ]
0
87d82551f614b089771b22a1992e2be41a2995b3
https://github.com/CallMeSp/My_flowQA/tree/87d82551f614b089771b22a1992e2be41a2995b3
import torch import torch.nn as nn import torch.nn.functional as F def seq_dropout(x, p=0, training=False): """ x: batch * len * input_size """ if training is False or p == 0: return x dropout_mask = 1.0 / (1 - p) * torch.bernoulli((1 - p) * (x.new_zeros(x .size(0), x.size(2)) + 1)...
MCCLoss
# 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 MCCLoss(nn.Module): def __init__(self, eps=1e-06): super(MCCLoss, self).__init__() self.eps = eps def forward(self, y_pred, y_true, w=None): y_pred = F.softmax(y_pred, dim=1) y_true_mean = torch.mean(y_t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
CarlosPena00/pytorch-unet
MCCLoss
false
215
[ "MIT" ]
0
8365bace23e4b04b9c5b75cd6720807ea8cac5ab
https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, eps=1e-06): super().__init__() self.eps = eps def forward(self, y_pred, y_true, w=None): y_pred = F.softmax(y_pred, dim=1) y_true_mean = torch.mean(y_true) y_...
Coder
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.nn as nn def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = conv3x3(in_, out) self.activation = nn.ReLU(inplace=True) def fo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 im...
CarlosPena00/pytorchvision
Coder
false
216
[ "MIT" ]
0
824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
import torch import torch.nn.functional import torch.nn as nn def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = conv3x3(in_, out) self.activation = nn.ReLU(inplace=True) def fo...
ConvRelu2
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.nn as nn def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = conv3x3(in_, out) self.activation = nn.ReLU(inplace=True) def fo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 im...
CarlosPena00/pytorchvision
ConvRelu2
false
217
[ "MIT" ]
0
824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
import torch import torch.nn.functional import torch.nn as nn def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = conv3x3(in_, out) self.activation = nn.ReLU(inplace=True) def fo...
WeightedCrossEntropyLoss
# 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 WeightedCrossEntropyLoss(nn.Module): def __init__(self): super(WeightedCrossEntropyLoss, self).__init__() self.bce = nn.CrossEntropyLoss(reduction='none') def forward(self, y_pred, y_true, weight): y_true_hot = y_true.argmax(1) loss = ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
CarlosPena00/pytorch-unet
WeightedCrossEntropyLoss
false
218
[ "MIT" ]
0
8365bace23e4b04b9c5b75cd6720807ea8cac5ab
https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.bce = nn.CrossEntropyLoss(reduction='none') def forward(self, y_pred, y_true, weight): y_true_hot = y_true.argmax(1) loss = self.bce(y_pred, y_true_hot.long()) * weight ...
WeightedBCELoss
# 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 WeightedBCELoss(nn.Module): def __init__(self): super(WeightedBCELoss, self).__init__() self.bce = nn.BCEWithLogitsLoss(reduction='none') def forward(self, y_pred, y_true, weights): loss_0 = self.bce(y_pred[:, 0], y_true[:, 0]) loss_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...
CarlosPena00/pytorch-unet
WeightedBCELoss
false
219
[ "MIT" ]
0
8365bace23e4b04b9c5b75cd6720807ea8cac5ab
https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.bce = nn.BCEWithLogitsLoss(reduction='none') def forward(self, y_pred, y_true, weights): loss_0 = self.bce(y_pred[:, 0], y_true[:, 0]) loss_1 = self.bce(y_pred[:, 1], y_true...
MaxPoolPad
# 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 import torch.nn as nn class MaxPoolPad(nn.Module): def __init__(self): super(MaxPoolPad, self).__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(x) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn.functional import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
CarlosPena00/pytorchvision
MaxPoolPad
false
220
[ "MIT" ]
0
824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
import torch import torch.nn.functional import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() self.pad = nn.ZeroPad2d((1, 0, 1, 0)) self.pool = nn.MaxPool2d(3, stride=2, padding=1) def forward(self, x): x = self.pad(x) x = self.pool(x) ...
SoftDiceLossSquared
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np from torch import nn import torch.jit import torch.nn.functional def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=Tr...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np from torch import nn import torch.jit import torch.nn.functional assert_size_stride = torch._C._dynamo.guards.assert_size...
CamilaGL/nnUNet
SoftDiceLossSquared
false
221
[ "Apache-2.0" ]
0
471ab73a6e4f67fc72d476183b5344be4cccf7ca
https://github.com/CamilaGL/nnUNet/tree/471ab73a6e4f67fc72d476183b5344be4cccf7ca
import torch import numpy as np from torch import nn import torch.jit import torch.nn.functional def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=Tr...
ClipGlobalAvgPool
# 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.optim.lr_scheduler import * from torch.optim import * class FastGlobalAvgPool(nn.Module): def __init__(self, flatten=False, *args, **kwargs): super().__init__() self.flatten = flatten def forward(self, x): if self.flatten: in_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 import nn from torch.optim.lr_scheduler import * from torch.optim import * ass...
Challyfilio/NAIC2021
ClipGlobalAvgPool
false
222
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * class FastGlobalAvgPool(nn.Module): def __init__(self, flatten=False, *args, **kwargs): super().__init__() self.flatten = flatten def forward(self, x): if self.flatten: in_s...
Shifted_softplus
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel class Shifted_softplus(nn.Module): """ Performs a Shifter softplus loss, which modifies with a value of log(2) """ def __init__(self): super(Shifted_softplus, self).__init__() self.act = nn.Softplus() self.shift = nn.Para...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn import torch.nn.parallel assert_size_str...
Chahalprincy/deepchem
Shifted_softplus
false
223
[ "MIT" ]
0
9d1a6a879cc74b065694b3ddb763d52151d57b7a
https://github.com/Chahalprincy/deepchem/tree/9d1a6a879cc74b065694b3ddb763d52151d57b7a
import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """ Performs a Shifter softplus loss, which modifies with a value of log(2) """ def __init__(self): super().__init__() self.act = nn.Softplus() self.shift = nn.Parameter(torch.tensor([0.6931]), Fal...
Custom_dropout
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.parallel class Custom_dropout(nn.Module): """ An implementation for few , Given a task perform a rowise sum of 2-d matrix , you get a zero out the contribution of few of rows in the matrix Given, X a 2-d matrix consisting of row vectors (1-d) x1 , x2 ,..xn....
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
Chahalprincy/deepchem
Custom_dropout
false
224
[ "MIT" ]
0
9d1a6a879cc74b065694b3ddb763d52151d57b7a
https://github.com/Chahalprincy/deepchem/tree/9d1a6a879cc74b065694b3ddb763d52151d57b7a
import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """ An implementation for few , Given a task perform a rowise sum of 2-d matrix , you get a zero out the contribution of few of rows in the matrix Given, X a 2-d matrix consisting of row vectors (1-d) x1 , x2 ,..xn. Sum = ...
AdaptiveAvgMaxPool
# 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.optim.lr_scheduler import * from torch.optim import * class GlobalMaxPool(nn.AdaptiveMaxPool2d): def __init__(self, output_size=1, *args, **kwargs): super().__init__(output_size) class FastGlobalAvgPool(nn.Module): def __init__(self, flatten=False, *arg...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * ass...
Challyfilio/NAIC2021
AdaptiveAvgMaxPool
false
225
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * class GlobalMaxPool(nn.AdaptiveMaxPool2d): def __init__(self, output_size=1, *args, **kwargs): super().__init__(output_size) class FastGlobalAvgPool(nn.Module): def __init__(self, flatten=False, *arg...
MSEDICELoss
# 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 DiceLoss(nn.Module): def __init__(self, dims=(1, 2, 3)) ->None: super(DiceLoss, self).__init__() self.eps: 'float' = 1e-06 self.dims = dims def forward(self, input: 'torch.Tensor', target: 'torch.Tensor', ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
CarlosPena00/pytorch-unet
MSEDICELoss
false
226
[ "MIT" ]
0
8365bace23e4b04b9c5b75cd6720807ea8cac5ab
https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab
import torch import torch.nn as nn import torch.nn.functional as F class DiceLoss(nn.Module): def __init__(self, dims=(1, 2, 3)) ->None: super().__init__() self.eps: 'float' = 1e-06 self.dims = dims def forward(self, input: 'torch.Tensor', target: 'torch.Tensor', weights=None...
AnyHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.optim.lr_scheduler import * from torch.optim import * class AnyHead(nn.Module): """AnyNet head.""" def __init__(self, w_in, nc): super(AnyHead, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2d((1, 1)) self.fc = nn.Linear(w_in, nc, 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 import nn from torch.optim.lr_scheduler import * from torch.optim imp...
Challyfilio/NAIC2021
AnyHead
false
227
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * class Model(nn.Module): """AnyNet head.""" def __init__(self, w_in, nc): super().__init__() self.avg_pool = nn.AdaptiveAvgPool2d((1, 1)) self.fc = nn.Linear(w_in, nc, bias=True) def...
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 math import torch import torch.nn as nn import torch.nn.parallel class ScaleNorm(nn.Module): """Apply Scale Normalization to input. The ScaleNorm layer first computes the square root of the scale, then computes the matrix/vector norm of the input tensor. The norm value is calculated as `sqrt(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 math import torch.nn ...
Chahalprincy/deepchem
ScaleNorm
false
228
[ "MIT" ]
0
9d1a6a879cc74b065694b3ddb763d52151d57b7a
https://github.com/Chahalprincy/deepchem/tree/9d1a6a879cc74b065694b3ddb763d52151d57b7a
import math import torch import torch.nn as nn import torch.nn.parallel class Model(nn.Module): """Apply Scale Normalization to input. The ScaleNorm layer first computes the square root of the scale, then computes the matrix/vector norm of the input tensor. The norm value is calculated as `sqrt(scale) / matr...
_Residual_Block_SR
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.nn as nn class _Residual_Block_SR(nn.Module): def __init__(self, num_ft): super(_Residual_Block_SR, self).__init__() self.conv1 = nn.Conv2d(in_channels=num_ft, out_channels=num_ft, kernel_size=3, stride=1, padding=1, bias=True) ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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.functional import torch.nn as nn assert_size_stride = torch._C._...
CarlosPena00/pytorchvision
_Residual_Block_SR
false
229
[ "MIT" ]
0
824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
import torch import torch.nn.functional import torch.nn as nn class Model(nn.Module): def __init__(self, num_ft): super().__init__() self.conv1 = nn.Conv2d(in_channels=num_ft, out_channels=num_ft, kernel_size=3, stride=1, padding=1, bias=True) self.relu = nn.LeakyReLU(0.2, inp...
_Residual_Block_DB
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.nn as nn class _Residual_Block_DB(nn.Module): def __init__(self, num_ft): super(_Residual_Block_DB, self).__init__() self.conv1 = nn.Conv2d(in_channels=num_ft, out_channels=num_ft, kernel_size=3, stride=1, padding=1, bias=True) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 im...
CarlosPena00/pytorchvision
_Residual_Block_DB
false
230
[ "MIT" ]
0
824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
import torch import torch.nn.functional import torch.nn as nn class Model(nn.Module): def __init__(self, num_ft): super().__init__() self.conv1 = nn.Conv2d(in_channels=num_ft, out_channels=num_ft, kernel_size=3, stride=1, padding=1, bias=True) self.relu = nn.ReLU(inplace=True)...
GELU
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * class GELU(nn.Module): """ Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU """ def forward(self, x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / m...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn from torch.optim.lr_scheduler import * from torch.optim im...
Challyfilio/NAIC2021
GELU
false
231
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import math import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * class Model(nn.Module): """ Paper Section 3.4, last paragraph notice that BERT used the GELU instead of RELU """ def forward(self, x): return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / ...
GeneralizedMeanPooling
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F from torch.optim.lr_scheduler import * from torch.optim import * class GeneralizedMeanPooling(nn.Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(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 libdevice from torch import nn from to...
Challyfilio/NAIC2021
GeneralizedMeanPooling
false
232
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import torch from torch import nn import torch.nn.functional as F from torch.optim.lr_scheduler import * from torch.optim import * class Model(nn.Module): """Applies a 2D power-average adaptive pooling over an input signal composed of several input planes. The function computed is: :math:`f(X) = pow(sum(pow(X...
Net
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Net(nn.Module): def __init__(self, STATE_NUM, ACTION_NUM): super(Net, self).__init__() self.fc1 = nn.Linear(in_features=STATE_NUM, out_features=128) self.fc2 = nn.Linear(in_fe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
ChangQingAAS/Deep-Reinforcement-Learning
Net
false
233
[ "MIT" ]
0
3bc1381c632b1730a48e63e972aea62086c4287c
https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Model(nn.Module): def __init__(self, STATE_NUM, ACTION_NUM): super().__init__() self.fc1 = nn.Linear(in_features=STATE_NUM, out_features=128) self.fc2 = nn.Linear(in_features=...
Critic
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Critic(nn.Module): def __init__(self, input_size): super(Critic, self).__init__() self.fc1 = nn.Linear(input_size, 128) self.fc2 = nn.Linear(128, 256) self.fc3 = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ChangQingAAS/Deep-Reinforcement-Learning
Critic
false
234
[ "MIT" ]
0
3bc1381c632b1730a48e63e972aea62086c4287c
https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Model(nn.Module): def __init__(self, input_size): super().__init__() self.fc1 = nn.Linear(input_size, 128) self.fc2 = nn.Linear(128, 256) self.fc3 = nn.Linear(256, 1) ...
TLU
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.parameter import Parameter from torch.optim.lr_scheduler import * from torch.optim import * class TLU(nn.Module): def __init__(self, num_features): """max(y, tau) = max(y - tau, 0) + tau = ReLU(y - tau) + tau""" super(TLU, self).__init__() s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn from torch.nn.parameter import Parameter from torch.optim.lr_schedul...
Challyfilio/NAIC2021
TLU
false
235
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import torch from torch import nn from torch.nn.parameter import Parameter from torch.optim.lr_scheduler import * from torch.optim import * class Model(nn.Module): def __init__(self, num_features): """max(y, tau) = max(y - tau, 0) + tau = ReLU(y - tau) + tau""" super().__init__() self.num...
MDiceLoss
# 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 DiceLoss(nn.Module): def __init__(self, dims=(1, 2, 3)) ->None: super(DiceLoss, self).__init__() self.eps: 'float' = 1e-06 self.dims = dims def forward(self, input: 'torch.Tensor', target: 'torch.Tensor', ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
CarlosPena00/pytorch-unet
MDiceLoss
false
236
[ "MIT" ]
0
8365bace23e4b04b9c5b75cd6720807ea8cac5ab
https://github.com/CarlosPena00/pytorch-unet/tree/8365bace23e4b04b9c5b75cd6720807ea8cac5ab
import torch import torch.nn as nn import torch.nn.functional as F class DiceLoss(nn.Module): def __init__(self, dims=(1, 2, 3)) ->None: super().__init__() self.eps: 'float' = 1e-06 self.dims = dims def forward(self, input: 'torch.Tensor', target: 'torch.Tensor', weights=None...
MuNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class MuNet(nn.Module): def __init__(self, in_dim, out_dim): super(MuNet, self).__init__() self.fc1 = nn.Linear(in_dim, 128) self.fc2 = nn.Linear(128, 64) self.fc_mu = nn.Li...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ChangQingAAS/Deep-Reinforcement-Learning
MuNet
false
237
[ "MIT" ]
0
3bc1381c632b1730a48e63e972aea62086c4287c
https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Model(nn.Module): def __init__(self, in_dim, out_dim): super().__init__() self.fc1 = nn.Linear(in_dim, 128) self.fc2 = nn.Linear(128, 64) self.fc_mu = nn.Linear(64, ou...
Atom_Wise_Convolution
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.parallel class Shifted_softplus(nn.Module): """ Performs a Shifter softplus loss, which modifies with a value of log(2) """ def __init__(self): super(Shifted_softplus, self).__init__() self.act = nn.Softplus() self.shift = nn.Para...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math im...
Chahalprincy/deepchem
Atom_Wise_Convolution
false
238
[ "MIT" ]
0
9d1a6a879cc74b065694b3ddb763d52151d57b7a
https://github.com/Chahalprincy/deepchem/tree/9d1a6a879cc74b065694b3ddb763d52151d57b7a
import torch import torch.nn as nn import torch.nn.parallel class Shifted_softplus(nn.Module): """ Performs a Shifter softplus loss, which modifies with a value of log(2) """ def __init__(self): super().__init__() self.act = nn.Softplus() self.shift = nn.Parameter(torch.tensor([0....
rSoftMax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import nn import torch.nn.functional as F from torch.optim.lr_scheduler import * from torch.optim import * class rSoftMax(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self,...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn f...
Challyfilio/NAIC2021
rSoftMax
false
239
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import torch from torch import nn import torch.nn.functional as F from torch.optim.lr_scheduler import * from torch.optim import * class Model(nn.Module): def __init__(self, radix, cardinality): super().__init__() self.radix = radix self.cardinality = cardinality def forward(self, x)...
Hardswish
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Hardswish(nn.Module): @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
ChaokunChang/SVAS
Hardswish
false
240
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): @staticmethod def forward(x): return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0 def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return []
SelfAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.checkpoint class SelfAttention(nn.Module): def __init__(self, *args, **kwargs): super().__init__() self.fn = nn.MultiheadAttention(*args, **kwargs) def forward(self, x): x = torch.unsqueeze(x, -2) y, _ = self.fn(x, x, x, n...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Antipurity/sensor-network
SelfAttention
false
241
[ "MIT" ]
0
c5cc67dee408da831c3ab60a03374da3c4789bd2
https://github.com/Antipurity/sensor-network/tree/c5cc67dee408da831c3ab60a03374da3c4789bd2
import torch import torch.nn as nn import torch.utils.checkpoint class Model(nn.Module): def __init__(self, *args, **kwargs): super().__init__() self.fn = nn.MultiheadAttention(*args, **kwargs) def forward(self, x): x = torch.unsqueeze(x, -2) y, _ = self.fn(x, x, x, need_weig...
Contract
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class Contract(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, C, H // s, s, W // s, s) x = x.permute...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
ChaokunChang/SVAS
Contract
false
242
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, C, H // s, s, W // s, s) x = x.permute(0,...
GroverAttention
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn as nn import torch.nn.functional as F from typing import * class GroverAttention(nn.Module): """ Compute 'Scaled Dot Product SelfAttention """ def forward(self, query, key, value, mask=None, dropout=None): """ :param query: :param key: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Changgun-Choi/huggingmolecules
GroverAttention
false
243
[ "Apache-2.0" ]
0
6d7c5e7d0acfd3d4725eb0deaeb0413dad9cfde8
https://github.com/Changgun-Choi/huggingmolecules/tree/6d7c5e7d0acfd3d4725eb0deaeb0413dad9cfde8
import math import torch import torch.nn as nn import torch.nn.functional as F from typing import * class Model(nn.Module): """ Compute 'Scaled Dot Product SelfAttention """ def forward(self, query, key, value, mask=None, dropout=None): """ :param query: :param key: :p...
RSoftmax
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn class RSoftmax(nn.Module): """Radix Softmax module in ``SplitAttentionConv2d``. Args: radix (int): Radix of input. groups (int): Groups of input. """ def __init__(self, radix, groups): super().__init__() ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
ChengBo5/mask-text-detector
RSoftmax
false
244
[ "Apache-2.0" ]
0
ce93e45ed1d982ec0ef6ad977c02e49326bf255a
https://github.com/ChengBo5/mask-text-detector/tree/ce93e45ed1d982ec0ef6ad977c02e49326bf255a
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): """Radix Softmax module in ``SplitAttentionConv2d``. Args: radix (int): Radix of input. groups (int): Groups of input. """ def __init__(self, radix, groups): super().__init__() ...
AttentionNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.nn as nn from torch.nn import functional as F def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = conv3x3(in_, out) self.activatio...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 im...
CarlosPena00/pytorchvision
AttentionNet
false
245
[ "MIT" ]
0
824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
https://github.com/CarlosPena00/pytorchvision/tree/824b3a5a8940f3ee6b4da5de7a391a88e5aa36a2
import torch import torch.nn.functional import torch.nn as nn from torch.nn import functional as F def conv3x3(in_, out): return nn.Conv2d(in_, out, 3, padding=1) class ConvRelu(nn.Module): def __init__(self, in_, out): super().__init__() self.conv = conv3x3(in_, out) self.activatio...
MyUpsample2
# 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 MyUpsample2(nn.Module): def forward(self, x): return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x .size(0), x.size(1), x.size(2) * 2, x.size(3) * 2) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
Chenyang-Lu/road-completion
MyUpsample2
false
246
[ "MIT" ]
0
115ca232922d3c48ead324299664a9a71348d2fe
https://github.com/Chenyang-Lu/road-completion/tree/115ca232922d3c48ead324299664a9a71348d2fe
import torch import torch.nn as nn class Model(nn.Module): def forward(self, x): return x[:, :, :, None, :, None].expand(-1, -1, -1, 2, -1, 2).reshape(x .size(0), x.size(1), x.size(2) * 2, x.size(3) * 2) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): re...
SqueezeExcitation
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import Tensor from torch import nn import torch.nn.functional as F from torch.optim.lr_scheduler import * from torch.optim import * def _make_divisible(v, divisor, min_value=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel numbe...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import Tensor from...
Challyfilio/NAIC2021
SqueezeExcitation
false
247
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import torch from torch import Tensor from torch import nn import torch.nn.functional as F from torch.optim.lr_scheduler import * from torch.optim import * def _make_divisible(v, divisor, min_value=None): """ This function is taken from the original tf repo. It ensures that all layers have a channel numbe...
Expand
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class Expand(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, s, s, C // s ** 2, H, W) x = x.permute(0...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
ChaokunChang/SVAS
Expand
false
248
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, gain=2): super().__init__() self.gain = gain def forward(self, x): N, C, H, W = x.size() s = self.gain x = x.view(N, s, s, C // s ** 2, H, W) x = x.permute(0,...
Actor
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Actor(nn.Module): def __init__(self, input_size, output_size): super(Actor, self).__init__() self.fc1 = nn.Linear(input_size, 128) self.fc2 = nn.Linear(128, 256) self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ChangQingAAS/Deep-Reinforcement-Learning
Actor
false
249
[ "MIT" ]
0
3bc1381c632b1730a48e63e972aea62086c4287c
https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Model(nn.Module): def __init__(self, input_size, output_size): super().__init__() self.fc1 = nn.Linear(input_size, 128) self.fc2 = nn.Linear(128, 256) self.fc3 = nn.Li...
L2Norm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class L2Norm(nn.Module): def __init__(self, n_dims, scale=20.0, eps=1e-10): """L2 normalization layer. Args: n_dims (int): Number of dimensions to be normalized scale (float, optional): Defaults to 20.. eps (float, optional):...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
ChengBo5/mask-text-detector
L2Norm
false
250
[ "Apache-2.0" ]
0
ce93e45ed1d982ec0ef6ad977c02e49326bf255a
https://github.com/ChengBo5/mask-text-detector/tree/ce93e45ed1d982ec0ef6ad977c02e49326bf255a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, n_dims, scale=20.0, eps=1e-10): """L2 normalization layer. Args: n_dims (int): Number of dimensions to be normalized scale (float, optional): Defaults to 20.. eps (float, optional): ...
duelingdqnNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class duelingdqnNet(nn.Module): def __init__(self, STATE_NUM, ACTION_NUM): super(duelingdqnNet, self).__init__() self.ACTION_NUM = ACTION_NUM self.fc1_a = nn.Linear(in_features=STAT...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
ChangQingAAS/Deep-Reinforcement-Learning
duelingdqnNet
false
251
[ "MIT" ]
0
3bc1381c632b1730a48e63e972aea62086c4287c
https://github.com/ChangQingAAS/Deep-Reinforcement-Learning/tree/3bc1381c632b1730a48e63e972aea62086c4287c
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim import torch.autograd class Model(nn.Module): def __init__(self, STATE_NUM, ACTION_NUM): super().__init__() self.ACTION_NUM = ACTION_NUM self.fc1_a = nn.Linear(in_features=STATE_NUM, out_features=512) ...
Reorg
# 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.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class Reorg(nn.Module): def __init__(self, stride=2): super(Reorg, self).__init__() self.stride = stride def forward(self, x): stride = se...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo assert_...
ChitienSun/NCTU_DLSR_final_project
Reorg
false
252
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
import torch from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class Model(nn.Module): def __init__(self, stride=2): super().__init__() self.stride = stride def forward(self, x): stride = self.stride ...
CausalConv1d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 CausalConv1d(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=1, **kwargs): super(CausalConv1d, self).__init__(in_channels, out_channels, kernel_size, padding=dilation * (kernel_size - 1), dilation= ...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
ChesterHuynh/Wavenet-CPC-Music-Translation
CausalConv1d
false
253
[ "MIT" ]
0
60632b0330a61a10bac1a129826c55372f685427
https://github.com/ChesterHuynh/Wavenet-CPC-Music-Translation/tree/60632b0330a61a10bac1a129826c55372f685427
import torch import torch.nn as nn class Model(nn.Conv1d): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=1, **kwargs): super().__init__(in_channels, out_channels, kernel_size, padding=dilation * (kernel_size - 1), dilation= dilation, **kwargs) ...
Sum
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class Sum(nn.Module): def __init__(self, n, weight=False): super(Sum, self).__init__() self.weight = weight self.iter = range(n - 1) if weight: self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=Tru...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
ChaokunChang/SVAS
Sum
false
254
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, n, weight=False): super().__init__() self.weight = weight self.iter = range(n - 1) if weight: self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=True ...
BPNet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 BPNet(nn.Module): def __init__(self, input_dim, output_dim, level1, level2): super(BPNet, self).__init__() self.fc1 = nn.Linear(input_dim, level1) self.fc2 = nn.Linear(level1, level2) self.fc3 = nn.Linear(lev...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
Cheemion/Sitting_Posture_Recognization_Experiments
BPNet
false
255
[ "MIT" ]
0
3a96377fe36b97e9867b5c32fe4d7434ddd370e2
https://github.com/Cheemion/Sitting_Posture_Recognization_Experiments/tree/3a96377fe36b97e9867b5c32fe4d7434ddd370e2
import torch import torch.nn.functional as F import torch.nn as nn class Model(nn.Module): def __init__(self, input_dim, output_dim, level1, level2): super().__init__() self.fc1 = nn.Linear(input_dim, level1) self.fc2 = nn.Linear(level1, level2) self.fc3 = nn.Linear(level2, output...
BCEBlurWithLogitsLoss
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn as nn import torch.utils.data class BCEBlurWithLogitsLoss(nn.Module): def __init__(self, alpha=0.05): super(BCEBlurWithLogitsLoss, self).__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, true): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
ChaokunChang/SVAS
BCEBlurWithLogitsLoss
false
256
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, alpha=0.05): super().__init__() self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none') self.alpha = alpha def forward(self, pred, true): loss = self.loss_fcn(pred, true) ...
SELayer
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class SELayer(nn.Module): def __init__(self, in_channels, reduction): super(SELayer, self).__init__() mid_channels = in_channels // reduction self.fc1 = nn.Linear(in_channels, mid_channels) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ChengBin1997/pytorch_image_classification
SELayer
false
257
[ "MIT" ]
0
f7c39efceb86d961489514917d11b96f44699094
https://github.com/ChengBin1997/pytorch_image_classification/tree/f7c39efceb86d961489514917d11b96f44699094
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Model(nn.Module): def __init__(self, in_channels, reduction): super().__init__() mid_channels = in_channels // reduction self.fc1 = nn.Linear(in_channels, mid_channels) self.fc2 = nn.L...
GHMC
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn def _expand_onehot_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero((labels >= 0) & (labels < label_channels), as_tuple=False).squeeze() if inds.n...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
ChengBo5/mask-text-detector
GHMC
false
258
[ "Apache-2.0" ]
0
ce93e45ed1d982ec0ef6ad977c02e49326bf255a
https://github.com/ChengBo5/mask-text-detector/tree/ce93e45ed1d982ec0ef6ad977c02e49326bf255a
import torch import torch.nn.functional as F import torch.nn as nn def _expand_onehot_labels(labels, label_weights, label_channels): bin_labels = labels.new_full((labels.size(0), label_channels), 0) inds = torch.nonzero((labels >= 0) & (labels < label_channels), as_tuple=False).squeeze() if inds.n...
Classify
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data def autopad(k, p=None): if p is None: p = k // 2 if isinstance(k, int) else [(x // 2) for x in k] return p class Classify(nn.Module): def __init__(self, c1, c2, k=1, s=1, p=None, g=1): super(Classify, self).__init__() se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
ChaokunChang/SVAS
Classify
false
259
[ "Apache-2.0" ]
0
61af6eb39269edff8ea5147311628b3200c3a3d2
https://github.com/ChaokunChang/SVAS/tree/61af6eb39269edff8ea5147311628b3200c3a3d2
import torch import torch.nn as nn import torch.utils.data def autopad(k, p=None): if p is None: p = k // 2 if isinstance(k, int) else [(x // 2) for x in k] return p class Model(nn.Module): def __init__(self, c1, c2, k=1, s=1, p=None, g=1): super().__init__() self.aap = nn.Adapt...
PetarVGAT
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 BaseModel(nn.Module): @staticmethod def add_args(parser): """Add model-specific arguments to the parser.""" pass @classmethod def build_model_from_args(cls, args): """Build a new ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
BruceW91/cogdl
PetarVGAT
false
260
[ "MIT" ]
0
1ad524375f5ba062103698a0432fc857572a6933
https://github.com/BruceW91/cogdl/tree/1ad524375f5ba062103698a0432fc857572a6933
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class BaseModel(nn.Module): @staticmethod def add_args(parser): """Add model-specific arguments to the parser.""" pass @classmethod def build_model_from_args(cls, args): """Build a new ...
ZeroPad1d
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class ZeroPad1d(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left = pad_left self.p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler assert_size_str...
ChanLiang/MAP-BERT
ZeroPad1d
false
261
[ "MIT" ]
0
c3f95a925002061463dbb68608ff7c67ff353b5d
https://github.com/ChanLiang/MAP-BERT/tree/c3f95a925002061463dbb68608ff7c67ff353b5d
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Model(nn.Module): def __init__(self, pad_left, pad_right): super().__init__() self.pad_left = pad_left self.pad_r...
Conv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, relu=True, same_padding=False, bn=False): super(Conv2d, self).__init__() padding = int((kernel_size - 1) / 2) if same_padding else 0 self.conv = nn.Conv...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ChrisKonishi/multi-stream-crowd-counting-extended
Conv2d
false
262
[ "MIT" ]
0
4b1590499bd93ac09e62c4c7760b88ae92e6b301
https://github.com/ChrisKonishi/multi-stream-crowd-counting-extended/tree/4b1590499bd93ac09e62c4c7760b88ae92e6b301
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, relu=True, same_padding=False, bn=False): super().__init__() padding = int((kernel_size - 1) / 2) if same_padding else 0 self.conv = nn.Conv2d(in_channel...
Fp32GroupNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Fp32GroupNorm(nn.GroupNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, input)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data import torch.onnx.operators impor...
ChanLiang/MAP-BERT
Fp32GroupNorm
false
263
[ "MIT" ]
0
c3f95a925002061463dbb68608ff7c67ff353b5d
https://github.com/ChanLiang/MAP-BERT/tree/c3f95a925002061463dbb68608ff7c67ff353b5d
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Model(nn.GroupNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, input): ...
MaxPoolStride1
# 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.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class MaxPoolStride1(nn.Module): def __init__(self): super(MaxPoolStride1, self).__init__() 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.optim.lr_scheduler import * import torch.optim import torch.nn as nn import to...
ChitienSun/NCTU_DLSR_final_project
MaxPoolStride1
false
264
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
import torch from torch.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): x = F.max_pool2d(F.pad(x, (0,...
GlobalAvgPool2d
# 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.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class GlobalAvgPool2d(nn.Module): def __init__(self): super(GlobalAvgPool2d, self).__init__() 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.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo assert_...
ChitienSun/NCTU_DLSR_final_project
GlobalAvgPool2d
false
265
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
import torch from torch.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() def forward(self, x): N = x.data.size(0) C ...
DilatedResConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 DilatedResConv(nn.Module): def __init__(self, channels, dilation=1, activation='relu', padding=1, kernel_size=3, left_pad=0): super().__init__() in_channels = channels if activation == 'relu': 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 from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
ChesterHuynh/Wavenet-CPC-Music-Translation
DilatedResConv
false
266
[ "MIT" ]
0
60632b0330a61a10bac1a129826c55372f685427
https://github.com/ChesterHuynh/Wavenet-CPC-Music-Translation/tree/60632b0330a61a10bac1a129826c55372f685427
import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, channels, dilation=1, activation='relu', padding=1, kernel_size=3, left_pad=0): super().__init__() in_channels = channels if activation == 'relu': self.activat...
ClippedLinearQuantization
# 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.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo def linear_dequantize(input, scale_factor, inplace=False): if inplace: input.div_(scale_factor) return input return input / scale_factor def linea...
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.optim.lr_schedule...
ChitienSun/NCTU_DLSR_final_project
ClippedLinearQuantization
false
267
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
import torch from torch.optim.lr_scheduler import * import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo def linear_dequantize(input, scale_factor, inplace=False): if inplace: input.div_(scale_factor) return input return input / scale_factor def linea...
BahdanauAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.nn.functional as F class BahdanauAttention(nn.Module): def __init__(self, hidden_size): super(BahdanauAttention, self).__init__() self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
Chiang97912/seq2seq
BahdanauAttention
false
268
[ "MIT" ]
0
4b544016ecc16fa8e48358021cf486e58494aa0f
https://github.com/Chiang97912/seq2seq/tree/4b544016ecc16fa8e48358021cf486e58494aa0f
import math import torch from torch import nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, hidden_size): super().__init__() self.hidden_size = hidden_size self.attn = nn.Linear(self.hidden_size * 2, hidden_size) self.v = nn.Parameter(torch.rand(hidden...
MaxPool2dStaticSamePadding
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import math import torch import torch.nn as nn import torch.nn.functional as F class MaxPool2dStaticSamePadding(nn.Module): def __init__(self, *args, **kwargs): super().__init__() self.pool = nn.MaxPool2d(*args, **kwargs) self.stride = self.pool.stride self.kernel_size = self.pool...
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...
ChrisLiuxp/efficientdet
MaxPool2dStaticSamePadding
false
269
[ "MIT" ]
0
5d52ac491e1dd2a29ee6650bb746f1e840c24fcc
https://github.com/ChrisLiuxp/efficientdet/tree/5d52ac491e1dd2a29ee6650bb746f1e840c24fcc
import math import torch import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): def __init__(self, *args, **kwargs): super().__init__() self.pool = nn.MaxPool2d(*args, **kwargs) self.stride = self.pool.stride self.kernel_size = self.pool.kernel_size ...
PSNRLoss
# 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.functional import mse_loss as mse def psnr(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float' ) ->torch.Tensor: """Creates a function that calculates the PSNR between 2 images. PSNR is Peek Signal to Noise Ratio, which is similar to mean squar...
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...
ChristophReich1996/kornia
PSNRLoss
false
270
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn from torch.nn.functional import mse_loss as mse def psnr(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float' ) ->torch.Tensor: """Creates a function that calculates the PSNR between 2 images. PSNR is Peek Signal to Noise Ratio, which is similar to mean squar...
RgbaToBgr
# 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 bgr_to_rgb(image: 'torch.Tensor') ->torch.Tensor: """Convert a BGR image to RGB. Args: image (torch.Tensor): BGR Image to be converted to BGR of shape :math:`(*,3,H,W)`. Returns: torch.Tensor: RGB version of the image with shape of shape :math:`(*,3...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ChristophReich1996/kornia
RgbaToBgr
false
271
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn def bgr_to_rgb(image: 'torch.Tensor') ->torch.Tensor: """Convert a BGR image to RGB. Args: image (torch.Tensor): BGR Image to be converted to BGR of shape :math:`(*,3,H,W)`. Returns: torch.Tensor: RGB version of the image with shape of shape :math:`(*,3...
GHMR
# 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 GHMR(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper `Gradient Harmonized Single-stage Detector <https://arxiv.org/abs/1811.05181>`_. Args: mu (float): The parameter for the Authentic Smooth L1 loss. 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
ChengBo5/mask-text-detector
GHMR
false
272
[ "Apache-2.0" ]
0
ce93e45ed1d982ec0ef6ad977c02e49326bf255a
https://github.com/ChengBo5/mask-text-detector/tree/ce93e45ed1d982ec0ef6ad977c02e49326bf255a
import torch import torch.nn as nn class Model(nn.Module): """GHM Regression Loss. Details of the theorem can be viewed in the paper `Gradient Harmonized Single-stage Detector <https://arxiv.org/abs/1811.05181>`_. Args: mu (float): The parameter for the Authentic Smooth L1 loss. ...
Rot180
# 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 rot180(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-2, -1]) class Rot180(nn.Module): """Rotate a tensor image or a batch of tensor images 180 degrees. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ChristophReich1996/kornia
Rot180
false
273
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn def rot180(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-2, -1]) class Model(nn.Module): """Rotate a tensor image or a batch of tensor images 180 degrees. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. ...
SplAtConv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import logging import torch from torch import nn import torch.nn.functional as F from torch.nn import ReLU from torch.nn import Conv2d from torch.nn.modules.utils import _pair from torch.optim.lr_scheduler import * from torch.optim import * def get_norm(norm, out_channels, **kwargs): """ Args: norm (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....
Challyfilio/NAIC2021
SplAtConv2d
false
274
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import logging import torch from torch import nn import torch.nn.functional as F from torch.nn import ReLU from torch.nn import Conv2d from torch.nn.modules.utils import _pair from torch.optim.lr_scheduler import * from torch.optim import * def get_norm(norm, out_channels, **kwargs): """ Args: norm (s...
RobertaMaskLeanerHead
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class RobertaMaskLeanerHead(nn.Module): """ Head for mask leaner. input: (batch, src_lens, embed_dim) output: (batch, src_lens,1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ChanLiang/MAP-BERT
RobertaMaskLeanerHead
false
275
[ "MIT" ]
0
c3f95a925002061463dbb68608ff7c67ff353b5d
https://github.com/ChanLiang/MAP-BERT/tree/c3f95a925002061463dbb68608ff7c67ff353b5d
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Model(nn.Module): """ Head for mask leaner. input: (batch, src_lens, embed_dim) output: (batch, src_lens,1) """ def _...
ExtractTensorPatches
# 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 typing import Tuple from typing import Union from typing import Optional from torch.nn.modules.utils import _pair def _extract_tensor_patchesnd(input: 'torch.Tensor', window_sizes: 'Tuple[int, ...]', strides: 'Tuple[int, ...]') ->torch.Tensor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.functional as F from typing import Tuple from typing import Union from typing import Optional from tor...
ChristophReich1996/kornia
ExtractTensorPatches
false
276
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn import torch.nn.functional as F from typing import Tuple from typing import Union from typing import Optional from torch.nn.modules.utils import _pair def _extract_tensor_patchesnd(input: 'torch.Tensor', window_sizes: 'Tuple[int, ...]', strides: 'Tuple[int, ...]') ->torch.Tensor...
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: return torch.flip(input, [-1]) class Hflip(nn.Module): """Horizontally flip a tensor image or a batch of tensor images. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: ...
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...
ChristophReich1996/kornia
Hflip
false
277
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn def hflip(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-1]) class Model(nn.Module): """Horizontally flip a tensor image or a batch of tensor images. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: ...
InverseDepthSmoothnessLoss
# 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 _gradient_x(img: 'torch.Tensor') ->torch.Tensor: assert len(img.shape) == 4, img.shape return img[:, :, :, :-1] - img[:, :, :, 1:] def _gradient_y(img: 'torch.Tensor') ->torch.Tensor: assert len(img.shape) == 4, img.shape return img[:, :, :-1, :] - img[:, :, 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.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ChristophReich1996/kornia
InverseDepthSmoothnessLoss
false
278
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn def _gradient_x(img: 'torch.Tensor') ->torch.Tensor: assert len(img.shape) == 4, img.shape return img[:, :, :, :-1] - img[:, :, :, 1:] def _gradient_y(img: 'torch.Tensor') ->torch.Tensor: assert len(img.shape) == 4, img.shape return img[:, :, :-1, :] - img[:, :, 1:...
NCutLossOptimized
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch from torch import Tensor import torch.nn as nn class NCutLossOptimized(nn.Module): """Implementation of the continuous N-Cut loss, as in: 'W-Net: A Deep Model for Fully Unsupervised Image Segmentation', by Xia, Kulis (2017)""" def __init__(self, radius: 'int'=5): """ :param r...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
Christer-L/wnet_pytorch
NCutLossOptimized
false
279
[ "MIT" ]
0
c7a7d3db0c07d5e2d83fe152ce5fdae31472748b
https://github.com/Christer-L/wnet_pytorch/tree/c7a7d3db0c07d5e2d83fe152ce5fdae31472748b
import torch from torch import Tensor import torch.nn as nn class Model(nn.Module): """Implementation of the continuous N-Cut loss, as in: 'W-Net: A Deep Model for Fully Unsupervised Image Segmentation', by Xia, Kulis (2017)""" def __init__(self, radius: 'int'=5): """ :param radius: Radiu...
RgbaToRgb
# 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 rgba_to_rgb(image: 'torch.Tensor') ->torch.Tensor: """Convert an image from RGBA to RGB. Args: image (torch.Tensor): RGBA Image to be converted to RGB of shape :math:`(*,4,H,W)`. Returns: torch.Tensor: RGB version of the image with shape :math:`(*,3...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
ChristophReich1996/kornia
RgbaToRgb
false
280
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn def rgba_to_rgb(image: 'torch.Tensor') ->torch.Tensor: """Convert an image from RGBA to RGB. Args: image (torch.Tensor): RGBA Image to be converted to RGB of shape :math:`(*,4,H,W)`. Returns: torch.Tensor: RGB version of the image with shape :math:`(*,3...
MomentumNetSide
# 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.utils.data.dataloader class MomentumNetSide(torch.nn.Module): def __init__(self, beta: 'float'): super(MomentumNetSide, self).__init__() self.beta = beta def forward(self, inp: 'torch.Tensor'): return inp * self.beta 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 import torch.utils.data import torch.utils.data.dataloader assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
ClashLuke/HomebrewNLP
MomentumNetSide
false
281
[ "BSD-2-Clause" ]
0
18d9a9a32af4e5e5672a9261ef6ac613dc9194c0
https://github.com/ClashLuke/HomebrewNLP/tree/18d9a9a32af4e5e5672a9261ef6ac613dc9194c0
import torch import torch.utils.data import torch.utils.data.dataloader class Model(torch.nn.Module): def __init__(self, beta: 'float'): super().__init__() self.beta = beta def forward(self, inp: 'torch.Tensor'): return inp * self.beta def get_inputs(): return [torch.rand([4, 4...
BinaryFocalLossWithLogits
# 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 binary_focal_loss_with_logits(input: 'torch.Tensor', target: 'torch.Tensor', alpha: 'float'=0.25, gamma: 'float'=2.0, reduction: 'str'='none', eps: 'float'=1e-08) ->torch.Tensor: """Function that computes Binary Focal loss. .. math:: \\text{FL}(p_t) = -...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ChristophReich1996/kornia
BinaryFocalLossWithLogits
false
282
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn def binary_focal_loss_with_logits(input: 'torch.Tensor', target: 'torch.Tensor', alpha: 'float'=0.25, gamma: 'float'=2.0, reduction: 'str'='none', eps: 'float'=1e-08) ->torch.Tensor: """Function that computes Binary Focal loss. .. math:: \\text{FL}(p_t) = -...
TotalVariation
# 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 total_variation(img: 'torch.Tensor') ->torch.Tensor: """Function that computes Total Variation according to [1]. Args: img (torch.Tensor): the input image with shape :math:`(N, C, H, W)` or :math:`(C, H, W)`. Return: torch.Tensor: a scalar with the ...
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...
ChristophReich1996/kornia
TotalVariation
false
283
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn def total_variation(img: 'torch.Tensor') ->torch.Tensor: """Function that computes Total Variation according to [1]. Args: img (torch.Tensor): the input image with shape :math:`(N, C, H, W)` or :math:`(C, H, W)`. Return: torch.Tensor: a scalar with the ...
Vflip
# 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 vflip(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-2]) class Vflip(nn.Module): """Vertically flip a tensor image or a batch of tensor images. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: ...
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...
ChristophReich1996/kornia
Vflip
false
284
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn def vflip(input: 'torch.Tensor') ->torch.Tensor: return torch.flip(input, [-2]) class Model(nn.Module): """Vertically flip a tensor image or a batch of tensor images. Input must be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`. Args: ...
MSE
# 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 MSE(nn.Module): def __init__(self): super(MSE, self).__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) mse = torch.sum(diffs.pow(2)) / n return mse def get_inputs(): retu...
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...
Clement25/Multimodal-Attack
MSE
false
285
[ "MIT" ]
0
bd04ee099d457e87b6e6ee918c03f65a589bcb9a
https://github.com/Clement25/Multimodal-Attack/tree/bd04ee099d457e87b6e6ee918c03f65a589bcb9a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) mse = torch.sum(diffs.pow(2)) / n return mse def get_inputs(): return [tor...
DiffLoss
# 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 DiffLoss(nn.Module): def __init__(self): super(DiffLoss, self).__init__() def forward(self, input1, input2): batch_size = input1.size(0) input1 = input1.view(batch_size, -1) input2 = input2.view(batch_size, -1) input1_mean = to...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Clement25/Multimodal-Attack
DiffLoss
false
286
[ "MIT" ]
0
bd04ee099d457e87b6e6ee918c03f65a589bcb9a
https://github.com/Clement25/Multimodal-Attack/tree/bd04ee099d457e87b6e6ee918c03f65a589bcb9a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, input1, input2): batch_size = input1.size(0) input1 = input1.view(batch_size, -1) input2 = input2.view(batch_size, -1) input1_mean = torch.mean(input1, ...
Fp32LayerNorm
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Fp32LayerNorm(nn.LayerNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, input)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.data import torch.onnx.operators impor...
ChanLiang/MAP-BERT
Fp32LayerNorm
false
287
[ "MIT" ]
0
c3f95a925002061463dbb68608ff7c67ff353b5d
https://github.com/ChanLiang/MAP-BERT/tree/c3f95a925002061463dbb68608ff7c67ff353b5d
import torch import torch.nn.functional as F import torch.nn as nn import torch.utils.data import torch.onnx.operators import torch.optim import torch.optim.lr_scheduler class Model(nn.LayerNorm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def forward(self, input): ...
ConcatenateChannels
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn class ConcatenateChannels(torch.nn.Module): def __init__(self, split_location): self.split_location = split_location super(ConcatenateChannels, self).__init__() def forward(self, x, y): return torch.cat([x, y], dim=1) def inverse(self, x): 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 import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_...
ClashLuke/memcnn
ConcatenateChannels
false
288
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, split_location): self.split_location = split_location super().__init__() def forward(self, x, y): return torch.cat([x, y], dim=1) def inverse(self, x): return x[:, :self.split_location, :].clon...
SplitChannels
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import torch.nn class SplitChannels(torch.nn.Module): def __init__(self, split_location): self.split_location = split_location super(SplitChannels, self).__init__() def forward(self, x): return x[:, :self.split_location, :].clone(), x[:, self. split_location:...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_...
ClashLuke/memcnn
SplitChannels
false
289
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, split_location): self.split_location = split_location super().__init__() def forward(self, x): return x[:, :self.split_location, :].clone(), x[:, self. split_location:, :].clone() def inver...
SpatialAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn class SpatialAttention(nn.Module): def __init__(self, kernel=3): super(SpatialAttention, self).__init__() self.conv1 = nn.Conv2d(2, 1, kernel_size=kernel, padding=kernel // 2, bias=False) self.sigmoid = nn.Sigmoid() def forward(self, x)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
Clayrisee/BanchelorsProject-FAS
SpatialAttention
false
290
[ "MIT" ]
0
3da199fb2e7be04eed7f28374ef753383511dbee
https://github.com/Clayrisee/BanchelorsProject-FAS/tree/3da199fb2e7be04eed7f28374ef753383511dbee
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, kernel=3): super().__init__() self.conv1 = nn.Conv2d(2, 1, kernel_size=kernel, padding=kernel // 2, bias=False) self.sigmoid = nn.Sigmoid() def forward(self, x): avg_out = torch.mean(x,...
InvDepth
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 InvDepth(nn.Module): def __init__(self, height, width, min_depth=0.5, max_depth=25.0): super(InvDepth, self).__init__() self._min_range = 1.0 / max_depth self._max_range = 1.0 / min_depth self.w = nn.Parameter(self._init_weights(height, wid...
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...
ChristophReich1996/kornia
InvDepth
false
291
[ "ECL-2.0", "Apache-2.0" ]
0
35f955b46e8015da1cb9faa28c6943ec2b09cc2a
https://github.com/ChristophReich1996/kornia/tree/35f955b46e8015da1cb9faa28c6943ec2b09cc2a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, height, width, min_depth=0.5, max_depth=25.0): super().__init__() self._min_range = 1.0 / max_depth self._max_range = 1.0 / min_depth self.w = nn.Parameter(self._init_weights(height, width)) def _in...
DummyModel
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn class DummyModel(torch.nn.Module): def __init__(self, block): super(DummyModel, self).__init__() self.block = block self.conv = torch.nn.Conv2d(1, 1, 1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch.rand([4, 1, 64...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride ...
ClashLuke/memcnn
DummyModel
false
292
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, block): super().__init__() self.block = block self.conv = torch.nn.Conv2d(1, 1, 1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch.rand([4, 1, 64, 64])] def get_ini...
Simplenet
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class Simplenet(nn.Module): def __init__(self): super(Simplenet, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.optim.lr_scheduler...
ChitienSun/NCTU_DLSR_final_project
Simplenet
false
293
[ "MIT" ]
0
9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
https://github.com/ChitienSun/NCTU_DLSR_final_project/tree/9d647426c274afc7651ea4fe9a11f2a0a0fd1fba
import torch from torch.optim.lr_scheduler import * import torch.nn.functional as F import torch.optim import torch.nn as nn import torch.utils.data import torch.utils.model_zoo class Model(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.M...
InvConv
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class InvConv(nn.Module): """Invertible 1x1 Convolution for 2D inputs. Originally described in Glow (https://arxiv.org/abs/1807.03039). Does not support LU-decomposed version. Args: num_channels (int): Number of...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
ClaraBing/flow
InvConv
false
294
[ "MIT" ]
0
00290326a97235e7d83303f1efff2e14214d0c36
https://github.com/ClaraBing/flow/tree/00290326a97235e7d83303f1efff2e14214d0c36
import torch import numpy as np import torch.nn as nn import torch.nn.functional as F class Model(nn.Module): """Invertible 1x1 Convolution for 2D inputs. Originally described in Glow (https://arxiv.org/abs/1807.03039). Does not support LU-decomposed version. Args: num_channels (int): Number of c...
PixWiseBCELoss
# 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 PixWiseBCELoss(nn.Module): def __init__(self, beta=0.5): super().__init__() self.criterion = nn.BCELoss() self.beta = beta def forward(self, net_mask, net_label, target_mask, target_label): pixel_loss = self.criterion(net_mask, target_...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
Clayrisee/BanchelorsProject-FAS
PixWiseBCELoss
false
295
[ "MIT" ]
0
3da199fb2e7be04eed7f28374ef753383511dbee
https://github.com/Clayrisee/BanchelorsProject-FAS/tree/3da199fb2e7be04eed7f28374ef753383511dbee
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, beta=0.5): super().__init__() self.criterion = nn.BCELoss() self.beta = beta def forward(self, net_mask, net_label, target_mask, target_label): pixel_loss = self.criterion(net_mask, target_mask) ...
SIMSE
# 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 SIMSE(nn.Module): def __init__(self): super(SIMSE, self).__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) simse = torch.sum(diffs).pow(2) / n ** 2 return simse def get_input...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Clement25/Multimodal-Attack
SIMSE
false
296
[ "MIT" ]
0
bd04ee099d457e87b6e6ee918c03f65a589bcb9a
https://github.com/Clement25/Multimodal-Attack/tree/bd04ee099d457e87b6e6ee918c03f65a589bcb9a
import torch import torch.nn as nn class Model(nn.Module): def __init__(self): super().__init__() def forward(self, pred, real): diffs = torch.add(real, -pred) n = torch.numel(diffs.data) simse = torch.sum(diffs).pow(2) / n ** 2 return simse def get_inputs(): re...
Attention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import math import torch from torch import nn class Attention(nn.Module): """A generic attention module for a decoder in seq2seq""" def __init__(self, dim, use_tanh=False, C=10): super(Attention, self).__init__() self.use_tanh = use_tanh self.project_query = nn.Linear(dim, dim) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import math from to...
ChristinaTan0704/transTSP
Attention
false
297
[ "MIT" ]
0
b97cd7ed8ae97e91b687d5007d13a021781f3d1d
https://github.com/ChristinaTan0704/transTSP/tree/b97cd7ed8ae97e91b687d5007d13a021781f3d1d
import math import torch from torch import nn class Model(nn.Module): """A generic attention module for a decoder in seq2seq""" def __init__(self, dim, use_tanh=False, C=10): super().__init__() self.use_tanh = use_tanh self.project_query = nn.Linear(dim, dim) self.project_ref ...
Gate
# 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 Gate(torch.nn.Module): def __init__(self, out_planes): super(Gate, self).__init__() self.gate = nn.Parameter(torch.ones(1, out_planes, 1, 1), requires_grad=False) def forward(self, x): return self.gate * x def get_inputs(): r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
CityU-AIM-Group/GFBS
Gate
false
298
[ "MIT" ]
0
d71361243f1bcf699e1a20b312b05fe0be4dfd6d
https://github.com/CityU-AIM-Group/GFBS/tree/d71361243f1bcf699e1a20b312b05fe0be4dfd6d
import torch import torch.nn as nn class Model(torch.nn.Module): def __init__(self, out_planes): super().__init__() self.gate = nn.Parameter(torch.ones(1, out_planes, 1, 1), requires_grad=False) def forward(self, x): return self.gate * x def get_inputs(): return [to...
Block
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is the same as the DropConnect impl I created fo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
Challyfilio/NAIC2021
Block
false
299
[ "MIT" ]
0
11b38a920dcc902f9b798dc43ae360062862e6e4
https://github.com/Challyfilio/NAIC2021/tree/11b38a920dcc902f9b798dc43ae360062862e6e4
import torch from torch import nn from torch.optim.lr_scheduler import * from torch.optim import * def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). This is the same as the DropConnect impl I created fo...
ConvBlock
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 ConvBlock(nn.Module): def __init__(self, nb_in, nb_out): super(ConvBlock, self).__init__() self.convolution = nn.Conv2d(in_channels=nb_in, out_channels=nb_out, kernel_size=5, stride=1, padding=2) self.ReLU = nn.ReLU() self.MaxPoo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
Clement-W/PT-Activation-Map-Visualiser
ConvBlock
false
300
[ "MIT" ]
0
6c71d5225585e5f18c3e73a4775d7816699faeea
https://github.com/Clement-W/PT-Activation-Map-Visualiser/tree/6c71d5225585e5f18c3e73a4775d7816699faeea
import torch from torch import nn class Model(nn.Module): def __init__(self, nb_in, nb_out): super().__init__() self.convolution = nn.Conv2d(in_channels=nb_in, out_channels=nb_out, kernel_size=5, stride=1, padding=2) self.ReLU = nn.ReLU() self.MaxPooling = nn.MaxPool2d...
MultiplicationInverse
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn class MultiplicationInverse(torch.nn.Module): def __init__(self, factor=2): super(MultiplicationInverse, self).__init__() self.factor = torch.nn.Parameter(torch.ones(1) * factor) def forward(self, x): return x * self.factor def inverse(self, y): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_...
ClashLuke/memcnn
MultiplicationInverse
false
301
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
import torch import torch.nn class Model(torch.nn.Module): def __init__(self, factor=2): super().__init__() self.factor = torch.nn.Parameter(torch.ones(1) * factor) def forward(self, x): return x * self.factor def inverse(self, y): return y / self.factor def get_inputs...
CrossEntropyLossTF
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
from torch.nn import Module import torch import torch.nn as nn import torch.nn from torch.nn.modules.module import Module def _assert_no_grad(variable): msg = ( "nn criterions don't compute the gradient w.r.t. targets - please mark these variables as not requiring gradients" ) assert not varia...
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 import M...
ClashLuke/memcnn
CrossEntropyLossTF
false
302
[ "MIT" ]
0
1d48132282c02506ca3d35540f819c4c9130eab4
https://github.com/ClashLuke/memcnn/tree/1d48132282c02506ca3d35540f819c4c9130eab4
from torch.nn import Module import torch import torch.nn as nn import torch.nn from torch.nn.modules.module import Module def _assert_no_grad(variable): msg = ( "nn criterions don't compute the gradient w.r.t. targets - please mark these variables as not requiring gradients" ) assert not varia...
SSE
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import torch.nn as nn import torch.utils.data class SSE(nn.Module): def __init__(self, in_ch): super(SSE, self).__init__() self.conv = nn.Conv2d(in_ch, in_ch, kernel_size=1, stride=1) def forward(self, x): input_x = x x = self.conv(x) x = torch.sigmoid(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 import torch.utils.data assert_size_stride = torch._C._dyn...
ColinWine/Accurate-and-rapid-pulmonary-tuberculosis-diagnosis-system
SSE
false
303
[ "Apache-2.0" ]
0
7be433b3a495a7c4db2b850a79dc505e413909c4
https://github.com/ColinWine/Accurate-and-rapid-pulmonary-tuberculosis-diagnosis-system/tree/7be433b3a495a7c4db2b850a79dc505e413909c4
import torch import torch.nn as nn import torch.utils.data class Model(nn.Module): def __init__(self, in_ch): super().__init__() self.conv = nn.Conv2d(in_ch, in_ch, kernel_size=1, stride=1) def forward(self, x): input_x = x x = self.conv(x) x = torch.sigmoid(x) ...
ExpNormalBasis
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class ExpNormalBasis(nn.Module): def __init__(self, n_rbf, cutoff, learnable_mu, learnable_beta): super().__init__() self.mu = torch.linspace(np.exp(-cutoff), 1, n_rbf) init_beta = (2 / n_rbf * (1 - np.exp(-cutoff))) ** -2 self...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import numpy as np import torch.nn as nn assert_size_stride = torch._C._d...
ClintvanHoesel/MXMNet_adapted
ExpNormalBasis
false
304
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, n_rbf, cutoff, learnable_mu, learnable_beta): super().__init__() self.mu = torch.linspace(np.exp(-cutoff), 1, n_rbf) init_beta = (2 / n_rbf * (1 - np.exp(-cutoff))) ** -2 self.beta = t...
CosineEnvelope
# AOT ID: ['0_inference'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _al...
import torch import numpy as np import torch.nn as nn class CosineEnvelope(nn.Module): def __init__(self, cutoff): super().__init__() self.cutoff = cutoff def forward(self, d): output = 0.5 * (torch.cos(np.pi * d / self.cutoff) + 1) exclude = d >= self.cutoff output[e...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
ClintvanHoesel/MXMNet_adapted
CosineEnvelope
false
305
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, cutoff): super().__init__() self.cutoff = cutoff def forward(self, d): output = 0.5 * (torch.cos(np.pi * d / self.cutoff) + 1) exclude = d >= self.cutoff output[exclude] =...
Conv2d
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from 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 Conv2d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding='auto', dilation=1, bias=False, norm=nn.Identity(), activation=nn.ReLU()): super(Conv2d, self).__init__() if padding == 'auto': ke...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ClementPla/NNTools
Conv2d
false
306
[ "MIT" ]
0
61562be2d931a7f720ceee1bd91a37a2b9a329af
https://github.com/ClementPla/NNTools/tree/61562be2d931a7f720ceee1bd91a37a2b9a329af
import torch import torch.nn as nn class Model(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding='auto', dilation=1, bias=False, norm=nn.Identity(), activation=nn.ReLU()): super().__init__() if padding == 'auto': kernel_size_eff...
MultiHeadedAttention
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan 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 import torch.nn as nn class MultiHeadedAttention(nn.Module): """ Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py """ def __init__(self, num_heads: 'in...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ClementNguyen/slt
MultiHeadedAttention
false
307
[ "Apache-2.0" ]
0
20ee90349d1ed0655b99612ffcfae6d079116db6
https://github.com/ClementNguyen/slt/tree/20ee90349d1ed0655b99612ffcfae6d079116db6
import math import torch from torch import Tensor import torch.nn as nn class Model(nn.Module): """ Multi-Head Attention module from "Attention is All You Need" Implementation modified from OpenNMT-py. https://github.com/OpenNMT/OpenNMT-py """ def __init__(self, num_heads: 'int', size: 'int'...
PainnRadialBasis
# AOT ID: ['0_forward'] from ctypes import c_void_p, c_long, c_int import torch import math import random import os import tempfile from math import inf, nan from torch._inductor.hooks import run_intermediate_hooks from torch._inductor.utils import maybe_profile from torch._inductor.codegen.memory_planning import _alig...
import torch import numpy as np import torch.nn as nn class PainnRadialBasis(nn.Module): def __init__(self, n_rbf, cutoff, learnable_k): super().__init__() self.n = torch.arange(1, n_rbf + 1).float() if learnable_k: self.n = nn.Parameter(self.n) self.cutoff = cutoff ...
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...
ClintvanHoesel/MXMNet_adapted
PainnRadialBasis
false
308
[ "MIT" ]
0
091aae4a664b5b0944dfe95dbd2f5da441541437
https://github.com/ClintvanHoesel/MXMNet_adapted/tree/091aae4a664b5b0944dfe95dbd2f5da441541437
import torch import numpy as np import torch.nn as nn class Model(nn.Module): def __init__(self, n_rbf, cutoff, learnable_k): super().__init__() self.n = torch.arange(1, n_rbf + 1).float() if learnable_k: self.n = nn.Parameter(self.n) self.cutoff = cutoff def forw...
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 from torch import Tensor from logging import info from torch import nn from logging import error from torch.nn import Linear from torch.nn.functional import relu class Net(nn.Module): def __init__(self, size): super(Net, self).__init__() convolutions = [5] info('CONV LAYERS: ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 logging import info from...
ChsHub/ai_denoiser
Net
false
309
[ "MIT" ]
0
abb0852765b10a0f05593a850f9922c5737f5f6a
https://github.com/ChsHub/ai_denoiser/tree/abb0852765b10a0f05593a850f9922c5737f5f6a
import torch from torch import Tensor from logging import info from torch import nn from logging import error from torch.nn import Linear from torch.nn.functional import relu class Model(nn.Module): def __init__(self, size): super().__init__() convolutions = [5] info('CONV LAYERS: %s' % c...