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
Normalization
import torch from torch import nn class Normalization(nn.Module): def __init__(self, mean=torch.zeros(3), std=torch.ones(3)): super(Normalization, self).__init__() self.mean = nn.Parameter(mean.view(-1, 1, 1), requires_grad=False) self.std = nn.Parameter(std.view(-1, 1, 1), requires_grad=...
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...
asjir/adain
Normalization
false
6,265
[ "MIT" ]
1
1d0f70f161e485ce61ea57ab619d66e8f4ccadde
https://github.com/asjir/adain/tree/1d0f70f161e485ce61ea57ab619d66e8f4ccadde
BCELoss
import torch import torch.nn as nn import torch.nn.functional as F class BCELoss(nn.Module): """Binary Cross Entropy loss.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.binary_cross_entropy self.use_target_weight = use_target_we...
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...
atoaiari/mmpose
BCELoss
false
6,266
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
KLDLossWithStandardGaussian
import torch import torch.nn as nn import torch.utils.data class KLDLossWithStandardGaussian(nn.Module): def forward(self, mu, logvar): return -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp()) def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])] def get_init_inputs(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
atmacvit/meronymnet
KLDLossWithStandardGaussian
false
6,267
[ "MIT" ]
1
47e1a7caadc0f770439bb26a93b885f790f62804
https://github.com/atmacvit/meronymnet/tree/47e1a7caadc0f770439bb26a93b885f790f62804
KLDLossWithStandardGaussianNoReduction
import torch import torch.nn as nn import torch.utils.data class KLDLossWithStandardGaussianNoReduction(nn.Module): def forward(self, mu, logvar): KLD = -0.5 * torch.sum(1 + logvar - mu.pow(2) - logvar.exp(), dim=-1) return KLD def get_inputs(): return [torch.rand([4, 4, 4, 4]), torch.rand(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn import torch.utils.data assert_size_stride = torch....
atmacvit/meronymnet
KLDLossWithStandardGaussianNoReduction
false
6,268
[ "MIT" ]
1
47e1a7caadc0f770439bb26a93b885f790f62804
https://github.com/atmacvit/meronymnet/tree/47e1a7caadc0f770439bb26a93b885f790f62804
MSELoss
import torch import torch.nn as nn import torch.nn.functional as F class MSELoss(nn.Module): """MSE loss for coordinate regression.""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.mse_loss self.use_target_weight = use_target_weigh...
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.functional as F assert_size_stride = torch._C._dyna...
atoaiari/mmpose
MSELoss
false
6,269
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
SpatialEmbedding
import torch import torch.nn class SpatialEmbedding(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super(SpatialEmbedding, self).__init__() self.b = torch.zeros((in_features, out_features)) self.b.normal_(0, weight_multiplier) self.b = torc...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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....
ashwinpn/Computer-Vision
SpatialEmbedding
false
6,270
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
KLDLoss
import torch import torch.nn as nn import torch.utils.data class KLDLoss(nn.Module): def forward(self, mu1, logvar1, mu2, logvar2): batch_size = mu1.shape[0] sigma1 = logvar1.mul(0.5).exp() sigma2 = logvar2.mul(0.5).exp() kld = torch.log(sigma2 / sigma1 + 1e-08) + (torch.exp(logva...
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 ...
atmacvit/meronymnet
KLDLoss
false
6,271
[ "MIT" ]
1
47e1a7caadc0f770439bb26a93b885f790f62804
https://github.com/atmacvit/meronymnet/tree/47e1a7caadc0f770439bb26a93b885f790f62804
CuboidPoseHead
import torch import torch.nn as nn import torch.nn.functional as F class CuboidPoseHead(nn.Module): def __init__(self, beta): """Get results from the 3D human pose heatmap. Instead of obtaining maximums on the heatmap, this module regresses the coordinates of keypoints via integral pose r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert...
atoaiari/mmpose
CuboidPoseHead
false
6,272
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
KLDLossNoReduction
import torch import torch.nn as nn import torch.utils.data class KLDLossNoReduction(nn.Module): def forward(self, mu1, logvar1, mu2, logvar2): sigma1 = logvar1.mul(0.5).exp() sigma2 = logvar2.mul(0.5).exp() kld = torch.log(sigma2 / sigma1 + 1e-08) + (torch.exp(logvar1) + ( mu1...
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 import torch.utils.data assert_size_stride = torch....
atmacvit/meronymnet
KLDLossNoReduction
false
6,273
[ "MIT" ]
1
47e1a7caadc0f770439bb26a93b885f790f62804
https://github.com/atmacvit/meronymnet/tree/47e1a7caadc0f770439bb26a93b885f790f62804
SimpleSpatialEmbedding
import torch import torch.nn class SimpleSpatialEmbedding(torch.nn.Module): def __init__(self, in_features, out_features, weight_multiplier=1.0): super(SimpleSpatialEmbedding, self).__init__() self.b = torch.zeros((in_features, out_features)) self.b.normal_(0, weight_multiplier) s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import torch....
ashwinpn/Computer-Vision
SimpleSpatialEmbedding
false
6,274
[ "MIT" ]
1
9dc3abfe416385171b76e2bad6872e10f36a12b4
https://github.com/ashwinpn/Computer-Vision/tree/9dc3abfe416385171b76e2bad6872e10f36a12b4
MPJPELoss
import torch import torch.nn as nn class MPJPELoss(nn.Module): """MPJPE (Mean Per Joint Position Error) loss. Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the loss. Default:...
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_...
atoaiari/mmpose
MPJPELoss
false
6,275
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
SelfGate
import torch import torch.nn as nn from torch.nn import functional as F class SelfGate(nn.Module): def __init__(self, dim_in, dim_out): super().__init__() self.proj = nn.Linear(dim_in, dim_out * 2) def forward(self, x): x = self.proj(x) x, gate = x.chunk(2, dim=-1) 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, math as tl_math im...
awesome-archive/AI-Writer
SelfGate
false
6,276
[ "BSD-3-Clause" ]
1
abdcd5582f81fca2f677a020360654865bf82065
https://github.com/awesome-archive/AI-Writer/tree/abdcd5582f81fca2f677a020360654865bf82065
GELU
import torch import numpy as np from torch import nn import torch.nn.functional as F class GELU(nn.Module): def __init__(self): super(GELU, self).__init__() def forward(self, x): return 0.5 * x * (1 + F.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) 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.triton_helpers import libdevice from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
au55555/classification-pytorch
GELU
false
6,277
[ "MIT" ]
1
1937599ae6e688ed7af7470f69964fb6f97241c4
https://github.com/au55555/classification-pytorch/tree/1937599ae6e688ed7af7470f69964fb6f97241c4
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...
aswanthkrishna/reinforced_scinet
Selection
false
6,278
[ "Apache-2.0" ]
1
b520f0c73bb1cdf0d0595f0df32372c96946d963
https://github.com/aswanthkrishna/reinforced_scinet/tree/b520f0c73bb1cdf0d0595f0df32372c96946d963
SmoothL1Loss
import torch import torch.nn as nn import torch.nn.functional as F class SmoothL1Loss(nn.Module): """SmoothL1Loss loss. Args: use_target_weight (bool): Option to use weighted MSE loss. Different joint types may have different target weights. loss_weight (float): Weight of the loss...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import math as tl_math import torch.nn as nn ...
atoaiari/mmpose
SmoothL1Loss
false
6,279
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
L1Loss
import torch import torch.nn as nn import torch.nn.functional as F class L1Loss(nn.Module): """L1Loss loss .""" def __init__(self, use_target_weight=False, loss_weight=1.0): super().__init__() self.criterion = F.l1_loss self.use_target_weight = use_target_weight self.loss_weig...
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 ...
atoaiari/mmpose
L1Loss
false
6,280
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
Postnet
import torch from torch import nn class Postnet(nn.Module): """Postnet is a simple linear layer for predicting the target frames given the RNN context during training. We don't need the Postnet for feature extraction. """ def __init__(self, input_size, output_size=80): super(Postnet, 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 import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
aviasd/Mockingjay-Speech-Representation
Postnet
false
6,281
[ "MIT" ]
1
c01aef3f98bbb3fd4b0fc1b61e77fb5d02a0e453
https://github.com/aviasd/Mockingjay-Speech-Representation/tree/c01aef3f98bbb3fd4b0fc1b61e77fb5d02a0e453
DivideMax
import torch from torch import nn import torch.utils.data class DivideMax(nn.Module): def __init__(self, dim): super().__init__() self.dim = dim def forward(self, x): maxes = x.amax(dim=self.dim, keepdim=True) return x / maxes def get_inputs(): return [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 import nn import torch.utils.data assert_size_stride = torch._C._dynamo.guards...
avihu111/viewpoint_disentanglement
DivideMax
false
6,282
[ "MIT" ]
1
07aa4e119426a500fb1e5b5929909cd791982f27
https://github.com/avihu111/viewpoint_disentanglement/tree/07aa4e119426a500fb1e5b5929909cd791982f27
Mlp
import torch import numpy as np from torch import nn import torch.nn.functional as F class GELU(nn.Module): def __init__(self): super(GELU, self).__init__() def forward(self, x): return 0.5 * x * (1 + F.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))) class Mlp(nn.M...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import numpy as np ...
au55555/classification-pytorch
Mlp
false
6,283
[ "MIT" ]
1
1937599ae6e688ed7af7470f69964fb6f97241c4
https://github.com/au55555/classification-pytorch/tree/1937599ae6e688ed7af7470f69964fb6f97241c4
AllocatingLayer
from torch.nn import Module import torch from torch.nn.modules.module import Module class AllocatingLayer(Module): """The actor NN base its output for the case of full CSI on a continuous relaxation of the problem. Specifically it gives a value for every user. This layer will start allocating to the most val...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from torch.nn.modules.module import Module assert_si...
avranasa/DRL_Scheduling_Communications
AllocatingLayer
false
6,284
[ "MIT" ]
1
2e6cb3a9599e43b73547f4281d82b1e5999271b7
https://github.com/avranasa/DRL_Scheduling_Communications/tree/2e6cb3a9599e43b73547f4281d82b1e5999271b7
TauSTE
from torch.nn import Module import torch from typing import Any import torch.nn.functional as F class TauSTEFunction(torch.autograd.Function): @staticmethod def forward(ctx: 'Any', tau_threshold: 'float', input: 'Any') ->Any: return (input > tau_threshold).float() @staticmethod def backward(...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module from typing import Any import torch.nn.functional as F assert_size_stride = torch._C._dynamo.guards.assert_size_...
atreyasha/spp-explainability
TauSTE
false
6,285
[ "MIT" ]
1
c959b837591cc1980d057a67f682e00b1f3e8e37
https://github.com/atreyasha/spp-explainability/tree/c959b837591cc1980d057a67f682e00b1f3e8e37
RoutingCapsules
import torch import torch.nn as nn import torch.nn.functional as F def squash(x, dim=-1, epsilon=1e-08): norm = (x ** 2).sum(dim=dim, keepdim=True) x = norm / (norm + 1) * x / (torch.sqrt(norm) + epsilon) return x class RoutingCapsules(nn.Module): """ input capsules_num: new feature, num...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ashawkey/CapsNet.pytorch
RoutingCapsules
false
6,286
[ "MIT" ]
1
3b796b572bbabe79cc445c35913cd3584733aedf
https://github.com/ashawkey/CapsNet.pytorch/tree/3b796b572bbabe79cc445c35913cd3584733aedf
MaxMarginRankingLoss
import torch import torch.nn.functional as F import torch.nn as nn import torch as th import torch.optim import torch.utils.data class MaxMarginRankingLoss(nn.Module): def __init__(self, margin=1): super(MaxMarginRankingLoss, self).__init__() self.loss = th.nn.MarginRankingLoss(margin) se...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch as th import torch.optim import torch.utils.data asser...
awesome-archive/Video-to-Online-Platform
MaxMarginRankingLoss
false
6,287
[ "Apache-2.0" ]
1
4f91724133a817e79bce91e0abbd46cf38a31167
https://github.com/awesome-archive/Video-to-Online-Platform/tree/4f91724133a817e79bce91e0abbd46cf38a31167
WingLoss
import math import torch import torch.nn as nn class WingLoss(nn.Module): """Wing Loss. paper ref: 'Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks' Feng et al. CVPR'2018. Args: omega (float): Also referred to as width. epsilon (float): Also referred t...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
atoaiari/mmpose
WingLoss
false
6,288
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
SoftWingLoss
import math import torch import torch.nn as nn class SoftWingLoss(nn.Module): """Soft Wing Loss 'Structure-Coherent Deep Feature Learning for Robust Face Alignment' Lin et al. TIP'2021. loss = 1. |x| , if |x| < omega1 2. omega2*ln(1+|x|/epsilon) + B, if |x| >= om...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import math as tl_math import math import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
atoaiari/mmpose
SoftWingLoss
false
6,289
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
SSLoss
import torch import numpy as np import torch.nn as nn import torch.utils.data import torch def sum_tensor(inp, axes, keepdim=False): axes = np.unique(axes).astype(int) if keepdim: for ax in axes: inp = inp.sum(int(ax), keepdim=True) else: for ax in sorted(axes, reverse=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 import numpy as np import torch.nn as nn import torch.utils.data import torch assert_size_stride = torch._C._dynamo.guards.assert_size_strid...
ayanglab/HDL
SSLoss
false
6,290
[ "Apache-2.0" ]
1
5ff778d713331671ffa85e9fb63378d8c0a57769
https://github.com/ayanglab/HDL/tree/5ff778d713331671ffa85e9fb63378d8c0a57769
ScaledDotProductAttention
import torch import torch.nn.functional as F import torch.nn as nn class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention """ def __init__(self, temperature, attn_dropout=0.1): super().__init__() self.temperature = temperature self.dropout = nn.Dropout(attn_dropo...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
awesome-archive/FEAT
ScaledDotProductAttention
false
6,291
[ "MIT" ]
1
940d525fcbf2a40528d284392a03e4b0193344a7
https://github.com/awesome-archive/FEAT/tree/940d525fcbf2a40528d284392a03e4b0193344a7
GraphConvolution
import torch import torch.nn as nn import torch.nn.functional as F class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, dropout=0.3): super(GraphConvolution, self).__init__() self.in_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
ayyyq/T-LSTM
GraphConvolution
false
6,292
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
LayerNorm
import torch import torch.nn as nn import torch.optim class LayerNorm(nn.Module): """A Layer Normalization layer. Lei Ba, Jimmy, Jamie Ryan Kiros, and Geoffrey E. Hinton. arXiv preprint arXiv:1607.06450 (2016). """ def __init__(self, dim): super(LayerNorm, self).__init__() s...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as nn import torch.optim assert_size_stride = torch._C._dynamo....
awesome-archive/nmtpytorch
LayerNorm
false
6,293
[ "MIT" ]
1
7c0ea21b29fc85a1f30ef4400d62b9d8e3d88be4
https://github.com/awesome-archive/nmtpytorch/tree/7c0ea21b29fc85a1f30ef4400d62b9d8e3d88be4
AttentionModule
import torch import torch.nn as nn import torch.nn.functional as F class AttentionModule(nn.Module): """ A neural module that takes a feature map, attends to the features, and produces an attention. """ def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim, kerne...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
aymenx17/ShapeCount
AttentionModule
false
6,294
[ "Apache-2.0" ]
1
6d2fb780684335ccd0127b3084bf40674203bcf1
https://github.com/aymenx17/ShapeCount/tree/6d2fb780684335ccd0127b3084bf40674203bcf1
GDiceLossV2
import torch import torch.nn as nn import torch.utils.data import torch from torch.autograd import Variable def flatten(tensor): """Flattens a given tensor such that the channel axis is first. The shapes are transformed as follows: (N, C, D, H, W) -> (C, N * D * H * W) """ C = tensor.size(1) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torch.utils.data import torch assert_size_stride = torch._C....
ayanglab/HDL
GDiceLossV2
false
6,295
[ "Apache-2.0" ]
1
5ff778d713331671ffa85e9fb63378d8c0a57769
https://github.com/ayanglab/HDL/tree/5ff778d713331671ffa85e9fb63378d8c0a57769
BCELoss
import torch import torch.nn as nn class BCELoss(nn.BCELoss): def __init__(self, **kwargs): super(BCELoss, self).__init__(**kwargs) def forward(self, input, target): input = input.squeeze(1) target = target.float() return super(BCELoss, self).forward(input, target) def get_...
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...
azxj/BRRNet
BCELoss
false
6,296
[ "MIT" ]
1
274068efd5453f2c1fb07bfaad448d048b9c793b
https://github.com/azxj/BRRNet/tree/274068efd5453f2c1fb07bfaad448d048b9c793b
LogLoss
import torch from torch.nn import MSELoss class LogLoss(MSELoss): def __init__(self): super(LogLoss, self).__init__() self.loss = torch.nn.MSELoss() self.loss2 = torch.nn.MSELoss() def forward(self, input, target): tgt = torch.atan(target) inp = torch.atan(input) ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime.triton_helpers import libdevice from torch.nn import MSELoss...
aykuttasil/mindsdb
LogLoss
false
6,297
[ "MIT" ]
1
2c36b6f75f13d7104fe4d3dbb7ca307fa84f45ad
https://github.com/aykuttasil/mindsdb/tree/2c36b6f75f13d7104fe4d3dbb7ca307fa84f45ad
QueryModule
import torch import torch.nn as nn import torch.nn.functional as F class QueryModule(nn.Module): """ A neural module that takes as input a feature map and an attention and produces a feature map as output. """ def __init__(self, dim): super().__init__() self.conv1 = nn.Conv2d(dim, dim...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
aymenx17/ShapeCount
QueryModule
false
6,298
[ "Apache-2.0" ]
1
6d2fb780684335ccd0127b3084bf40674203bcf1
https://github.com/aymenx17/ShapeCount/tree/6d2fb780684335ccd0127b3084bf40674203bcf1
GCN
import torch import torch.nn as nn import torch.nn.functional as F class GraphConvolution(nn.Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, in_features, out_features, dropout=0.3): super(GraphConvolution, self).__init__() self.in_feat...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
ayyyq/T-LSTM
GCN
false
6,299
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 94 * 94, 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 import torch.nn as nn assert_...
arefmalek/Demographics_Disenfranchisement
Net
false
6,300
[ "MIT" ]
1
f4ae8c0965cf1b1cab9b245c3f5f54d3b5fe9aba
https://github.com/arefmalek/Demographics_Disenfranchisement/tree/f4ae8c0965cf1b1cab9b245c3f5f54d3b5fe9aba
ExgLayer
import torch import torch.nn as nn class ExgLayer(nn.Module): def __init__(self, x_size, h_size, g_size, out_size): super(ExgLayer, self).__init__() self.h_size = h_size self.g_size = g_size self.out_size = out_size self.x_size = x_size self.linear_x2 = nn.Linear(x...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ayyyq/T-LSTM
ExgLayer
false
6,301
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
myCustomModel
import logging import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class BaseModel(nn.Module): """ Base class for all models All models require an initialization a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
awoloshuk/NephNet
myCustomModel
false
6,302
[ "MIT" ]
1
562431364874fef1680069c7a5235c67b96504b8
https://github.com/awoloshuk/NephNet/tree/562431364874fef1680069c7a5235c67b96504b8
DiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=1.0): super(DiceLoss, self).__init__() self.smooth = smooth def forward(self, input, target): n = input.shape[0] input = input.view(n, -1) target = target.view(n, -1) inter...
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...
azxj/BRRNet
DiceLoss
false
6,303
[ "MIT" ]
1
274068efd5453f2c1fb07bfaad448d048b9c793b
https://github.com/azxj/BRRNet/tree/274068efd5453f2c1fb07bfaad448d048b9c793b
CombinedTargetMSELoss
import torch import torch.nn as nn class CombinedTargetMSELoss(nn.Module): """MSE loss for combined target. CombinedTarget: The combination of classification target (response map) and regression target (offset map). Paper ref: Huang et al. The Devil is in the Details: Delving into ...
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...
atoaiari/mmpose
CombinedTargetMSELoss
false
6,304
[ "Apache-2.0" ]
1
256a9117767008e8c33b4038a346aca12233e300
https://github.com/atoaiari/mmpose/tree/256a9117767008e8c33b4038a346aca12233e300
DiceLoss
import torch import torch.nn as nn import torch.utils.data import torch class DiceLoss(nn.Module): def __init__(self): super(DiceLoss, self).__init__() def forward(self, pred, target): pred = pred.squeeze(dim=1) dice = 2 * (pred * target).sum(dim=1).sum(dim=1).sum(dim=1) / (pred ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data import torch assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cud...
ayanglab/HDL
DiceLoss
false
6,305
[ "Apache-2.0" ]
1
5ff778d713331671ffa85e9fb63378d8c0a57769
https://github.com/ayanglab/HDL/tree/5ff778d713331671ffa85e9fb63378d8c0a57769
SigmoidBCELoss
import torch import torch.nn as nn class SigmoidBCELoss(nn.BCEWithLogitsLoss): def __init__(self, **kwargs): super(SigmoidBCELoss, self).__init__(**kwargs) def forward(self, input, target): input = input.squeeze(1) target = target.float() return super(SigmoidBCELoss, self).fo...
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...
azxj/BRRNet
SigmoidBCELoss
false
6,306
[ "MIT" ]
1
274068efd5453f2c1fb07bfaad448d048b9c793b
https://github.com/azxj/BRRNet/tree/274068efd5453f2c1fb07bfaad448d048b9c793b
SqueezeExcitation
import torch from torch import Tensor import torch.nn.functional as F from torch import nn from torchvision.models.mobilenetv2 import _make_divisible class SqueezeExcitation(nn.Module): def __init__(self, input_channels: 'int', squeeze_factor: 'int'=4): super().__init__() squeeze_channels = _make...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch import Tensor impo...
ayrna/ordinal-cnn-ecoc
SqueezeExcitation
false
6,307
[ "BSD-3-Clause" ]
1
2b7909d036612727a45a174c891c4e749c3b60c4
https://github.com/ayrna/ordinal-cnn-ecoc/tree/2b7909d036612727a45a174c891c4e749c3b60c4
templateModel
import logging import torch import numpy as np import torch.nn as nn from torch.nn import functional as F import torch.nn.parallel import torch.optim import torch.utils.data import torch.utils.data.distributed class BaseModel(nn.Module): """ Base class for all models All models require an initialization a...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 logging import numpy a...
awoloshuk/NephNet
templateModel
false
6,308
[ "MIT" ]
1
562431364874fef1680069c7a5235c67b96504b8
https://github.com/awoloshuk/NephNet/tree/562431364874fef1680069c7a5235c67b96504b8
ScaledDotProductAttention
import torch import torch.nn as nn import torch.nn.functional as F class ScaledDotProductAttention(nn.Module): """ Scaled Dot-Product Attention --baseline version""" def __init__(self, dropout=0.3): super().__init__() self.dropout = nn.Dropout(dropout) def forward(self, q, k, v, mask=Non...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
ayyyq/T-LSTM
ScaledDotProductAttention
false
6,309
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
SentenceMatrixLayer
import torch import torch.nn as nn class SentenceMatrixLayer(nn.Module): def __init__(self, in_size, out_size=1, p_Asem=0.6): super(SentenceMatrixLayer, self).__init__() self.in_size = in_size self.out_size = out_size self.p_Asem = p_Asem self.linear = nn.Linear(in_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ayyyq/T-LSTM
SentenceMatrixLayer
false
6,310
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
SplitDim
import torch import torch.nn as nn class SplitDim(nn.Module): def __init__(self, nonlin_col=1, nonlin_type=torch.nn.functional. softplus, correction=True): super(SplitDim, self).__init__() self.nonlinearity = nonlin_type self.col = nonlin_col if correction: 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.triton_helpers import libdevice, math as tl_math import torch.nn as nn assert_size_stride = torch._C._dynamo.gu...
b4thesunrise/drbayes
SplitDim
false
6,311
[ "BSD-2-Clause" ]
1
9bc827aea2c7f084fb1ee77a4bd9f3c9726ecf8c
https://github.com/b4thesunrise/drbayes/tree/9bc827aea2c7f084fb1ee77a4bd9f3c9726ecf8c
ReSentenceMatrixLayer
import torch import torch.nn as nn class ReSentenceMatrixLayer(nn.Module): def __init__(self, in_size, out_size=1): super(ReSentenceMatrixLayer, self).__init__() self.in_size = in_size self.out_size = out_size self.a_Asem = nn.Parameter(torch.tensor(0.0)) self.linear = 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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
ayyyq/T-LSTM
ReSentenceMatrixLayer
false
6,312
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
Qnet
import random import torch import torch.nn as nn import torch.nn.functional as F class Qnet(nn.Module): def __init__(self): super(Qnet, self).__init__() self.fc1 = nn.Linear(4, 128) self.fc2 = nn.Linear(128, 128) self.fc3 = nn.Linear(128, 2) def forward(self, x): x = ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import random import torch.nn...
azeye/QuickstartRL
Qnet
false
6,313
[ "MIT" ]
1
ae1a9eb8bc0c5f52700fa0ac19ce5abcf3ccdefa
https://github.com/azeye/QuickstartRL/tree/ae1a9eb8bc0c5f52700fa0ac19ce5abcf3ccdefa
HardSwish
import torch import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.functional as F def hard_swish(x: 'torch.Tensor', inplace: 'bool'=False): """Hard swish.""" inner = F.relu6(x + 3.0).div_(6.0) return x.mul_(inner) if inplace else x.mul(inner) class HardSwish(nn.Module): ...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn import torchvision.transforms.functional as F import torch.nn.funct...
bcaitech1/p4-mod-model_diet
HardSwish
false
6,314
[ "MIT" ]
1
36d8a747e12c375b07d132ed4d08f9fc77126a8b
https://github.com/bcaitech1/p4-mod-model_diet/tree/36d8a747e12c375b07d132ed4d08f9fc77126a8b
PoswiseFeedForwardNet
from _paritybench_helpers import _mock_config import torch import torch.nn as nn import torch.nn.functional as F class PoswiseFeedForwardNet(nn.Module): """ feed forward """ def __init__(self, config): super().__init__() self.config = config self.conv1 = nn.Conv1d(in_channels=self.con...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime.triton_helpers import libdevice import torch.nn as ...
bage79/transformer-evolution-bage
PoswiseFeedForwardNet
false
6,315
[ "Apache-2.0" ]
1
715bdf61421dc19e21fb0f66bfa4b564305987f8
https://github.com/bage79/transformer-evolution-bage/tree/715bdf61421dc19e21fb0f66bfa4b564305987f8
CNNHead
import torch import torch.nn as nn class CNNHead(nn.Module): def __init__(self, input_dim): super().__init__() self.conv = nn.Conv1d(in_channels=input_dim, out_channels=2, kernel_size=3, padding=1) self.relu = nn.ReLU() def forward(self, x): return self.relu(self....
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
baseballChatbot7/KBO_MRC
CNNHead
false
6,316
[ "MIT" ]
1
ad11318d785bacdf29a12adfd25afe90d7ff2779
https://github.com/baseballChatbot7/KBO_MRC/tree/ad11318d785bacdf29a12adfd25afe90d7ff2779
IdentityMessage
import torch 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, z_dst, raw_msg...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
beneisner/pytorch_geometric
IdentityMessage
false
6,317
[ "MIT" ]
1
53d44a96bd2de2753b1ab1d7153c026c92606a81
https://github.com/beneisner/pytorch_geometric/tree/53d44a96bd2de2753b1ab1d7153c026c92606a81
SigmoidDiceLoss
import torch import torch.nn as nn class DiceLoss(nn.Module): def __init__(self, smooth=1.0): super(DiceLoss, self).__init__() self.smooth = smooth def forward(self, input, target): n = input.shape[0] input = input.view(n, -1) target = target.view(n, -1) inter...
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...
azxj/BRRNet
SigmoidDiceLoss
false
6,318
[ "MIT" ]
1
274068efd5453f2c1fb07bfaad448d048b9c793b
https://github.com/azxj/BRRNet/tree/274068efd5453f2c1fb07bfaad448d048b9c793b
PolicyModuleAlt
import torch import torch.nn as nn import torch.nn.functional as F class PolicyModuleAlt(nn.Module): def __init__(self, input_dim, hid_dim, n_actions): super().__init__() self.fc_1 = nn.Linear(input_dim, hid_dim) self.fc_2 = nn.Linear(hid_dim, hid_dim) self.fc_a = nn.Linear(hid_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 assert_...
bentrevett/task-oriented-language-grounding
PolicyModuleAlt
false
6,319
[ "MIT" ]
1
812a7bc21ee622030eb0594c576c7d60dc630148
https://github.com/bentrevett/task-oriented-language-grounding/tree/812a7bc21ee622030eb0594c576c7d60dc630148
feedforwardLayer
import torch import torch.nn as nn import torch.nn.functional as F class feedforwardLayer(nn.Module): """ A two-feed-forward-layer module """ def __init__(self, d_in, d_hid, dropout=0.3): super().__init__() self.w_1 = nn.Linear(d_in, d_hid) self.w_2 = nn.Linear(d_hid, d_in) se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
ayyyq/T-LSTM
feedforwardLayer
false
6,320
[ "MIT" ]
1
36dbc88ac710d3925851cd87c2368ecfc7061b70
https://github.com/ayyyq/T-LSTM/tree/36dbc88ac710d3925851cd87c2368ecfc7061b70
Envelope
import torch 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 + 1) / 2 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 import torch.utils.data assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_...
beneisner/pytorch_geometric
Envelope
false
6,321
[ "MIT" ]
1
53d44a96bd2de2753b1ab1d7153c026c92606a81
https://github.com/beneisner/pytorch_geometric/tree/53d44a96bd2de2753b1ab1d7153c026c92606a81
CR
import torch from typing import List from typing import Union import torch.nn as nn def autopad(kernel_size: 'Union[int, List[int]]', padding: 'Union[int, None]'=None) ->Union[int, List[int]]: """Auto padding calculation for pad='same' in TensorFlow.""" if isinstance(kernel_size, int): 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 typing import List from ...
bcaitech1/p4-mod-model_diet
CR
false
6,322
[ "MIT" ]
1
36d8a747e12c375b07d132ed4d08f9fc77126a8b
https://github.com/bcaitech1/p4-mod-model_diet/tree/36d8a747e12c375b07d132ed4d08f9fc77126a8b
bodypose_model
import torch from collections import OrderedDict import torch.nn as nn def make_layers(block, no_relu_layers): layers = [] for layer_name, v in block.items(): if 'pool' in layer_name: layer = nn.MaxPool2d(kernel_size=v[0], stride=v[1], padding=v[2]) layers.append((layer_name, l...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 collections import Order...
alanlee-chn/handpose-est
bodypose_model
false
6,323
[ "MIT" ]
1
241a6beb45e045e65a328aade22ce536f4dcd893
https://github.com/alanlee-chn/handpose-est/tree/241a6beb45e045e65a328aade22ce536f4dcd893
ShiftedSoftplus
import torch import torch.nn.functional as F import torch.utils.data class ShiftedSoftplus(torch.nn.Module): def __init__(self): super(ShiftedSoftplus, self).__init__() self.shift = torch.log(torch.tensor(2.0)).item() def forward(self, x): return F.softplus(x) - self.shift def get_...
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.utils.data assert_size_stride = torch._C._dynamo....
beneisner/pytorch_geometric
ShiftedSoftplus
false
6,324
[ "MIT" ]
1
53d44a96bd2de2753b1ab1d7153c026c92606a81
https://github.com/beneisner/pytorch_geometric/tree/53d44a96bd2de2753b1ab1d7153c026c92606a81
ImageProcessingModule
import torch import torch.nn as nn import torch.nn.functional as F class ImageProcessingModule(nn.Module): def __init__(self, n_filters): super().__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=n_filters, kernel_size=7, stride=7) def forward(self, observation): ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bentrevett/task-oriented-language-grounding
ImageProcessingModule
false
6,325
[ "MIT" ]
1
812a7bc21ee622030eb0594c576c7d60dc630148
https://github.com/bentrevett/task-oriented-language-grounding/tree/812a7bc21ee622030eb0594c576c7d60dc630148
BinaryChunk
import math import torch class BinaryChunk(torch.nn.Module): def __init__(self, nCls, isLogit=False, pooling='max', chunk_dim=-1): super(BinaryChunk, self).__init__() self.nClass = nCls self.nChunk = int(math.ceil(math.log2(self.nClass))) self.pooling = pooling self.isLogi...
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 math assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided...
azopticsinc/optical-neural-network
BinaryChunk
false
6,326
[ "MIT" ]
1
28280014a6c1fc717a5077ed5e3c3496a4b103ac
https://github.com/azopticsinc/optical-neural-network/tree/28280014a6c1fc717a5077ed5e3c3496a4b103ac
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...
bharadwaj1098/sparseml
Accuracy
false
6,327
[ "Apache-2.0" ]
1
b43dc3edc9f7e6cd32368937b7ed3352180abe52
https://github.com/bharadwaj1098/sparseml/tree/b43dc3edc9f7e6cd32368937b7ed3352180abe52
Attention
import math import torch import torch.nn.functional as F 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) + (margin - src_max).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 from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
beneisner/pytorch_geometric
Attention
false
6,328
[ "MIT" ]
1
53d44a96bd2de2753b1ab1d7153c026c92606a81
https://github.com/beneisner/pytorch_geometric/tree/53d44a96bd2de2753b1ab1d7153c026c92606a81
DentReLU
import torch import torch.nn as nn class DentReLUFunction(torch.autograd.Function): @staticmethod def forward(ctx, input, p): ctx.save_for_backward(input) ctx.p = p output = input.clone() mask1 = p <= input mask2 = input <= 0 output[mask1 & mask2] = 0 r...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._empty_st...
bfeng/pytorch-cifar
DentReLU
false
6,329
[ "MIT" ]
1
6de257bb4b489429785502d487044c55bec62aae
https://github.com/bfeng/pytorch-cifar/tree/6de257bb4b489429785502d487044c55bec62aae
LuongAttentionConcat
import torch import torch.nn as nn import torch.nn.functional as F class LuongAttentionConcat(nn.Module): def __init__(self, units, hidden_size): super().__init__() self.W = nn.Linear(2 * hidden_size, units) self.V = nn.Linear(units, 1) def forward(self, query, values): query...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
beroguedou/nmt-pytorch
LuongAttentionConcat
false
6,330
[ "MIT" ]
1
8758ba33e2d5f4eca7f1ac2d04582678332bbcd5
https://github.com/beroguedou/nmt-pytorch/tree/8758ba33e2d5f4eca7f1ac2d04582678332bbcd5
BahdanauAttention
import torch import torch.nn as nn import torch.nn.functional as F class BahdanauAttention(nn.Module): def __init__(self, units, hidden_size): super().__init__() self.W1 = nn.Linear(hidden_size, units) self.W2 = nn.Linear(hidden_size, units) self.V = nn.Linear(units, 1) def f...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
beroguedou/nmt-pytorch
BahdanauAttention
false
6,331
[ "MIT" ]
1
8758ba33e2d5f4eca7f1ac2d04582678332bbcd5
https://github.com/beroguedou/nmt-pytorch/tree/8758ba33e2d5f4eca7f1ac2d04582678332bbcd5
RC
import torch import torch.nn as nn import torch.nn.functional as F class RC(nn.Module): """ A wrapper class for ReflectionPad2d, Conv2d and an optional relu """ def __init__(self, in_dim, out_dim, kernel_size=3, padding=1, activation_function=True): super().__init__() self.pad...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
benningtonlee7/AdaIn_Style_Transfer_From_Scratch_In_Pytorch
RC
false
6,332
[ "MIT" ]
1
50dfe4bdcbcdd0f4e647f9ee45de2a3f81eb6722
https://github.com/benningtonlee7/AdaIn_Style_Transfer_From_Scratch_In_Pytorch/tree/50dfe4bdcbcdd0f4e647f9ee45de2a3f81eb6722
Decoder
import torch import torch.nn as nn import torch.nn.functional as F class Decoder(nn.Module): """ Encoder """ def __init__(self, n_levels, n_color, n_eccentricity, n_azimuth, n_theta, n_phase): super(Decoder, self).__init__() self.n_levels = n_levels self.n_color = n_color ...
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...
bicv/POLO
Decoder
false
6,333
[ "MIT" ]
1
b8d4f9014796a4eb24c178d8be611a0b3b4c44df
https://github.com/bicv/POLO/tree/b8d4f9014796a4eb24c178d8be611a0b3b4c44df
ImageProcessingModuleAlt
import torch import torch.nn as nn import torch.nn.functional as F class ImageProcessingModuleAlt(nn.Module): def __init__(self, n_filters): super().__init__() self.conv1 = nn.Conv2d(in_channels=3, out_channels=n_filters * 2, kernel_size=7) self.conv2 = nn.Conv2d(in_channels=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 assert_...
bentrevett/task-oriented-language-grounding
ImageProcessingModuleAlt
false
6,334
[ "MIT" ]
1
812a7bc21ee622030eb0594c576c7d60dc630148
https://github.com/bentrevett/task-oriented-language-grounding/tree/812a7bc21ee622030eb0594c576c7d60dc630148
MultimodalFusionModule
import torch import torch.nn as nn class MultimodalFusionModule(nn.Module): def __init__(self, emb_dim, n_filters): super().__init__() self.fc_h = nn.Linear(emb_dim, n_filters) def forward(self, image, instruction): _batch_size, _n_filters, _height, _width = image.shape a = t...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bentrevett/task-oriented-language-grounding
MultimodalFusionModule
false
6,335
[ "MIT" ]
1
812a7bc21ee622030eb0594c576c7d60dc630148
https://github.com/bentrevett/task-oriented-language-grounding/tree/812a7bc21ee622030eb0594c576c7d60dc630148
LuongAttentionDot
import torch import torch.nn as nn import torch.nn.functional as F class LuongAttentionDot(nn.Module): def __init__(self): super().__init__() def forward(self, query, values): query = torch.squeeze(query, 0) query = torch.unsqueeze(query, 1) query_transposed = query.transpose...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
beroguedou/nmt-pytorch
LuongAttentionDot
false
6,336
[ "MIT" ]
1
8758ba33e2d5f4eca7f1ac2d04582678332bbcd5
https://github.com/beroguedou/nmt-pytorch/tree/8758ba33e2d5f4eca7f1ac2d04582678332bbcd5
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, feature_num): super(Net, self).__init__() self.layer_1 = nn.Linear(feature_num, 500) self.layer_2 = nn.Linear(500, 20) def forward(self, x): x = F.relu(self.layer_1(x))...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
bm2-lab/scPrivacy
Net
false
6,337
[ "MIT" ]
1
444c8f3a5e7b890c299cd823359e5414f73d6205
https://github.com/bm2-lab/scPrivacy/tree/444c8f3a5e7b890c299cd823359e5414f73d6205
MLP
import torch from torch import nn from torch.nn import functional as F class MLP(nn.Module): """ Multi-Layer Perceptron :param in_dim: int, size of input feature :param n_classes: int, number of output classes :param hidden_dim: int, size of hidden vector :param dropout: fl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import 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...
bigdata-ustc/DisenQNet
MLP
false
6,338
[ "MIT" ]
1
908fadeb9b8d278450213deff70205703bd91da6
https://github.com/bigdata-ustc/DisenQNet/tree/908fadeb9b8d278450213deff70205703bd91da6
PairwiseBCELoss
import torch from abc import abstractmethod import torch.utils.data.dataloader import torch.nn.functional as F import torch.nn as nn import torch.nn import torch.optim.optimizer class SimilarityLoss(nn.Module): def __init__(self): super(SimilarityLoss, self).__init__() @abstractmethod def forwar...
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 abc im...
bogdankostic/flair
PairwiseBCELoss
false
6,339
[ "MIT" ]
1
8cf03eab19512e94c1bcb4a30409bb065d37fe25
https://github.com/bogdankostic/flair/tree/8cf03eab19512e94c1bcb4a30409bb065d37fe25
FociDetector
import torch import torch.nn as nn import torch.utils.data class FociDetector(nn.Module): def __init__(self, input_channels=3, input_size=17, ksize=5, hidden_channels=10): super(FociDetector, self).__init__() self.conv1 = nn.Conv2d(input_channels, hidden_channels, ksize, strid...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
bharath272/centrosome-analysis
FociDetector
false
6,340
[ "MIT" ]
1
6ae3744be464812b3767909420d7b78cea9da670
https://github.com/bharath272/centrosome-analysis/tree/6ae3744be464812b3767909420d7b78cea9da670
LuongAttentionGeneral
import torch import torch.nn as nn import torch.nn.functional as F class LuongAttentionGeneral(nn.Module): def __init__(self, hidden_size): super().__init__() self.W = nn.Linear(hidden_size, hidden_size) def forward(self, query, values): query = torch.squeeze(query, 0) query ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
beroguedou/nmt-pytorch
LuongAttentionGeneral
false
6,341
[ "MIT" ]
1
8758ba33e2d5f4eca7f1ac2d04582678332bbcd5
https://github.com/beroguedou/nmt-pytorch/tree/8758ba33e2d5f4eca7f1ac2d04582678332bbcd5
Actor
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_unit(layer): inp = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(inp) return -lim, lim class Actor(nn.Module): def __init__(self, state_size, action_size, seed=2, fc_units=256): super(Actor, s...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers from torch._inductor.runtime....
bnriiitb/Deep-Reinforcement-Learning
Actor
false
6,342
[ "MIT" ]
1
5649a9d86fbec32fe3ac9cbb923d0d3a4c692d1e
https://github.com/bnriiitb/Deep-Reinforcement-Learning/tree/5649a9d86fbec32fe3ac9cbb923d0d3a4c692d1e
PositionwiseFeedforwardLayer
import torch import torch.nn as nn import torch.nn.functional as F class PositionwiseFeedforwardLayer(nn.Module): def __init__(self, hid_dim: 'int', pf_dim: 'int', dropout: 'float') ->None: super().__init__() self.fc_1 = nn.Linear(hid_dim, pf_dim) self.fc_2 = nn.Linear(pf_dim, hid_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 import torch.nn as nn assert_...
bob80333/investigating_extrapolation
PositionwiseFeedforwardLayer
false
6,343
[ "MIT" ]
1
fc4f72baa46b8490968f7ad546897937feb8b25d
https://github.com/bob80333/investigating_extrapolation/tree/fc4f72baa46b8490968f7ad546897937feb8b25d
KopoinANNNetwork
import torch import torch.nn as nn class KopoinANNNetwork(nn.Module): def __init__(self, featShape): super(KopoinANNNetwork, self).__init__() self.featShape = featShape self.act = nn.Sigmoid() self.layer0 = nn.Linear(featShape, featShape // 2) self.layer1 = nn.Linear(featS...
import torch from torch._inductor.select_algorithm import extern_kernels import 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...
bmd2007/benchmark_eval
KopoinANNNetwork
false
6,344
[ "MIT" ]
1
aa42bb3369e79db4cb63e1963afcc8af6d8f5696
https://github.com/bmd2007/benchmark_eval/tree/aa42bb3369e79db4cb63e1963afcc8af6d8f5696
BertPooler
from _paritybench_helpers import _mock_config import torch import torch.nn.functional from torch import nn class BertPooler(nn.Module): def __init__(self, config): super(BertPooler, self).__init__() self.dense = nn.Linear(config.hidden_size, config.hidden_size) self.activation = nn.GELU()...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language 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.fun...
bj1103/FaST-VGS-Family
BertPooler
false
6,345
[ "BSD-3-Clause" ]
1
824f987a5bd647fc17aa34b98eb1d9109441d64b
https://github.com/bj1103/FaST-VGS-Family/tree/824f987a5bd647fc17aa34b98eb1d9109441d64b
PatchMerge
import torch from torch import nn class PatchMerge(nn.Module): """ Implements the Patch Merge operator from Swin Transformer """ def __init__(self, channels: 'int', window_size: 'int'=2): super(PatchMerge, self).__init__() self.merger = nn.Conv2d(in_channels=channels, out_channels= ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch import nn assert_size_stride = torch._C._dynamo.guards.assert_size_st...
bradezard131/swin-transformer
PatchMerge
false
6,346
[ "MIT" ]
1
72e38cbae8bda332d03dced814d10b45185c04de
https://github.com/bradezard131/swin-transformer/tree/72e38cbae8bda332d03dced814d10b45185c04de
PatchEmbed
import torch import torch.nn as nn class PatchEmbed(nn.Module): """ Image to Patch Embedding """ def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768): super().__init__() num_patches = img_size // patch_size * (img_size // patch_size) self.img_size = img_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 import torch.nn as nn assert_size_stride = torch._C._dynamo.guards.assert_size_s...
bmi-imaginelab/CD-Net-Histopathology-Representation-Learning-using-Pyramidal-Context-Detail-Network
PatchEmbed
false
6,347
[ "Apache-2.0" ]
1
cc4dad85cdeea7295cb48f6f947fd1ac25d8862e
https://github.com/bmi-imaginelab/CD-Net-Histopathology-Representation-Learning-using-Pyramidal-Context-Detail-Network/tree/cc4dad85cdeea7295cb48f6f947fd1ac25d8862e
LunarLanderDQN
import torch import torch.nn as nn import torch.nn.functional as F class LunarLanderDQN(nn.Module): def __init__(self, state_space_dim, action_space_dim, hidden=12): super(LunarLanderDQN, self).__init__() self.hidden = hidden self.fc1 = nn.Linear(state_space_dim, hidden) self.fc2 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
breno-aberle/rl-pong-project
LunarLanderDQN
false
6,348
[ "MIT" ]
1
9dc0d12e4bbcdb2905d46f66e84fac6d70c7831d
https://github.com/breno-aberle/rl-pong-project/tree/9dc0d12e4bbcdb2905d46f66e84fac6d70c7831d
DuelingQNetwork
import torch import torch.nn.functional as F import torch.nn as nn class DuelingQNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=48): """Initialize parameters and build model. Params ====== state_size (int): Dimen...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bobiblazeski/navigation
DuelingQNetwork
false
6,349
[ "MIT" ]
1
bb863b4475a90ff26bede20af647ae4882a0f6fb
https://github.com/bobiblazeski/navigation/tree/bb863b4475a90ff26bede20af647ae4882a0f6fb
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(1, 32, 5) self.pool = nn.MaxPool2d(2, 2) def forward(self, x): x = self.pool(F.relu(self.conv1(x))) 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 import torch.nn as nn assert_...
bongsang/face-landmark
Net
false
6,350
[ "MIT" ]
1
bc7644480be1ddf8d35c2875d251bc84c00ccaa7
https://github.com/bongsang/face-landmark/tree/bc7644480be1ddf8d35c2875d251bc84c00ccaa7
RankingLoss
import torch from abc import abstractmethod import torch.utils.data.dataloader import torch.nn.functional as F import torch.nn as nn import torch.nn import torch.optim.optimizer class SimilarityLoss(nn.Module): def __init__(self): super(SimilarityLoss, self).__init__() @abstractmethod def forwar...
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 abc import abstractmethod import torch.utils.data.dataloader import torch.nn as nn i...
bogdankostic/flair
RankingLoss
false
6,351
[ "MIT" ]
1
8cf03eab19512e94c1bcb4a30409bb065d37fe25
https://github.com/bogdankostic/flair/tree/8cf03eab19512e94c1bcb4a30409bb065d37fe25
AttnModel
import torch from torch import nn from torch.nn import functional as F class MLP(nn.Module): """ Multi-Layer Perceptron :param in_dim: int, size of input feature :param n_classes: int, number of output classes :param hidden_dim: int, size of hidden vector :param dropout: fl...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bigdata-ustc/DisenQNet
AttnModel
false
6,352
[ "MIT" ]
1
908fadeb9b8d278450213deff70205703bd91da6
https://github.com/bigdata-ustc/DisenQNet/tree/908fadeb9b8d278450213deff70205703bd91da6
QNetwork
import torch import torch.nn.functional as F import torch.nn as nn class QNetwork(nn.Module): """Actor (Policy) Model.""" def __init__(self, state_size, action_size, seed, fc1_units=48): """Initialize parameters and build model. Params ====== state_size (int): Dimension of...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch._inductor.runtime import triton_helpers import torch.nn as nn assert_...
bobiblazeski/navigation
QNetwork
false
6,353
[ "MIT" ]
1
bb863b4475a90ff26bede20af647ae4882a0f6fb
https://github.com/bobiblazeski/navigation/tree/bb863b4475a90ff26bede20af647ae4882a0f6fb
Block
import torch import numpy as np from torch import nn import torch.nn.functional as F def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False): if drop_prob == 0.0 or not training: return x keep_prob = 1 - drop_prob shape = (x.shape[0],) + (1,) * (x.ndim - 1) random_tensor = keep_prob +...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
au55555/classification-pytorch
Block
false
6,354
[ "MIT" ]
1
1937599ae6e688ed7af7470f69964fb6f97241c4
https://github.com/au55555/classification-pytorch/tree/1937599ae6e688ed7af7470f69964fb6f97241c4
MaskedLinear
import torch import torch.cuda from torch.nn.functional import * class MaskedLinear(torch.nn.Linear): def forward(self, x, mask): out = super().forward(x) if mask.is_floating_point(): out = out * mask else: out = out * mask.type_as(out) return out 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.cuda from torch.nn.functional import * assert_size_stride = torch._...
bratao/DeepSpeed
MaskedLinear
false
6,355
[ "MIT" ]
1
c50d8955e942e5e26cf81835d59ec3f20ef8540d
https://github.com/bratao/DeepSpeed/tree/c50d8955e942e5e26cf81835d59ec3f20ef8540d
CartpoleDQN
import torch import torch.nn as nn import torch.nn.functional as F class CartpoleDQN(nn.Module): def __init__(self, state_space_dim, action_space_dim, hidden=12): super(CartpoleDQN, self).__init__() self.hidden = hidden self.fc1 = nn.Linear(state_space_dim, hidden) self.fc2 = nn.L...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
breno-aberle/rl-pong-project
CartpoleDQN
false
6,356
[ "MIT" ]
1
9dc0d12e4bbcdb2905d46f66e84fac6d70c7831d
https://github.com/breno-aberle/rl-pong-project/tree/9dc0d12e4bbcdb2905d46f66e84fac6d70c7831d
AvgPool2d
from torch.nn import Module import torch import torch as th class AvgPool2d(Module): """ This class is the beginning of an exact python port of the torch.nn.AvgPool2d module. Because PySyft cannot hook into layers which are implemented in C++, our special functionalities (such as encrypted computation...
import torch import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream from torch.nn import Module assert_size_stride = torch._C._dynamo.guards.assert_size_stride empty_strided_cuda = torch._C._dynamo.guards._em...
brandonhee/PySyft
AvgPool2d
false
6,357
[ "Apache-2.0" ]
1
31217f28aa3d996b2bb84477fb15a990f0cb9a80
https://github.com/brandonhee/PySyft/tree/31217f28aa3d996b2bb84477fb15a990f0cb9a80
Critic
import torch import numpy as np import torch.nn.functional as F import torch.nn as nn def hidden_unit(layer): inp = layer.weight.data.size()[0] lim = 1.0 / np.sqrt(inp) return -lim, lim class Critic(nn.Module): def __init__(self, state_size, action_size, seed=2, fc1_units=256, fc2_units=256...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import numpy as np import torch.nn as nn assert_size_stride = torch._C._dynamo.g...
bnriiitb/Deep-Reinforcement-Learning
Critic
false
6,358
[ "MIT" ]
1
5649a9d86fbec32fe3ac9cbb923d0d3a4c692d1e
https://github.com/bnriiitb/Deep-Reinforcement-Learning/tree/5649a9d86fbec32fe3ac9cbb923d0d3a4c692d1e
SimpleModel
import torch import torch.cuda from torch.nn.functional import * class SimpleModel(torch.nn.Module): def __init__(self, hidden_dim, empty_grad=False, rank=0): super(SimpleModel, self).__init__() self.linear = torch.nn.Linear(hidden_dim, hidden_dim) if empty_grad: self.linear2 ...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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....
bratao/DeepSpeed
SimpleModel
false
6,359
[ "MIT" ]
1
c50d8955e942e5e26cf81835d59ec3f20ef8540d
https://github.com/bratao/DeepSpeed/tree/c50d8955e942e5e26cf81835d59ec3f20ef8540d
Mid_block
import torch import torch.nn as nn import torch.utils.data class Mid_block(nn.Module): def __init__(self, chanIn, chanOut, ks=3, stride=1): super().__init__() self.conv1 = nn.Conv3d(chanIn, chanOut, ks, padding=1) self.conv2 = nn.Conv3d(chanOut, chanOut, ks, padding=1) def forward(se...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from torch._inductor.runtime.triton_heuristics import grid from torch._C import _cuda_getCurrentRawStream as get_raw_stream import torch.nn as nn import torch.utils.data assert_size_stride = torch._C._dyn...
basharbme/3d_segmentation
Mid_block
false
6,360
[ "MIT" ]
1
efcd966f74ebb74614515c38930e820ea1c4744e
https://github.com/basharbme/3d_segmentation/tree/efcd966f74ebb74614515c38930e820ea1c4744e
MaskedLinearSeqDup
import torch import torch.cuda from torch.nn.functional import * class MaskedLinear(torch.nn.Linear): def forward(self, x, mask): out = super().forward(x) if mask.is_floating_point(): out = out * mask else: out = out * mask.type_as(out) return out class 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 import torch.cuda from torch.nn.functional import * assert_size_stride = torch._...
bratao/DeepSpeed
MaskedLinearSeqDup
false
6,361
[ "MIT" ]
1
c50d8955e942e5e26cf81835d59ec3f20ef8540d
https://github.com/bratao/DeepSpeed/tree/c50d8955e942e5e26cf81835d59ec3f20ef8540d
MultiChannelCombinedScorer
import torch import torch.nn as nn import torch.utils.data import torch.nn.functional as F class FociDetector(nn.Module): def __init__(self, input_channels=3, input_size=17, ksize=5, hidden_channels=10): super(FociDetector, self).__init__() self.conv1 = nn.Conv2d(input_channels, hidden_ch...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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 ...
bharath272/centrosome-analysis
MultiChannelCombinedScorer
false
6,362
[ "MIT" ]
1
6ae3744be464812b3767909420d7b78cea9da670
https://github.com/bharath272/centrosome-analysis/tree/6ae3744be464812b3767909420d7b78cea9da670
SmoothBCEwLogits
import torch import torch.utils.data import torch.nn.functional as F from torch.nn.modules.loss import _WeightedLoss class SmoothBCEwLogits(_WeightedLoss): def __init__(self, weight=None, reduction='mean', smoothing=0.0, pos_weight=None): super().__init__(weight=weight, reduction=reduction) ...
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...
broadinstitute/lincs-profiling-comparison
SmoothBCEwLogits
false
6,363
[ "BSD-3-Clause" ]
1
075c3bc60eeb3934fc42c30bae6aeed8cda1cd6d
https://github.com/broadinstitute/lincs-profiling-comparison/tree/075c3bc60eeb3934fc42c30bae6aeed8cda1cd6d
Net
import torch import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self, input_seq_length, output_num_classes): """Initialize model layers""" super(Net, self).__init__() self.input_seq_length = input_seq_length self.output_num_classes = output_nu...
import torch from torch._inductor.select_algorithm import extern_kernels import triton import triton.language as tl from 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_...
bradford415/multiclassification
Net
false
6,364
[ "MIT" ]
1
ee0234ec0a85b04f78cd86c3e5c52e5d658f19ac
https://github.com/bradford415/multiclassification/tree/ee0234ec0a85b04f78cd86c3e5c52e5d658f19ac