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 |
|---|---|---|---|---|---|---|---|---|---|---|
Attention | import math
import torch
import torch.nn as nn
class Attention(nn.Module):
def __init__(self, embedding_size, num_attention_heads,
attention_dropout, residual_dropout):
super(Attention, self).__init__()
self.num_attention_heads = num_attention_heads
self.size_per_head = embedding_... | 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.... | AeroXi/CPM-Generate-Pytorch | Attention | false | 8,913 | [
"Apache-2.0"
] | 0 | a1530ad2848a690c6e1557f996fe58538fe86884 | https://github.com/AeroXi/CPM-Generate-Pytorch/tree/a1530ad2848a690c6e1557f996fe58538fe86884 |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, pred, target, weight=None):
smooth = 1
size = pred.size(0)
pred_flat = pred.view(size, -1)
target_flat = target.view(size, -1)
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | CityU-AIM-Group/PRR-Imbalance | DiceLoss | false | 8,914 | [
"MIT"
] | 0 | e893809c72697511897c9100c25f831087fc345f | https://github.com/CityU-AIM-Group/PRR-Imbalance/tree/e893809c72697511897c9100c25f831087fc345f |
HardSwish | import torch
import torch.nn.functional as F
from torch import nn
class HardSwish(nn.Module):
def forward(self, x):
return x * F.hardtanh(x + 3, 0.0, 6.0, True) / 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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | Cris-zj/mmdetection | HardSwish | false | 8,915 | [
"Apache-2.0"
] | 0 | ede648b93e7ba2562f835f338b778f3e705f7119 | https://github.com/Cris-zj/mmdetection/tree/ede648b93e7ba2562f835f338b778f3e705f7119 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Chrisfsj2051/my_tools | FocalLoss | false | 8,916 | [
"MIT"
] | 0 | 67355a46df6290aa2fdc1e0266c61daacced3ba1 | https://github.com/Chrisfsj2051/my_tools/tree/67355a46df6290aa2fdc1e0266c61daacced3ba1 |
EncoderSlot | import torch
from torch import nn
class EncoderSlot(nn.Module):
def __init__(self):
super().__init__()
self.conv_1 = nn.Conv2d(in_channels=1, out_channels=64, kernel_size=5)
self.conv_2 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size=5)
self.conv_3 = nn.Conv2d(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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | CatarauCorina/representation_learning | EncoderSlot | false | 8,917 | [
"Apache-2.0"
] | 0 | bb467761b03e5d8ac20c2f705f3bfdb84a7c3842 | https://github.com/CatarauCorina/representation_learning/tree/bb467761b03e5d8ac20c2f705f3bfdb84a7c3842 |
GlobalAveragePooling | import torch
import torch.nn as nn
class GlobalAveragePooling(nn.Module):
"""Global Average Pooling neck.
Note that we use `view` to remove extra channel after pooling. We do not
use `squeeze` as it will also remove the batch dimension when the tensor
has a batch dimension of size 1, which can lead t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Chrisfsj2051/my_tools | GlobalAveragePooling | false | 8,918 | [
"MIT"
] | 0 | 67355a46df6290aa2fdc1e0266c61daacced3ba1 | https://github.com/Chrisfsj2051/my_tools/tree/67355a46df6290aa2fdc1e0266c61daacced3ba1 |
Mish | import torch
import torch.nn.functional as F
from torch import nn
class Mish(nn.Module):
def forward(self, x):
return x * F.softplus(x).tanh()
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch import nn
assert_size_stride = torch._C._dynamo.gua... | Cris-zj/mmdetection | Mish | false | 8,919 | [
"Apache-2.0"
] | 0 | ede648b93e7ba2562f835f338b778f3e705f7119 | https://github.com/Cris-zj/mmdetection/tree/ede648b93e7ba2562f835f338b778f3e705f7119 |
AsymmetricLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Chrisfsj2051/my_tools | AsymmetricLoss | false | 8,920 | [
"MIT"
] | 0 | 67355a46df6290aa2fdc1e0266c61daacced3ba1 | https://github.com/Chrisfsj2051/my_tools/tree/67355a46df6290aa2fdc1e0266c61daacced3ba1 |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
import torch._utils
class MaxPoolStride1(nn.Module):
def __init__(self, kernel_size):
super(MaxPoolStride1, self).__init__()
self.kernel_size = kernel_size
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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import ... | AutoRaider/AlphaPose | MaxPoolStride1 | false | 8,921 | [
"Apache-2.0"
] | 0 | bf74882728901b033d45512b402c32277bf9246b | https://github.com/AutoRaider/AlphaPose/tree/bf74882728901b033d45512b402c32277bf9246b |
Actor | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, 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.... | CCThompson82/deep-reinforcement-learning | Actor | false | 8,922 | [
"MIT"
] | 0 | f93faf0fb2b2dd8cfafeb8a4480e5520cefe6cb2 | https://github.com/CCThompson82/deep-reinforcement-learning/tree/f93faf0fb2b2dd8cfafeb8a4480e5520cefe6cb2 |
RFDB | import torch
import torch.nn as nn
import torch.nn.functional as F
def activation(act_type, inplace=True, neg_slope=0.05, n_prelu=1):
act_type = act_type.lower()
if act_type == 'relu':
layer = nn.ReLU(inplace)
elif act_type == 'lrelu':
layer = nn.LeakyReLU(neg_slope, False)
elif act_ty... | 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 ... | BigKingXXL/RFDN | RFDB | false | 8,923 | [
"MIT"
] | 0 | 35efe7db2558ca063206f3b5ab8341ba9c5e2dc8 | https://github.com/BigKingXXL/RFDN/tree/35efe7db2558ca063206f3b5ab8341ba9c5e2dc8 |
GELU | import torch
import torch.nn as nn
class GELU(nn.Module):
def __init__(self):
super(GELU, self).__init__()
def forward(self, x):
return torch.sigmoid(1.702 * x) * x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ChurchChen/SparsityRegularization | GELU | false | 8,924 | [
"Apache-2.0"
] | 0 | 5c2e050ffe511cf4307a0bcd98360d28b7db8fef | https://github.com/ChurchChen/SparsityRegularization/tree/5c2e050ffe511cf4307a0bcd98360d28b7db8fef |
RFDBsmall | import torch
import torch.nn as nn
import torch.nn.functional as F
def activation(act_type, inplace=True, neg_slope=0.05, n_prelu=1):
act_type = act_type.lower()
if act_type == 'relu':
layer = nn.ReLU(inplace)
elif act_type == 'lrelu':
layer = nn.LeakyReLU(neg_slope, False)
elif act_ty... | 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 ... | BigKingXXL/RFDN | RFDBsmall | false | 8,925 | [
"MIT"
] | 0 | 35efe7db2558ca063206f3b5ab8341ba9c5e2dc8 | https://github.com/BigKingXXL/RFDN/tree/35efe7db2558ca063206f3b5ab8341ba9c5e2dc8 |
OELoss | import torch
import torch.nn as nn
class OELoss(nn.Module):
def __init__(self):
super(OELoss, self).__init__()
def forward(self, x):
return -(x.mean(1) - torch.logsumexp(x, dim=1)).mean()
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | ChurchChen/SparsityRegularization | OELoss | false | 8,926 | [
"Apache-2.0"
] | 0 | 5c2e050ffe511cf4307a0bcd98360d28b7db8fef | https://github.com/ChurchChen/SparsityRegularization/tree/5c2e050ffe511cf4307a0bcd98360d28b7db8fef |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super(DiceLoss, self).__init__()
def forward(self, inputs, targets, smooth=1):
inputs = inputs.view(-1)
targets = targets.view(-1)
intersection = (inputs * target... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Charbel199/Oil-Spill-Thickness-Estimation | DiceLoss | false | 8,927 | [
"MIT"
] | 0 | dd600f6da611461f3b8072389bc34e6285109246 | https://github.com/Charbel199/Oil-Spill-Thickness-Estimation/tree/dd600f6da611461f3b8072389bc34e6285109246 |
Q | import torch
import torch.nn as nn
class P(nn.Module):
"""
to solve min(P) = ||I-PQ||^2 + γ||P-R||^2
this is a least square problem
how to solve?
P* = (gamma*R + I*Q) / (Q*Q + gamma)
"""
def __init__(self):
super().__init__()
def forward(self, I, Q, R, gamma):... | 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... | AndersonYong/URetinex-Net-Retinex-based-Deep-Unfolding-Network-for-Low-light-Image-Enhancem | Q | false | 8,928 | [
"MIT"
] | 0 | 9d837b8df9c761defb1eca390b3a60aa4a6fbb1a | https://github.com/AndersonYong/URetinex-Net-Retinex-based-Deep-Unfolding-Network-for-Low-light-Image-Enhancem/tree/9d837b8df9c761defb1eca390b3a60aa4a6fbb1a |
P | import torch
import torch.nn as nn
class P(nn.Module):
"""
to solve min(P) = ||I-PQ||^2 + γ||P-R||^2
this is a least square problem
how to solve?
P* = (gamma*R + I*Q) / (Q*Q + gamma)
"""
def __init__(self):
super().__init__()
def forward(self, I, Q, R, gamma):... | 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... | AndersonYong/URetinex-Net-Retinex-based-Deep-Unfolding-Network-for-Low-light-Image-Enhancem | P | false | 8,929 | [
"MIT"
] | 0 | 9d837b8df9c761defb1eca390b3a60aa4a6fbb1a | https://github.com/AndersonYong/URetinex-Net-Retinex-based-Deep-Unfolding-Network-for-Low-light-Image-Enhancem/tree/9d837b8df9c761defb1eca390b3a60aa4a6fbb1a |
get_loss | import torch
import torch.nn as nn
class get_loss(nn.Module):
def __init__(self):
super(get_loss, self).__init__()
def forward(self, pred, target):
weight = target + 1
loss = nn.BCELoss(weight=weight)(pred, target)
return loss
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._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | ChunhuiChen97/RetinalVesselSegmentation | get_loss | false | 8,930 | [
"MIT"
] | 0 | d291e23b1ad9814070897ef850d0117d67331d70 | https://github.com/ChunhuiChen97/RetinalVesselSegmentation/tree/d291e23b1ad9814070897ef850d0117d67331d70 |
SSWELoss | import torch
import torch.nn as nn
class HingeMarginLoss(nn.Module):
"""
计算hinge loss 接口
"""
def __init__(self):
super(HingeMarginLoss, self).__init__()
def forward(self, t, tr, delt=None, size_average=False):
"""
计算hingle loss
"""
if delt is None:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Cuiqingyao/multilabel | SSWELoss | false | 8,931 | [
"Apache-2.0"
] | 0 | f36dc6f1168a3edf8f43565477c096dc0bf31de8 | https://github.com/Cuiqingyao/multilabel/tree/f36dc6f1168a3edf8f43565477c096dc0bf31de8 |
Pooler | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.linear import Linear
import torch.nn.init as init
from torch.nn import Parameter
from torch.nn.parameter import Parameter
class Pooler(nn.Module):
"""Pooler layer.
Pool hidden states of a specific token (for example star... | 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 ... | BoxiangW/ColossalAI-Examples | Pooler | false | 8,932 | [
"Apache-2.0"
] | 0 | 853fefe709508839a56df0cfe1a548e02254724a | https://github.com/BoxiangW/ColossalAI-Examples/tree/853fefe709508839a56df0cfe1a548e02254724a |
GELU_ | import math
import torch
import torch.nn as nn
class GELU_(nn.Module):
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x +
0.044715 * torch.pow(x, 3))))
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | AniketRajpoot/reformer-pytorch | GELU_ | false | 8,933 | [
"MIT"
] | 0 | 06b131eb383e7a3a184b7038ef20fe614958216f | https://github.com/AniketRajpoot/reformer-pytorch/tree/06b131eb383e7a3a184b7038ef20fe614958216f |
MultiHeadAttention | import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
def __init__(self, hidden_size, attention_dropout_rate, num_heads):
super(MultiHeadAttention, self).__init__()
self.num_heads = num_heads
self.att_size = att_size = hidden_size // num_heads
self.scale = att_si... | 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.... | ChantalMP/Graphormer | MultiHeadAttention | false | 8,934 | [
"MIT"
] | 0 | 5c384d0f2840afc88ee88aeb874f4b1f41d760bf | https://github.com/ChantalMP/Graphormer/tree/5c384d0f2840afc88ee88aeb874f4b1f41d760bf |
TVLoss | import torch
import torch.nn as nn
class TVLoss(nn.Module):
def __init__(self, strength):
super(TVLoss, self).__init__()
self.strength = strength
def forward(self, input):
self.x_diff = input[:, :, 1:, :] - input[:, :, :-1, :]
self.y_diff = input[:, :, :, 1:] - 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 math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | DarekGit/neural_style | TVLoss | false | 8,935 | [
"MIT"
] | 0 | 461f0d791f23e82bbf0adcecf5630854ccac9944 | https://github.com/DarekGit/neural_style/tree/461f0d791f23e82bbf0adcecf5630854ccac9944 |
ScaledDotProductAttention | import math
import torch
from torch import nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, d_k):
super().__init__()
self.dropout = nn.Dropout(0.5)
self.sqrt_d_k = math.sqrt(d_k)
def forward(self, Q, K, V):
attn = torch.bmm(Q, K.transpose(2, 1))
attn ... | 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.... | DaanG96/breakfastDSNet | ScaledDotProductAttention | false | 8,936 | [
"MIT"
] | 0 | 17a146ef5ad077e935e6f4b773e0a1f605f76a78 | https://github.com/DaanG96/breakfastDSNet/tree/17a146ef5ad077e935e6f4b773e0a1f605f76a78 |
TorchModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class TorchModel(nn.Module):
def __init__(self):
super(TorchModel, self).__init__()
self.conv1 = nn.Conv2d(1, 20, 5)
self.conv2 = nn.Conv2d(20, 20, 5)
def forward(self, x):
x = F.relu(self.conv1(x))
re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | DLPerf/elasticdl | TorchModel | false | 8,937 | [
"MIT"
] | 0 | b9c03ea0e81861ae8d349c3d8ffd1f7b588b910b | https://github.com/DLPerf/elasticdl/tree/b9c03ea0e81861ae8d349c3d8ffd1f7b588b910b |
ScaleNorm | import torch
import torch.nn as nn
class ScaleNorm(nn.Module):
def __init__(self, dim, eps=1e-05):
super().__init__()
self.g = nn.Parameter(torch.ones(1))
self.eps = eps
def forward(self, x):
n = torch.norm(x, dim=-1, keepdim=True).clamp(min=self.eps)
return x / n * s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | AniketRajpoot/reformer-pytorch | ScaleNorm | false | 8,938 | [
"MIT"
] | 0 | 06b131eb383e7a3a184b7038ef20fe614958216f | https://github.com/AniketRajpoot/reformer-pytorch/tree/06b131eb383e7a3a184b7038ef20fe614958216f |
ScaledDotProductAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
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.... | Blair129/FEAT-master | ScaledDotProductAttention | false | 8,939 | [
"MIT"
] | 0 | 459e05000a8cca5421fafb7d2f33f19418378df7 | https://github.com/Blair129/FEAT-master/tree/459e05000a8cca5421fafb7d2f33f19418378df7 |
VAE | import torch
import torch.nn.functional as F
from torch import nn
class VAE(nn.Module):
"""A classic VAE.
Params
------
input_dim : int
The size of the (flattened) image vector
latent_dim : int
The size of the latent memory
"""
def __init__(self, input_dim=784, laten... | 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... | CoAxLab/newremagine | VAE | false | 8,940 | [
"MIT"
] | 0 | 5ae1c579121c93271ebf5dcef45bd66e8daea3a7 | https://github.com/CoAxLab/newremagine/tree/5ae1c579121c93271ebf5dcef45bd66e8daea3a7 |
ResidualSequential | import torch
import torch.nn as nn
import torch.nn.init
class ResidualSequential(nn.Sequential):
def __init__(self, *args):
super(ResidualSequential, self).__init__(*args)
def forward(self, x):
out = super(ResidualSequential, self).forward(x)
x_ = None
if out.size(2) != x.siz... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.init
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dy... | DDQXZcp/FYP_ProjectFile_TANG_Zhiheng | ResidualSequential | false | 8,941 | [
"MIT"
] | 0 | b0e3b9d1c5cee61e1d09a32e405244bda09b6f0d | https://github.com/DDQXZcp/FYP_ProjectFile_TANG_Zhiheng/tree/b0e3b9d1c5cee61e1d09a32e405244bda09b6f0d |
Hsigmoid | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
class Hsigmoid(nn.Module):
def __init__(self, inplace=True):
super(Hsigmoid, self).__init__()
self.inplace = inplace
def forward(self, x):
return F.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 import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim... | AlbertiPot/once-for-all | Hsigmoid | false | 8,942 | [
"MIT"
] | 0 | 092b9e6184be353383396761ea5ec61d67152645 | https://github.com/AlbertiPot/once-for-all/tree/092b9e6184be353383396761ea5ec61d67152645 |
Flatten | import torch
from torch import nn
class Flatten(nn.Module):
def __init__(self):
super(Flatten, self).__init__()
def forward(self, x):
"""
Arguments:
x: a float tensor with shape [batch_size, c, h, w].
Returns:
a float tensor with shape [batch_size, c*h... | 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... | DebugVBZ/pixel2style2pixel | Flatten | false | 8,943 | [
"MIT"
] | 0 | e884c0cf471ad9ee09b8743d7ffd532283a638e5 | https://github.com/DebugVBZ/pixel2style2pixel/tree/e884c0cf471ad9ee09b8743d7ffd532283a638e5 |
GenNoise | import torch
import torch.nn as nn
import torch.nn.init
class GenNoise(nn.Module):
def __init__(self, dim2):
super(GenNoise, self).__init__()
self.dim2 = dim2
def forward(self, input):
a = list(input.size())
a[1] = self.dim2
b = torch.zeros(a).type_as(input.data)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.init
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dy... | DDQXZcp/FYP_ProjectFile_TANG_Zhiheng | GenNoise | false | 8,944 | [
"MIT"
] | 0 | b0e3b9d1c5cee61e1d09a32e405244bda09b6f0d | https://github.com/DDQXZcp/FYP_ProjectFile_TANG_Zhiheng/tree/b0e3b9d1c5cee61e1d09a32e405244bda09b6f0d |
AttentionScore | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttentionScore(nn.Module):
"""
correlation_func = 1, sij = x1^Tx2
correlation_func = 2, sij = (Wx1)D(Wx2)
correlation_func = 3, sij = Relu(Wx1)DRelu(Wx2)
correlation_func = 4, sij = x1^TWx2
correlation_func = 5, sij = Rel... | 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.... | BruceWen120/neurips-reproducibility-challenge-2019 | AttentionScore | false | 8,945 | [
"Apache-2.0"
] | 0 | b0635aefe83e3f895ce0991913824e861bb7d02d | https://github.com/BruceWen120/neurips-reproducibility-challenge-2019/tree/b0635aefe83e3f895ce0991913824e861bb7d02d |
MyGlobalAvgPool2d | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim
class MyGlobalAvgPool2d(nn.Module):
def __init__(self, keep_dim=True):
super(MyGlobalAvgPool2d, self).__init__()
self.keep_dim = keep_dim
def forward(self, x):
return x.mean(3, keep... | 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.nn.parallel
import torch.optim
assert_size_stride = torch._C._dynamo.guards.asser... | AlbertiPot/once-for-all | MyGlobalAvgPool2d | false | 8,946 | [
"MIT"
] | 0 | 092b9e6184be353383396761ea5ec61d67152645 | https://github.com/AlbertiPot/once-for-all/tree/092b9e6184be353383396761ea5ec61d67152645 |
Hswish | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
class Hswish(nn.Module):
def __init__(self, inplace=True):
super(Hswish, self).__init__()
self.inplace = inplace
def forward(self, x):
return x * F.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 import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.nn.parallel
import torch.optim... | AlbertiPot/once-for-all | Hswish | false | 8,947 | [
"MIT"
] | 0 | 092b9e6184be353383396761ea5ec61d67152645 | https://github.com/AlbertiPot/once-for-all/tree/092b9e6184be353383396761ea5ec61d67152645 |
HuberLoss | import torch
import torch.nn as nn
import torch.utils.data
class HuberLoss(nn.Module):
def __init__(self, delta=1):
super().__init__()
self.huber_loss_delta1 = nn.SmoothL1Loss()
self.delta = delta
def forward(self, x, x_hat):
loss = self.huber_loss_delta1(x / self.delta, x_ha... | 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
... | Altriaex/d4rl_evaluations | HuberLoss | false | 8,948 | [
"Apache-2.0"
] | 0 | ceb34c04e98af9332c6338a1414c0c2aa5fea68b | https://github.com/Altriaex/d4rl_evaluations/tree/ceb34c04e98af9332c6338a1414c0c2aa5fea68b |
Block | import math
import torch
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, embedding_size):
super(MLP, self).__init__()
self.dense_h_to_4h = nn.Linear(embedding_size, embedding_size * 4)
self.dense_4h_to_h = nn.Linear(embedding_size * 4, embedding_size)
self.act = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | AeroXi/CPM-Generate-Pytorch | Block | false | 8,949 | [
"Apache-2.0"
] | 0 | a1530ad2848a690c6e1557f996fe58538fe86884 | https://github.com/AeroXi/CPM-Generate-Pytorch/tree/a1530ad2848a690c6e1557f996fe58538fe86884 |
LayerNorm | import torch
import torch.nn as nn
import torch.utils.data
class LayerNorm(nn.Module):
"""
Simple 1D LayerNorm.
"""
def __init__(self, features, center=True, scale=False, eps=1e-06):
super().__init__()
self.center = center
self.scale = scale
self.eps = eps
if 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.utils.data
assert_size_stride = torch._C._dy... | Altriaex/d4rl_evaluations | LayerNorm | false | 8,950 | [
"Apache-2.0"
] | 0 | ceb34c04e98af9332c6338a1414c0c2aa5fea68b | https://github.com/Altriaex/d4rl_evaluations/tree/ceb34c04e98af9332c6338a1414c0c2aa5fea68b |
softCrossEntropy | import torch
from torch import nn
import torch.nn.functional as fcnal
class softCrossEntropy(torch.nn.Module):
def __init__(self, alpha=0.95):
"""
:param alpha: Strength (0-1) of influence from soft labels in training
"""
super(softCrossEntropy, self).__init__()
self.alpha... | 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
assert_size... | Benjamin-Lee/cyphercat | softCrossEntropy | false | 8,951 | [
"Apache-2.0"
] | 0 | d8df0544337d4e7e14c2463264c008b7811d35b3 | https://github.com/Benjamin-Lee/cyphercat/tree/d8df0544337d4e7e14c2463264c008b7811d35b3 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""Construct a layernorm module (See citation for details)."""
def __init__(self, features, eps=1e-06):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(features))
self.b_2 = nn.Parameter(torch.zeros(fe... | 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_... | BruceWen120/neurips-reproducibility-challenge-2019 | LayerNorm | false | 8,952 | [
"Apache-2.0"
] | 0 | b0635aefe83e3f895ce0991913824e861bb7d02d | https://github.com/BruceWen120/neurips-reproducibility-challenge-2019/tree/b0635aefe83e3f895ce0991913824e861bb7d02d |
Value | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Value(nn.Module):
def __init__(self, state_dim, action_dim):
super(Value, self).__init__()
self.l1 = nn.Linear(state_dim, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn.Linear(300, 1)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Altriaex/d4rl_evaluations | Value | false | 8,953 | [
"Apache-2.0"
] | 0 | ceb34c04e98af9332c6338a1414c0c2aa5fea68b | https://github.com/Altriaex/d4rl_evaluations/tree/ceb34c04e98af9332c6338a1414c0c2aa5fea68b |
DecoderSlot | import torch
from torch import nn
class DecoderSlot(nn.Module):
def __init__(self):
super().__init__()
self.conv_1 = nn.ConvTranspose2d(in_channels=66, out_channels=64,
kernel_size=5, stride=(2, 2))
self.conv_2 = nn.ConvTranspose2d(in_channels=64, out_channels=64,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | CatarauCorina/representation_learning | DecoderSlot | false | 8,954 | [
"Apache-2.0"
] | 0 | bb467761b03e5d8ac20c2f705f3bfdb84a7c3842 | https://github.com/CatarauCorina/representation_learning/tree/bb467761b03e5d8ac20c2f705f3bfdb84a7c3842 |
Classifier | import torch
import torch.nn as nn
class Classifier(nn.Module):
def __init__(self, latent_size, output_size):
super().__init__()
self.fc1 = nn.Linear(latent_size, 100)
self.relu1 = nn.LeakyReLU(0.2)
self.fc2 = nn.Linear(100, 50)
self.relu2 = nn.LeakyReLU(0.2)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | BruceWen120/neurips-reproducibility-challenge-2019 | Classifier | false | 8,955 | [
"Apache-2.0"
] | 0 | b0635aefe83e3f895ce0991913824e861bb7d02d | https://github.com/BruceWen120/neurips-reproducibility-challenge-2019/tree/b0635aefe83e3f895ce0991913824e861bb7d02d |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, 300)
self.l3 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Altriaex/d4rl_evaluations | Critic | false | 8,956 | [
"Apache-2.0"
] | 0 | ceb34c04e98af9332c6338a1414c0c2aa5fea68b | https://github.com/Altriaex/d4rl_evaluations/tree/ceb34c04e98af9332c6338a1414c0c2aa5fea68b |
Generator | import torch
import torch.nn as nn
import torch.nn.functional as F
class Generator(nn.Module):
"""Define standard linear + softmax generation step."""
def __init__(self, d_model, vocab):
super(Generator, self).__init__()
self.proj = nn.Linear(d_model, vocab)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | BruceWen120/neurips-reproducibility-challenge-2019 | Generator | false | 8,957 | [
"Apache-2.0"
] | 0 | b0635aefe83e3f895ce0991913824e861bb7d02d | https://github.com/BruceWen120/neurips-reproducibility-challenge-2019/tree/b0635aefe83e3f895ce0991913824e861bb7d02d |
DurationPredictorLoss | import torch
import torch.multiprocessing
import torch.nn
import torch.optim
import torch.distributed
class DurationPredictorLoss(torch.nn.Module):
"""Loss function module for duration predictor.
The loss value is Calculated in log domain to make it Gaussian.
"""
def __init__(self, offset=1.0, reduct... | 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.multiproc... | Cardroid/Muskits | DurationPredictorLoss | false | 8,958 | [
"Apache-2.0"
] | 0 | 91708bb243bc671e48893a734aee710c356e4bd8 | https://github.com/Cardroid/Muskits/tree/91708bb243bc671e48893a734aee710c356e4bd8 |
CriticNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class CriticNet(nn.Module):
def __init__(self, s_dim, a_dim):
super(CriticNet, self).__init__()
self.fcs = nn.Linear(s_dim, 30)
self.fcs.weight.data.normal_(0, 0.1)
self.fca = nn.Linear(a_dim, 30)
self.fca.... | 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_... | CuteWans/sheep-vs-dog | CriticNet | false | 8,959 | [
"MIT"
] | 0 | 4d1542eaa22fd618976757704e584d2c62db5b21 | https://github.com/CuteWans/sheep-vs-dog/tree/4d1542eaa22fd618976757704e584d2c62db5b21 |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
def new_parameter(*size):
out = Parameter(torch.FloatTensor(*size))
torch.nn.init.xavier_normal_(out)
return out
class Attention(nn.Module):
def __init__(self, attention_size):
super(Attention,... | 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.... | Danil328/Comment-classification | Attention | false | 8,960 | [
"Apache-2.0"
] | 0 | 5b355458d7f1fc28921e0df6257564db3da63201 | https://github.com/Danil328/Comment-classification/tree/5b355458d7f1fc28921e0df6257564db3da63201 |
GeneralizedMeanPooling | import torch
import torch.nn as nn
class GeneralizedMeanPooling(nn.Module):
"""Applies a 2D power-average adaptive pooling over an input signal composed of several input planes.
The function computed is: :math:`f(X) = pow(sum(pow(X, p)), 1/p)`
- At p = infinity, one gets Max Pooling
- At p = 1... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | AsyaPes/light-reid-master | GeneralizedMeanPooling | false | 8,961 | [
"MIT"
] | 0 | acb4bdd973cdf3832294d8e42442305ab52014f5 | https://github.com/AsyaPes/light-reid-master/tree/acb4bdd973cdf3832294d8e42442305ab52014f5 |
ActorNet | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class ActorNet(nn.Module):
def __init__(self, s_dim, a_dim):
super(ActorNet, self).__init__()
self.fc1 = nn.Linear(s_dim, 30)
self.fc1.weight.data.normal_(0, 0.1)
self.out = nn.Linear(30, a_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.... | CuteWans/sheep-vs-dog | ActorNet | false | 8,962 | [
"MIT"
] | 0 | 4d1542eaa22fd618976757704e584d2c62db5b21 | https://github.com/CuteWans/sheep-vs-dog/tree/4d1542eaa22fd618976757704e584d2c62db5b21 |
Clamp | import torch
import torch.nn as nn
class Clamp(nn.Module):
def __init__(self, min, max):
super(Clamp, self).__init__()
self.min = min
self.max = max
def forward(self, x):
return torch.clamp(x, min=self.min, max=self.max)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | AsyaPes/light-reid-master | Clamp | false | 8,963 | [
"MIT"
] | 0 | acb4bdd973cdf3832294d8e42442305ab52014f5 | https://github.com/AsyaPes/light-reid-master/tree/acb4bdd973cdf3832294d8e42442305ab52014f5 |
CoralLayer | import torch
import torch.nn as nn
class CoralLayer(nn.Module):
"""Implements CORAL layer
Parameters
-----------
size_in : int
Number of input features for the inputs to the forward method, which
are expected to have shape=(num_examples, num_features).
num_classes : int
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Dineswar11/dretino | CoralLayer | false | 8,964 | [
"MIT"
] | 0 | f6b1e1043a62f88b1853df1bfaada296710223f7 | https://github.com/Dineswar11/dretino/tree/f6b1e1043a62f88b1853df1bfaada296710223f7 |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class Actor(nn.Module):
def __init__(self, state_dim, action_dim, max_action):
super(Actor, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, 300)
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.... | Altriaex/d4rl_evaluations | Actor | false | 8,965 | [
"Apache-2.0"
] | 0 | ceb34c04e98af9332c6338a1414c0c2aa5fea68b | https://github.com/Altriaex/d4rl_evaluations/tree/ceb34c04e98af9332c6338a1414c0c2aa5fea68b |
Scale | import torch
import torch.nn as nn
class Scale(nn.Module):
def __init__(self, scale=1.0):
super(Scale, self).__init__()
self.scale = nn.Parameter(torch.tensor(scale, dtype=torch.float))
def forward(self, x):
return x * self.scale
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Cynicsss/mmdetection | Scale | false | 8,966 | [
"Apache-2.0"
] | 0 | 89e207fc8c8a7ae3663a5cda53d77b2b94cd1ec8 | https://github.com/Cynicsss/mmdetection/tree/89e207fc8c8a7ae3663a5cda53d77b2b94cd1ec8 |
Conv1dLinear | import torch
import torch.multiprocessing
import torch.nn
import torch.optim
import torch.distributed
class Conv1dLinear(torch.nn.Module):
"""Conv1D + Linear for Transformer block.
A variant of MultiLayeredConv1d, which replaces second conv-layer to linear.
"""
def __init__(self, in_chans, hidden_c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.multiprocessing
... | Cardroid/Muskits | Conv1dLinear | false | 8,967 | [
"Apache-2.0"
] | 0 | 91708bb243bc671e48893a734aee710c356e4bd8 | https://github.com/Cardroid/Muskits/tree/91708bb243bc671e48893a734aee710c356e4bd8 |
EncoderLayer | import torch
import torch.nn as nn
class FeedForwardNetwork(nn.Module):
def __init__(self, hidden_size, ffn_size, dropout_rate):
super(FeedForwardNetwork, self).__init__()
self.layer1 = nn.Linear(hidden_size, ffn_size)
self.gelu = nn.GELU()
self.layer2 = nn.Linear(ffn_size, hidden... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ChantalMP/Graphormer | EncoderLayer | false | 8,968 | [
"MIT"
] | 0 | 5c384d0f2840afc88ee88aeb874f4b1f41d760bf | https://github.com/ChantalMP/Graphormer/tree/5c384d0f2840afc88ee88aeb874f4b1f41d760bf |
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 ... | Cynicsss/mmdetection | ConvWS2d | false | 8,969 | [
"Apache-2.0"
] | 0 | 89e207fc8c8a7ae3663a5cda53d77b2b94cd1ec8 | https://github.com/Cynicsss/mmdetection/tree/89e207fc8c8a7ae3663a5cda53d77b2b94cd1ec8 |
ConvRelu | import torch
from torch.nn.modules.loss import *
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import *
from torch.optim import *
from torch.optim.lr_scheduler import *
class ConvRelu(nn.Module):
"""3x3 convolution followed by ReLU activation building block.
"""
def __init__(self, n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn.modules.loss im... | DBusAI/catalyst | ConvRelu | false | 8,970 | [
"Apache-2.0"
] | 0 | 4fbdf477ea93b4d3781bf4eb10ae8da1747e4566 | https://github.com/DBusAI/catalyst/tree/4fbdf477ea93b4d3781bf4eb10ae8da1747e4566 |
SEModule | import torch
import torch.nn as nn
import torch.utils.data
from collections import OrderedDict
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
def make_divisible(v, divisor, min_val=None):
"""
This function is taken from the original tf repo.
It ensures that all layers have a channel... | 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 ... | AlbertiPot/once-for-all | SEModule | false | 8,971 | [
"MIT"
] | 0 | 092b9e6184be353383396761ea5ec61d67152645 | https://github.com/AlbertiPot/once-for-all/tree/092b9e6184be353383396761ea5ec61d67152645 |
ConvLayer | import torch
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding)
self.conv2d = torch.nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_s... | Chandan-h-509/ignite | ConvLayer | false | 8,972 | [
"BSD-3-Clause"
] | 0 | f8c39828cb1dac49b6ef358cdf77865bf2430106 | https://github.com/Chandan-h-509/ignite/tree/f8c39828cb1dac49b6ef358cdf77865bf2430106 |
LongCNN | import torch
from torch import nn
class LongCNN(nn.Module):
def __init__(self, num_channels, input_shape, name, conv_sizes=[64, 128,
128, 256], lin_size=512):
super(LongCNN, self).__init__()
self.name = name
self.relu = nn.ReLU(inplace=True)
self.do1 = nn.Dropout(p=0.25)
... | 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... | Csaba591/LHYP | LongCNN | false | 8,973 | [
"MIT"
] | 0 | d1b07381b9dc39210d338b60908acfa64c476b8e | https://github.com/Csaba591/LHYP/tree/d1b07381b9dc39210d338b60908acfa64c476b8e |
FC_Q | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class FC_Q(nn.Module):
def __init__(self, state_dim, num_actions):
super(FC_Q, self).__init__()
self.q1 = nn.Linear(state_dim, 256)
self.q2 = nn.Linear(256, 256)
self.q3 = nn.Linear(256, 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.... | Altriaex/d4rl_evaluations | FC_Q | false | 8,974 | [
"Apache-2.0"
] | 0 | ceb34c04e98af9332c6338a1414c0c2aa5fea68b | https://github.com/Altriaex/d4rl_evaluations/tree/ceb34c04e98af9332c6338a1414c0c2aa5fea68b |
InputInjection | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class InputInjection(nn.Module):
"""Downsampling module for CGNet."""
def __init__(self, num_downsampling):
super(InputInjection, self).__init__()
self.pool = nn.ModuleList()
for i in range(num_downsampling)... | 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._C
import torch.serialization
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | AnonSubmission6150/submission6150 | InputInjection | false | 8,975 | [
"Apache-2.0"
] | 0 | 571633d9a12b4fd7a9546947787fc068966dab04 | https://github.com/AnonSubmission6150/submission6150/tree/571633d9a12b4fd7a9546947787fc068966dab04 |
Policy | import torch
import torch.nn as nn
import torch.nn.functional as F
class Policy(nn.Module):
def __init__(self):
super(Policy, self).__init__()
self.affine1 = nn.Linear(4, 128)
self.affine2 = nn.Linear(128, 2)
self.saved_log_probs = []
self.rewards = []
def forward(sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Chandan-h-509/ignite | Policy | false | 8,976 | [
"BSD-3-Clause"
] | 0 | f8c39828cb1dac49b6ef358cdf77865bf2430106 | https://github.com/Chandan-h-509/ignite/tree/f8c39828cb1dac49b6ef358cdf77865bf2430106 |
DecoderBlock | import torch
from torch.nn.modules.loss import *
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import *
from torch.optim import *
from torch.optim.lr_scheduler import *
class ConvRelu(nn.Module):
"""3x3 convolution followed by ReLU activation building block.
"""
def __init__(self, n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn.modules.loss im... | DBusAI/catalyst | DecoderBlock | false | 8,977 | [
"Apache-2.0"
] | 0 | 4fbdf477ea93b4d3781bf4eb10ae8da1747e4566 | https://github.com/DBusAI/catalyst/tree/4fbdf477ea93b4d3781bf4eb10ae8da1747e4566 |
NormedLinear | import torch
import torch.nn.functional as F
from torch import nn
class NormedLinear(nn.Linear):
"""Normalized Linear Layer.
Args:
tempeature (float, optional): Tempeature term. Default to 20.
power (int, optional): Power term. Default to 1.0.
eps (float, optional): The minimal value ... | 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... | CVPR2022-911/PPH | NormedLinear | false | 8,978 | [
"Apache-2.0"
] | 0 | f066933525aaeef412b8d166ef167f00170b5428 | https://github.com/CVPR2022-911/PPH/tree/f066933525aaeef412b8d166ef167f00170b5428 |
L2Norm | import torch
from torch import nn
class L2Norm(nn.Module):
def __init__(self, n_dims, scale=20.0, eps=1e-10):
"""L2 normalization layer.
Args:
n_dims (int): Number of dimensions to be normalized
scale (float, optional): Defaults to 20..
eps (float, optional): ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | CVPR2022-911/PPH | L2Norm | false | 8,979 | [
"Apache-2.0"
] | 0 | f066933525aaeef412b8d166ef167f00170b5428 | https://github.com/CVPR2022-911/PPH/tree/f066933525aaeef412b8d166ef167f00170b5428 |
FCUDown | import torch
from functools import partial
from torch import nn
class FCUDown(nn.Module):
""" CNN feature maps -> Transformer patch embeddings
"""
def __init__(self, inplanes, outplanes, dw_stride, act_layer=nn.GELU,
norm_layer=partial(nn.LayerNorm, eps=1e-06)):
super(FCUDown, self).__ini... | 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 functools impo... | CVPR2022-911/PPH | FCUDown | false | 8,980 | [
"Apache-2.0"
] | 0 | f066933525aaeef412b8d166ef167f00170b5428 | https://github.com/CVPR2022-911/PPH/tree/f066933525aaeef412b8d166ef167f00170b5428 |
ChannelMixer | import torch
from torch import nn
import torch.nn.functional as F
import torch.multiprocessing
import torch.nn
import torch.optim
import torch.distributed
class FeedForward(nn.Module):
def __init__(self, num_features, expansion_factor, dropout):
super().__init__()
num_hidden = expansion_factor * ... | 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... | Cardroid/Muskits | ChannelMixer | false | 8,981 | [
"Apache-2.0"
] | 0 | 91708bb243bc671e48893a734aee710c356e4bd8 | https://github.com/Cardroid/Muskits/tree/91708bb243bc671e48893a734aee710c356e4bd8 |
ResidualBlock | import torch
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = torch.nn.ReflectionPad2d(reflection_padding)
self.conv2d = torch.nn.Conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Chandan-h-509/ignite | ResidualBlock | false | 8,982 | [
"BSD-3-Clause"
] | 0 | f8c39828cb1dac49b6ef358cdf77865bf2430106 | https://github.com/Chandan-h-509/ignite/tree/f8c39828cb1dac49b6ef358cdf77865bf2430106 |
ClassHead | import torch
from itertools import product as product
import torch.nn as nn
class ClassHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(ClassHead, self).__init__()
self.num_anchors = num_anchors
self.conv1x1 = nn.Conv2d(inchannels, self.num_anchors * 2,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from itertools import product as product
import torch.nn as nn
assert_size_strid... | BossunWang/Pytorch_Retinaface | ClassHead | false | 8,983 | [
"MIT"
] | 0 | 01ec6cfbcced1e8cc8802084e4e566ccaf2513a8 | https://github.com/BossunWang/Pytorch_Retinaface/tree/01ec6cfbcced1e8cc8802084e4e566ccaf2513a8 |
LandmarkHead | import torch
from itertools import product as product
import torch.nn as nn
class LandmarkHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(LandmarkHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 10, kernel_size=
(1, 1), stride=1, padd... | 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 itertools import product as product
import torch.nn as nn
assert_size_strid... | BossunWang/Pytorch_Retinaface | LandmarkHead | false | 8,984 | [
"MIT"
] | 0 | 01ec6cfbcced1e8cc8802084e4e566ccaf2513a8 | https://github.com/BossunWang/Pytorch_Retinaface/tree/01ec6cfbcced1e8cc8802084e4e566ccaf2513a8 |
ExampleBackbone | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class ExampleBackbone(nn.Module):
def __init__(self):
super(ExampleBackbone, self).__init__()
self.conv = nn.Conv2d(3, 3, 3)
def init_weights(self, pretrained=None):
pass
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch._C
import torch.serialization
assert_size_str... | AnonSubmission6150/submission6150 | ExampleBackbone | false | 8,985 | [
"Apache-2.0"
] | 0 | 571633d9a12b4fd7a9546947787fc068966dab04 | https://github.com/AnonSubmission6150/submission6150/tree/571633d9a12b4fd7a9546947787fc068966dab04 |
NormedConv2d | import torch
from torch import nn
class NormedConv2d(nn.Conv2d):
"""Normalized Conv2d Layer.
Args:
tempeature (float, optional): Tempeature term. Default to 20.
power (int, optional): Power term. Default to 1.0.
eps (float, optional): The minimal value of divisor to
keep ... | 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... | CVPR2022-911/PPH | NormedConv2d | false | 8,986 | [
"Apache-2.0"
] | 0 | f066933525aaeef412b8d166ef167f00170b5428 | https://github.com/CVPR2022-911/PPH/tree/f066933525aaeef412b8d166ef167f00170b5428 |
BboxHead | import torch
from itertools import product as product
import torch.nn as nn
class BboxHead(nn.Module):
def __init__(self, inchannels=512, num_anchors=3):
super(BboxHead, self).__init__()
self.conv1x1 = nn.Conv2d(inchannels, num_anchors * 4, kernel_size=(
1, 1), stride=1, padding=0)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from itertools import product as product
import torch.nn as nn
assert_size_strid... | BossunWang/Pytorch_Retinaface | BboxHead | false | 8,987 | [
"MIT"
] | 0 | 01ec6cfbcced1e8cc8802084e4e566ccaf2513a8 | https://github.com/BossunWang/Pytorch_Retinaface/tree/01ec6cfbcced1e8cc8802084e4e566ccaf2513a8 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, num_features, eps=1e-05, affine=True):
super(LayerNorm, self).__init__()
self.num_features = num_features
self.affine = affine
self.eps = eps
if self.affine:
self.gamma = nn.Param... | 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_... | AnnanShu/gan | LayerNorm | false | 8,988 | [
"MIT"
] | 0 | 0c6409872ce65fe046e620fca053cff553bba9ef | https://github.com/AnnanShu/gan/tree/0c6409872ce65fe046e620fca053cff553bba9ef |
RSoftmax | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
class RSoftmax(nn.Module):
"""Radix Softmax module in ``SplitAttentionConv2d``.
Args:
radix (int): Radix of input.
groups (int): Groups of input.
"""
def __init__(self, radix... | 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
... | AnonSubmission6150/submission6150 | RSoftmax | false | 8,989 | [
"Apache-2.0"
] | 0 | 571633d9a12b4fd7a9546947787fc068966dab04 | https://github.com/AnonSubmission6150/submission6150/tree/571633d9a12b4fd7a9546947787fc068966dab04 |
RMSELoss | import torch
from torch import Tensor
from torch import nn
class RMSELoss(nn.Module):
""" Root mean square error. """
def __init__(self, **kwargs):
super().__init__()
self.mse = nn.MSELoss(**kwargs)
def forward(self, preds: 'Tensor', target: 'Tensor') ->Tensor:
return torch.sqrt(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_... | Connormcc3/ludwig | RMSELoss | false | 8,990 | [
"Apache-2.0"
] | 0 | 5d562cbc0c4fed3e607969e18611f34240eef177 | https://github.com/Connormcc3/ludwig/tree/5d562cbc0c4fed3e607969e18611f34240eef177 |
ContrastiveDistanceLoss | import torch
from torch import nn
from torch.nn.modules.loss import *
from torch.nn.modules import *
from torch.optim import *
from torch.optim.lr_scheduler import *
import torch.distributed
import torch.multiprocessing
import torch.backends
class ContrastiveDistanceLoss(nn.Module):
"""The Contrastive distance lo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from torch.nn.modules.loss import *
from torch.nn.modules import *
f... | Casyfill/catalyst | ContrastiveDistanceLoss | false | 8,991 | [
"Apache-2.0"
] | 0 | 7f63545dbc53902c3dd959463def28a67a16a989 | https://github.com/Casyfill/catalyst/tree/7f63545dbc53902c3dd959463def28a67a16a989 |
SpatialGatherModule | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
class SpatialGatherModule(nn.Module):
"""Aggregate the context features according to the initial predicted
probability distribution.
Employ the soft-weighted method to aggregate the context.
... | 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.... | AnonSubmission6150/submission6150 | SpatialGatherModule | false | 8,992 | [
"Apache-2.0"
] | 0 | 571633d9a12b4fd7a9546947787fc068966dab04 | https://github.com/AnonSubmission6150/submission6150/tree/571633d9a12b4fd7a9546947787fc068966dab04 |
DiceLoss | import functools
import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import functools
impor... | AnonSubmission6150/submission6150 | DiceLoss | false | 8,993 | [
"Apache-2.0"
] | 0 | 571633d9a12b4fd7a9546947787fc068966dab04 | https://github.com/AnonSubmission6150/submission6150/tree/571633d9a12b4fd7a9546947787fc068966dab04 |
CrossEntropyLoss | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
def _expand_onehot_labels(labels, label_weights, target_shape, ignore_index):
"""Expand onehot labels to match the size of prediction."""
bin_labels = labels.new_zeros(target_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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy as np
imp... | AnonSubmission6150/submission6150 | CrossEntropyLoss | false | 8,994 | [
"Apache-2.0"
] | 0 | 571633d9a12b4fd7a9546947787fc068966dab04 | https://github.com/AnonSubmission6150/submission6150/tree/571633d9a12b4fd7a9546947787fc068966dab04 |
PTLogreg | import torch
import torch.nn as nn
class PTLogreg(nn.Module):
def __init__(self, D, C):
"""Arguments:
- D: dimensions of each datapoint
- C: number of classes
"""
super(PTLogreg, self).__init__()
self.W = torch.nn.Parameter(torch.zeros(D, C))
self.b =... | 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.... | EduardEdiJerkovic/deeplearning | PTLogreg | false | 8,995 | [
"MIT"
] | 0 | 0493b26ca153f93f41e8de930e16df658fb01a56 | https://github.com/EduardEdiJerkovic/deeplearning/tree/0493b26ca153f93f41e8de930e16df658fb01a56 |
Encoding | import torch
import torch.nn.functional as F
import torch.nn as nn
import torch._C
import torch.serialization
class Encoding(nn.Module):
"""Encoding Layer: a learnable residual encoder.
Input is of shape (batch_size, channels, height, width).
Output is of shape (batch_size, num_codes, channels).
Ar... | 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
... | AnonSubmission6150/submission6150 | Encoding | false | 8,996 | [
"Apache-2.0"
] | 0 | 571633d9a12b4fd7a9546947787fc068966dab04 | https://github.com/AnonSubmission6150/submission6150/tree/571633d9a12b4fd7a9546947787fc068966dab04 |
SquareActivation | import torch
import torch.nn as nn
class SquareActivation(nn.Module):
"""
Square activation function, clamps the output between 0 and 20 to avoid overflow
"""
@staticmethod
def forward(x):
return torch.clamp(x ** 2, 0, 20)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Ergodice/PWLU | SquareActivation | false | 8,997 | [
"MIT"
] | 0 | 8e714cff4245b9282fe6b9420ffbab8178ba456c | https://github.com/Ergodice/PWLU/tree/8e714cff4245b9282fe6b9420ffbab8178ba456c |
PPMConcat | import torch
import torch.nn as nn
import torch._C
import torch.serialization
class PPMConcat(nn.ModuleList):
"""Pyramid Pooling Module that only concat the features of each layer.
Args:
pool_scales (tuple[int]): Pooling scales used in Pooling Pyramid
Module.
"""
def __init__(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
import torch.nn as nn
import torch._C
import torch.serialization
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | AnonSubmission6150/submission6150 | PPMConcat | false | 8,998 | [
"Apache-2.0"
] | 0 | 571633d9a12b4fd7a9546947787fc068966dab04 | https://github.com/AnonSubmission6150/submission6150/tree/571633d9a12b4fd7a9546947787fc068966dab04 |
EDMLoss | import torch
import torch.nn as nn
from torch.autograd import Variable
class EDMLoss(nn.Module):
def __init__(self):
super(EDMLoss, self).__init__()
def forward(self, p_target: 'Variable', p_estimate: 'Variable'):
assert p_target.shape == p_estimate.shape
cdf_target = torch.cumsum(p_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | DazhiZhong/NIMA | EDMLoss | false | 8,999 | [
"MIT"
] | 0 | 82655ac762414ef2a980feba8b6978c605c66a4d | https://github.com/DazhiZhong/NIMA/tree/82655ac762414ef2a980feba8b6978c605c66a4d |
ContrastiveEmbeddingLoss | import torch
from torch import nn
from torch.nn.modules.loss import *
from torch.nn.modules import *
from torch.optim import *
from torch.optim.lr_scheduler import *
import torch.distributed
import torch.multiprocessing
import torch.backends
class ContrastiveEmbeddingLoss(nn.Module):
"""The Contrastive embedding ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | Casyfill/catalyst | ContrastiveEmbeddingLoss | false | 9,000 | [
"Apache-2.0"
] | 0 | 7f63545dbc53902c3dd959463def28a67a16a989 | https://github.com/Casyfill/catalyst/tree/7f63545dbc53902c3dd959463def28a67a16a989 |
ycbcr_to_rgb_jpeg | import torch
import numpy as np
import torch.nn as nn
class ycbcr_to_rgb_jpeg(nn.Module):
""" Converts YCbCr image to RGB JPEG
Input:
image(tensor): batch x height x width x 3
Outpput:
result(tensor): batch x 3 x height x width
"""
def __init__(self):
super(ycbcr_to_rgb_jp... | 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... | DazhiZhong/DiffJPEG | ycbcr_to_rgb_jpeg | false | 9,001 | [
"MIT"
] | 0 | e20de92539f31a57906ae4c32a41dc46e774c316 | https://github.com/DazhiZhong/DiffJPEG/tree/e20de92539f31a57906ae4c32a41dc46e774c316 |
ContrastivePairwiseEmbeddingLoss | import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.modules.loss import *
from torch.nn.modules import *
from torch.optim import *
from torch.optim.lr_scheduler import *
import torch.distributed
import torch.multiprocessing
import torch.backends
class ContrastivePairwiseEmbeddingLoss(... | 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.... | Casyfill/catalyst | ContrastivePairwiseEmbeddingLoss | false | 9,002 | [
"Apache-2.0"
] | 0 | 7f63545dbc53902c3dd959463def28a67a16a989 | https://github.com/Casyfill/catalyst/tree/7f63545dbc53902c3dd959463def28a67a16a989 |
BWCEWLoss | import torch
from torch import Tensor
from typing import Optional
from torch import nn
class BWCEWLoss(nn.Module):
""" Binary weighted cross entropy loss. """
def __init__(self, positive_class_weight: 'Optional[Tensor]'=None,
robust_lambda: 'int'=0, confidence_penalty: 'int'=0, **kwargs):
sup... | 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 ... | Connormcc3/ludwig | BWCEWLoss | false | 9,003 | [
"Apache-2.0"
] | 0 | 5d562cbc0c4fed3e607969e18611f34240eef177 | https://github.com/Connormcc3/ludwig/tree/5d562cbc0c4fed3e607969e18611f34240eef177 |
DQNetwork | from torch.nn import Module
import torch
import torch.nn as nn
class DQNetwork(Module):
def __init__(self, num_states, num_actions):
super(DQNetwork, self).__init__()
self.relu = nn.ReLU()
self.fc_layer1 = nn.Linear(num_states, 256)
self.fc_layer2 = nn.Linear(256, 256)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | Devanshu-singh-VR/Reinforcement-Learning_Mixed | DQNetwork | false | 9,004 | [
"MIT"
] | 0 | 6b8b23977864f918ab8958b729d0faabcca720e4 | https://github.com/Devanshu-singh-VR/Reinforcement-Learning_Mixed/tree/6b8b23977864f918ab8958b729d0faabcca720e4 |
deepQ | import torch
import torch.nn as nn
import torch.nn.functional as F
class deepQ(nn.Module):
def __init__(self, action_size, obs_size, hidden_size=256):
super().__init__()
self.input_layer = nn.Linear(obs_size, hidden_size)
self.output_layer = nn.Linear(hidden_size, action_size)
def fo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | ExilesAI/RLAgents | deepQ | false | 9,005 | [
"MIT"
] | 0 | b8159a933c4674c7a62bfe9555870336616a59f3 | https://github.com/ExilesAI/RLAgents/tree/b8159a933c4674c7a62bfe9555870336616a59f3 |
ArcMarginProduct | import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.modules.loss import *
from torch.nn.modules import *
from torch.optim import *
from torch.optim.lr_scheduler import *
import torch.distributed
import torch.multiprocessing
import torch.backends
class ArcMarginProduct(nn.Module):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Casyfill/catalyst | ArcMarginProduct | false | 9,006 | [
"Apache-2.0"
] | 0 | 7f63545dbc53902c3dd959463def28a67a16a989 | https://github.com/Casyfill/catalyst/tree/7f63545dbc53902c3dd959463def28a67a16a989 |
chroma_subsampling | import torch
import torch.nn as nn
class chroma_subsampling(nn.Module):
""" Chroma subsampling on CbCv channels
Input:
image(tensor): batch x height x width x 3
Output:
y(tensor): batch x height x width
cb(tensor): batch x height/2 x width/2
cr(tensor): batch x height/2 x w... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | DazhiZhong/DiffJPEG | chroma_subsampling | false | 9,007 | [
"MIT"
] | 0 | e20de92539f31a57906ae4c32a41dc46e774c316 | https://github.com/DazhiZhong/DiffJPEG/tree/e20de92539f31a57906ae4c32a41dc46e774c316 |
BPR | import torch
import torch.nn as nn
import torch.nn.functional as F
class BPR(nn.Module):
def __init__(self, user_size, item_size, dim, weight_decay):
super().__init__()
self.W = nn.Parameter(torch.empty(user_size, dim))
self.H = nn.Parameter(torch.empty(item_size, dim))
nn.init.xa... | 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... | EternalImmortal/bpr | BPR | false | 9,008 | [
"MIT"
] | 0 | ba95806530e51b580359d22ed533ad461124fa22 | https://github.com/EternalImmortal/bpr/tree/ba95806530e51b580359d22ed533ad461124fa22 |
SigmoidCrossEntropyLoss | import torch
from torch import Tensor
from typing import List
from typing import Optional
from typing import Union
from torch import nn
class SigmoidCrossEntropyLoss(nn.Module):
def __init__(self, class_weights: 'Optional[Union[Tensor, List]]'=None,
**kwargs):
"""
Params:
clas... | 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 ... | Connormcc3/ludwig | SigmoidCrossEntropyLoss | false | 9,009 | [
"Apache-2.0"
] | 0 | 5d562cbc0c4fed3e607969e18611f34240eef177 | https://github.com/Connormcc3/ludwig/tree/5d562cbc0c4fed3e607969e18611f34240eef177 |
MNISTBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class MNISTBlock(nn.Module):
def __init__(self, width, scaling=1.0, use_bias=True):
super(MNISTBlock, self).__init__()
self.scaling = scaling
self.linear = nn.Linear(width, width, bias=use_bias)
nn.init.xavier_norm... | 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_... | EulerInstitute/mgopt_icml21 | MNISTBlock | false | 9,010 | [
"Apache-2.0"
] | 0 | 3790ac863e22c49e067d2872f7e3ea6e306c65af | https://github.com/EulerInstitute/mgopt_icml21/tree/3790ac863e22c49e067d2872f7e3ea6e306c65af |
StatsPool | import torch
import warnings
from typing import Optional
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
class StatsPool(nn.Module):
"""Statistics pooling
Compute temporal mean and (unbiased) standard deviation
and returns their concatenation.
Reference
---------
htt... | 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.... | FrenchKrab/pyannote-audio | StatsPool | false | 9,011 | [
"MIT"
] | 0 | 14e3b999e3b3fa6063d6401c375a9f7a2534cb74 | https://github.com/FrenchKrab/pyannote-audio/tree/14e3b999e3b3fa6063d6401c375a9f7a2534cb74 |
idct_8x8 | import itertools
import torch
import numpy as np
import torch.nn as nn
class idct_8x8(nn.Module):
""" Inverse discrete Cosine Transformation
Input:
dcp(tensor): batch x height x width
Output:
image(tensor): batch x height x width
"""
def __init__(self):
super(idct_8x8, sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import itertools
import numpy as np
import torch.nn as nn
assert_size_stride = t... | DazhiZhong/DiffJPEG | idct_8x8 | false | 9,012 | [
"MIT"
] | 0 | e20de92539f31a57906ae4c32a41dc46e774c316 | https://github.com/DazhiZhong/DiffJPEG/tree/e20de92539f31a57906ae4c32a41dc46e774c316 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.