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
SmoothL1Loss
import functools import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". 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._inductor.runtime.triton_helpers import math as tl_math import functools impor...
Fanzhongjie/ARFE
SmoothL1Loss
false
456
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
BasicModel_ConvNet_MaxPool1d
import torch from torch import Tensor import torch.nn as nn from typing import no_type_check class BasicModel_ConvNet_MaxPool1d(nn.Module): """Same as above, but with the MaxPool2d replaced with a MaxPool1d. This is useful because the MaxPool modules behave differently to other modules from the perspectiv...
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....
Europium248/captum
BasicModel_ConvNet_MaxPool1d
false
457
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
HardSwish
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def hard_swish(x, inplace: 'bool'=False): inner = F.relu6(x + 3.0).div_(6.0) return x.mul_(inner) if inplace else x.mul(inner) class HardSwish(nn.Module): def __init__(self, inplace: 'bool'=False): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel asser...
Fanzhongjie/ARFE
HardSwish
false
458
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
CecaModule
import math import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel class CecaModule(nn.Module): """Constructs a circular ECA module. ECA module where the conv uses circular padding rather than zero padding. Unlike the spatial dimension, the channels do not have 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 math import torch.nn as nn import torch.nn.parallel assert_size_stride = ...
Fanzhongjie/ARFE
CecaModule
false
459
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
EcaModule
import math import torch import torch.nn as nn import torch.nn.parallel class EcaModule(nn.Module): """Constructs an ECA module. Args: channels: Number of channels of the input feature map for use in adaptive kernel sizes for actual calculations according to channel. gamma, be...
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.nn.parallel assert_size_stride = ...
Fanzhongjie/ARFE
EcaModule
false
460
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
Encoder
import torch import torch.nn as nn class Encoder(nn.Module): """ This class defines the encoder architecture """ def __init__(self, input_size, hidden_size, bottleneck): super().__init__() self.linear1 = nn.Linear(input_size, hidden_size) self.mean = nn.Linear(hidden_size, bottlen...
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 ...
FaisalAhmed0/variational-autoencoder
Encoder
false
461
[ "MIT" ]
0
a6c1c96da8063d822aef2e2bdd69d7cb1b35c2cd
https://github.com/FaisalAhmed0/variational-autoencoder/tree/a6c1c96da8063d822aef2e2bdd69d7cb1b35c2cd
Sigmoid
import torch import torch.nn as nn import torch.nn.parallel class Sigmoid(nn.Module): def __init__(self, inplace: 'bool'=False): super(Sigmoid, self).__init__() self.inplace = inplace def forward(self, x): return x.sigmoid_() if self.inplace else x.sigmoid() 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 import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
Fanzhongjie/ARFE
Sigmoid
false
462
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
LocationLayer
import torch import torch.utils.data from torch import nn class LinearNorm(torch.nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super(LinearNorm, self).__init__() self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias) torch.nn.init.xavier_unifor...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data from torch import nn assert_size_stride = torch._C._dyna...
FadyKhalaf/tacotron2
LocationLayer
false
463
[ "BSD-3-Clause" ]
0
d9bf28a6d286aab42bce46df9f26a9a3d7c2f01f
https://github.com/FadyKhalaf/tacotron2/tree/d9bf28a6d286aab42bce46df9f26a9a3d7c2f01f
MSELoss
import functools import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". 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 functools import torch.nn as nn from torch.nn import functional as F import torch....
Fanzhongjie/ARFE
MSELoss
false
464
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
Aggregator
import torch import torch.nn as nn import torch.nn.functional as F class Aggregator(nn.Module): def __init__(self, hidden_dim, num_node): super(Aggregator, self).__init__() self.W_q = nn.Linear(hidden_dim, hidden_dim) self.W_k = nn.Linear(hidden_dim, hidden_dim) self.fc = nn.Linea...
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....
FANTASTPATR/STST
Aggregator
false
465
[ "Apache-2.0" ]
0
8f969fcfe31f9555b19e783fb14eecf72def4122
https://github.com/FANTASTPATR/STST/tree/8f969fcfe31f9555b19e783fb14eecf72def4122
Conv2dSame
import math import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel from typing import Tuple from typing import Optional from typing import List def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int'): return max((math.ceil(x / s) - 1) * s + (k - 1) * d + 1 - x, 0) ...
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 from torch.nn import functional as F import to...
Fanzhongjie/ARFE
Conv2dSame
false
466
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
h_swish
import torch import torch.nn as nn class h_sigmoid(nn.Module): def __init__(self, inplace=True): super(h_sigmoid, self).__init__() self.relu = nn.ReLU6(inplace=inplace) def forward(self, x): return self.relu(x + 3) / 6 class h_swish(nn.Module): def __init__(self, inplace=True)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride emp...
Felicia980317/mytorch
h_swish
false
467
[ "Apache-2.0" ]
0
e463122c0d402878ec5b4c5a823a0feeba8fdbfe
https://github.com/Felicia980317/mytorch/tree/e463122c0d402878ec5b4c5a823a0feeba8fdbfe
SigmoidDeepLiftModel
import torch import torch.nn as nn class SigmoidDeepLiftModel(nn.Module): """ Model architecture from: https://medium.com/coinmonks/create-a-neural-network-in -pytorch-and-make-your-life-simpler-ec5367895199 """ def __init__(self, num_in, num_hidden, num_out): super()....
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_...
Europium248/captum
SigmoidDeepLiftModel
false
468
[ "BSD-3-Clause" ]
0
ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
https://github.com/Europium248/captum/tree/ac02fae2651b8d68a44bcb9d03b91cbb3959f2fc
L1Loss
import functools import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". 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._inductor.runtime.triton_helpers import math as tl_math import functools impor...
Fanzhongjie/ARFE
L1Loss
false
469
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
Scale1Minus1
import torch class Scale1Minus1(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x): x = x / 254.0 * 2 - 1 return 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Filco306/WASP-GANs
Scale1Minus1
false
470
[ "Apache-2.0" ]
0
e50cf096a5e3eb26d33a3cbf164d728b9789e41b
https://github.com/Filco306/WASP-GANs/tree/e50cf096a5e3eb26d33a3cbf164d728b9789e41b
RMSELoss
import torch import torch.nn as nn class RMSELoss(nn.Module): def __init__(self): super(RMSELoss, self).__init__() def forward(self, x, y): criterion = nn.MSELoss() loss = torch.sqrt(criterion(x, y)) return loss def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch....
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert...
FizzerYu/CollaborativeVAE
RMSELoss
false
471
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
Rescale
import torch class Rescale(torch.nn.Module): def __init__(self, old_min, old_max, new_min, new_max): super(Rescale, self).__init__() self.old_min = old_min self.old_max = old_max self.new_min = new_min self.new_max = new_max def forward(self, x): x = (x - 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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Filco306/WASP-GANs
Rescale
false
472
[ "Apache-2.0" ]
0
e50cf096a5e3eb26d33a3cbf164d728b9789e41b
https://github.com/Filco306/WASP-GANs/tree/e50cf096a5e3eb26d33a3cbf164d728b9789e41b
LRN
import torch import torch.optim import torch.nn as nn class LRN(nn.Module): def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS=True ): super(LRN, self).__init__() self.ACROSS_CHANNELS = ACROSS_CHANNELS if ACROSS_CHANNELS: self.average = nn.AvgPool3d...
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.optim import torch.nn as nn assert_size_stride = torch._C._dynamo....
Fyy10/UESTC-Thesis-DA
LRN
false
473
[ "MIT" ]
0
6cb16efd1f80aa569c90874a806a62dec8afaec4
https://github.com/Fyy10/UESTC-Thesis-DA/tree/6cb16efd1f80aa569c90874a806a62dec8afaec4
MMDLoss
import torch import torch.optim import torch.nn as nn class MMDLoss(nn.Module): def __init__(self): """ Maximum Mean Discrepancy Loss """ super(MMDLoss, self).__init__() self.eps = 1e-08 def forward(self, f1: 'torch.Tensor', f2: 'torch.Tensor') ->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.optim import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
Fyy10/UESTC-Thesis-DA
MMDLoss
false
474
[ "MIT" ]
0
6cb16efd1f80aa569c90874a806a62dec8afaec4
https://github.com/Fyy10/UESTC-Thesis-DA/tree/6cb16efd1f80aa569c90874a806a62dec8afaec4
ConvWS2d
import torch import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel def conv_ws_2d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1, eps=1e-05): c_in = weight.size(0) weight_flat = weight.view(c_in, -1) mean = weight_flat.mean(dim=1, keepdim=True).view(c...
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 ...
Fanzhongjie/ARFE
ConvWS2d
false
475
[ "Apache-2.0" ]
0
4b96b8c5bc0895d3d30acec2a490f81a860fe860
https://github.com/Fanzhongjie/ARFE/tree/4b96b8c5bc0895d3d30acec2a490f81a860fe860
selfVLoss
import torch import torch.nn as nn class selfVLoss(nn.Module): def __init__(self, lambda_v, lambda_r): super(selfVLoss, self).__init__() self.lambda_v = lambda_v self.lambda_r = lambda_r def forward(self, v, z): return 1.0 * self.lambda_v / self.lambda_r * torch.mean(torch.su...
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...
FizzerYu/CollaborativeVAE
selfVLoss
false
476
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
ConvLayer
import torch import torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.module = module self.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 import torch.nn as nn from torch.nn import Parameter assert_size_stride = torch....
GEN418/EventGAN
ConvLayer
false
477
[ "MIT" ]
0
372318bc8f285f513db4babf7786b5c04e97c86d
https://github.com/GEN418/EventGAN/tree/372318bc8f285f513db4babf7786b5c04e97c86d
GeM
import torch import torch.nn.functional as F from torch import nn def gem(x, p=3, eps=1e-06): return F.avg_pool2d(x.clamp(min=eps).pow(p), (x.size(-2), x.size(-1))).pow( 1.0 / p) class GeM(nn.Module): def __init__(self, p=3, eps=1e-06, requires_grad: 'bool'=True): 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 libdevice import torch.nn.functional a...
Fkaneko/kaggle_g2net_gravitational_wave_detection-
GeM
false
478
[ "Apache-2.0" ]
0
8bb32cc675e6b56171da8a3754fffeda41e934bb
https://github.com/Fkaneko/kaggle_g2net_gravitational_wave_detection-/tree/8bb32cc675e6b56171da8a3754fffeda41e934bb
FakeReLUM
import torch import torch.nn as nn import torch.utils.data class FakeReLU(torch.autograd.Function): @staticmethod def forward(ctx, input): return input.clamp(min=0) @staticmethod def backward(ctx, grad_output): return grad_output class FakeReLUM(nn.Module): 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guard...
GeoffNN/robustness
FakeReLUM
false
479
[ "MIT" ]
0
2cefabb5b0ceab62a77e0572f209144d7124cc9f
https://github.com/GeoffNN/robustness/tree/2cefabb5b0ceab62a77e0572f209144d7124cc9f
NetVLAD
import torch import numpy as np import torch.utils.data import torch import torch.nn.functional as F from torch import nn class NetVLAD(nn.Module): """NetVLAD layer implementation""" def __init__(self, num_clusters=64, dim=128, normalize_input=True): """ Args: num_clusters : int ...
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....
DanielPollithy/UncertainToDayGAN
NetVLAD
false
480
[ "BSD-2-Clause" ]
0
bd16fa1a34878dbdc765d548169b7058a56864ff
https://github.com/DanielPollithy/UncertainToDayGAN/tree/bd16fa1a34878dbdc765d548169b7058a56864ff
Encoder
import torch from torch import nn class Encoder(nn.Module): def __init__(self, input_dim, hidden_dim, latent_dim): super(Encoder, self).__init__() self.FC_input = nn.Linear(input_dim, hidden_dim) self.FC_mean = nn.Linear(hidden_dim, latent_dim) self.FC_var = nn.Linear(hidden_dim, ...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
FrederikKromann/dtu_mlops
Encoder
false
481
[ "Apache-2.0" ]
0
b82e43e1a1b58f0ba208414092e4c0ea63c5d4ff
https://github.com/FrederikKromann/dtu_mlops/tree/b82e43e1a1b58f0ba208414092e4c0ea63c5d4ff
LinearTextualHead
import torch from torch import nn from typing import Optional class TextualHead(nn.Module): """ Base class for all textual heads. All child classes can simply inherit from :class:`~torch.nn.Module`, however this is kept here for uniform type annotations. Args: visual_feature_size: Size (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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
GeorgeBatch/arch-pre-training
LinearTextualHead
false
482
[ "MIT" ]
0
7ed75868689e9283d61d11360fdbf4e77d4ebd2e
https://github.com/GeorgeBatch/arch-pre-training/tree/7ed75868689e9283d61d11360fdbf4e77d4ebd2e
LinearRegression
import torch from torch import nn class LinearRegression(nn.Module): def __init__(self, in_features: 'int', out_features: 'int', bias: 'bool'=True): super().__init__() self.weights = nn.Parameter(torch.randn(out_features, in_features)) self.bias = bias if 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 assert_size_stride = torch._C._dynamo.guards.assert_size_st...
GaspardLeMarque/Competition-Models
LinearRegression
false
483
[ "MIT" ]
0
3bd0b75de369420ac3a3011659f1de5942a867e1
https://github.com/GaspardLeMarque/Competition-Models/tree/3bd0b75de369420ac3a3011659f1de5942a867e1
ResidualBlock
import torch import torch.nn as nn from torch.nn import Parameter def l2normalize(v, eps=1e-12): return v / (v.norm() + eps) class SpectralNorm(nn.Module): def __init__(self, module, name='weight', power_iterations=1): super(SpectralNorm, self).__init__() self.module = module self.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 import torch.nn as nn from to...
GEN418/EventGAN
ResidualBlock
false
484
[ "MIT" ]
0
372318bc8f285f513db4babf7786b5c04e97c86d
https://github.com/GEN418/EventGAN/tree/372318bc8f285f513db4babf7786b5c04e97c86d
MyNet
import torch import torch.nn as nn class MyNet(nn.Module): def __init__(self): super(MyNet, self).__init__() self.conv1_1 = nn.Conv2d(in_channels=3, out_channels=8, kernel_size =5, stride=2, padding=0) self.conv2_1 = nn.Conv2d(8, 16, 3, 1, 0) self.conv2_2 = nn.Conv2d(1...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
DeepDuke/Face_Keypoints_Dectection
MyNet
false
485
[ "MIT" ]
0
9f09e1ad113734a9ba5d006d3f817a497db572aa
https://github.com/DeepDuke/Face_Keypoints_Dectection/tree/9f09e1ad113734a9ba5d006d3f817a497db572aa
CAM_Module
import torch import torch.nn as nn import torch._utils class CAM_Module(nn.Module): """ Channel attention module""" def __init__(self, in_dim): super(CAM_Module, self).__init__() self.chanel_in = in_dim self.gamma = nn.Parameter(torch.zeros(1)) self.softmax = nn.Softmax(dim=-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....
GhadeerElmkaiel/Trans2Seg
CAM_Module
false
486
[ "Apache-2.0" ]
0
6717db602205cbed494ae1913ac7cbbca8e83463
https://github.com/GhadeerElmkaiel/Trans2Seg/tree/6717db602205cbed494ae1913ac7cbbca8e83463
HistogramLayerUNET
import torch import numpy as np import torch.nn as nn class HistogramLayerUNET(nn.Module): def __init__(self, in_channels, kernel_size, dim=2, num_bins=4, stride= None, padding=0, normalize_count=True, normalize_bins=True, count_include_pad=False, ceil_mode=False, skip_connection=False): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
GatorSense/Histological_Segmentation
HistogramLayerUNET
false
487
[ "MIT" ]
0
12849fff3d9d58c1fe419b18dba49294db375488
https://github.com/GatorSense/Histological_Segmentation/tree/12849fff3d9d58c1fe419b18dba49294db375488
selfCrossEntropy
import torch import torch.nn as nn class selfCrossEntropy(nn.Module): def __init__(self): super(selfCrossEntropy, self).__init__() def forward(self, output, target): output = nn.functional.softmax(output, dim=0) return -torch.mean(torch.sum(target * torch.log(torch.clamp(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 import torch.nn as nn ...
FizzerYu/CollaborativeVAE
selfCrossEntropy
false
488
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
ChannelPool
import torch from torch import nn class ChannelPool(nn.Module): def forward(self, x): return torch.mean(x, 1).unsqueeze(1) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
GhadeerElmkaiel/MirrorNet
ChannelPool
false
489
[ "BSD-3-Clause" ]
0
1a0389abc5b1ccbe7fde7bd1df772cb9df30c072
https://github.com/GhadeerElmkaiel/MirrorNet/tree/1a0389abc5b1ccbe7fde7bd1df772cb9df30c072
run_latent
import torch import torch.nn as nn class run_latent(nn.Module): def __init__(self, in_dim, hidden_dim): super(run_latent, self).__init__() self.fc_z_mean = nn.Linear(in_dim, hidden_dim) self.fc_z_log_sigma = nn.Linear(in_dim, hidden_dim) self.fc_gen = nn.Linear(hidden_dim, in_dim)...
import torch from torch import device from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from...
FizzerYu/CollaborativeVAE
run_latent
false
490
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
Attention_Decoder
import torch import torch.nn as nn import torch._utils class Attention_Decoder(nn.Module): def __init__(self, dim, num_heads=1, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0): super().__init__() self.num_heads = num_heads head_dim = dim // num_heads self.scal...
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....
GhadeerElmkaiel/Trans2Seg
Attention_Decoder
false
491
[ "Apache-2.0" ]
0
6717db602205cbed494ae1913ac7cbbca8e83463
https://github.com/GhadeerElmkaiel/Trans2Seg/tree/6717db602205cbed494ae1913ac7cbbca8e83463
ParsingRelationLoss
import torch import torch.nn.modules import torch.nn as nn class ParsingRelationLoss(nn.Module): def __init__(self): super(ParsingRelationLoss, self).__init__() def forward(self, logits): _n, _c, h, _w = logits.shape loss_all = [] for i in range(0, h - 1): loss_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.triton_helpers import math as tl_math import torch.nn.modules import torch.nn as nn assert_size_stride = torch....
Glutamat42/Ultra-Fast-Lane-Detection
ParsingRelationLoss
false
492
[ "MIT" ]
0
175448f39574d64a7cc6fd35ec92e3c5539c9837
https://github.com/Glutamat42/Ultra-Fast-Lane-Detection/tree/175448f39574d64a7cc6fd35ec92e3c5539c9837
selfLatentLoss
import torch import torch.nn as nn class selfLatentLoss(nn.Module): def __init__(self): super(selfLatentLoss, self).__init__() def forward(self, z_mean, z_log_sigma_sq): return torch.mean(torch.sum(torch.pow(z_mean, 2) + torch.exp( z_log_sigma_sq) - z_log_sigma_sq - 1, 1)) def ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
FizzerYu/CollaborativeVAE
selfLatentLoss
false
493
[ "MIT" ]
0
4714cce49acba258600b1b5bbcd3a1a4762385e6
https://github.com/FizzerYu/CollaborativeVAE/tree/4714cce49acba258600b1b5bbcd3a1a4762385e6
OneLayerFCBodyWithAction
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class OneLayerFCBodyWithAction(nn.Module): def __init__(self, state_di...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import ...
Fieps1/p3-tennis
OneLayerFCBodyWithAction
false
494
[ "MIT" ]
0
29f3dab5810d7cd7f84120416a615956d266c256
https://github.com/Fieps1/p3-tennis/tree/29f3dab5810d7cd7f84120416a615956d266c256
GRUCell
import torch import numpy as np import torch.nn.functional as F import torch.utils.data import torch.nn as nn class GRUCell(nn.Module): def __init__(self, input_size, hidden_size, bias=True): super(GRUCell, self).__init__() self.input_size = input_size self.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.triton_helpers import libdevice import numpy as np ...
GregoryLand/PyGrid
GRUCell
false
495
[ "Apache-2.0" ]
0
00271f73db825eaf378095ea5c4363d4a04d38a6
https://github.com/GregoryLand/PyGrid/tree/00271f73db825eaf378095ea5c4363d4a04d38a6
VarifocalLoss
import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss 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 libdevice, math as tl_math import torc...
Guoning-Chen/mmdetection
VarifocalLoss
false
496
[ "Apache-2.0" ]
0
f1d1c5a19dbe6aa2e74fc9ca2e9578db4532fc64
https://github.com/Guoning-Chen/mmdetection/tree/f1d1c5a19dbe6aa2e74fc9ca2e9578db4532fc64
CrossEntropy
import torch from torch import nn from torch.nn import functional as F class CrossEntropy(nn.Module): def __init__(self, ignore_label=-1, weight=None): super(CrossEntropy, self).__init__() self.ignore_label = ignore_label self.criterion = nn.CrossEntropyLoss(weight=weight, ignore_index= ...
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...
Gummary/Pytorch-Project-Template
CrossEntropy
false
497
[ "MIT" ]
0
56bc5e253627d40fb8771eccdb2bb663c833beb3
https://github.com/Gummary/Pytorch-Project-Template/tree/56bc5e253627d40fb8771eccdb2bb663c833beb3
FeatureSelect
import torch import torch.optim import torch.nn as nn class FeatureSelect(nn.Module): def __init__(self, in_dim=84, ratio=0.5): """ Feature Select via Sorting Args: in_dim: the number of dimensions of raw features ratio: the portion of selected features ""...
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.optim import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.ass...
Fyy10/UESTC-Thesis-DA
FeatureSelect
false
498
[ "MIT" ]
0
6cb16efd1f80aa569c90874a806a62dec8afaec4
https://github.com/Fyy10/UESTC-Thesis-DA/tree/6cb16efd1f80aa569c90874a806a62dec8afaec4
GeM
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter class GeM(nn.Module): def __init__(self, p=3, eps=1e-06): """ Args: p : int Number of the pooling parameter eps : float lower-bound o...
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...
GiaVit97/project_vg
GeM
false
499
[ "MIT" ]
0
410de0861f479a86e9c4611bd4f0e270566bcd49
https://github.com/GiaVit97/project_vg/tree/410de0861f479a86e9c4611bd4f0e270566bcd49
L2Norm
from torch.nn import Module import torch import torch.nn.functional as F class L2Norm(Module): def forward(self, input): return F.normalize(input) 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._inductor.runtime.triton_helpers import libdevice from torch.nn import Module ...
HAOCHENYE/Silent-Face-Anti-Spoofing-master-yehc
L2Norm
false
500
[ "Apache-2.0" ]
0
014c781d4109733f87a50b10d10508ba5e431581
https://github.com/HAOCHENYE/Silent-Face-Anti-Spoofing-master-yehc/tree/014c781d4109733f87a50b10d10508ba5e431581
SIG_LOSS
import torch from torch import nn class SIG_LOSS(nn.Module): def __init__(self, device): super(SIG_LOSS, self).__init__() self.m_device = device self.m_criterion = nn.BCEWithLogitsLoss(reduction='mean') def forward(self, preds, targets): loss = self.m_criterion(preds, targets...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math from torch ...
HCDM/XRec
SIG_LOSS
false
501
[ "MIT" ]
0
dae7d3e1237b8e41913656eb33d81e78c61424ea
https://github.com/HCDM/XRec/tree/dae7d3e1237b8e41913656eb33d81e78c61424ea
SigmoidFocalLoss
import torch import torch.utils.data.distributed import torch import torch.nn as nn from numpy import int64 as int64 import torch.utils class SigmoidFocalLoss(nn.Module): def __init__(self, ignore_label, gamma=2.0, alpha=0.25, reduction='mean'): super(SigmoidFocalLoss, self).__init__() self.ignor...
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...
HRTNet/HRTNet
SigmoidFocalLoss
false
502
[ "MIT" ]
0
6a51c9c34568988ea6125a1638794c63d8fadbea
https://github.com/HRTNet/HRTNet/tree/6a51c9c34568988ea6125a1638794c63d8fadbea
GaussianFocalLoss
import functools import torch import torch.nn.functional as F import torch.nn as nn def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss ten...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import functools impor...
Guoning-Chen/mmdetection
GaussianFocalLoss
false
503
[ "Apache-2.0" ]
0
f1d1c5a19dbe6aa2e74fc9ca2e9578db4532fc64
https://github.com/Guoning-Chen/mmdetection/tree/f1d1c5a19dbe6aa2e74fc9ca2e9578db4532fc64
InnerProductDecoder
import torch import torch.fx import torch.utils.data class InnerProductDecoder(torch.nn.Module): """The inner product decoder from the `"Variational Graph Auto-Encoders" <https://arxiv.org/abs/1611.07308>`_ paper .. math:: \\sigma(\\mathbf{Z}\\mathbf{Z}^{\\top}) where :math:`\\mathbf{Z} \\in...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.fx import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
HWSelf/pytorch_geometric
InnerProductDecoder
false
504
[ "MIT" ]
0
c1214de674079b5e39e57c045d0f844b60caf590
https://github.com/HWSelf/pytorch_geometric/tree/c1214de674079b5e39e57c045d0f844b60caf590
SeparableConv2d_same
import torch from torch import nn from torch.nn import functional as F def fixed_padding(inputs, kernel_size, rate): kernel_size_effective = kernel_size + (kernel_size - 1) * (rate - 1) pad_total = kernel_size_effective - 1 pad_beg = pad_total // 2 pad_end = pad_total - pad_beg padded_inputs = F.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 import nn from torch.nn import functional as F assert_size_stride = t...
Gummary/Pytorch-Project-Template
SeparableConv2d_same
false
505
[ "MIT" ]
0
56bc5e253627d40fb8771eccdb2bb663c833beb3
https://github.com/Gummary/Pytorch-Project-Template/tree/56bc5e253627d40fb8771eccdb2bb663c833beb3
perceptron
import torch from torch import nn import torch.nn.functional as F class perceptron(nn.Module): def __init__(self, n_channels): super(perceptron, self).__init__() self.L = nn.Linear(n_channels, 10) def forward(self, x): x = self.L(x) x = F.softmax(x, dim=1) return x ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
GuilhermeSenna/Testes-TCC
perceptron
false
506
[ "MIT" ]
0
ed38baf864d8993685427affa1f009e6cf7c5dcb
https://github.com/GuilhermeSenna/Testes-TCC/tree/ed38baf864d8993685427affa1f009e6cf7c5dcb
Invertible1x1Conv
import torch import torch.nn.functional as F from torch.autograd import Variable import torch.utils.data import torch.nn class Invertible1x1Conv(torch.nn.Module): """ The layer outputs both the convolution, and the log determinant of its weight matrix. If reverse=True it does convolution with inverse...
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 as F from torch.autograd import Variable import torch...
GreyZzzzzzXh/TensorRT
Invertible1x1Conv
false
507
[ "Apache-2.0" ]
0
ba5b1b4f1ade5896c7fae206e43570a2712498d4
https://github.com/GreyZzzzzzXh/TensorRT/tree/ba5b1b4f1ade5896c7fae206e43570a2712498d4
IdentityMessage
import torch import torch.fx import torch.utils.data class IdentityMessage(torch.nn.Module): def __init__(self, raw_msg_dim: 'int', memory_dim: 'int', time_dim: 'int'): super(IdentityMessage, self).__init__() self.out_channels = raw_msg_dim + 2 * memory_dim + time_dim def forward(self, z_src...
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.fx import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
HWSelf/pytorch_geometric
IdentityMessage
false
508
[ "MIT" ]
0
c1214de674079b5e39e57c045d0f844b60caf590
https://github.com/HWSelf/pytorch_geometric/tree/c1214de674079b5e39e57c045d0f844b60caf590
wide_basic
import torch import torch.nn as nn def get_norm(n_filters, norm): if norm is None: return Identity() elif norm == 'batch': return nn.BatchNorm2d(n_filters, momentum=0.9) elif norm == 'instance': return nn.InstanceNorm2d(n_filters, affine=True) elif norm == 'layer': retu...
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...
FloralZhao/unlimited_labeled_data_project_strong_augmen
wide_basic
false
509
[ "MIT" ]
0
caf90d70145e5d841a38b2e2f18a710703264a28
https://github.com/FloralZhao/unlimited_labeled_data_project_strong_augmen/tree/caf90d70145e5d841a38b2e2f18a710703264a28
DeConvNet2
import torch import torch.nn as nn import torch.nn.functional as F def spectral_norm(module, init=True, std=1, bound=False): if init: nn.init.normal_(module.weight, 0, std) if hasattr(module, 'bias') and module.bias is not None: module.bias.data.zero_() SpectralNorm.apply(module, 'weight',...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
GloryyrolG/normalized-autoencoders
DeConvNet2
false
510
[ "MIT" ]
0
27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
https://github.com/GloryyrolG/normalized-autoencoders/tree/27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
KMomentLoss
import torch import torch.optim import torch.nn as nn class KMomentLoss(nn.Module): def __init__(self, k: 'int'=4): """ k moment distance, where `k` represents the highest order of moment. """ super(KMomentLoss, self).__init__() self.eps = 1e-08 self.k = k def...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.optim import torch.nn as nn assert_size_stride = torch._C._dynamo....
Fyy10/UESTC-Thesis-DA
KMomentLoss
false
511
[ "MIT" ]
0
6cb16efd1f80aa569c90874a806a62dec8afaec4
https://github.com/Fyy10/UESTC-Thesis-DA/tree/6cb16efd1f80aa569c90874a806a62dec8afaec4
DDPGConvBody
import torch import torch.nn as nn import torch.nn.functional as F def layer_init(layer, w_scale=1.0): nn.init.orthogonal_(layer.weight.data) layer.weight.data.mul_(w_scale) nn.init.constant_(layer.bias.data, 0) return layer class DDPGConvBody(nn.Module): def __init__(self, in_channels=4): ...
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 ...
Fieps1/p3-tennis
DDPGConvBody
false
512
[ "MIT" ]
0
29f3dab5810d7cd7f84120416a615956d266c256
https://github.com/Fieps1/p3-tennis/tree/29f3dab5810d7cd7f84120416a615956d266c256
CenteredLayer
import torch from torch import nn class CenteredLayer(nn.Module): def __init__(self, **kwargs): super(CenteredLayer, self).__init__(**kwargs) def forward(self, x): return x - x.mean() 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...
Halo1236/Dive-into-DL-PyTorch
CenteredLayer
false
513
[ "Apache-2.0" ]
0
586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
https://github.com/Halo1236/Dive-into-DL-PyTorch/tree/586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
DenseBlock
import torch import torch.nn as nn class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2): super().__init__() self.padding = dilation self.causal_conv = nn.Conv1d(in_channels, out_channels, kernel_size, padding=self.padding, dil...
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 ...
Hao-Kailong/DisFeb
DenseBlock
false
514
[ "MIT" ]
0
2877edd587556e127d6648ee211ed22838c8d015
https://github.com/Hao-Kailong/DisFeb/tree/2877edd587556e127d6648ee211ed22838c8d015
WordAVGModel
import torch import torch.nn as nn import torch.nn.functional as F class WordAVGModel(nn.Module): def __init__(self, vocab_size, embedding_dim, output_dim, dropout=0.5): super().__init__() self.embedding = nn.Embedding(vocab_size, embedding_dim) self.fc1 = nn.Linear(embedding_dim, int((em...
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...
HanielF/siRNA-Predict-and-RSC-Test-System
WordAVGModel
false
515
[ "Apache-2.0" ]
0
59c41558e0c579ee03168ee860490770ecb0a7a3
https://github.com/HanielF/siRNA-Predict-and-RSC-Test-System/tree/59c41558e0c579ee03168ee860490770ecb0a7a3
Attention
import math import torch import torch.nn.functional as F import torch.fx import torch.utils.data def restricted_softmax(src, dim: 'int'=-1, margin: 'float'=0.0): src_max = torch.clamp(src.max(dim=dim, keepdim=True)[0], min=0.0) out = (src - src_max).exp() out = out / (out.sum(dim=dim, keepdim=True) + (mar...
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....
HWSelf/pytorch_geometric
Attention
false
516
[ "MIT" ]
0
c1214de674079b5e39e57c045d0f844b60caf590
https://github.com/HWSelf/pytorch_geometric/tree/c1214de674079b5e39e57c045d0f844b60caf590
PreNormTransformerDecoderLayer
import torch from torch import nn class PreNormTransformerDecoderLayer(nn.TransformerDecoderLayer): """ A variant of :class:`torch.nn.TransformerDecoderLayer` where layer normalization is included inside the residual branch, and performed before self-attention and feedforward layers. Refer docume...
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....
GeorgeBatch/arch-pre-training
PreNormTransformerDecoderLayer
false
517
[ "MIT" ]
0
7ed75868689e9283d61d11360fdbf4e77d4ebd2e
https://github.com/GeorgeBatch/arch-pre-training/tree/7ed75868689e9283d61d11360fdbf4e77d4ebd2e
CausalConv1d
import torch import torch.nn as nn class CausalConv1d(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=2, dilation=2): super().__init__() self.padding = dilation self.causal_conv = nn.Conv1d(in_channels, out_channels, kernel_size, padding=self.padding, dil...
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...
Hao-Kailong/DisFeb
CausalConv1d
false
518
[ "MIT" ]
0
2877edd587556e127d6648ee211ed22838c8d015
https://github.com/Hao-Kailong/DisFeb/tree/2877edd587556e127d6648ee211ed22838c8d015
ConvNet2FC
import torch import torch.nn as nn def spectral_norm(module, init=True, std=1, bound=False): if init: nn.init.normal_(module.weight, 0, std) if hasattr(module, 'bias') and module.bias is not None: module.bias.data.zero_() SpectralNorm.apply(module, 'weight', bound=bound) return module ...
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_...
GloryyrolG/normalized-autoencoders
ConvNet2FC
false
519
[ "MIT" ]
0
27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
https://github.com/GloryyrolG/normalized-autoencoders/tree/27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
Envelope
import torch import torch.fx import torch.utils.data class Envelope(torch.nn.Module): def __init__(self, exponent): super(Envelope, self).__init__() self.p = exponent + 1 self.a = -(self.p + 1) * (self.p + 2) / 2 self.b = self.p * (self.p + 2) self.c = -self.p * (self.p + ...
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.fx import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynam...
HWSelf/pytorch_geometric
Envelope
false
520
[ "MIT" ]
0
c1214de674079b5e39e57c045d0f844b60caf590
https://github.com/HWSelf/pytorch_geometric/tree/c1214de674079b5e39e57c045d0f844b60caf590
Attn
import torch from torch import nn class Attn(torch.nn.Module): """ Attention: feature_dim: dimension of feature embedding method: method to calculate attention, (general, dot, concat) input_dim: dimension of input embedding, default is the same as feature_dim; method dot is only available wh...
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....
HCDM/XRec
Attn
false
521
[ "MIT" ]
0
dae7d3e1237b8e41913656eb33d81e78c61424ea
https://github.com/HCDM/XRec/tree/dae7d3e1237b8e41913656eb33d81e78c61424ea
Encoder
import torch import torch.nn as nn import torch.nn.functional as F class Encoder(nn.Module): """利用卷积 + 最大池化得到句子嵌入""" def __init__(self, max_length, word_embedding_dim=50, pos_embedding_dim =5, hidden_size=230): nn.Module.__init__(self) self.max_length = max_length self.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 import ...
Hao-Kailong/DisFeb
Encoder
false
522
[ "MIT" ]
0
2877edd587556e127d6648ee211ed22838c8d015
https://github.com/Hao-Kailong/DisFeb/tree/2877edd587556e127d6648ee211ed22838c8d015
CrossNet
import torch from torch import nn class CrossNet(nn.Module): """The Cross Network part of Deep&Cross Network model, which leans both low and high degree cross feature. Input shape - 2D tensor with shape: ``(batch_size, units)``. Output shape - 2D tensor with shape: ``(batch_size, u...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
HCDM/XRec
CrossNet
false
523
[ "MIT" ]
0
dae7d3e1237b8e41913656eb33d81e78c61424ea
https://github.com/HCDM/XRec/tree/dae7d3e1237b8e41913656eb33d81e78c61424ea
VGGASPP
import torch from torch import nn class FCReLUDrop(nn.Sequential): def __init__(self, in_ch, out_ch, kernel_size, dilation, padding, layer_idx, branch_idx): super(FCReLUDrop, self).__init__() self.add_module(f'fc{layer_idx}_{branch_idx}', nn.Conv2d(in_ch, out_ch, kernel_size, ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
HAL-42/DeepLabV2YQ
VGGASPP
false
524
[ "Apache-2.0" ]
0
96bfcf1055da7adeb4a7c1ed841f6ec29957be59
https://github.com/HAL-42/DeepLabV2YQ/tree/96bfcf1055da7adeb4a7c1ed841f6ec29957be59
InstanceNorm2D
import torch import torch.nn as nn class InstanceNorm2D(nn.Module): def __init__(self, num_channels, epsilon=1e-05, momentum=0.9, rescale=True ): super(InstanceNorm2D, self).__init__() self.num_channels = num_channels self.epsilon = epsilon self.momentum = momentum ...
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_...
HarmanDotpy/Normalizations-in-Deep-Learning
InstanceNorm2D
false
525
[ "MIT" ]
0
3e1899837fb3ba625f515ef1a995f3573b65456d
https://github.com/HarmanDotpy/Normalizations-in-Deep-Learning/tree/3e1899837fb3ba625f515ef1a995f3573b65456d
NN
import torch from torch import nn import torch.nn.functional as F class NN(nn.Module): def __init__(self, input_size, num_classes): super(NN, self).__init__() self.fc1 = nn.Linear(input_size, 50) self.fc2 = nn.Linear(50, num_classes) def forward(self, x): x = F.relu(self.fc1(...
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...
HaowenWeiJohn/CV_Project
NN
false
526
[ "MIT" ]
0
8e2414796f60a8c3fe452f3721e4a6ef7edfdb11
https://github.com/HaowenWeiJohn/CV_Project/tree/8e2414796f60a8c3fe452f3721e4a6ef7edfdb11
LayerNorm2D
import torch import torch.nn as nn class LayerNorm2D(nn.Module): def __init__(self, num_channels, epsilon=1e-05): super(LayerNorm2D, self).__init__() self.num_channels = num_channels self.epsilon = epsilon self.gamma = nn.Parameter(torch.ones(num_channels)) self.beta = nn....
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_...
HarmanDotpy/Normalizations-in-Deep-Learning
LayerNorm2D
false
527
[ "MIT" ]
0
3e1899837fb3ba625f515ef1a995f3573b65456d
https://github.com/HarmanDotpy/Normalizations-in-Deep-Learning/tree/3e1899837fb3ba625f515ef1a995f3573b65456d
GroupNorm2D
import torch import torch.nn as nn class GroupNorm2D(nn.Module): def __init__(self, num_channels, num_groups=4, epsilon=1e-05): super(GroupNorm2D, self).__init__() self.num_channels = num_channels self.num_groups = num_channels // 4 self.epsilon = epsilon self.gamma = nn.P...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
HarmanDotpy/Normalizations-in-Deep-Learning
GroupNorm2D
false
528
[ "MIT" ]
0
3e1899837fb3ba625f515ef1a995f3573b65456d
https://github.com/HarmanDotpy/Normalizations-in-Deep-Learning/tree/3e1899837fb3ba625f515ef1a995f3573b65456d
InstanceNorm
import torch import torch.nn as nn class InstanceNorm(nn.Module): def __init__(self, epsilon=1e-08): """ avoid in-place ops. https://discuss.pytorch.org/t/encounter-the-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operation/836/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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_...
Holmes-Alan/Photo2Sketch
InstanceNorm
false
529
[ "MIT" ]
0
43a0ca6bb8a8e645b35a2ab23d11ed5efe117e09
https://github.com/Holmes-Alan/Photo2Sketch/tree/43a0ca6bb8a8e645b35a2ab23d11ed5efe117e09
TVLoss
import torch class TVLoss(torch.nn.Module): def __init__(self): super(TVLoss, self).__init__() def forward(self, x): x.size()[0] h_x = x.size()[2] w_x = x.size()[3] self._tensor_size(x[:, :, 1:, :]) self._tensor_size(x[:, :, :, 1:]) h_tv = torch.pow(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 assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda @triton.j...
Holmes-Alan/Photo2Sketch
TVLoss
false
530
[ "MIT" ]
0
43a0ca6bb8a8e645b35a2ab23d11ed5efe117e09
https://github.com/Holmes-Alan/Photo2Sketch/tree/43a0ca6bb8a8e645b35a2ab23d11ed5efe117e09
Net
import torch from torch import nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 100, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(100, 16, 5) self.fc1 = nn.Linear(16 * 5 * 5, 120)...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import nn assert_s...
Halo1236/Dive-into-DL-PyTorch
Net
false
531
[ "Apache-2.0" ]
0
586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
https://github.com/Halo1236/Dive-into-DL-PyTorch/tree/586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
GlobalAvgPool2d
import torch from torch import nn import torch.nn.functional as F class GlobalAvgPool2d(nn.Module): def __init__(self): super(GlobalAvgPool2d, self).__init__() def forward(self, x): return F.avg_pool2d(x, kernel_size=x.size()[2:]) def get_inputs(): return [torch.rand([4, 4, 4, 4])] d...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Halo1236/Dive-into-DL-PyTorch
GlobalAvgPool2d
false
532
[ "Apache-2.0" ]
0
586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
https://github.com/Halo1236/Dive-into-DL-PyTorch/tree/586b4e9ca77b2121ce5f5bec8b0a893b33f1b574
DeConvNet3
import torch import torch.nn as nn def get_activation(s_act): if s_act == 'relu': return nn.ReLU(inplace=True) elif s_act == 'sigmoid': return nn.Sigmoid() elif s_act == 'softplus': return nn.Softplus() elif s_act == 'linear': return None elif s_act == 'tanh': ...
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_...
GloryyrolG/normalized-autoencoders
DeConvNet3
false
533
[ "MIT" ]
0
27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
https://github.com/GloryyrolG/normalized-autoencoders/tree/27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
AvgPoolPad
import torch import torch.nn as nn from math import * 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_include_pad=Fa...
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 from math import * assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dyna...
Helicopt/torchreid-preprocess
AvgPoolPad
false
534
[ "MIT" ]
0
2597e502eef079705a5f8a9115a9a1980a9d080d
https://github.com/Helicopt/torchreid-preprocess/tree/2597e502eef079705a5f8a9115a9a1980a9d080d
SharpenSoftmax
import torch import torch.nn as nn class SharpenSoftmax(nn.Module): def __init__(self, tau, dim=0): super().__init__() self.tau = tau self.dim = dim def forward(self, pred): pred = pred / self.tau return pred.log_softmax(self.dim) def get_inputs(): return [torch...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
Hayoung93/UDA
SharpenSoftmax
false
535
[ "Apache-2.0" ]
0
a587b01c76141d64e7cead55b62e0f3ed75890bf
https://github.com/Hayoung93/UDA/tree/a587b01c76141d64e7cead55b62e0f3ed75890bf
GramMatrix
import torch import torch.nn as nn class GramMatrix(nn.Module): def forward(self, input): b, c, h, w = input.size() f = input.view(b, c, h * w) G = torch.bmm(f, f.transpose(1, 2)) return G.div_(c * h * w) def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inp...
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...
Holmes-Alan/Photo2Sketch
GramMatrix
false
536
[ "MIT" ]
0
43a0ca6bb8a8e645b35a2ab23d11ed5efe117e09
https://github.com/Holmes-Alan/Photo2Sketch/tree/43a0ca6bb8a8e645b35a2ab23d11ed5efe117e09
HardAttn
import torch from torch.nn import functional as F import torch.nn as nn from math import * class HardAttn(nn.Module): """Hard Attention (Sec. 3.1.II)""" def __init__(self, in_channels): super(HardAttn, self).__init__() self.fc = nn.Linear(in_channels, 4 * 2) self.init_params() 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 from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
Helicopt/torchreid-preprocess
HardAttn
false
537
[ "MIT" ]
0
2597e502eef079705a5f8a9115a9a1980a9d080d
https://github.com/Helicopt/torchreid-preprocess/tree/2597e502eef079705a5f8a9115a9a1980a9d080d
SiamusicLoss
import torch import torch.nn as nn import torch.nn.functional as F class SiamusicLoss(nn.Module): def __init__(self, dim=1): super().__init__() self.dim = dim def neg_cos_sim(self, p, z): z = z.detach() p = F.normalize(p, dim=self.dim) z = F.normalize(z, dim=self.dim)...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import...
HongSungRae/SiamRec
SiamusicLoss
false
538
[ "MIT" ]
0
2ab3b973bc6503eeea66c15c563fdd75b8e5bea1
https://github.com/HongSungRae/SiamRec/tree/2ab3b973bc6503eeea66c15c563fdd75b8e5bea1
styleLoss_v2
import torch import torch.nn as nn def calc_mean_std(feat, eps=1e-05): size = feat.size() assert len(size) == 4 N, C = size[:2] feat_var = feat.view(N, C, -1).var(dim=2) + eps feat_std = feat_var.sqrt().view(N, C, 1, 1) feat_mean = feat.view(N, C, -1).mean(dim=2).view(N, C, 1, 1) return 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.triton_helpers import libdevice import torch.nn as ...
Holmes-Alan/Photo2Sketch
styleLoss_v2
false
539
[ "MIT" ]
0
43a0ca6bb8a8e645b35a2ab23d11ed5efe117e09
https://github.com/Holmes-Alan/Photo2Sketch/tree/43a0ca6bb8a8e645b35a2ab23d11ed5efe117e09
InnerProductDecoder
import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.modules.loss class InnerProductDecoder(nn.Module): """Decoder for using inner product for prediction.""" def __init__(self, dropout, act=torch.sigmoid): super(InnerProductDecoder, self).__init__() self.dropout ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.nn.modules.loss assert_size_stride = torch._C...
HongyiZhu/EHI
InnerProductDecoder
false
540
[ "MIT" ]
0
9fbbc6046546dd7fc6de5d831b4c941bc4404e02
https://github.com/HongyiZhu/EHI/tree/9fbbc6046546dd7fc6de5d831b4c941bc4404e02
AddReadout
import torch import torch.nn as nn class AddReadout(nn.Module): """Handles readout operation when `readout` parameter is `add`. Removes `cls_token` or `readout_token` from tensor and adds it to the rest of tensor""" def __init__(self, start_index=1): super(AddReadout, self).__init__() self.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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
HrithikNambiar/vformer
AddReadout
false
541
[ "MIT" ]
0
5bd902a45e5cae70ab001ca6c217f12f923561f1
https://github.com/HrithikNambiar/vformer/tree/5bd902a45e5cae70ab001ca6c217f12f923561f1
MaxPoolPad
import torch import torch.nn as nn from math import * 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) x = 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 import torch.nn as nn from math import * assert_size_stride = torch._C._dynamo.guards.ass...
Helicopt/torchreid-preprocess
MaxPoolPad
false
542
[ "MIT" ]
0
2597e502eef079705a5f8a9115a9a1980a9d080d
https://github.com/Helicopt/torchreid-preprocess/tree/2597e502eef079705a5f8a9115a9a1980a9d080d
DeConvNet64
import torch import torch.nn as nn def get_activation(s_act): if s_act == 'relu': return nn.ReLU(inplace=True) elif s_act == 'sigmoid': return nn.Sigmoid() elif s_act == 'softplus': return nn.Softplus() elif s_act == 'linear': return None elif s_act == 'tanh': ...
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_...
GloryyrolG/normalized-autoencoders
DeConvNet64
false
543
[ "MIT" ]
0
27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
https://github.com/GloryyrolG/normalized-autoencoders/tree/27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
RoundPass
import torch import torch as t import torch.utils.data class RoundPass(t.nn.Module): def forward(self, x): y = x.round() y_grad = x return (y - y_grad).detach() + y_grad def get_inputs(): return [torch.rand([4, 4, 4, 4])] def get_init_inputs(): return [[], {}]
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch as t import torch.utils.data assert_size_stride = torch._C._dynamo...
HumberMe/lsq-net
RoundPass
false
544
[ "MIT" ]
0
7dcd75bff4aa7ff2d9c8a7902198fe411a38eb4c
https://github.com/HumberMe/lsq-net/tree/7dcd75bff4aa7ff2d9c8a7902198fe411a38eb4c
GraphConvolution
from torch.nn import Module import torch import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn.modules.loss class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ 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.nn import Module i...
HongyiZhu/EHI
GraphConvolution
false
545
[ "MIT" ]
0
9fbbc6046546dd7fc6de5d831b4c941bc4404e02
https://github.com/HongyiZhu/EHI/tree/9fbbc6046546dd7fc6de5d831b4c941bc4404e02
HardMish
import torch import torch.nn as nn import torch.nn.parallel def hard_mish(x, inplace: 'bool'=False): """ Hard Mish Experimental, based on notes by Mish author Diganta Misra at https://github.com/digantamisra98/H-Mish/blob/0da20d4bc58e696b6803f2523c58d3c8a82782d0/README.md """ if inplace: ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guar...
HotaekHan/detr_pytorch
HardMish
false
546
[ "MIT" ]
0
730e02db0ac8910ef782234a3990587771ad67f9
https://github.com/HotaekHan/detr_pytorch/tree/730e02db0ac8910ef782234a3990587771ad67f9
GlobalAvgPool2d
import torch import torch.nn as nn import torch.nn.parallel class GlobalAvgPool2d(nn.Module): def __init__(self): """Global average pooling over the input's spatial dimensions""" super(GlobalAvgPool2d, self).__init__() def forward(self, inputs): return nn.functional.adaptive_avg_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 import torch.nn as nn import torch.nn.parallel assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C...
HotaekHan/detr_pytorch
GlobalAvgPool2d
false
547
[ "MIT" ]
0
730e02db0ac8910ef782234a3990587771ad67f9
https://github.com/HotaekHan/detr_pytorch/tree/730e02db0ac8910ef782234a3990587771ad67f9
Selection
import torch import torch.nn as nn class Selection(nn.Module): """ Selection neurons to sample from a latent representation for a decoder agent. An abstract representation :math:`l_i` is disturbed by a value :math:`r_i` sampled from a normal standard distribution which is scaled by the selection neur...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
HendrikPN/intervention-based-autoencoder
Selection
false
548
[ "Apache-2.0" ]
0
90018d8ea264681cc9b9b55ba9e531e36275136f
https://github.com/HendrikPN/intervention-based-autoencoder/tree/90018d8ea264681cc9b9b55ba9e531e36275136f
Pad_Pool2d
import torch from torch import nn class Pad_Pool2d(nn.Module): """ Implements a padding layer in front of pool1d layers used in our architectures to achieve padding=same output shape Pads 0 to the left and 1 to the right side of x """ def __init__(self, left=0, right=1, top=0, bottom=1, value=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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_str...
Hullimulli/EEGEyeNet
Pad_Pool2d
false
549
[ "MIT" ]
0
677a791b39800f44dc254553b16ee2f92e62c423
https://github.com/Hullimulli/EEGEyeNet/tree/677a791b39800f44dc254553b16ee2f92e62c423
GCNModelVAE
from torch.nn import Module import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module import torch.nn.modules.loss class GraphConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 ...
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.nn import Module i...
HongyiZhu/EHI
GCNModelVAE
false
550
[ "MIT" ]
0
9fbbc6046546dd7fc6de5d831b4c941bc4404e02
https://github.com/HongyiZhu/EHI/tree/9fbbc6046546dd7fc6de5d831b4c941bc4404e02
Pad_Conv2d
import math import torch from torch import nn class Pad_Conv2d(nn.Module): """ Implements a padding layer in front of conv2d layers used in our architectures to achieve padding=same output shape Pads 0 to the left and 1 to the right side of x Input: kernel as a tuple (kx, ky) Output: Pad...
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 math from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guard...
Hullimulli/EEGEyeNet
Pad_Conv2d
false
551
[ "MIT" ]
0
677a791b39800f44dc254553b16ee2f92e62c423
https://github.com/Hullimulli/EEGEyeNet/tree/677a791b39800f44dc254553b16ee2f92e62c423
PatchEmbedding
import torch import torch.nn as nn def pair(t): """ Parameters ---------- t: tuple[int] or int """ return t if isinstance(t, tuple) else (t, t) class PatchEmbedding(nn.Module): """ Parameters ---------- img_size: int Image Size patch_size: int Patch 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.triton_helpers import libdevice import torch.nn as ...
HrithikNambiar/vformer
PatchEmbedding
false
552
[ "MIT" ]
0
5bd902a45e5cae70ab001ca6c217f12f923561f1
https://github.com/HrithikNambiar/vformer/tree/5bd902a45e5cae70ab001ca6c217f12f923561f1
SEModule
import torch import torch.nn as nn import torch.nn.parallel class FastGlobalAvgPool2d(nn.Module): def __init__(self, flatten=False): super(FastGlobalAvgPool2d, self).__init__() self.flatten = flatten def forward(self, x): if self.flatten: in_size = x.size() re...
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 ...
HotaekHan/detr_pytorch
SEModule
false
553
[ "MIT" ]
0
730e02db0ac8910ef782234a3990587771ad67f9
https://github.com/HotaekHan/detr_pytorch/tree/730e02db0ac8910ef782234a3990587771ad67f9
ConvNet64
import torch import torch.nn as nn def get_activation(s_act): if s_act == 'relu': return nn.ReLU(inplace=True) elif s_act == 'sigmoid': return nn.Sigmoid() elif s_act == 'softplus': return nn.Softplus() elif s_act == 'linear': return None elif s_act == 'tanh': ...
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_...
GloryyrolG/normalized-autoencoders
ConvNet64
false
554
[ "MIT" ]
0
27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
https://github.com/GloryyrolG/normalized-autoencoders/tree/27ccb74bb725768f9ba9ea6fa03a7a40867eebb1
FocalLoss
import torch import torch.nn as nn import torch.nn.functional as F def reduce_loss(loss, reduction): """Reduce loss as specified. Args: loss (Tensor): Elementwise loss tensor. reduction (str): Options are "none", "mean" and "sum". Return: Tensor: Reduced loss 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 libdevice, math as tl_math import torc...
HumberMe/mmclassification
FocalLoss
false
555
[ "Apache-2.0" ]
0
68f1542068d3af4db932c97e6a728181432fff0c
https://github.com/HumberMe/mmclassification/tree/68f1542068d3af4db932c97e6a728181432fff0c