entry_point
stringlengths
1
65
original_triton_python_code
stringlengths
208
619k
optimised_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
BhattacharyyaDistance
import torch import torch.nn as nn class BhattacharyyaDistance(nn.Module): def __init__(self): super(BhattacharyyaDistance, self).__init__() def forward(self, hist1, hist2): bh_dist = torch.sqrt(hist1 * hist2).sum() return bh_dist def get_inputs(): return [torch.rand([4, 4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
tommy90191/Find_Tiny_but_Important_Image_Changes
BhattacharyyaDistance
false
4,438
[ "MIT" ]
0
429d679606f96f32db4cddf167a9cfb963d3df26
https://github.com/tommy90191/Find_Tiny_but_Important_Image_Changes/tree/429d679606f96f32db4cddf167a9cfb963d3df26
l1normalization
import torch import torch.nn as nn class l1normalization(nn.Module): def __init__(self, scale): super(l1normalization, self).__init__() self.scale = scale def forward(self, x, dim=1): return self.scale * x * x.pow(1).sum(dim).clamp(min=1e-12).rsqrt( ).expand_as(x) def g...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
tommy90191/Find_Tiny_but_Important_Image_Changes
l1normalization
false
4,439
[ "MIT" ]
0
429d679606f96f32db4cddf167a9cfb963d3df26
https://github.com/tommy90191/Find_Tiny_but_Important_Image_Changes/tree/429d679606f96f32db4cddf167a9cfb963d3df26
Conv2dWithConstraint
import torch from torch import nn class Conv2dWithConstraint(nn.Conv2d): def __init__(self, *args, max_norm=1, **kwargs): self.max_norm = max_norm super(Conv2dWithConstraint, self).__init__(*args, **kwargs) def forward(self, x): self.weight.data = torch.renorm(self.weight.data, p=2, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
tomMoral/braindecode
Conv2dWithConstraint
false
4,440
[ "BSD-3-Clause" ]
0
09d63b7e32fdfcfbaac7569a003f2611721a78ca
https://github.com/tomMoral/braindecode/tree/09d63b7e32fdfcfbaac7569a003f2611721a78ca
KLCoefficient
import torch import torch.nn as nn from torch.nn import functional as F class KLCoefficient(nn.Module): def __init__(self): super(KLCoefficient, self).__init__() def forward(self, hist1, hist2): kl = F.kl_div(hist1, hist2) dist = 1.0 / 1 + kl return dist def get_inputs(): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torc...
tommy90191/Find_Tiny_but_Important_Image_Changes
KLCoefficient
false
4,441
[ "MIT" ]
0
429d679606f96f32db4cddf167a9cfb963d3df26
https://github.com/tommy90191/Find_Tiny_but_Important_Image_Changes/tree/429d679606f96f32db4cddf167a9cfb963d3df26
ConstractiveLoss
import torch import numpy as np import torch.nn as nn from torch.nn import functional as F class ConstractiveLoss(nn.Module): def __init__(self, margin=2.0, dist_flag='l2'): super(ConstractiveLoss, self).__init__() self.margin = margin self.dist_flag = dist_flag def various_distance(...
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 numpy as np import to...
tommy90191/Find_Tiny_but_Important_Image_Changes
ConstractiveLoss
false
4,442
[ "MIT" ]
0
429d679606f96f32db4cddf167a9cfb963d3df26
https://github.com/tommy90191/Find_Tiny_but_Important_Image_Changes/tree/429d679606f96f32db4cddf167a9cfb963d3df26
l2normalization
import torch import torch.nn as nn class l2normalization(nn.Module): def __init__(self, scale): super(l2normalization, self).__init__() self.scale = scale def forward(self, x, dim=1): """out = scale * x / sqrt(\\sum x_i^2)""" return self.scale * x * x.pow(2).sum(dim).clamp(mi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
tommy90191/Find_Tiny_but_Important_Image_Changes
l2normalization
false
4,443
[ "MIT" ]
0
429d679606f96f32db4cddf167a9cfb963d3df26
https://github.com/tommy90191/Find_Tiny_but_Important_Image_Changes/tree/429d679606f96f32db4cddf167a9cfb963d3df26
scale_feature
import torch import torch.nn as nn class scale_feature(nn.Module): def __init__(self, scale): super(scale_feature, self).__init__() self.scale = scale def forward(self, x): return self.scale * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): 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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
tommy90191/Find_Tiny_but_Important_Image_Changes
scale_feature
false
4,444
[ "MIT" ]
0
429d679606f96f32db4cddf167a9cfb963d3df26
https://github.com/tommy90191/Find_Tiny_but_Important_Image_Changes/tree/429d679606f96f32db4cddf167a9cfb963d3df26
DQFFN
import torch import torch.nn as nn import torch.nn.functional as F class DQFFN(nn.Module): def __init__(self, n): """ Create Feed-forward Network with n dim input and n dim output """ super(DQFFN, self).__init__() self.n = n self.l1 = nn.Linear(n * (n + 1) // 2, 20...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
thomashopkins32/RedBlueGame
DQFFN
false
4,445
[ "MIT" ]
0
dd3e759123acc02375fdfcc504892e00e6b31ef1
https://github.com/thomashopkins32/RedBlueGame/tree/dd3e759123acc02375fdfcc504892e00e6b31ef1
L2Norm
import torch from math import sqrt as sqrt from itertools import product as product import torch.nn as nn import torch.nn.init as init class L2Norm(nn.Module): def __init__(self, n_channels, scale): super(L2Norm, self).__init__() self.n_channels = n_channels self.gamma = scale or None ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from math import sqrt as sqrt from itertools import product as product import t...
tomgause/pytorch-ssd
L2Norm
false
4,446
[ "MIT" ]
0
e458d4319deb21c8970bcce13382e7ada70ea1a2
https://github.com/tomgause/pytorch-ssd/tree/e458d4319deb21c8970bcce13382e7ada70ea1a2
FeatureCorrelation
import torch import torch.nn as nn class FeatureCorrelation(nn.Module): def __init__(self, scale): super(FeatureCorrelation, self).__init__() self.scale = scale def forward(self, feature_A, feature_B): b, c, h, w = feature_A.size() feature_A = feature_A.transpose(2, 3).contig...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
tommy90191/Find_Tiny_but_Important_Image_Changes
FeatureCorrelation
false
4,447
[ "MIT" ]
0
429d679606f96f32db4cddf167a9cfb963d3df26
https://github.com/tommy90191/Find_Tiny_but_Important_Image_Changes/tree/429d679606f96f32db4cddf167a9cfb963d3df26
ConstractiveThresholdHingeLoss
import torch import torch.nn as nn from torch.nn import functional as F class ConstractiveThresholdHingeLoss(nn.Module): def __init__(self, hingethresh=0.0, margin=2.0): super(ConstractiveThresholdHingeLoss, self).__init__() self.threshold = hingethresh self.margin = margin def forwa...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
tommy90191/Find_Tiny_but_Important_Image_Changes
ConstractiveThresholdHingeLoss
false
4,448
[ "MIT" ]
0
429d679606f96f32db4cddf167a9cfb963d3df26
https://github.com/tommy90191/Find_Tiny_but_Important_Image_Changes/tree/429d679606f96f32db4cddf167a9cfb963d3df26
ResNetBlock
import torch import torch.nn as nn import torch.nn.functional as F class ResNetBlock(nn.Module): def __init__(self, in_channels: 'int', out_channels: 'int', hid_channels: 'int', bias: 'bool'): super().__init__() self.shortcut = in_channels != out_channels self.conv_0 = nn.Conv2d(i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
tmralmeida/VGAN
ResNetBlock
false
4,449
[ "MIT" ]
0
103d2e7ac0b84b08ff3c3a40e0ccb16390b1e008
https://github.com/tmralmeida/VGAN/tree/103d2e7ac0b84b08ff3c3a40e0ccb16390b1e008
Affine
import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data class Affine(nn.Module): def __init__(self, dim): super().__init__() self.alpha = nn.Parameter(torch.ones((1, 1, dim))) self.beta = nn.Parameter(torch.zeros((1, 1, dim))) 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 import torch.nn as nn import torch.nn.parallel import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty...
tor4z/pytorch-image-models
Affine
false
4,450
[ "Apache-2.0" ]
0
d7bab8a6c52a72487d1bed0a28aad41e326d7622
https://github.com/tor4z/pytorch-image-models/tree/d7bab8a6c52a72487d1bed0a28aad41e326d7622
L1
import torch import torch.nn as nn class L1(nn.Module): def __init__(self): super(L1, self).__init__() def forward(self, output, target): lossvalue = torch.abs(output[:, None] - target).mean() return lossvalue def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
tomrunia/flownet2-pytorch
L1
false
4,451
[ "Apache-2.0" ]
0
759b09c375348cf64f52f914cf3bf3e9095cc959
https://github.com/tomrunia/flownet2-pytorch/tree/759b09c375348cf64f52f914cf3bf3e9095cc959
L2
import torch import torch.nn as nn class L2(nn.Module): def __init__(self): super(L2, self).__init__() def forward(self, output, target): lossvalue = torch.norm(output[:, None] - target, p=2, dim=1).mean() return lossvalue def get_inputs(): return [torch.rand([4, 4, 4, 4]), tor...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
tomrunia/flownet2-pytorch
L2
false
4,452
[ "Apache-2.0" ]
0
759b09c375348cf64f52f914cf3bf3e9095cc959
https://github.com/tomrunia/flownet2-pytorch/tree/759b09c375348cf64f52f914cf3bf3e9095cc959
AvgConsensus
import torch import torch.nn as nn class AvgConsensus(nn.Module): """Average consensus module. Args: dim (int): Decide which dim consensus function to apply. Default: 1. """ def __init__(self, dim=1): super().__init__() self.dim = dim 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
scenarios/dev
AvgConsensus
false
4,453
[ "Apache-2.0" ]
0
9f91ebc142cea1c31231d233571ad59460ab6fba
https://github.com/scenarios/dev/tree/9f91ebc142cea1c31231d233571ad59460ab6fba
WeightNet
import torch import torch.nn as nn class WeightNet(nn.Module): """WeightNet in Temporal interlace module. The WeightNet consists of two parts: one convolution layer and a sigmoid function. Following the convolution layer, the sigmoid function and rescale module can scale our output to the range (0, 2...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
scenarios/dev
WeightNet
false
4,454
[ "Apache-2.0" ]
0
9f91ebc142cea1c31231d233571ad59460ab6fba
https://github.com/scenarios/dev/tree/9f91ebc142cea1c31231d233571ad59460ab6fba
BinaryLogisticRegressionLoss
import torch import torch.nn as nn def binary_logistic_regression_loss(reg_score, label, threshold=0.5, ratio_range=(1.05, 21), eps=1e-05): """Binary Logistic Regression Loss.""" label = label.view(-1) reg_score = reg_score.contiguous().view(-1) pmask = (label > threshold).float() num_positive...
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 ...
scenarios/dev
BinaryLogisticRegressionLoss
false
4,455
[ "Apache-2.0" ]
0
9f91ebc142cea1c31231d233571ad59460ab6fba
https://github.com/scenarios/dev/tree/9f91ebc142cea1c31231d233571ad59460ab6fba
GCN
import torch from torchvision.datasets import * import torch.nn as nn from torchvision.transforms import * class GCN(nn.Module): def __init__(self, num_state, num_node, bias=False): super(GCN, self).__init__() self.conv1 = nn.Conv1d(num_node, num_node, kernel_size=1, padding=0, stride...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 torchvision.datasets imp...
tousifulhaque/DANet
GCN
false
4,456
[ "MIT" ]
0
1a0c91f0e551a071b5e335b4157313780a8a1b1a
https://github.com/tousifulhaque/DANet/tree/1a0c91f0e551a071b5e335b4157313780a8a1b1a
Normalize
import torch from torchvision.datasets import * import torch.nn as nn import torch.nn.functional as F from torchvision.transforms import * class Normalize(nn.Module): """Performs :math:`L_p` normalization of inputs over specified dimension. Does: .. math:: v = \\frac{v}{\\max(\\lVert v \\rVert_p...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torchvision.datasets im...
tousifulhaque/DANet
Normalize
false
4,457
[ "MIT" ]
0
1a0c91f0e551a071b5e335b4157313780a8a1b1a
https://github.com/tousifulhaque/DANet/tree/1a0c91f0e551a071b5e335b4157313780a8a1b1a
OffsetNet
import torch import torch.nn as nn class OffsetNet(nn.Module): """OffsetNet in Temporal interlace module. The OffsetNet consists of one convolution layer and two fc layers with a relu activation following with a sigmoid function. Following the convolution layer, two fc layers and relu are applied to ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
scenarios/dev
OffsetNet
false
4,458
[ "Apache-2.0" ]
0
9f91ebc142cea1c31231d233571ad59460ab6fba
https://github.com/scenarios/dev/tree/9f91ebc142cea1c31231d233571ad59460ab6fba
TwoPartSimpleModel
import torch import torch.nn as nn import torch.utils.data class SimpleModel(nn.Module): def forward(self, x): return 2 * x def prepare_for_export(self, cfg, inputs, predictor_type): return PredictorExportConfig(model=self, data_generator=lambda x: (x,)) class TwoPartSimpleModel(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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
tsubauaaa/d2go
TwoPartSimpleModel
false
4,459
[ "Apache-2.0" ]
0
9f746159ebf78ce79f644c405ca8695bc29d1075
https://github.com/tsubauaaa/d2go/tree/9f746159ebf78ce79f644c405ca8695bc29d1075
CPAMDec
from torch.nn import Module import torch from torchvision.datasets import * from torch.nn import Parameter from torch.nn import Conv2d from torch.nn import Linear from torch.nn import Softmax from torchvision.transforms import * class CPAMDec(Module): """ CPAM decoding module """ def __init__(self, i...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
tousifulhaque/DANet
CPAMDec
false
4,460
[ "MIT" ]
0
1a0c91f0e551a071b5e335b4157313780a8a1b1a
https://github.com/tousifulhaque/DANet/tree/1a0c91f0e551a071b5e335b4157313780a8a1b1a
SplitAndConcat
import torch import torch.nn as nn import torch.utils.data class SplitAndConcat(nn.Module): """Split the data from split_dim and concatenate in concat_dim. @param split_dim from which axis the data will be chunk @param concat_dim to which axis the data will be concatenated @param chunk size of the da...
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....
tsubauaaa/d2go
SplitAndConcat
false
4,461
[ "Apache-2.0" ]
0
9f746159ebf78ce79f644c405ca8695bc29d1075
https://github.com/tsubauaaa/d2go/tree/9f746159ebf78ce79f644c405ca8695bc29d1075
GELU
import torch import torch.nn as nn class GELU(nn.Module): def forward(self, x): return torch.sigmoid(1.702 * x) * x def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
txsing/augmix
GELU
false
4,462
[ "Apache-2.0" ]
0
9127809d8534ccb20a654f631833153e75a277fd
https://github.com/txsing/augmix/tree/9127809d8534ccb20a654f631833153e75a277fd
InstanceNormLayer
import torch from torch import nn class InstanceNormLayer(nn.Module): """Implements instance normalization layer.""" def __init__(self, epsilon=1e-08): super().__init__() self.epsilon = epsilon def forward(self, x): if len(x.shape) != 4: raise ValueError( ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
tylerwilliams/InterFaceGAN
InstanceNormLayer
false
4,463
[ "MIT" ]
0
120babcc0dc777aa902ef0dcdeaec7c528369dbc
https://github.com/tylerwilliams/InterFaceGAN/tree/120babcc0dc777aa902ef0dcdeaec7c528369dbc
CCAMDec
from torch.nn import Module import torch from torchvision.datasets import * from torch.nn import Parameter from torch.nn import Softmax from torchvision.transforms import * class CCAMDec(Module): """ CCAM decoding module """ def __init__(self): super(CCAMDec, self).__init__() self.sof...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tousifulhaque/DANet
CCAMDec
false
4,464
[ "MIT" ]
0
1a0c91f0e551a071b5e335b4157313780a8a1b1a
https://github.com/tousifulhaque/DANet/tree/1a0c91f0e551a071b5e335b4157313780a8a1b1a
Bandpass
import torch import torch.nn as nn class Bandpass(nn.Module): def __init__(self, input_dim): super().__init__() self.mean = nn.Parameter(torch.randn(1, input_dim, dtype=torch.float32) ) self.icov = nn.Parameter(torch.eye(input_dim, input_dim, dtype= torch.float32) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
tsumansapkota/Input-Invex-Neural-Network
Bandpass
false
4,465
[ "Apache-2.0" ]
0
6a14ee12b33da1d231d231c8f9631851a7668997
https://github.com/tsumansapkota/Input-Invex-Neural-Network/tree/6a14ee12b33da1d231d231c8f9631851a7668997
DQN
import torch import torch.nn as nn import torch.nn.functional as F class DQN(nn.Module): def __init__(self, obs_size, action_size, seed): super(DQN, self).__init__() self.fc1 = nn.Linear(obs_size, 128) self.fc2 = nn.Linear(128, 128) self.fc3 = nn.Linear(128, sum(action_size)) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
ulyssesdotcodes/ReaL-Crowds
DQN
false
4,466
[ "BSD-3-Clause" ]
0
9da01fe4d1858c3c26d6387e34f4e76db5385d51
https://github.com/ulyssesdotcodes/ReaL-Crowds/tree/9da01fe4d1858c3c26d6387e34f4e76db5385d51
TSA_Fusion
import torch import torch.utils.data import torch.nn as nn import torch.nn.functional as F class TSA_Fusion(nn.Module): """ Temporal Spatial Attention fusion module Temporal: correlation; Spatial: 3 pyramid levels. """ def __init__(self, nf=64, nframes=5, center=2): super(TSA_Fusion, self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.utils.data impor...
sutkarsh/EDVR
TSA_Fusion
false
4,467
[ "Apache-2.0" ]
0
cd9f2d46edbb00333d8ffb31aebc52cfbda4b6e3
https://github.com/sutkarsh/EDVR/tree/cd9f2d46edbb00333d8ffb31aebc52cfbda4b6e3
LenCompLoss
import torch import torch.utils.data import torch import torch.nn as nn class LenCompLoss(nn.Module): def __init__(self): super(LenCompLoss, self).__init__() self.loss = nn.L1Loss() def forward(self, x, y): loss = self.loss(torch.sum(x), torch.sum(y)) return loss def get_in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.utils.dat...
usmanwardag/pytorch-CycleGAN-and-pix2pix
LenCompLoss
false
4,468
[ "BSD-3-Clause" ]
0
72f2050600e7821476c9e19fcf8f1973f6a6f78c
https://github.com/usmanwardag/pytorch-CycleGAN-and-pix2pix/tree/72f2050600e7821476c9e19fcf8f1973f6a6f78c
FluidGravityForce
import torch import torch.nn as nn class FluidGravityForce(nn.Module): def __init__(self, gravity, maxSpeed=3): """ Initializes a fluid gravity model. Arguments: gravity: Gravity vector in the global frame (same as particle l) for the simulation maxSpeed: The maxi...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
ucsdarclab/liquid_reconstruction
FluidGravityForce
false
4,469
[ "MIT" ]
0
5559edbf71dba05d432d85e7dbbfe3634e650aeb
https://github.com/ucsdarclab/liquid_reconstruction/tree/5559edbf71dba05d432d85e7dbbfe3634e650aeb
KLDivergence
import torch import torch as th class KLDivergence(th.nn.Module): """ Args: min_value(float): the loss is clipped so that value below this number don't affect the optimization. """ def __init__(self, min_value=0.2): super(KLDivergence, self).__init__() self.min_val...
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 as th ass...
v-a-s-a/diffvg
KLDivergence
false
4,470
[ "Apache-2.0" ]
0
3685f3d47a5a4e5c76c68643ebf383f809ba59ed
https://github.com/v-a-s-a/diffvg/tree/3685f3d47a5a4e5c76c68643ebf383f809ba59ed
BMNLoss
import torch import torch.nn.functional as F import torch.nn as nn def binary_logistic_regression_loss(reg_score, label, threshold=0.5, ratio_range=(1.05, 21), eps=1e-05): """Binary Logistic Regression Loss.""" label = label.view(-1) reg_score = reg_score.contiguous().view(-1) pmask = (label > thr...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_ma...
scenarios/dev
BMNLoss
false
4,471
[ "Apache-2.0" ]
0
9f91ebc142cea1c31231d233571ad59460ab6fba
https://github.com/scenarios/dev/tree/9f91ebc142cea1c31231d233571ad59460ab6fba
MaxPPVPool1d
from torch.nn import Module import torch import torch.multiprocessing import torch class MaxPPVPool1d(Module): """Drop-in replacement for AdaptiveConcatPool1d - multiplies nf by 2""" def forward(self, x): _max = x.max(dim=-1).values _ppv = torch.gt(x, 0).sum(dim=-1).float() / x.shape[-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.nn import Module import torch.multiprocessing import torch assert_size_stride ...
sjdlloyd/tsai
MaxPPVPool1d
false
4,472
[ "Apache-2.0" ]
0
98d9c02b8429708819d373b475deb9e99f0ab7df
https://github.com/sjdlloyd/tsai/tree/98d9c02b8429708819d373b475deb9e99f0ab7df
ScoringFunction
import torch import torch.nn as nn class Conv2dAct(nn.Module): def __init__(self, in_channels, out_channels, ksize=1, activation='relu'): super(Conv2dAct, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, ksize) if activation == 'sigmoid': self.act = nn.Sigmoid...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
sunwhawhang/headpose-fsanet-pytorch
ScoringFunction
false
4,473
[ "MIT" ]
0
d37d39dbff649b2f607367f35d9eadba2fea18f7
https://github.com/sunwhawhang/headpose-fsanet-pytorch/tree/d37d39dbff649b2f607367f35d9eadba2fea18f7
CrossEntropy
import torch import torchvision.transforms.functional as F import torch.nn as nn import torch.nn.functional as F class CrossEntropy(nn.Module): def forward(self, x, y): return F.cross_entropy(x, torch.argmax(y, -1)) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
tgxs002/1-stage-wseg
CrossEntropy
false
4,474
[ "Apache-2.0" ]
0
de16c51cc6cf8cd0ef248145980434d5f6104910
https://github.com/tgxs002/1-stage-wseg/tree/de16c51cc6cf8cd0ef248145980434d5f6104910
Gaussian
import torch from torch import nn from torch.nn import functional as F import torch.utils.data class Gaussian(nn.Module): def __init__(self, in_dim, z_dim): super(Gaussian, self).__init__() self.mu = nn.Linear(in_dim, z_dim) self.var = nn.Linear(in_dim, z_dim) def reparameterize(self...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libd...
userVector/GMVAE
Gaussian
false
4,475
[ "MIT" ]
0
2d0330c4174aa614f3817888798f88798313e01f
https://github.com/userVector/GMVAE/tree/2d0330c4174aa614f3817888798f88798313e01f
VarianceC
import torch import torch.nn as nn class VarianceC(nn.Module): def __init__(self): super(VarianceC, self).__init__() def forward(self, x): mean_x = torch.mean(x, dim=1, keepdim=True) sub_x = x.sub(mean_x) x = torch.mean(torch.mul(sub_x, sub_x), dim=1, keepdim=True) 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 as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
sunwhawhang/headpose-fsanet-pytorch
VarianceC
false
4,476
[ "MIT" ]
0
d37d39dbff649b2f607367f35d9eadba2fea18f7
https://github.com/sunwhawhang/headpose-fsanet-pytorch/tree/d37d39dbff649b2f607367f35d9eadba2fea18f7
ToyRes
import torch import torch.nn as nn import torch.multiprocessing class ToyResLayer(nn.Module): """ Custom Linear layer but mimics a standard linear layer """ def __init__(self): super().__init__() aprime = torch.Tensor(1) bprime = torch.Tensor(1) self.aprime = nn.Parameter(apri...
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.multiprocessing assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torc...
suswei/RLCT
ToyRes
false
4,477
[ "MIT" ]
0
e9e04ca5e64250dfbb94134ec5283286dcdc4358
https://github.com/suswei/RLCT/tree/e9e04ca5e64250dfbb94134ec5283286dcdc4358
Tanh
import torch import torch.nn as nn import torch.multiprocessing class Tanh(nn.Module): def __init__(self, input_dim, output_dim, H): super(Tanh, self).__init__() self.fc1 = nn.Linear(input_dim, H, bias=False) self.fc2 = nn.Linear(H, output_dim, bias=False) 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.triton_helpers import libdevice import torch.nn as ...
suswei/RLCT
Tanh
false
4,478
[ "MIT" ]
0
e9e04ca5e64250dfbb94134ec5283286dcdc4358
https://github.com/suswei/RLCT/tree/e9e04ca5e64250dfbb94134ec5283286dcdc4358
GaussianMixtureReconstructionLoss
import torch import numpy as np import torch as th def gaussian_pdfs(dx, dy, params): """Returns the pdf at (dx, dy) for each Gaussian in the mixture. """ dx = dx.unsqueeze(-1) dy = dy.unsqueeze(-1) mu_x = params[..., 0] mu_y = params[..., 1] sigma_x = params[..., 2].exp() sigma_y = pa...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import nump...
v-a-s-a/diffvg
GaussianMixtureReconstructionLoss
false
4,479
[ "Apache-2.0" ]
0
3685f3d47a5a4e5c76c68643ebf383f809ba59ed
https://github.com/v-a-s-a/diffvg/tree/3685f3d47a5a4e5c76c68643ebf383f809ba59ed
PixelNorm
import torch import torch.nn as nn import torch.utils.cpp_extension import torch.utils.data.distributed class PixelNorm(nn.Module): def __init__(self, dim): super().__init__() def forward(self, input): return input * torch.rsqrt(torch.mean(input ** 2, dim=2, keepdim= True) + 1e-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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.utils.cpp_extension import torch.utils.data....
Pragyanstha/SummerCamp2021
PixelNorm
false
4,480
[ "MIT" ]
0
caa8bba64020ba52bdef2b23a7a54de93e93b8af
https://github.com/Pragyanstha/SummerCamp2021/tree/caa8bba64020ba52bdef2b23a7a54de93e93b8af
UpsampleConv2d
from torch.nn import Module import math import torch from torchvision.datasets import * import torch.nn.functional as F from torch.nn import Parameter from torch.nn.modules.utils import _pair from torchvision.transforms import * class UpsampleConv2d(Module): """ To avoid the checkerboard artifacts of standard...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module import math from torchvision.datasets import * from ...
tousifulhaque/DANet
UpsampleConv2d
false
4,481
[ "MIT" ]
0
1a0c91f0e551a071b5e335b4157313780a8a1b1a
https://github.com/tousifulhaque/DANet/tree/1a0c91f0e551a071b5e335b4157313780a8a1b1a
Quantize
import torch import torch.nn as nn import torch.nn.functional as F class Quantize(nn.Module): def __init__(self, emb_dim, emb_size, decay=0.99, eps=1e-05, ema_flag= False, bdt_flag=False): super().__init__() self.emb_dim = emb_dim self.emb_size = emb_size self.ema_flag = e...
import torch from torch._inductor.select_algorithm import extern_kernels import 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 assert_size_stride = torch...
unilight/crank
Quantize
false
4,482
[ "MIT" ]
0
0dc5d9df17f3186155b1c9583ab604ff218ad9a6
https://github.com/unilight/crank/tree/0dc5d9df17f3186155b1c9583ab604ff218ad9a6
ConvPlus
import torch import torch.nn as nn import torch.utils.data class ConvPlus(nn.Module): def __init__(self, c1, c2, k=3, s=1, g=1, bias=True): super(ConvPlus, self).__init__() self.cv1 = nn.Conv2d(c1, c2, (k, 1), s, (k // 2, 0), groups=g, bias =bias) self.cv2 = nn.Conv2d(c1, c2, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
verchable/GenderDiversityCalc
ConvPlus
false
4,483
[ "Apache-2.0" ]
0
eb07fbc9d13e567de4efd8ea2a0aae793a06bf1d
https://github.com/verchable/GenderDiversityCalc/tree/eb07fbc9d13e567de4efd8ea2a0aae793a06bf1d
Mean
import torch from torchvision.datasets import * import torch.nn as nn from torchvision.transforms import * class Mean(nn.Module): def __init__(self, dim, keep_dim=False): super(Mean, self).__init__() self.dim = dim self.keep_dim = keep_dim def forward(self, input): return inp...
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 torchvision.datasets import * import torch.nn as nn from torchvision.transforms import * assert_size_stride = torch._C._dynamo.guards.a...
tousifulhaque/DANet
Mean
false
4,484
[ "MIT" ]
0
1a0c91f0e551a071b5e335b4157313780a8a1b1a
https://github.com/tousifulhaque/DANet/tree/1a0c91f0e551a071b5e335b4157313780a8a1b1a
cheap_cnn
import torch import torch.nn as nn import torch.nn.functional as F class cheap_cnn(nn.Module): def __init__(self): super(cheap_cnn, self).__init__() self.cnn1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=3) self.cnn2 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
vaibhav117/sim2real4real
cheap_cnn
false
4,485
[ "MIT" ]
0
b1f253ef359eda0c7e3b594f89c8a35f0cf925bf
https://github.com/vaibhav117/sim2real4real/tree/b1f253ef359eda0c7e3b594f89c8a35f0cf925bf
ZeroCenter
import torch import torch.nn as nn class ZeroCenter(nn.Module): def __init__(self): super().__init__() def forward(self, x): """x : [B, C, H, W]""" return x.sub_(x.flatten(1).mean(1, keepdim=True).unsqueeze(-1). unsqueeze(-1)) def get_inputs(): return [torch.rand([4...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride @triton.jit def triton_per_fused_mean_sub_0(in_ptr0,...
vinnamkim/segmentation_models.pytorch
ZeroCenter
false
4,486
[ "MIT" ]
0
f967ded34df6fb536e8e8cba9b6491ae63b939f5
https://github.com/vinnamkim/segmentation_models.pytorch/tree/f967ded34df6fb536e8e8cba9b6491ae63b939f5
EnsembleDense
import math import torch from torch import nn class EnsembleDense(nn.Module): __constants__ = ['num_ensembles', 'in_features', 'out_features'] in_features: 'int' out_features: 'int' weight: 'torch.Tensor' def __init__(self, num_ensembles: 'int', in_features: 'int', out_features: 'int', bi...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math from torch import nn assert_size_stride = torch._C._dynamo.guards.as...
vermouth1992/rlutils
EnsembleDense
false
4,487
[ "Apache-2.0" ]
0
a326373b9e39dbf147c6c4261b82a688d4dc3e78
https://github.com/vermouth1992/rlutils/tree/a326373b9e39dbf147c6c4261b82a688d4dc3e78
FocalLoss
import torch from torch import nn from torchvision.datasets.folder import * class FocalLoss(nn.Module): def __init__(self, gamma=0, eps=1e-07): super(FocalLoss, self).__init__() self.gamma = gamma self.eps = eps self.ce = torch.nn.CrossEntropyLoss() def forward(self, input, 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 math as tl_math from torch import nn f...
tks1998/Pytorch-Face-recongition-state-of-the-art-Qmul-surveface-
FocalLoss
false
4,488
[ "MIT" ]
0
e4068db0c53a4c6b8e81127191687662806af8d8
https://github.com/tks1998/Pytorch-Face-recongition-state-of-the-art-Qmul-surveface-/tree/e4068db0c53a4c6b8e81127191687662806af8d8
Simple_AUG
import torch import torch.nn as nn from torch import autograd as autograd import torch.fft from itertools import product as product class Simple_AUG(nn.Module): def __init__(self, in_nc=3, out_nc=3, nf=5): super(Simple_AUG, self).__init__() self.c1 = nn.Conv2d(in_nc, nf, 3, 1, 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 as nn from to...
varun-jois/KAIR
Simple_AUG
false
4,489
[ "MIT" ]
0
90c04671c6eb32a6765edfec94f7db3ba1f53f1e
https://github.com/varun-jois/KAIR/tree/90c04671c6eb32a6765edfec94f7db3ba1f53f1e
Normalize
import torch import torch.nn as nn import torch.nn.functional as functional class Normalize(nn.Module): def __init__(self, dim: 'int', p: 'int'): super().__init__() self.dim = dim self.p = p def forward(self, inputs): outputs = functional.normalize(inputs, dim=self.dim, p=sel...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
uripatish/torchup
Normalize
false
4,490
[ "MIT" ]
0
0b7bee031fc99e536342331ba567c523a790d742
https://github.com/uripatish/torchup/tree/0b7bee031fc99e536342331ba567c523a790d742
ProteinBertPooler
from _paritybench_helpers import _mock_config import torch import torch.nn as nn class ProteinBertPooler(nn.Module): def __init__(self, config): super().__init__() self.trainable_encoder = config.trainable_encoder if self.trainable_encoder: self.dense = nn.Linear(config.hidden...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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 ...
StephanHeijl/tape
ProteinBertPooler
false
4,491
[ "BSD-3-Clause" ]
0
ec631ca53217686605477cf31af4fb8846ff660f
https://github.com/StephanHeijl/tape/tree/ec631ca53217686605477cf31af4fb8846ff660f
Q
import torch import torch.nn.functional as F import torch.nn as nn class Q(nn.Module): def __init__(self, state_dim, action_dim, hidden): super(Q, self).__init__() self.fc1 = nn.Linear(state_dim + action_dim, hidden) self.fc2 = nn.Linear(hidden, hidden) self.fc3 = nn.Linear(hidden...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
victorkich/agaragan
Q
false
4,492
[ "MIT" ]
0
64e312fc4fa42f5952f3ce997bafe674306a9419
https://github.com/victorkich/agaragan/tree/64e312fc4fa42f5952f3ce997bafe674306a9419
ActorSAC
import torch import torch.nn.functional as F import torch.nn as nn class ActorSAC(nn.Module): def __init__(self, state_dim, hidden, min_log_std=-20, max_log_std=2): super(ActorSAC, self).__init__() self.fc1 = nn.Linear(state_dim, hidden) self.fc2 = nn.Linear(hidden, hidden) self.m...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
victorkich/agaragan
ActorSAC
false
4,493
[ "MIT" ]
0
64e312fc4fa42f5952f3ce997bafe674306a9419
https://github.com/victorkich/agaragan/tree/64e312fc4fa42f5952f3ce997bafe674306a9419
PAM_Module
from torch.nn import Module import torch import torch.serialization import torch import torch.utils.data from torch.nn import Conv2d from torch.nn import Parameter from torch.nn import Softmax class PAM_Module(Module): """ Position attention module""" def __init__(self, in_dim): super(PAM_Module, 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 from torch._inductor.runtime....
vis-opt-group/GTANet
PAM_Module
false
4,494
[ "MIT" ]
0
269ff4418ee5f0267987e1fa4c69bda13e5cb00d
https://github.com/vis-opt-group/GTANet/tree/269ff4418ee5f0267987e1fa4c69bda13e5cb00d
SE_layer_3d
import torch import torch.nn as nn import torch.multiprocessing class SE_layer_3d(nn.Module): def __init__(self, num_channels, reduction_ratio=2): super(SE_layer_3d, self).__init__() num_channels_reduced = num_channels // reduction_ratio self.reduction_ratio = reduction_ratio self...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
vinbigdata-medical/abdomen-phases
SE_layer_3d
false
4,495
[ "MIT" ]
0
4adf5b8bf13aec85247d74e3cd3789c52cb88b92
https://github.com/vinbigdata-medical/abdomen-phases/tree/4adf5b8bf13aec85247d74e3cd3789c52cb88b92
Mean
import torch from torch import nn class Mean(nn.Module): def __init__(self, *args): super(Mean, self).__init__() self.shape = args def forward(self, x): return x.mean(self.shape) 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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
vitskvara/shape-guided-anomaly-detection
Mean
false
4,496
[ "MIT" ]
0
6685b2e0b97968a6d0f478d2920486da107b277f
https://github.com/vitskvara/shape-guided-anomaly-detection/tree/6685b2e0b97968a6d0f478d2920486da107b277f
HighwayLayer
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx.operators class HighwayLayer(nn.Module): def __init__(self, input_dim, transform_activation=F.relu, gate_activation=F.softmax, gate_bias=-2): super().__init__() self.highway_transform_activation = transfo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
vincentLiangBerkeley/translate
HighwayLayer
false
4,497
[ "BSD-3-Clause" ]
0
734ae1ad9dfb778935e4825b5ce2687e2df559ea
https://github.com/vincentLiangBerkeley/translate/tree/734ae1ad9dfb778935e4825b5ce2687e2df559ea
Patch2Image
import torch from torch import nn class Patch2Image(nn.Module): """ take in patch and copy n_up times to form the full image""" def __init__(self, patch_sz, n_up): super(Patch2Image, self).__init__() self.patch_sz = patch_sz self.n_up = n_up def forward(self, x): assert 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
vitskvara/shape-guided-anomaly-detection
Patch2Image
false
4,498
[ "MIT" ]
0
6685b2e0b97968a6d0f478d2920486da107b277f
https://github.com/vitskvara/shape-guided-anomaly-detection/tree/6685b2e0b97968a6d0f478d2920486da107b277f
Feature
import torch import torch.serialization import torch import torch.utils.data class ResBlock(torch.nn.Module): def __init__(self): super(ResBlock, self).__init__() self.conv1 = torch.nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, stride=1, padding=1) self.conv2 = tor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.serialization im...
vis-opt-group/GTANet
Feature
false
4,499
[ "MIT" ]
0
269ff4418ee5f0267987e1fa4c69bda13e5cb00d
https://github.com/vis-opt-group/GTANet/tree/269ff4418ee5f0267987e1fa4c69bda13e5cb00d
DuRB_p
import torch import numpy as np import torch.serialization import torch import torch.nn as nn import torch.utils.data class ConvLayer(nn.Module): def __init__(self, in_dim, out_dim, kernel_size, stride, dilation=1): super(ConvLayer, self).__init__() self.dilation = dilation if 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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
vis-opt-group/GTANet
DuRB_p
false
4,500
[ "MIT" ]
0
269ff4418ee5f0267987e1fa4c69bda13e5cb00d
https://github.com/vis-opt-group/GTANet/tree/269ff4418ee5f0267987e1fa4c69bda13e5cb00d
Accuracy
from torch.nn import Module import torch from torch import Tensor class Accuracy(Module): """ Class for calculating the accuracy for a given prediction and the labels for comparison. Expects the inputs to be from a range of 0 to 1 and sets a crossing threshold at 0.5 the labels are similarly round...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch.nn import Module from torch import Tensor assert_size_stride = torch._C._dynam...
vixadd/sparseml
Accuracy
false
4,501
[ "Apache-2.0" ]
0
e2dcb66bad713542158dfe54cba113a0cc02ed39
https://github.com/vixadd/sparseml/tree/e2dcb66bad713542158dfe54cba113a0cc02ed39
PureUpsampling
import torch import torch.nn as nn import torch.nn.functional as F class PureUpsampling(nn.Module): def __init__(self, scale=2, mode='bilinear'): super(PureUpsampling, self).__init__() assert isinstance(scale, int) self.scale = scale self.mode = mode 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
vlbthambawita/polyp-inpainting
PureUpsampling
false
4,502
[ "MIT" ]
0
f1d754f8ffb3f6d991206b2a661933ff32de0d7a
https://github.com/vlbthambawita/polyp-inpainting/tree/f1d754f8ffb3f6d991206b2a661933ff32de0d7a
RandomCrop
import torch from torch import nn def choose_rand_patches(x, patch_sz, dim): assert dim == 2 or dim == 3 batch_sz = x.shape[0] patches = x.unfold(dim, patch_sz, 1) n_patches = patches.shape[2] idx = torch.randint(0, n_patches, (batch_sz,)) if dim == 2: patches = patches[torch.arange(ba...
import torch from torch import device import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C....
vitskvara/shape-guided-anomaly-detection
RandomCrop
false
4,503
[ "MIT" ]
0
6685b2e0b97968a6d0f478d2920486da107b277f
https://github.com/vitskvara/shape-guided-anomaly-detection/tree/6685b2e0b97968a6d0f478d2920486da107b277f
TVLoss
import torch import torch.nn as nn class TVLoss(nn.Module): def __init__(self): super(TVLoss, self).__init__() def forward(self, x): h_x, w_x = x.size()[2:] h_tv = torch.abs(x[:, :, 1:, :] - x[:, :, :h_x - 1, :]) w_tv = torch.abs(x[:, :, :, 1:] - x[:, :, :, :w_x - 1]) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
vlbthambawita/polyp-inpainting
TVLoss
false
4,504
[ "MIT" ]
0
f1d754f8ffb3f6d991206b2a661933ff32de0d7a
https://github.com/vlbthambawita/polyp-inpainting/tree/f1d754f8ffb3f6d991206b2a661933ff32de0d7a
conv_head_pooling
import torch import torch.nn as nn import torch.utils.data class conv_head_pooling(nn.Module): def __init__(self, in_feature, out_feature, stride, conv_type, padding_mode='zeros', dilation=1): super(conv_head_pooling, self).__init__() if conv_type == 'depthwise': _groups = 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 import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
tsubauaaa/d2go
conv_head_pooling
false
4,505
[ "Apache-2.0" ]
0
9f746159ebf78ce79f644c405ca8695bc29d1075
https://github.com/tsubauaaa/d2go/tree/9f746159ebf78ce79f644c405ca8695bc29d1075
ShortcutLayer
import torch import torch.nn as nn class ShortcutLayer(nn.Module): def __init__(self, idx): super(ShortcutLayer, self).__init__() self.idx = idx def forward(self, x, outputs): return x + outputs[self.idx] def get_inputs(): return [torch.rand([5, 4, 4, 4]), torch.rand([5, 4, 4, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
vrindaprabhu/solofy
ShortcutLayer
false
4,506
[ "MIT" ]
0
d5e26ff20d293c200485c70be6dcd6481afba396
https://github.com/vrindaprabhu/solofy/tree/d5e26ff20d293c200485c70be6dcd6481afba396
CustomGroupNorm
import torch class CustomGroupNorm(torch.nn.Module): """ Custom Group Norm which adds n_groups=2 as default parameter """ def __init__(self, n_features, n_groups=2): """ Parameters ---------- n_features : int number of input features n_groups : int...
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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_c...
vuamitom/shapenet
CustomGroupNorm
false
4,507
[ "BSD-2-Clause" ]
0
9eb3dadc91801756cb3460707c37146c8176643e
https://github.com/vuamitom/shapenet/tree/9eb3dadc91801756cb3460707c37146c8176643e
PairwiseNorm
import torch from torch import nn class PairwiseNorm(nn.Module): def __init__(self, order=1, size_average=True): super().__init__() self.order = order self.average = size_average def forward(self, inp, target=None): inp = inp.flatten(1) assert len(inp) % 2 == 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 from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_...
vzinche/inferno
PairwiseNorm
false
4,508
[ "Apache-2.0" ]
0
91b22dfcd1b6a9ec415f0bbb6ae66caea42f4034
https://github.com/vzinche/inferno/tree/91b22dfcd1b6a9ec415f0bbb6ae66caea42f4034
Norm
import torch from torch import nn class Norm(nn.Module): def __init__(self, order=1, size_average=True): super().__init__() self.order = order self.average = size_average def forward(self, inp, target=None): if target is not None: inp = inp - target inp = ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
vzinche/inferno
Norm
false
4,509
[ "Apache-2.0" ]
0
91b22dfcd1b6a9ec415f0bbb6ae66caea42f4034
https://github.com/vzinche/inferno/tree/91b22dfcd1b6a9ec415f0bbb6ae66caea42f4034
ContrastiveLoss
import torch from torch import nn class ContrastiveLoss(nn.Module): def __init__(self, margin=1.0, reduction='mean'): super().__init__() self.m = margin assert reduction in ['mean', 'sum', 'none'] self.reduction = reduction def forward(self, dist, class_): dist = dist...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
vzinche/inferno
ContrastiveLoss
false
4,510
[ "Apache-2.0" ]
0
91b22dfcd1b6a9ec415f0bbb6ae66caea42f4034
https://github.com/vzinche/inferno/tree/91b22dfcd1b6a9ec415f0bbb6ae66caea42f4034
WordPredictor
import torch import torch.nn as nn import torch.nn.functional as F import torch.onnx.operators class WordPredictor(nn.Module): def __init__(self, encoder_output_dim, hidden_dim, output_dim): super().__init__() self.encoder_output_dim = encoder_output_dim self.hidden_dim = hidden_dim ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
vincentLiangBerkeley/translate
WordPredictor
false
4,511
[ "BSD-3-Clause" ]
0
734ae1ad9dfb778935e4825b5ce2687e2df559ea
https://github.com/vincentLiangBerkeley/translate/tree/734ae1ad9dfb778935e4825b5ce2687e2df559ea
PairwiseCrossCorrelation
import torch from torch import nn class PairwiseCrossCorrelation(nn.Module): def __init__(self, lambd=1): super().__init__() self.lambd = lambd def off_diagonal(self, x): n, m = x.shape assert n == m return x.flatten()[:-1].view(n - 1, n + 1)[:, 1:].flatten() def...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
vzinche/inferno
PairwiseCrossCorrelation
false
4,512
[ "Apache-2.0" ]
0
91b22dfcd1b6a9ec415f0bbb6ae66caea42f4034
https://github.com/vzinche/inferno/tree/91b22dfcd1b6a9ec415f0bbb6ae66caea42f4034
Linear
import torch from torch import Tensor from warnings import warn from torch.nn import functional as F from torch.nn import Linear as normal_linear import torch.utils.data from torchvision import transforms as transforms class Linear(normal_linear): def __init__(self, *args, **kwargs): super(Linear, self)....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from warnings import warn from torch.nn import Linear as normal_linear import to...
wang93/pytorch-cifar10
Linear
false
4,513
[ "Apache-2.0" ]
0
07a54dd575aad9b011114352d08fdd9f61e360a1
https://github.com/wang93/pytorch-cifar10/tree/07a54dd575aad9b011114352d08fdd9f61e360a1
Mnist_CNN
import torch import torch.nn as nn import torch.nn.functional as F import torch.quantization import torch.onnx import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class Mnist_CNN(nn.Module): def __init__(self): super().__init__() self.conv1 = nn...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
voyageth/PyTorch-tutorials-kr
Mnist_CNN
false
4,514
[ "BSD-3-Clause" ]
0
05d2dd5931abfca6ce1e0b297f4ceb7f4eae6239
https://github.com/voyageth/PyTorch-tutorials-kr/tree/05d2dd5931abfca6ce1e0b297f4ceb7f4eae6239
FrequencyLoss
import torch import torch.nn as nn class FrequencyLoss(nn.Module): """Charbonnier Loss (L1)""" def __init__(self, eps=0.001): super(FrequencyLoss, self).__init__() self.criterion = torch.nn.L1Loss() def forward(self, x, y): x_fft = torch.fft.rfft2(x, dim=(2, 3)) y_fft = t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
vztu/DebandingNet
FrequencyLoss
false
4,515
[ "MIT" ]
0
4af8e83ffbfc70dc220dd6fea2827fb75796f10c
https://github.com/vztu/DebandingNet/tree/4af8e83ffbfc70dc220dd6fea2827fb75796f10c
FocalLossSigmoid
import torch import torch.nn as nn from math import sqrt as sqrt from itertools import product as product class FocalLossSigmoid(nn.Module): """ sigmoid version focal loss """ def __init__(self, alpha=0.25, gamma=2, size_average=False): super(FocalLossSigmoid, self).__init__() self.al...
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 ...
wangbingok1118/SSD_Pytorch
FocalLossSigmoid
false
4,516
[ "MIT" ]
0
8d3f924671cec367c3c420eba2f002cc5b5181bb
https://github.com/wangbingok1118/SSD_Pytorch/tree/8d3f924671cec367c3c420eba2f002cc5b5181bb
MedianPool2d
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair from torch.nn.modules.utils import _quadruple class MedianPool2d(nn.Module): """ Median pool (usable as median filter when stride=1) module. Args: kernel_size: size of pooling kernel, int ...
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 from torch.nn.modules.utils import _pair from torch...
vztu/DebandingNet
MedianPool2d
false
4,517
[ "MIT" ]
0
4af8e83ffbfc70dc220dd6fea2827fb75796f10c
https://github.com/vztu/DebandingNet/tree/4af8e83ffbfc70dc220dd6fea2827fb75796f10c
ParseL1loss
import torch from torch import nn import torch.nn.functional as F class ParseL1loss(nn.Module): def __init__(self): super(ParseL1loss, self).__init__() def forward(self, output, target, mask): mask = (mask == 1).float() loss = F.l1_loss(output * mask, target * mask, size_average=Fals...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
weberhen/NonCuboidRoom
ParseL1loss
false
4,518
[ "MIT" ]
0
871a77941697f1457cdae541b8ffcdce4f9134e3
https://github.com/weberhen/NonCuboidRoom/tree/871a77941697f1457cdae541b8ffcdce4f9134e3
WassersteinLoss
import torch from torch import nn class WassersteinLoss(nn.Module): """For WGAN.""" def forward(self, real, fake): return real.mean() - fake.mean() def get_inputs(): return [torch.rand([4, 4, 4, 4]), 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 from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empt...
wegroupwolves/fastai
WassersteinLoss
false
4,519
[ "Apache-2.0" ]
0
df40df403e05e132411f0f7abc7ec33c86e58bb9
https://github.com/wegroupwolves/fastai/tree/df40df403e05e132411f0f7abc7ec33c86e58bb9
SpatialAttn
import torch import torch.nn as nn class SpatialAttn(nn.Module): """Spatial Attention Layer""" def __init__(self): super(SpatialAttn, self).__init__() def forward(self, x): x = x.mean(1, keepdim=True) h = x.size(2) w = x.size(3) x = x.view(x.size(0), -1) z...
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...
wangminjie920705/Part-reid
SpatialAttn
false
4,520
[ "MIT" ]
0
34a1e968a2eab692ba810332f309e82b441793f6
https://github.com/wangminjie920705/Part-reid/tree/34a1e968a2eab692ba810332f309e82b441793f6
FocalLoss
import torch from torch import nn import torch.nn.functional as F class FocalLoss(nn.Module): def __init__(self, focusing_param=2, balance_param=0.25): super(FocalLoss, self).__init__() self.focusing_param = focusing_param self.balance_param = balance_param def forward(self, output, ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math from torch import nn a...
wanghao15536870732/plants_disease_classify
FocalLoss
false
4,521
[ "Apache-2.0" ]
0
6d0d1d39f0ec15fc2bd523142c5c403a1577da84
https://github.com/wanghao15536870732/plants_disease_classify/tree/6d0d1d39f0ec15fc2bd523142c5c403a1577da84
SigmoidRange
import torch from torch import nn def sigmoid_range(x, low, high): """Sigmoid function with range `(low, high)`""" return torch.sigmoid(x) * (high - low) + low class SigmoidRange(nn.Module): """Sigmoid module with range `(low,x_max)`""" def __init__(self, low, high): 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
wegroupwolves/fastai
SigmoidRange
false
4,522
[ "Apache-2.0" ]
0
df40df403e05e132411f0f7abc7ec33c86e58bb9
https://github.com/wegroupwolves/fastai/tree/df40df403e05e132411f0f7abc7ec33c86e58bb9
TemporalRelation
import torch import torch.nn as nn class TemporalRelation(nn.Module): def __init__(self, feat_dim, time_window=1): super(TemporalRelation, self).__init__() self.time_window = time_window self.feat_dim = feat_dim self.WT = nn.Linear(self.feat_dim, self.feat_dim, bias=False) de...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
weiyi1991/UA_Concurrent
TemporalRelation
false
4,523
[ "MIT" ]
0
11238c778c60095abf326800d6e6a13a643bf071
https://github.com/weiyi1991/UA_Concurrent/tree/11238c778c60095abf326800d6e6a13a643bf071
LinearNormalGamma
import torch from torch import nn class LinearNormalGamma(nn.Module): def __init__(self, in_chanels, out_channels): super().__init__() self.linear = nn.Linear(in_chanels, out_channels * 4) def evidence(self, x): return torch.log(torch.exp(x) + 1) def forward(self, x): pr...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math from torch im...
wanzysky/evidential-deep-learning
LinearNormalGamma
false
4,524
[ "Apache-2.0" ]
0
71ebd59ab3a4b66c38d919e8aa9ad3711a416796
https://github.com/wanzysky/evidential-deep-learning/tree/71ebd59ab3a4b66c38d919e8aa9ad3711a416796
GMM_Module
import math import torch import torch.nn as nn import torch.utils.data class GMM_Module(nn.Module): """ GMM Module """ def __init__(self, out_channel_M, k): super(GMM_Module, self).__init__() self.conv1 = nn.Conv2d(int(out_channel_M), k * out_channel_M, kernel_size=1) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import math import torch.nn as nn import torch.utils.data assert_size_stride = t...
wemozj/Image-Compression-based-GMM-and-Attention-Module
GMM_Module
false
4,525
[ "Apache-2.0" ]
0
93f804dbcea8ffc1621456f3d104d0342c75373b
https://github.com/wemozj/Image-Compression-based-GMM-and-Attention-Module/tree/93f804dbcea8ffc1621456f3d104d0342c75373b
MobileViTv2Attention
import torch from torch import nn from torch.nn import init class MobileViTv2Attention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model): """ :param d_model: Output dimensionality of the model :param d_k: Dimensionality of queries and keys :p...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
weihaoxie/External-Attention-pytorch
MobileViTv2Attention
false
4,526
[ "MIT" ]
0
9bec70f4ed8dd858c815e9bad240ab2f95a91a9f
https://github.com/weihaoxie/External-Attention-pytorch/tree/9bec70f4ed8dd858c815e9bad240ab2f95a91a9f
BitEstimator
import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.data class Bitparm(nn.Module): """ save params """ def __init__(self, channel, final=False): super(Bitparm, self).__init__() self.final = final self.h = nn.Parameter(torch.nn.init.normal_(tor...
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.functional as F import t...
wemozj/Image-Compression-based-GMM-and-Attention-Module
BitEstimator
false
4,527
[ "Apache-2.0" ]
0
93f804dbcea8ffc1621456f3d104d0342c75373b
https://github.com/wemozj/Image-Compression-based-GMM-and-Attention-Module/tree/93f804dbcea8ffc1621456f3d104d0342c75373b
Prototype
import torch import torch.nn import torch.optim import torch.utils.data class Prototype(torch.nn.Module): """""" def __init__(self, prototype_num, latent_size) ->None: super(Prototype, self).__init__() self.latent_size = latent_size self.prototype_num = prototype_num self.prot...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
wenqiangxie/Prototype-Net
Prototype
false
4,528
[ "MIT" ]
0
a5ddd9976b78828d87806f9451a5092de3ff5c69
https://github.com/wenqiangxie/Prototype-Net/tree/a5ddd9976b78828d87806f9451a5092de3ff5c69
Model
import torch import torch.nn as nn import torch._C import torch.serialization class Model(nn.Module): def __init__(self): super().__init__() self.conv = nn.Conv2d(2, 2, 1) def forward(self, x): return self.conv(x) def get_inputs(): return [torch.rand([4, 2, 64, 64])] def get_...
import torch from torch._inductor.select_algorithm import extern_kernels import 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._C import torch.serialization assert_size_str...
whu-pzhang/mmsegmentation
Model
false
4,529
[ "Apache-2.0" ]
0
46326f63ce411c794d237e986dd3924590d0e75e
https://github.com/whu-pzhang/mmsegmentation/tree/46326f63ce411c794d237e986dd3924590d0e75e
MultiHeadAttention
import torch from torch import Tensor from typing import Any import torch.nn.functional as F from torch import nn def ifnone(a: 'Any', b: 'Any') ->Any: """`a` if `a` is not None, otherwise `b`.""" return b if a is None else a class MultiHeadAttention(nn.Module): """MutiHeadAttention.""" def __init_...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
wegroupwolves/fastai
MultiHeadAttention
false
4,530
[ "Apache-2.0" ]
0
df40df403e05e132411f0f7abc7ec33c86e58bb9
https://github.com/wegroupwolves/fastai/tree/df40df403e05e132411f0f7abc7ec33c86e58bb9
GDN
from torch.autograd import Function import torch import torch.nn as nn import torch.utils.data class LowerBound(Function): @staticmethod def forward(ctx, inputs, bound): b = torch.ones_like(inputs) * bound ctx.save_for_backward(inputs, b) return torch.max(inputs, b) @staticmethod...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
wemozj/Image-Compression-based-GMM-and-Attention-Module
GDN
false
4,531
[ "Apache-2.0" ]
0
93f804dbcea8ffc1621456f3d104d0342c75373b
https://github.com/wemozj/Image-Compression-based-GMM-and-Attention-Module/tree/93f804dbcea8ffc1621456f3d104d0342c75373b
UFOAttention
import torch from torch import nn from torch.nn import init def XNorm(x, gamma): norm_tensor = torch.norm(x, 2, -1, True) return x * gamma / norm_tensor class UFOAttention(nn.Module): """ Scaled dot-product attention """ def __init__(self, d_model, d_k, d_v, h, dropout=0.1): """ ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice from torch import n...
weihaoxie/External-Attention-pytorch
UFOAttention
false
4,532
[ "MIT" ]
0
9bec70f4ed8dd858c815e9bad240ab2f95a91a9f
https://github.com/weihaoxie/External-Attention-pytorch/tree/9bec70f4ed8dd858c815e9bad240ab2f95a91a9f
NaiveGate
import torch import torch.nn as nn import torch.nn.functional as F class NaiveGate(nn.Module): """ A naive gate implementation that defines the standard behavior of the gate which determines which experts the tokens are going to. Both the indecies and the score, or confidence, are output to the parent...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
whn09/fastmoe
NaiveGate
false
4,533
[ "Apache-2.0" ]
0
d0ffaffc6431abcd3ea6d0287dbf09f8cd727a0a
https://github.com/whn09/fastmoe/tree/d0ffaffc6431abcd3ea6d0287dbf09f8cd727a0a
ActorNetwork
import torch import torch.nn as nn import torch.nn.functional as F class ActorNetwork(nn.Module): def __init__(self, input_size, hidden_size, action_size): super(ActorNetwork, self).__init__() self.fc1 = nn.Linear(input_size, hidden_size) self.fc2 = nn.Linear(hidden_size, hidden_size) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
whongyu/MA3C
ActorNetwork
false
4,534
[ "MIT" ]
0
d3b38cf42a909c0938624ba853119804efaf47eb
https://github.com/whongyu/MA3C/tree/d3b38cf42a909c0938624ba853119804efaf47eb
ComplexBatchNormalize
import torch import torch.nn as nn def cylindricalToPolarConversion(input1, input2=None): if input2 is None: """input1 is tensor of [B,C,H,W,D,2] contains both real and imaginary channels in the last dims""" ndims = input1.ndimension() real_input = input1.narrow(ndims - 1, 0, 1).s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
wizofe/urus-mri-recon
ComplexBatchNormalize
false
4,535
[ "MIT" ]
0
eab8e48dca31d2b936ce69ccc251ec5a4a10facc
https://github.com/wizofe/urus-mri-recon/tree/eab8e48dca31d2b936ce69ccc251ec5a4a10facc
Channel_mean
import torch import torch.nn as nn class Channel_mean(nn.Module): def __init__(self) ->None: super().__init__() def forward(self, V): """ only V[0] """ return torch.sum(V[0], dim=0).squeeze() def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inp...
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...
wk989898/ARES-implement
Channel_mean
false
4,536
[ "MIT" ]
0
b2411be01124feaccbc89d74f6025fbfa584bb3f
https://github.com/wk989898/ARES-implement/tree/b2411be01124feaccbc89d74f6025fbfa584bb3f
MnistFeatureExtractor
import torch import torch.nn as nn import torch.nn.functional as F class MnistFeatureExtractor(nn.Module): def __init__(self, activation=F.leaky_relu): super(MnistFeatureExtractor, self).__init__() self.conv1 = nn.Conv2d(3, 10, kernel_size=5) self.conv2 = nn.Conv2d(10, 20, kernel_size=5) ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
wiatrak2/BScThesis
MnistFeatureExtractor
false
4,537
[ "MIT" ]
0
e5dd012fd9052e7088d8464b409dc055dbfcf840
https://github.com/wiatrak2/BScThesis/tree/e5dd012fd9052e7088d8464b409dc055dbfcf840