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 |
|---|---|---|---|---|---|---|---|---|---|---|
AUGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class AUGRUCell(nn.Module):
""" Effect of GRU with attentional update gate (AUGRU)
Reference:
- Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, ... | 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 ... | zzz123xyz/DeepCTR-Torch | AUGRUCell | false | 4,742 | [
"Apache-2.0"
] | 0 | d6b880cc6b3761dbef90920a28182ef6737dd665 | https://github.com/zzz123xyz/DeepCTR-Torch/tree/d6b880cc6b3761dbef90920a28182ef6737dd665 |
ResnetQ | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class ResnetQ(nn.Module):
def __init__(self, opt):
super(ResnetQ, self).__init__()
self.conv = nn.Linear(opt.ndf, opt.ndf)
self.lReLU = nn.LeakyReLU(0.1, inpla... | 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.... | arnabgho/infoGAN-pytorch | ResnetQ | false | 4,743 | [
"MIT"
] | 0 | 60f31010768f3e07010ac60845411a4a41fa1bba | https://github.com/arnabgho/infoGAN-pytorch/tree/60f31010768f3e07010ac60845411a4a41fa1bba |
AFMLayer | import itertools
import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class AFMLayer(nn.Module):
"""Attentonal Factorization Machine models pairwise (order-2) feature
interactions without linear term and bias.
Input shape
- A list of 3D tensor with sha... | 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.... | zzz123xyz/DeepCTR-Torch | AFMLayer | false | 4,744 | [
"Apache-2.0"
] | 0 | d6b880cc6b3761dbef90920a28182ef6737dd665 | https://github.com/zzz123xyz/DeepCTR-Torch/tree/d6b880cc6b3761dbef90920a28182ef6737dd665 |
ColorJitterLayer | from torch.autograd import Function
import math
import numbers
import torch
import numpy as np
import torch.nn as nn
import torch.utils.cpp_extension
def hsv2rgb(hsv):
"""Convert a 4-d HSV tensor to the RGB counterpart.
>>> %timeit hsv2rgb_lookup(hsv)
2.37 ms ± 13.4 µs per loop (mean ± std. dev. of 7 runs... | 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.... | yingnengd/MyGAN | ColorJitterLayer | false | 4,745 | [
"MIT"
] | 0 | 6e4abbe165c8f3b1e1b69d5d01177712761a3a1c | https://github.com/yingnengd/MyGAN/tree/6e4abbe165c8f3b1e1b69d5d01177712761a3a1c |
BertOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.onnx
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, 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.triton_helpers import libdevice
from torch import n... | Splendon/examples | BertOutput | false | 4,746 | [
"MIT"
] | 0 | ed4a8a01857b6ddca49559141acf5d0986eb01e1 | https://github.com/Splendon/examples/tree/ed4a8a01857b6ddca49559141acf5d0986eb01e1 |
ProteinResNetPooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class ProteinResNetPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.attention_weights = nn.Linear(config.hidden_size, 1)
self.dense = nn.Linear(config.hidden_size, config.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, math as tl_math
im... | StephanHeijl/tape | ProteinResNetPooler | false | 4,747 | [
"BSD-3-Clause"
] | 0 | ec631ca53217686605477cf31af4fb8846ff660f | https://github.com/StephanHeijl/tape/tree/ec631ca53217686605477cf31af4fb8846ff660f |
AGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class AGRUCell(nn.Module):
""" Attention based GRU (AGRU)
Reference:
- Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, 2018.
"""
def __... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | zzz123xyz/DeepCTR-Torch | AGRUCell | false | 4,748 | [
"Apache-2.0"
] | 0 | d6b880cc6b3761dbef90920a28182ef6737dd665 | https://github.com/zzz123xyz/DeepCTR-Torch/tree/d6b880cc6b3761dbef90920a28182ef6737dd665 |
MixtureDensityHead | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.distributions import Categorical
class MixtureDensityHead(nn.Module):
def __init__(self, config: 'DictConfig', **kwargs):
self.hparams = config
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | edchengmoore/pytorch_tabular | MixtureDensityHead | false | 4,749 | [
"MIT"
] | 0 | 25f87089fbed95b46f2a1a8a96fba1f581aa8af1 | https://github.com/edchengmoore/pytorch_tabular/tree/25f87089fbed95b46f2a1a8a96fba1f581aa8af1 |
InteractingLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class InteractingLayer(nn.Module):
"""A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism.
Input shape
- A 3D tensor with shape... | 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.... | zzz123xyz/DeepCTR-Torch | InteractingLayer | false | 4,750 | [
"Apache-2.0"
] | 0 | d6b880cc6b3761dbef90920a28182ef6737dd665 | https://github.com/zzz123xyz/DeepCTR-Torch/tree/d6b880cc6b3761dbef90920a28182ef6737dd665 |
AlphaClassifier | import torch
import numpy as np
from torch import nn
from torch.utils.data import DataLoader
import torch.nn.functional as F
from torchvision import transforms
from sklearn.preprocessing import StandardScaler
from sklearn import metrics
from torch.utils.data import Dataset
def compute_auc(labels, scores, pos_label=1)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy as np
fro... | vitskvara/shape-guided-anomaly-detection | AlphaClassifier | false | 4,751 | [
"MIT"
] | 0 | 6685b2e0b97968a6d0f478d2920486da107b277f | https://github.com/vitskvara/shape-guided-anomaly-detection/tree/6685b2e0b97968a6d0f478d2920486da107b277f |
FCN8_VGG16 | import torch
import numpy as np
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
def conv3x3(in_planes, out_planes, stride=1, padding=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=(3, 3), stride=(
stride, stride), padding=(padding, padding))
... | 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 numpy as np
import tor... | rdbadra/LCFCN | FCN8_VGG16 | false | 4,752 | [
"Apache-2.0"
] | 0 | 85ba21abb5de443d36d414fb7f732a3672d82c67 | https://github.com/rdbadra/LCFCN/tree/85ba21abb5de443d36d414fb7f732a3672d82c67 |
Model | from torch.nn import Module
import torch
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.parallel
import torch.optim
from torch.nn import Parameter
from torch.nn import Module
class Model(Module):
def __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.nn import Module
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
import torch.utils.data
import torc... | FDecaYed/apex | Model | false | 4,753 | [
"BSD-3-Clause"
] | 0 | 789afd89fe2c5a3e772f557055a9cf0f5e9d1241 | https://github.com/FDecaYed/apex/tree/789afd89fe2c5a3e772f557055a9cf0f5e9d1241 |
Model | from torch.nn import Module
import torch
import torch.nn.functional
from torch.nn import Parameter
from torch.nn.parameter import Parameter
from torch.nn.modules import Module
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data.distributed
from torch.nn import Module
import 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.nn import Module
import torch.nn.functional
from torch.nn import Parameter
from torch.nn.parameter import Parameter
from torch.nn... | Liuhongzhi2018/Person_ReID | Model | false | 4,754 | [
"MIT"
] | 0 | 51c576ed5b4ed960801669d6d59c0a77405b369d | https://github.com/Liuhongzhi2018/Person_ReID/tree/51c576ed5b4ed960801669d6d59c0a77405b369d |
Scale | import torch
import torch.nn as nn
import torch.utils.data
class Scale(nn.Module):
"""A learnable scale parameter.
This layer scales the input by a learnable factor. It multiplies a
learnable scale parameter of shape (1,) with input of any shape.
Args:
scale (float): Initial value of scale f... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | AIpakchoi/visualDet3D | Scale | false | 4,755 | [
"Apache-2.0"
] | 1 | 920f6f8ea44eac4c1896b7d157c015e039ac39f9 | https://github.com/AIpakchoi/visualDet3D/tree/920f6f8ea44eac4c1896b7d157c015e039ac39f9 |
GEGLU | import torch
from torch import Tensor
import torch.nn.functional as f
from torch import nn
class GEGLU(nn.Module):
"""Gated GELU, it splits a tensor in two slices based on the last dimension, and then multiply the
first half and the gelu of the second half
"""
def forward(self, x: 'Tensor') ->Tens... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Actis92/saint-lightning | GEGLU | false | 4,756 | [
"MIT"
] | 1 | 8f64fa0751fd7a36663f9e8b79bdea777905ea84 | https://github.com/Actis92/saint-lightning/tree/8f64fa0751fd7a36663f9e8b79bdea777905ea84 |
AnchorFlatten | import torch
import torch.nn as nn
import torch.utils.data
class AnchorFlatten(nn.Module):
"""
Module for anchor-based network outputs,
Init args:
num_output: number of output channel for each anchor.
Forward args:
x: torch.tensor of shape [B, num_anchors * 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
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | AIpakchoi/visualDet3D | AnchorFlatten | false | 4,757 | [
"Apache-2.0"
] | 1 | 920f6f8ea44eac4c1896b7d157c015e039ac39f9 | https://github.com/AIpakchoi/visualDet3D/tree/920f6f8ea44eac4c1896b7d157c015e039ac39f9 |
Swish | import torch
from torch import nn
class Swish(nn.Module):
def forward(self, x):
return x * torch.sigmoid(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | ANI717/effecientnet_b7_pneumonia | Swish | false | 4,758 | [
"MIT"
] | 1 | f8bf71c92bc1ae5a80b8e37b685bf314004001b3 | https://github.com/ANI717/effecientnet_b7_pneumonia/tree/f8bf71c92bc1ae5a80b8e37b685bf314004001b3 |
ModifiedSmoothedL1 | import torch
import torch.nn as nn
import torch.utils.data
class ModifiedSmoothedL1(nn.Module):
"""
ResultLoss = outside_weights * SmoothL1(inside_weights * (box_pred - box_targets))
SmoothL1(x) = 0.5 * (sigma * x)^2, if |x| < 1 / sigma^2
|x| - 0.5 / sigma^2, otherwise
... | 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.... | AIpakchoi/visualDet3D | ModifiedSmoothedL1 | false | 4,759 | [
"Apache-2.0"
] | 1 | 920f6f8ea44eac4c1896b7d157c015e039ac39f9 | https://github.com/AIpakchoi/visualDet3D/tree/920f6f8ea44eac4c1896b7d157c015e039ac39f9 |
IoULoss | import torch
import torch.nn as nn
import torch.utils.data
class IoULoss(nn.Module):
"""Some Information about IoULoss"""
def forward(self, preds: 'torch.Tensor', targets: 'torch.Tensor', eps:
'float'=1e-08) ->torch.Tensor:
"""IoU Loss
Args:
preds (torch.Tensor): [x1, y1,... | 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
... | AIpakchoi/visualDet3D | IoULoss | false | 4,760 | [
"Apache-2.0"
] | 1 | 920f6f8ea44eac4c1896b7d157c015e039ac39f9 | https://github.com/AIpakchoi/visualDet3D/tree/920f6f8ea44eac4c1896b7d157c015e039ac39f9 |
Reorg | import torch
import torch.nn as nn
import torch.utils.data
class Reorg(nn.Module):
def __init__(self, stride=2):
super(Reorg, self).__init__()
self.stride = stride
def forward(self, x):
stride = self.stride
assert x.data.dim() == 4
B = x.data.size(0)
C = x.dat... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | AP-EPFL/DA-segmentation-driven-pose | Reorg | false | 4,761 | [
"MIT"
] | 1 | 451b8ee3619b16db152ac37ba2b64f7ebf5e2832 | https://github.com/AP-EPFL/DA-segmentation-driven-pose/tree/451b8ee3619b16db152ac37ba2b64f7ebf5e2832 |
EqualizedLinear | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter... | 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 numpy as np
from torch import nn
import torch.utils.data
impo... | Aarsh2001/annotated_deep_learning_paper_implementations | EqualizedLinear | false | 4,762 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class MaxPoolStride1(nn.Module):
def __init__(self):
super(MaxPoolStride1, self).__init__()
def forward(self, x):
x = F.max_pool2d(F.pad(x, (0, 1, 0, 1), mode='replicate'), 2, stride=1)
return ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | AP-EPFL/DA-segmentation-driven-pose | MaxPoolStride1 | false | 4,763 | [
"MIT"
] | 1 | 451b8ee3619b16db152ac37ba2b64f7ebf5e2832 | https://github.com/AP-EPFL/DA-segmentation-driven-pose/tree/451b8ee3619b16db152ac37ba2b64f7ebf5e2832 |
UnbalancedWeight | import torch
class UnbalancedWeight(torch.nn.Module):
def __init__(self, ε, ρ):
super(UnbalancedWeight, self).__init__()
self.ε, self.ρ = ε, ρ
def forward(self, x):
return (self.ρ + self.ε / 2) * x
def backward(self, g):
return (self.ρ + self.ε) * g
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | AdrienCorenflos/PFlow | UnbalancedWeight | false | 4,764 | [
"MIT"
] | 1 | ec5f43a5e20d1280260e482ee0f9139fb9d1ca2b | https://github.com/AdrienCorenflos/PFlow/tree/ec5f43a5e20d1280260e482ee0f9139fb9d1ca2b |
Upsample | import torch
import torch.nn as nn
import torch.nn.functional as F
class Upsample(nn.Module):
""" nn.Upsample is deprecated """
def __init__(self, scale_factor, mode='nearest'):
super(Upsample, self).__init__()
self.scale_factor = scale_factor
self.mode = mode
def forward(self, x... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | AIplayblocks/littlecarroute | Upsample | false | 4,765 | [
"MIT"
] | 1 | e20b4a318746637dd1e2170b175201bd8ba1e7d5 | https://github.com/AIplayblocks/littlecarroute/tree/e20b4a318746637dd1e2170b175201bd8ba1e7d5 |
OutConv | import torch
import torch.nn as nn
import torch.utils.data
class OutConv(nn.Module):
def __init__(self, in_channels, out_channels):
super(OutConv, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3,
padding=1)
def forward(self, x):
return 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
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | AIpakchoi/visualDet3D | OutConv | false | 4,766 | [
"Apache-2.0"
] | 1 | 920f6f8ea44eac4c1896b7d157c015e039ac39f9 | https://github.com/AIpakchoi/visualDet3D/tree/920f6f8ea44eac4c1896b7d157c015e039ac39f9 |
GlobalAvgPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class GlobalAvgPool2d(nn.Module):
def __init__(self):
super(GlobalAvgPool2d, self).__init__()
def forward(self, x):
N = x.data.size(0)
C = x.data.size(1)
H = x.data.size(2)
W = ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | AP-EPFL/DA-segmentation-driven-pose | GlobalAvgPool2d | false | 4,767 | [
"MIT"
] | 1 | 451b8ee3619b16db152ac37ba2b64f7ebf5e2832 | https://github.com/AP-EPFL/DA-segmentation-driven-pose/tree/451b8ee3619b16db152ac37ba2b64f7ebf5e2832 |
MaxPool2dDynamicSamePadding | import math
import torch
from torch import nn
from torch.nn import functional as F
class MaxPool2dDynamicSamePadding(nn.MaxPool2d):
"""2D MaxPooling like TensorFlow's 'SAME' mode, with a dynamic image size.
The padding is operated in forward function by calculating dynamically.
"""
def __init__(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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | ANI717/effecientnet_b7_pneumonia | MaxPool2dDynamicSamePadding | false | 4,768 | [
"MIT"
] | 1 | f8bf71c92bc1ae5a80b8e37b685bf314004001b3 | https://github.com/ANI717/effecientnet_b7_pneumonia/tree/f8bf71c92bc1ae5a80b8e37b685bf314004001b3 |
Upsample | import torch
import torch.nn as nn
import torch.utils.data
class Upsample(nn.Module):
def __init__(self, stride=2):
super(Upsample, self).__init__()
self.stride = stride
def forward(self, x):
stride = self.stride
assert x.data.dim() == 4
B = x.data.size(0)
C =... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | AP-EPFL/DA-segmentation-driven-pose | Upsample | false | 4,769 | [
"MIT"
] | 1 | 451b8ee3619b16db152ac37ba2b64f7ebf5e2832 | https://github.com/AP-EPFL/DA-segmentation-driven-pose/tree/451b8ee3619b16db152ac37ba2b64f7ebf5e2832 |
EqualizedWeight | import math
import torch
import numpy as np
from torch import nn
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter
This is based on equalized... | 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
import numpy as np
from torch import nn
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.... | Aarsh2001/annotated_deep_learning_paper_implementations | EqualizedWeight | false | 4,770 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
HLoss | import torch
import torch.nn as nn
class HLoss(nn.Module):
def __init__(self):
super(HLoss, self).__init__()
def forward(self, x):
b = x * torch.log(x)
b[torch.isnan(b)] = 0
b = -1.0 * b.sum()
return b
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def ge... | 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... | AayushGrover/ViscaNet | HLoss | false | 4,771 | [
"MIT"
] | 1 | 41786e10b84f2264b638567bdce1c189c1b66b00 | https://github.com/AayushGrover/ViscaNet/tree/41786e10b84f2264b638567bdce1c189c1b66b00 |
BackProjection | import torch
import torch.nn as nn
import torch.utils.data
class BackProjection(nn.Module):
"""
forward method:
bbox3d: [N, 7] homo_x, homo_y, z, w, h, l, alpha
p2: [3, 4]
return [x3d, y3d, z, w, h, l, alpha]
"""
def forward(self, bbox3d, p2):
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | AIpakchoi/visualDet3D | BackProjection | false | 4,772 | [
"Apache-2.0"
] | 1 | 920f6f8ea44eac4c1896b7d157c015e039ac39f9 | https://github.com/AIpakchoi/visualDet3D/tree/920f6f8ea44eac4c1896b7d157c015e039ac39f9 |
Conv2dDynamicSamePadding | import math
import torch
from torch import nn
from torch.nn import functional as F
class Conv2dDynamicSamePadding(nn.Conv2d):
"""2D Convolutions like TensorFlow, for a dynamic image size.
The padding is operated in forward function by calculating dynamically.
"""
def __init__(self, in_channels, ou... | 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... | ANI717/effecientnet_b7_pneumonia | Conv2dDynamicSamePadding | false | 4,773 | [
"MIT"
] | 1 | f8bf71c92bc1ae5a80b8e37b685bf314004001b3 | https://github.com/ANI717/effecientnet_b7_pneumonia/tree/f8bf71c92bc1ae5a80b8e37b685bf314004001b3 |
MiniBatchStdDev | import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class MiniBatchStdDev(nn.Module):
"""
<a id="mini_batch_std_dev"></a>
### Mini-batch Standard Deviation
Mini-batch standard deviation calculates the standard deviation
across a mini-batch (... | 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
import torch.utils.data
import torch.nn.functional
import ... | Aarsh2001/annotated_deep_learning_paper_implementations | MiniBatchStdDev | false | 4,774 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
InstanceNorm | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class InstanceNorm(Module):
"""
## Instance Normalization Layer
Instance normalization layer $\\text{IN}$ normalizes the input $X$ as follows:
When input $X \\in \\m... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
from torch import nn
import torch.utils.data
import... | Aarsh2001/annotated_deep_learning_paper_implementations | InstanceNorm | false | 4,775 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
FeedForward | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class FeedForward(Module):
"""
## FFN module
"""
def __init__(self, d_model: 'int', d_ff: 'int', dropout: 'float'=0.1,
activation=nn.ReLU(), is_gated: 'bool'=... | 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
f... | Aarsh2001/annotated_deep_learning_paper_implementations | FeedForward | false | 4,776 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
ModifiedSmoothL1Loss | import torch
import torch.nn as nn
import torch.utils.data
class ModifiedSmoothL1Loss(nn.Module):
def __init__(self, L1_regression_alpha: 'float'):
super(ModifiedSmoothL1Loss, self).__init__()
self.alpha = L1_regression_alpha
def forward(self, normed_targets: 'torch.Tensor', pos_reg: '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.triton_helpers import math as tl_math
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch.... | AIpakchoi/visualDet3D | ModifiedSmoothL1Loss | false | 4,777 | [
"Apache-2.0"
] | 1 | 920f6f8ea44eac4c1896b7d157c015e039ac39f9 | https://github.com/AIpakchoi/visualDet3D/tree/920f6f8ea44eac4c1896b7d157c015e039ac39f9 |
NeuralNet | import torch
import torch.nn as nn
class NeuralNet(nn.Module):
def __init__(self, input_size, hidden_size, num_classes, p=0.5):
super(NeuralNet, self).__init__()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size, num_classes)
self.dropout = nn.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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | AWebZen/FunctionalPrediction5000species | NeuralNet | false | 4,779 | [
"MIT"
] | 1 | 6d351da7f85ff9d23f5465c9bd6ea47eccec9771 | https://github.com/AWebZen/FunctionalPrediction5000species/tree/6d351da7f85ff9d23f5465c9bd6ea47eccec9771 |
GroupNorm | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class GroupNorm(Module):
"""
## Group Normalization Layer
"""
def __init__(self, groups: 'int', channels: 'int', *, eps: float=1e-05,
affine: bool=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.triton_helpers import libdevice
from torch.nn import Module
from torch import nn
import torch.utils.data
import... | Aarsh2001/annotated_deep_learning_paper_implementations | GroupNorm | false | 4,780 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
UpSample | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Smooth(nn.Module):
"""
<a id="smooth"></a>
### Smoothing Layer
This layer blurs each channel
"""
def __init__(self):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | Aarsh2001/annotated_deep_learning_paper_implementations | UpSample | false | 4,781 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
SpacialGatingUnit | import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
from typing import Optional
import torch.autograd
class SpacialGatingUnit(nn.Module):
"""
## Spatial Gating Unit
$$s(Z) = Z_1 \\odot f_{W,b}(Z_2)$$
where $f_{W,b}(Z) = W Z + b$ is a linear transformation along the s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Aarsh2001/annotated_deep_learning_paper_implementations | SpacialGatingUnit | false | 4,782 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
EqualizedConv2d | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter... | 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 numpy as np
from torch import nn
import torch.utils.data
impo... | Aarsh2001/annotated_deep_learning_paper_implementations | EqualizedConv2d | false | 4,783 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
ResConv | import torch
import torch.nn as nn
import torch.utils.data
class ResConv(nn.Module):
"""Some Information about ResConv"""
def __init__(self, *args, **kwarg):
super(ResConv, self).__init__()
self.conv = nn.Conv2d(*args, **kwarg)
def forward(self, x):
x = x + self.conv(x)
r... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | AIpakchoi/visualDet3D | ResConv | false | 4,784 | [
"Apache-2.0"
] | 1 | 920f6f8ea44eac4c1896b7d157c015e039ac39f9 | https://github.com/AIpakchoi/visualDet3D/tree/920f6f8ea44eac4c1896b7d157c015e039ac39f9 |
GLU | import torch
import torch.nn as nn
import torch.utils.model_zoo
class GLU(nn.Module):
def forward(self, x):
nc = x.size(1)
assert nc % 2 == 0, 'channels dont divide 2!'
nc = int(nc / 2)
return x[:, :nc] * torch.sigmoid(x[:, nc:])
def get_inputs():
return [torch.rand([4, 4, 4... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.model_zoo
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Aitical/ADspeech2face | GLU | false | 4,785 | [
"MIT"
] | 1 | 2e811ff8cc7333729f4b77d1b1067296253e8e38 | https://github.com/Aitical/ADspeech2face/tree/2e811ff8cc7333729f4b77d1b1067296253e8e38 |
Conv1dCompression | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Conv1dCompression(Module):
"""
## 1D Convolution Compression $f_c$
This is a simple wrapper around
[`nn.Conv1d`](https://pytorch.org/docs/stable/generated/torch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import ... | Aarsh2001/annotated_deep_learning_paper_implementations | Conv1dCompression | false | 4,786 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
BertLayerNorm | import torch
from torch import nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self).__init__()
self.weight = nn.Parameter(torch.ones(hidden_si... | 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... | Adelashl6/mask_transformers | BertLayerNorm | false | 4,787 | [
"MIT"
] | 1 | 2a2e4d1b40ae3ed546cb850d041af246806b63e7 | https://github.com/Adelashl6/mask_transformers/tree/2a2e4d1b40ae3ed546cb850d041af246806b63e7 |
GEGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | 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 ... | Actis92/pytorch_tabular | GEGLU | false | 4,788 | [
"MIT"
] | 1 | 78dabf5e7b97d8ff24db4bc83d9d0a2273941bbe | https://github.com/Actis92/pytorch_tabular/tree/78dabf5e7b97d8ff24db4bc83d9d0a2273941bbe |
DownSample | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Smooth(nn.Module):
"""
<a id="smooth"></a>
### Smoothing Layer
This layer blurs each channel
"""
def __init__(self):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | Aarsh2001/annotated_deep_learning_paper_implementations | DownSample | false | 4,789 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
PixelNorm | import torch
import torch.nn as nn
import torch.utils.model_zoo
class PixelNorm(nn.Module):
def __init__(self):
super().__init__()
def forward(self, input):
return input * torch.rsqrt(torch.mean(input ** 2, dim=1, keepdim=
True) + 1e-08)
def get_inputs():
return [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 libdevice
import torch.nn as nn
import torch.utils.model_zoo
assert_size_stride = torch._... | Aitical/ADspeech2face | PixelNorm | false | 4,790 | [
"MIT"
] | 1 | 2e811ff8cc7333729f4b77d1b1067296253e8e38 | https://github.com/Aitical/ADspeech2face/tree/2e811ff8cc7333729f4b77d1b1067296253e8e38 |
ReGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | 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_... | Actis92/pytorch_tabular | ReGLU | false | 4,791 | [
"MIT"
] | 1 | 78dabf5e7b97d8ff24db4bc83d9d0a2273941bbe | https://github.com/Actis92/pytorch_tabular/tree/78dabf5e7b97d8ff24db4bc83d9d0a2273941bbe |
ToRGB | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter... | 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 numpy as np
from torch import nn
import torch.nn.functional a... | Aarsh2001/annotated_deep_learning_paper_implementations | ToRGB | false | 4,792 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
Smooth | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Smooth(nn.Module):
"""
<a id="smooth"></a>
### Smoothing Layer
This layer blurs each channel
"""
def __init__(self):
super().__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 import nn
import torch.utils.data
import torch.nn.functional
import t... | Aarsh2001/annotated_deep_learning_paper_implementations | Smooth | false | 4,793 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
Decoder | import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
class Decoder(nn.Module):
""" VAE decoder """
def __init__(self, in_channels, latent_size):
super(Decoder, self).__init__()
self.latent_size = latent_size
self.in_channels = in_channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | Adwaver4157/WorldModel_for_FinRL | Decoder | false | 4,794 | [
"MIT"
] | 1 | 0aa0a984aadffe0f6f2e83e55678c0e9304fba05 | https://github.com/Adwaver4157/WorldModel_for_FinRL/tree/0aa0a984aadffe0f6f2e83e55678c0e9304fba05 |
NoiseInjection | import torch
import torch.nn as nn
import torch.utils.model_zoo
class NoiseInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, noise=None):
if noise is None:
batch, _, height, width = image.shape... | 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.model_zoo
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Aitical/ADspeech2face | NoiseInjection | false | 4,795 | [
"MIT"
] | 1 | 2e811ff8cc7333729f4b77d1b1067296253e8e38 | https://github.com/Aitical/ADspeech2face/tree/2e811ff8cc7333729f4b77d1b1067296253e8e38 |
Conv2d | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
def weight_standardization(weight: 'torch.Tensor', eps: 'float'):
"""
## Weight Standardization
$$\\hat{W}_{i,j} = \\frac{W_{i,j} - \\mu_{W_{i,\\cdot}}} {\\sigma_{W_{... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | Aarsh2001/annotated_deep_learning_paper_implementations | Conv2d | false | 4,796 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
Encoder | import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
class Encoder(nn.Module):
""" VAE encoder """
def __init__(self, in_channels, latent_size):
super(Encoder, self).__init__()
self.latent_size = latent_size
self.in_channels = in_channels
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | Adwaver4157/WorldModel_for_FinRL | Encoder | false | 4,797 | [
"MIT"
] | 1 | 0aa0a984aadffe0f6f2e83e55678c0e9304fba05 | https://github.com/Adwaver4157/WorldModel_for_FinRL/tree/0aa0a984aadffe0f6f2e83e55678c0e9304fba05 |
SwiGLU | import torch
import torch.nn as nn
class PositionWiseFeedForward(nn.Module):
"""
title: Position-wise Feed-Forward Network (FFN)
summary: Documented reusable implementation of the position wise feedforward network.
# Position-wise Feed-Forward Network (FFN)
This is a [PyTorch](https://pytorch.org... | 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... | Actis92/pytorch_tabular | SwiGLU | false | 4,798 | [
"MIT"
] | 1 | 78dabf5e7b97d8ff24db4bc83d9d0a2273941bbe | https://github.com/Actis92/pytorch_tabular/tree/78dabf5e7b97d8ff24db4bc83d9d0a2273941bbe |
LatentAtten | import math
import torch
import torch.nn as nn
class LatentAtten(nn.Module):
"""
Attention on latent representation
"""
def __init__(self, h_dim, key_dim=None) ->None:
super(LatentAtten, self).__init__()
if key_dim is None:
key_dim = h_dim
self.key_dim = key_dim
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AdityaLab/EpiFNP | LatentAtten | false | 4,799 | [
"MIT"
] | 1 | 476c7a40ee70fffb77b76c60c42a58adf82c62f6 | https://github.com/AdityaLab/EpiFNP/tree/476c7a40ee70fffb77b76c60c42a58adf82c62f6 |
Loss | import torch
import torch.nn as nn
from torch.nn import functional as F
class Loss(nn.Module):
def __init__(self):
super(Loss, self).__init__()
def forward(self, output, label):
loss = F.cross_entropy(output, label)
return loss
def get_inputs():
return [torch.rand([4, 4, 4, 4])... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Airpooyan/FaceRecognition | Loss | false | 4,800 | [
"Apache-2.0"
] | 1 | 5bd5b14d46635ee5972fd556c103533193469d86 | https://github.com/Airpooyan/FaceRecognition/tree/5bd5b14d46635ee5972fd556c103533193469d86 |
ScaledLeakyReLU | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo
class ScaledLeakyReLU(nn.Module):
def __init__(self, negative_slope=0.2):
super().__init__()
self.negative_slope = negative_slope
def forward(self, input):
out = F.leaky_relu(i... | 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.model_zoo
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Aitical/ADspeech2face | ScaledLeakyReLU | false | 4,801 | [
"MIT"
] | 1 | 2e811ff8cc7333729f4b77d1b1067296253e8e38 | https://github.com/Aitical/ADspeech2face/tree/2e811ff8cc7333729f4b77d1b1067296253e8e38 |
AddNorm | import torch
import torch.nn as nn
class AddNorm(nn.Module):
"""
Applies LayerNorm, Dropout and adds to input. Standard AddNorm operations in Transformers
"""
def __init__(self, input_dim: 'int', dropout: 'float'):
super(AddNorm, self).__init__()
self.dropout = nn.Dropout(dropout)
... | 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_... | Actis92/pytorch_tabular | AddNorm | false | 4,802 | [
"MIT"
] | 1 | 78dabf5e7b97d8ff24db4bc83d9d0a2273941bbe | https://github.com/Actis92/pytorch_tabular/tree/78dabf5e7b97d8ff24db4bc83d9d0a2273941bbe |
AdaptiveAvgMaxPool2d | import torch
import torch.nn
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
def pooling_factor(pool_type='avg'):
return 2 if pool_type == 'avgmaxc' else 1
class AdaptiveAvgMaxPool2d(torch.nn.Module):
"""Selectable global pooling ... | 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
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distribute... | Ajithbalakrishnan/PyTorch-Image-Classification | AdaptiveAvgMaxPool2d | false | 4,803 | [
"MIT"
] | 1 | 2a6fe541cd537d3c6412f7a38ec41ac2ead43f63 | https://github.com/Ajithbalakrishnan/PyTorch-Image-Classification/tree/2a6fe541cd537d3c6412f7a38ec41ac2ead43f63 |
LayerNorm | import torch
from torch import nn
class LayerNorm(nn.Module):
def __init__(self, d_model, eps=1e-06):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(d_model))
self.beta = nn.Parameter(torch.zeros(d_model))
self.eps = eps
def forward(self, x):
m... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Adelashl6/mask_transformers | LayerNorm | false | 4,804 | [
"MIT"
] | 1 | 2a2e4d1b40ae3ed546cb850d041af246806b63e7 | https://github.com/Adelashl6/mask_transformers/tree/2a2e4d1b40ae3ed546cb850d041af246806b63e7 |
MemoryEfficientMish | import torch
import torch.nn as nn
import torch.nn.functional as F
class MemoryEfficientMish(nn.Module):
class F(torch.autograd.Function):
@staticmethod
def forward(ctx, x):
ctx.save_for_backward(x)
return x.mul(torch.tanh(F.softplus(x)))
@staticmethod
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._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
import torch.nn.functional as F
assert_s... | AkshayGanesh/yolov5processor | MemoryEfficientMish | false | 4,805 | [
"MIT"
] | 1 | 788accfa93798729c002b2c9b4f943284ff97cad | https://github.com/AkshayGanesh/yolov5processor/tree/788accfa93798729c002b2c9b4f943284ff97cad |
EqualLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo
class EqualLinear(nn.Module):
def __init__(self, in_dim, out_dim, lr_mul=1, bias=True):
super().__init__()
self.weight = nn.Parameter(torch.randn(out_dim, in_dim))
if bias:
self.bia... | 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.model_zoo
assert_size_stride = torch._C... | Aitical/ADspeech2face | EqualLinear | false | 4,806 | [
"MIT"
] | 1 | 2e811ff8cc7333729f4b77d1b1067296253e8e38 | https://github.com/Aitical/ADspeech2face/tree/2e811ff8cc7333729f4b77d1b1067296253e8e38 |
BCEBlurWithLogitsLoss | import torch
import torch.nn as nn
class BCEBlurWithLogitsLoss(nn.Module):
def __init__(self, alpha=0.05):
super(BCEBlurWithLogitsLoss, self).__init__()
self.loss_fcn = nn.BCEWithLogitsLoss(reduction='none')
self.alpha = alpha
def forward(self, pred, true):
loss = self.loss_f... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | AkshayGanesh/yolov5processor | BCEBlurWithLogitsLoss | false | 4,807 | [
"MIT"
] | 1 | 788accfa93798729c002b2c9b4f943284ff97cad | https://github.com/AkshayGanesh/yolov5processor/tree/788accfa93798729c002b2c9b4f943284ff97cad |
Sum | import torch
import torch.nn as nn
class Sum(nn.Module):
def __init__(self, n, weight=False):
super(Sum, self).__init__()
self.weight = weight
self.iter = range(n - 1)
if weight:
self.w = nn.Parameter(-torch.arange(1.0, n) / 2, requires_grad=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 torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | AkshayGanesh/yolov5processor | Sum | false | 4,808 | [
"MIT"
] | 1 | 788accfa93798729c002b2c9b4f943284ff97cad | https://github.com/AkshayGanesh/yolov5processor/tree/788accfa93798729c002b2c9b4f943284ff97cad |
StyleBlock | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
from typing import Optional
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | Aarsh2001/annotated_deep_learning_paper_implementations | StyleBlock | false | 4,809 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
MultiHead | import math
import torch
from torch import nn
from torch.nn import functional as F
class Attention(nn.Module):
def __init__(self, d_key, drop_ratio, causal):
super(Attention, self).__init__()
self.scale = math.sqrt(d_key)
self.dropout = nn.Dropout(drop_ratio)
self.causal = causal
... | 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.... | Adelashl6/mask_transformers | MultiHead | false | 4,810 | [
"MIT"
] | 1 | 2a2e4d1b40ae3ed546cb850d041af246806b63e7 | https://github.com/Adelashl6/mask_transformers/tree/2a2e4d1b40ae3ed546cb850d041af246806b63e7 |
Hardswish | import torch
import torch.nn as nn
import torch.nn.functional as F
class Hardswish(nn.Module):
@staticmethod
def forward(x):
return x * F.hardtanh(x + 3, 0.0, 6.0) / 6.0
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | AkshayGanesh/yolov5processor | Hardswish | false | 4,811 | [
"MIT"
] | 1 | 788accfa93798729c002b2c9b4f943284ff97cad | https://github.com/AkshayGanesh/yolov5processor/tree/788accfa93798729c002b2c9b4f943284ff97cad |
SEModule | from torch.nn import Module
import torch
from torch.nn import Conv2d
from torch.nn import ReLU
from torch.nn import Sigmoid
from torch.nn import AdaptiveAvgPool2d
import torch.utils.model_zoo
class SEModule(Module):
def __init__(self, channels, reduction):
super(SEModule, self).__init__()
self.av... | 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
f... | Aitical/ADspeech2face | SEModule | false | 4,812 | [
"MIT"
] | 1 | 2e811ff8cc7333729f4b77d1b1067296253e8e38 | https://github.com/Aitical/ADspeech2face/tree/2e811ff8cc7333729f4b77d1b1067296253e8e38 |
Classify | import torch
import torch.nn as nn
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class Flatten(nn.Module):
@staticmethod
def forward(x):
return x.view(x.size(0), -1)
class Classify(nn.Module):
def __init__(self, c1,... | 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... | AkshayGanesh/yolov5processor | Classify | false | 4,813 | [
"MIT"
] | 1 | 788accfa93798729c002b2c9b4f943284ff97cad | https://github.com/AkshayGanesh/yolov5processor/tree/788accfa93798729c002b2c9b4f943284ff97cad |
VAE | import torch
from torch import nn
from torch.nn import functional as F
import torch.utils.data
class Decoder(nn.Module):
""" VAE decoder """
def __init__(self, in_channels, latent_size):
super(Decoder, self).__init__()
self.latent_size = latent_size
self.in_channels = in_channels
... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from... | Adwaver4157/WorldModel_for_FinRL | VAE | false | 4,814 | [
"MIT"
] | 1 | 0aa0a984aadffe0f6f2e83e55678c0e9304fba05 | https://github.com/Adwaver4157/WorldModel_for_FinRL/tree/0aa0a984aadffe0f6f2e83e55678c0e9304fba05 |
MLPNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class MLPNetwork(nn.Module):
"""
MLP network (can be used as value or policy)
"""
def __init__(self, input_dim, out_dim, hidden_dim=64, nonlin=F.relu,
constrain_out=False, norm_in=False, discrete_action=True):
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional as... | Aks-Dmv/maddpg-pytorch | MLPNetwork | false | 4,815 | [
"MIT"
] | 1 | 8afe2448875824cf5aee69c5d0314a3e00777b6f | https://github.com/Aks-Dmv/maddpg-pytorch/tree/8afe2448875824cf5aee69c5d0314a3e00777b6f |
Fp32LayerNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class Fp32LayerNorm(nn.LayerNorm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def forward(self, input)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
impor... | AbhilashMathews/adahessian | Fp32LayerNorm | false | 4,819 | [
"MIT"
] | 1 | bacccecc7a078c3e9e72aa55b17d8e46d21dc9c9 | https://github.com/AbhilashMathews/adahessian/tree/bacccecc7a078c3e9e72aa55b17d8e46d21dc9c9 |
GeneratorBlock | import math
import torch
import numpy as np
from torch import nn
from typing import Tuple
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
from typing import List
from typing import Optional
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_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.triton_helpers import libdevice
import math
import ... | Aarsh2001/annotated_deep_learning_paper_implementations | GeneratorBlock | false | 4,821 | [
"MIT"
] | 1 | ff0d5c065da1a46769f5f66fddc252c178f8fa37 | https://github.com/Aarsh2001/annotated_deep_learning_paper_implementations/tree/ff0d5c065da1a46769f5f66fddc252c178f8fa37 |
HighwayLayer | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.jit
import torch.onnx.operators
class HighwayLayer(nn.Module):
def __init__(self, input_dim, transform_activation=F.relu,
gate_activation=F.softmax, gate_bias=-2):
super().__init__()
self.highway_transform_act... | 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.... | Acidburn0zzz/translate-1 | HighwayLayer | false | 4,822 | [
"BSD-3-Clause"
] | 1 | 8385a3c95de397fec8ca7a032fe1c215fa4e31f9 | https://github.com/Acidburn0zzz/translate-1/tree/8385a3c95de397fec8ca7a032fe1c215fa4e31f9 |
SimilarityMatrix | import torch
import torch.utils.data
class SimilarityMatrix(torch.nn.Module):
def __init__(self, padding=0):
super().__init__()
self.padding = padding
def forward(self, query_embed, doc_embed, query_tok, doc_tok):
simmat = []
assert type(query_embed) == type(doc_embed)
... | 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.utils.... | AlexWang000/capreolus | SimilarityMatrix | false | 4,823 | [
"Apache-2.0"
] | 1 | 00b0bf471ea0eb116ab973254ea61b0492405c54 | https://github.com/AlexWang000/capreolus/tree/00b0bf471ea0eb116ab973254ea61b0492405c54 |
Hswish | import torch
import torch.nn as nn
from torch.nn import functional as F
class Hswish(nn.Module):
def __init__(self, inplace=True):
super(Hswish, self).__init__()
self.inplace = inplace
def forward(self, x):
return x * F.relu6(x + 3.0, inplace=self.inplace) / 6.0
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Alterith/masters_code | Hswish | false | 4,824 | [
"MIT"
] | 1 | 65d0f2d26698cc8f7a5ffb564936113e2bbec201 | https://github.com/Alterith/masters_code/tree/65d0f2d26698cc8f7a5ffb564936113e2bbec201 |
Hsigmoid | import torch
import torch.nn as nn
from torch.nn import functional as F
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
return F.relu6(x + 3.0, inplace=self.inplace) / 6.0
def get_inputs():
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Alterith/Dense_Video_Captioning_Feature_Extraction_Model_Choice | Hsigmoid | false | 4,826 | [
"MIT"
] | 1 | 65d0f2d26698cc8f7a5ffb564936113e2bbec201 | https://github.com/Alterith/Dense_Video_Captioning_Feature_Extraction_Model_Choice/tree/65d0f2d26698cc8f7a5ffb564936113e2bbec201 |
PACRRConvMax2dModule | import torch
import torch.utils.data
class PACRRConvMax2dModule(torch.nn.Module):
def __init__(self, shape, n_filters, k, channels):
super().__init__()
self.shape = shape
if shape != 1:
self.pad = torch.nn.ConstantPad2d((0, shape - 1, 0, shape - 1), 0)
else:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
asser... | AlexWang000/capreolus | PACRRConvMax2dModule | false | 4,827 | [
"Apache-2.0"
] | 1 | 00b0bf471ea0eb116ab973254ea61b0492405c54 | https://github.com/AlexWang000/capreolus/tree/00b0bf471ea0eb116ab973254ea61b0492405c54 |
MLP_Qnet | import torch
import torch.nn.functional as F
import torch.nn as nn
class MLPNetwork(nn.Module):
"""
MLP network (can be used as value or policy)
"""
def __init__(self, input_dim, out_dim, hidden_dim=64, nonlin=F.relu,
constrain_out=False, norm_in=False, discrete_action=True):
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn.functional as... | Aks-Dmv/maddpg-pytorch | MLP_Qnet | false | 4,828 | [
"MIT"
] | 1 | 8afe2448875824cf5aee69c5d0314a3e00777b6f | https://github.com/Aks-Dmv/maddpg-pytorch/tree/8afe2448875824cf5aee69c5d0314a3e00777b6f |
JointsMSELoss | import torch
import torch.nn as nn
import torch.utils.data
class JointsMSELoss(nn.Module):
def __init__(self, use_target_weight):
super(JointsMSELoss, self).__init__()
self.criterion = nn.MSELoss(size_average=True)
self.use_target_weight = use_target_weight
def forward(self, output, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | AlongRide/Py3torch_HigherHRNet | JointsMSELoss | false | 4,829 | [
"MIT"
] | 1 | 62c455b62c0ac6d1de482fd3740dc947033e9e9a | https://github.com/AlongRide/Py3torch_HigherHRNet/tree/62c455b62c0ac6d1de482fd3740dc947033e9e9a |
tofp16 | import torch
import torch.nn as nn
import torch.utils.data
class tofp16(nn.Module):
"""
Model wrapper that implements::
def forward(self, input):
return input.half()
"""
def __init__(self):
super(tofp16, self).__init__()
def forward(self, input):
return 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
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | AlongRide/Py3torch_HigherHRNet | tofp16 | false | 4,830 | [
"MIT"
] | 1 | 62c455b62c0ac6d1de482fd3740dc947033e9e9a | https://github.com/AlongRide/Py3torch_HigherHRNet/tree/62c455b62c0ac6d1de482fd3740dc947033e9e9a |
MultiheadAttention | import math
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch.jit
import torch.onnx.operators
def combine_heads(X):
"""
Combine heads (the inverse of split heads):
1) Transpose X from (batch size, nheads, sequence length, d_head) to
(batch size, seq... | 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.... | Acidburn0zzz/translate-1 | MultiheadAttention | false | 4,831 | [
"BSD-3-Clause"
] | 1 | 8385a3c95de397fec8ca7a032fe1c215fa4e31f9 | https://github.com/Acidburn0zzz/translate-1/tree/8385a3c95de397fec8ca7a032fe1c215fa4e31f9 |
SimCLRLoss | import torch
import numpy as np
import torch.nn as nn
import torch.utils.model_zoo
class SimCLRLoss(nn.Module):
def __init__(self, temperature):
super(SimCLRLoss, self).__init__()
self.T = temperature
self.ce = nn.CrossEntropyLoss()
self.norm = nn.functional.normalize
self... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import nump... | Aitical/ADspeech2face | SimCLRLoss | false | 4,832 | [
"MIT"
] | 1 | 2e811ff8cc7333729f4b77d1b1067296253e8e38 | https://github.com/Aitical/ADspeech2face/tree/2e811ff8cc7333729f4b77d1b1067296253e8e38 |
ZeroPad1d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class ZeroPad1d(nn.Module):
def __init__(self, pad_left, pad_right):
super().__init__()
self.pad_left = pad_left
self.p... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
assert_size_str... | AbhilashMathews/adahessian | ZeroPad1d | false | 4,833 | [
"MIT"
] | 1 | bacccecc7a078c3e9e72aa55b17d8e46d21dc9c9 | https://github.com/AbhilashMathews/adahessian/tree/bacccecc7a078c3e9e72aa55b17d8e46d21dc9c9 |
CrossEntropyLoss | 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 math as tl_math
import torch.nn as nn
... | AlphaLFC/mmdetection | CrossEntropyLoss | false | 4,834 | [
"Apache-2.0"
] | 1 | 45619c5b8aca0ca3e6ddc211210a8946c94694d8 | https://github.com/AlphaLFC/mmdetection/tree/45619c5b8aca0ca3e6ddc211210a8946c94694d8 |
LayerNorm | import numbers
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.nn.init as init
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class LayerNorm(nn.Module):
"""Applies Layer Normalization over a mini-batch of inputs as described ... | 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 numbers
import torch.nn as nn
import torch.utils.data
import torch.nn.in... | AbhilashMathews/adahessian | LayerNorm | false | 4,835 | [
"MIT"
] | 1 | bacccecc7a078c3e9e72aa55b17d8e46d21dc9c9 | https://github.com/AbhilashMathews/adahessian/tree/bacccecc7a078c3e9e72aa55b17d8e46d21dc9c9 |
Fp32GroupNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class Fp32GroupNorm(nn.GroupNorm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def forward(self, input)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
impor... | AbhilashMathews/adahessian | Fp32GroupNorm | false | 4,836 | [
"MIT"
] | 1 | bacccecc7a078c3e9e72aa55b17d8e46d21dc9c9 | https://github.com/AbhilashMathews/adahessian/tree/bacccecc7a078c3e9e72aa55b17d8e46d21dc9c9 |
Generator | import torch
from torch import nn
import torch.nn.functional as f
class Generator(nn.Module):
def __init__(self, nz):
super(Generator, self).__init__()
self.fc1 = nn.Linear(nz, 10)
self.fc2 = nn.Linear(10, 1)
def forward(self, x):
x = f.relu(self.fc1(x))
x = 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
from torch import nn
assert_s... | Anas-Alamri/vegans | Generator | false | 4,837 | [
"MIT"
] | 1 | 2e8513c9cbebf18d0125cebdc7d924dd6345883a | https://github.com/Anas-Alamri/vegans/tree/2e8513c9cbebf18d0125cebdc7d924dd6345883a |
Swish | import torch
import torch.nn
import torch.nn as nn
class Swish(nn.Module):
"""Applies the element-wise function:
.. math::
\\text{Swish}(x) = x * \\text{Sigmoid}(\\alpha * x) for constant value alpha.
Citation: Searching for Activation Functions, Ramachandran et al., 2017, https://arxiv.org/abs/... | 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.... | Alxaline/MONAI | Swish | false | 4,838 | [
"Apache-2.0"
] | 1 | 6b8fdf9db7f13ed7d88d605155a0463840abcbf2 | https://github.com/Alxaline/MONAI/tree/6b8fdf9db7f13ed7d88d605155a0463840abcbf2 |
BalancedL1Loss | import functools
import torch
import numpy as np
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:
Tenso... | 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... | AlphaLFC/mmdetection | BalancedL1Loss | false | 4,839 | [
"Apache-2.0"
] | 1 | 45619c5b8aca0ca3e6ddc211210a8946c94694d8 | https://github.com/AlphaLFC/mmdetection/tree/45619c5b8aca0ca3e6ddc211210a8946c94694d8 |
Clump | import torch
from torch import nn
class Clump(nn.Module):
"""Clipping input tensor."""
def __init__(self, min_v: 'int'=-50, max_v: 'int'=50):
"""Class for preparing input for DL model with mixed data.
Args:
min_v: Min value.
max_v: Max value.
"""
supe... | 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... | Andrey-Nikitin/LightAutoML | Clump | false | 4,840 | [
"Apache-2.0"
] | 1 | fe58d98d1ab05e177f0b9dea918fef8b922ae922 | https://github.com/Andrey-Nikitin/LightAutoML/tree/fe58d98d1ab05e177f0b9dea918fef8b922ae922 |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def __init__(self, n_dims, scale=20.0, eps=1e-10):
super(L2Norm, self).__init__()
self.n_dims = n_dims
self.weight = nn.Parameter(torch.Tensor(self.n_dims))
self.eps = eps
self.scale = scale
def forward(self,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | AlphaLFC/mmdetection | L2Norm | false | 4,841 | [
"Apache-2.0"
] | 1 | 45619c5b8aca0ca3e6ddc211210a8946c94694d8 | https://github.com/AlphaLFC/mmdetection/tree/45619c5b8aca0ca3e6ddc211210a8946c94694d8 |
EncoderLayer | import math
import torch
from torch import nn
from torch.nn import functional as F
class LayerNorm(nn.Module):
def __init__(self, d_model, eps=1e-06):
super(LayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(d_model))
self.beta = nn.Parameter(torch.zeros(d_model))
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.... | Adelashl6/mask_transformers | EncoderLayer | false | 4,842 | [
"MIT"
] | 1 | 2a2e4d1b40ae3ed546cb850d041af246806b63e7 | https://github.com/Adelashl6/mask_transformers/tree/2a2e4d1b40ae3ed546cb850d041af246806b63e7 |
WordPredictor | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.jit
import torch.onnx.operators
class WordPredictor(nn.Module):
def __init__(self, encoder_output_dim, hidden_dim, output_dim,
topk_labels_per_source_token=None, use_self_attention=False):
super().__init__()
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
import torch.nn.functional as... | Acidburn0zzz/translate-1 | WordPredictor | false | 4,843 | [
"BSD-3-Clause"
] | 1 | 8385a3c95de397fec8ca7a032fe1c215fa4e31f9 | https://github.com/Acidburn0zzz/translate-1/tree/8385a3c95de397fec8ca7a032fe1c215fa4e31f9 |
ConvWS2d | import torch
import torch.nn as nn
import torch.nn.functional as F
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_in, 1, 1, 1)
std = 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.triton_helpers import libdevice
import torch.nn as ... | AlphaLFC/mmdetection | ConvWS2d | false | 4,845 | [
"Apache-2.0"
] | 1 | 45619c5b8aca0ca3e6ddc211210a8946c94694d8 | https://github.com/AlphaLFC/mmdetection/tree/45619c5b8aca0ca3e6ddc211210a8946c94694d8 |
ValueNetwork | import torch
import torch.nn.functional as F
from torch import nn
import torch.nn
def weights_init_(m):
if isinstance(m, nn.Linear):
torch.nn.init.xavier_uniform_(m.weight, gain=1)
torch.nn.init.constant_(m.bias, 0)
class ValueNetwork(nn.Module):
def __init__(self, num_inputs, hidden_dim):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | AmmarFayad/Influence-based-Reinforcement-Learning-in-Intrinsically-motivated-Agents | ValueNetwork | false | 4,846 | [
"MIT"
] | 1 | e7cfa4121542312de641792288f7487f86971c1e | https://github.com/AmmarFayad/Influence-based-Reinforcement-Learning-in-Intrinsically-motivated-Agents/tree/e7cfa4121542312de641792288f7487f86971c1e |
GDN | from torch.autograd import Function
import torch
import torch.nn.functional as F
import torch.nn as nn
class LowerBound(Function):
@staticmethod
def forward(ctx, inputs, bound):
ctx.save_for_backward(inputs, inputs.new_ones(1) * bound)
return inputs.clamp(min=bound)
@staticmethod
def... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AmigoLab/pytorch-msssim | GDN | false | 4,847 | [
"MIT"
] | 1 | 234fde137d8d1b4f9b7a2b94523ecc8f11f54c49 | https://github.com/AmigoLab/pytorch-msssim/tree/234fde137d8d1b4f9b7a2b94523ecc8f11f54c49 |
MeanStd | import torch
import torch.nn as nn
class MeanStd(nn.Module):
def __init__(self):
super(MeanStd, self).__init__()
def forward(self, x):
x = x.view(x.size(0), x.size(1), -1)
mean_x = torch.mean(x, dim=2)
var_x = torch.mean(x ** 2, dim=2) - mean_x * mean_x
return torch.c... | 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... | Andribi/pytorch_GAN_zoo | MeanStd | false | 4,848 | [
"BSD-3-Clause"
] | 1 | b37c7268cbd4ec7dc61ba65a3ccf11af71247597 | https://github.com/Andribi/pytorch_GAN_zoo/tree/b37c7268cbd4ec7dc61ba65a3ccf11af71247597 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.