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 |
|---|---|---|---|---|---|---|---|---|---|---|
ScoreNetwork | from torch.nn import Module
import torch
from torch.nn import Tanh
from torch.nn import Linear
class ScoreNetwork(Module):
"""
An optimized single hidden layer neural network for attention scores.
The optimization idea behind this network is that projection of keys can
performed only once without conc... | 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.nn impor... | stungkit/Copycat-abstractive-opinion-summarizer | ScoreNetwork | false | 16,502 | [
"MIT"
] | 51 | 04fe5393a7bb6883516766b762f6a0c530e95375 | https://github.com/stungkit/Copycat-abstractive-opinion-summarizer/tree/04fe5393a7bb6883516766b762f6a0c530e95375 |
ContrastiveLoss | import torch
import torch.nn.functional as F
class ContrastiveLoss(torch.nn.Module):
"""
Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin=2.0):
super(ContrastiveLoss, self).__init__()
self.margin =... | 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
assert_size_stride = torch._... | sugi-chan/project_pendragon | ContrastiveLoss | false | 16,503 | [
"MIT"
] | 56 | 267624365f25964fece1952e6dcde629bbc2ee5b | https://github.com/sugi-chan/project_pendragon/tree/267624365f25964fece1952e6dcde629bbc2ee5b |
Highway | import torch
import torch.nn as nn
import torch.nn.utils
class Highway(nn.Module):
def __init__(self, eword_size):
super(Highway, self).__init__()
self.eword_size = eword_size
self.w_proj = nn.Linear(self.eword_size, self.eword_size, bias=True)
self.w_gate = nn.Linear(self.eword_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 as nn
import ... | stxxllbu/CS224n-winter-together | Highway | false | 16,504 | [
"Apache-2.0"
] | 468 | eae158ed8e88dc7c8638e25bac4c4fc8eeddcc8c | https://github.com/stxxllbu/CS224n-winter-together/tree/eae158ed8e88dc7c8638e25bac4c4fc8eeddcc8c |
MyKernelTorch | import torch
import torch.nn as nn
class MyKernelTorch(nn.Module):
def __init__(self, n_features: 'int'):
super().__init__()
self.dense1 = nn.Linear(n_features, 20)
self.dense2 = nn.Linear(20, 2)
def forward(self, x: 'torch.Tensor') ->torch.Tensor:
x = nn.ReLU()(self.dense1(x... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | sugatoray/alibi-detect | MyKernelTorch | false | 16,505 | [
"Apache-2.0"
] | 1,227 | 66d7873c248c0be1a1d836e6fe1ef59351b802d9 | https://github.com/sugatoray/alibi-detect/tree/66d7873c248c0be1a1d836e6fe1ef59351b802d9 |
S_Loss | import torch
import torch.nn.functional as F
from torch import nn
class S_Loss(nn.Module):
def __init__(self):
super(S_Loss, self).__init__()
def forward(self, x, label):
loss = F.smooth_l1_loss(x, label)
return loss
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.ran... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | suyukun666/UFO | S_Loss | false | 16,506 | [
"MIT"
] | 122 | e57016948b03cd2f75155d2958cea69b6e4b56f8 | https://github.com/suyukun666/UFO/tree/e57016948b03cd2f75155d2958cea69b6e4b56f8 |
PtModel | import torch
import torch.nn as nn
class PtModel(nn.Module):
def __init__(self, n_features, n_labels, softmax=False, dropout=False):
super().__init__()
self.dense1 = nn.Linear(n_features, 20)
self.dense2 = nn.Linear(20, n_labels)
self.dropout = nn.Dropout(0.5) if dropout else lamb... | 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_... | sugatoray/alibi-detect | PtModel | false | 16,507 | [
"Apache-2.0"
] | 1,227 | 66d7873c248c0be1a1d836e6fe1ef59351b802d9 | https://github.com/sugatoray/alibi-detect/tree/66d7873c248c0be1a1d836e6fe1ef59351b802d9 |
MLP | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP(nn.Module):
def __init__(self):
super(MLP, self).__init__()
self.fc1 = nn.Linear(in_features=28 * 28, out_features=500)
self.fc2 = nn.Linear(in_features=500, out_features=200)
self.fc3 = nn.Linear(in_feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | stjordanis/ml-cheatsheet | MLP | false | 16,508 | [
"MIT"
] | 1,031 | d34e096032b7ae826868be8808aee01699cec491 | https://github.com/stjordanis/ml-cheatsheet/tree/d34e096032b7ae826868be8808aee01699cec491 |
ToRGB | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def upsample(in_tens, out_H=64):
in_H = in_tens.shape[2]
scale_factor = 1.0 * out_H / in_H
return nn.Upsample(scale_factor=scale_factor, mode='bilinear',
align_corners=False)(in_tens)... | 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.autograd import Function
import math
import torch.nn as nn
import tor... | songquanpeng/BlendGAN | ToRGB | false | 16,509 | [
"MIT",
"BSD-2-Clause",
"Apache-2.0"
] | 67 | cbf7225c50c548ee955614715ae3f8fa4d68ee13 | https://github.com/songquanpeng/BlendGAN/tree/cbf7225c50c548ee955614715ae3f8fa4d68ee13 |
SoftCrossEntropyLoss2d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
class SoftCrossEntropyLoss2d(nn.Module):
def __init__(self):
super(SoftCrossEntropyLoss2d, self).__init__()
def forward(self, inputs, targets):
loss = 0
inputs = -F.log_softmax(inputs, dim=1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | songzijiang/FasterSeg | SoftCrossEntropyLoss2d | false | 16,510 | [
"MIT"
] | 334 | 1a14ef6dd665afd229a16ab43b532b5a406512f8 | https://github.com/songzijiang/FasterSeg/tree/1a14ef6dd665afd229a16ab43b532b5a406512f8 |
BinaryTreeLeafModule | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
class BinaryTreeLeafModule(nn.Module):
"""
local input = nn.Identity()()
local c = nn.Linear(self.in_dim, self.mem_dim)(input)
local h
if self.gate_output then
local o = nn.Sigmoid()(nn.Linear(self.in_dim, self.mem_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | supunab/Lantern | BinaryTreeLeafModule | false | 16,511 | [
"BSD-3-Clause"
] | 158 | 932a031816617d71c46653f3b2245129a6a8a7c8 | https://github.com/supunab/Lantern/tree/932a031816617d71c46653f3b2245129a6a8a7c8 |
VAE | import torch
import numpy as np
from abc import ABC
from abc import abstractmethod
import torch.nn.functional as F
from torch.functional import F
from torch import nn
from typing import *
from torch.nn import functional as F
def to_array_as(x, y):
if isinstance(x, torch.Tensor) and isinstance(y, np.ndarray):
... | 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... | ssimonc/NeoRL | VAE | false | 16,512 | [
"Apache-2.0"
] | 50 | 098c58c8e4c3e43e67803f6384619d3bfe7fce5d | https://github.com/ssimonc/NeoRL/tree/098c58c8e4c3e43e67803f6384619d3bfe7fce5d |
Weighed_Bce_Loss | import torch
import torch.nn.functional as F
from torch import nn
class Weighed_Bce_Loss(nn.Module):
def __init__(self):
super(Weighed_Bce_Loss, self).__init__()
def forward(self, x, label):
x = x.view(-1, 1, x.shape[1], x.shape[2])
label = label.view(-1, 1, label.shape[1], label.sha... | 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 ... | suyukun666/UFO | Weighed_Bce_Loss | false | 16,513 | [
"MIT"
] | 122 | e57016948b03cd2f75155d2958cea69b6e4b56f8 | https://github.com/suyukun666/UFO/tree/e57016948b03cd2f75155d2958cea69b6e4b56f8 |
Conv2dWithConstraint | import torch
import torch as th
from torch import nn
class Conv2dWithConstraint(nn.Conv2d):
def __init__(self, *args, max_norm=1, **kwargs):
self.max_norm = max_norm
super(Conv2dWithConstraint, self).__init__(*args, **kwargs)
def forward(self, x):
self.weight.data = th.renorm(self.we... | 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... | sylvchev/braindecode | Conv2dWithConstraint | false | 16,514 | [
"BSD-3-Clause"
] | 260 | c37ace8fcb90eee0d447c97d1c0a06ce58e8f6ad | https://github.com/sylvchev/braindecode/tree/c37ace8fcb90eee0d447c97d1c0a06ce58e8f6ad |
Unet | import torch
from torch import nn
import torch.nn.functional as F
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, dropout=False, norm=None,
residual=True, activation='leakyrelu', in_place_activation=True,
transpose=False, reflectpad=True):
super(ConvBlock, self).... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | royerloic/aydin | Unet | false | 16,515 | [
"BSD-3-Clause"
] | 78 | f9c61a24030891d008c318b250da5faec69fcd7d | https://github.com/royerloic/aydin/tree/f9c61a24030891d008c318b250da5faec69fcd7d |
PatchMerging | import torch
import torch.nn as nn
from torch import optim as optim
class PatchMerging(nn.Module):
""" Patch Merging Layer.
Args:
input_resolution (tuple[int]): Resolution of input feature.
dim (int): Number of input channels.
norm_layer (nn.Module, optional): Normalization layer. De... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | svip-lab/AS-MLP | PatchMerging | false | 16,516 | [
"MIT"
] | 66 | 5f360348583b3cac8663a392c9588b6f7e2f46b8 | https://github.com/svip-lab/AS-MLP/tree/5f360348583b3cac8663a392c9588b6f7e2f46b8 |
upconv | import torch
import torch.nn as nn
from torch.nn import functional as F
import torch.utils.data.distributed
class upconv(nn.Module):
def __init__(self, in_channels, out_channels, ratio=2):
super(upconv, self).__init__()
self.elu = nn.ELU()
self.conv = nn.Conv2d(in_channels=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._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | syKevinPeng/TransDepth | upconv | false | 16,517 | [
"MIT"
] | 118 | 2282039da7bc0812e19a27b2d73a25bdef97d739 | https://github.com/syKevinPeng/TransDepth/tree/2282039da7bc0812e19a27b2d73a25bdef97d739 |
UpsamplingLinear1d | import torch
import torch.nn.functional as F
import torch.nn as nn
class UpsamplingLinear1d(nn.Module):
def __init__(self, scale_factor=2.0):
super().__init__()
self.scale_factor = scale_factor
def forward(self, x):
return F.interpolate(x, scale_factor=self.scale_factor, mode=
... | 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... | tailintalent/ar-pde-cnn | UpsamplingLinear1d | false | 16,518 | [
"MIT"
] | 51 | 88c130d7296af4ef7c13ec28a287fec4af3639f7 | https://github.com/tailintalent/ar-pde-cnn/tree/88c130d7296af4ef7c13ec28a287fec4af3639f7 |
NonLocal2d | import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision.transforms import functional as F
from torch.nn import functional as F
import torch.utils.data
class NonLocal2d(nn.Module):
def __init__(self, dim_in, dim_inner, dim_out, max_pool_stride=2,
use_maxpool=True, use_gn=False,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | shunya-toyokawa/qanet_human_parts_segmentatiom | NonLocal2d | false | 16,519 | [
"MIT"
] | 72 | 5527b247acd65534b455c26e3692a14b31669602 | https://github.com/shunya-toyokawa/qanet_human_parts_segmentatiom/tree/5527b247acd65534b455c26e3692a14b31669602 |
BinaryTreeComposer | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.onnx
class BinaryTreeComposer(nn.Module):
"""
local lc, lh = nn.Identity()(), nn.Identity()()
local rc, rh = nn.Identity()(), nn.Identity()()
local new_gate = function()
return nn.CAddTable(){
nn.Linear(self.mem_dim, 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
import torch.nn as ... | supunab/Lantern | BinaryTreeComposer | false | 16,520 | [
"BSD-3-Clause"
] | 158 | 932a031816617d71c46653f3b2245129a6a8a7c8 | https://github.com/supunab/Lantern/tree/932a031816617d71c46653f3b2245129a6a8a7c8 |
reduction_1x1 | import math
import torch
import torch.nn as nn
import torch.utils.data.distributed
class reduction_1x1(nn.Sequential):
def __init__(self, num_in_filters, num_out_filters, max_depth, is_final
=False):
super(reduction_1x1, self).__init__()
self.max_depth = max_depth
self.is_final = ... | 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.... | syKevinPeng/TransDepth | reduction_1x1 | false | 16,521 | [
"MIT"
] | 118 | 2282039da7bc0812e19a27b2d73a25bdef97d739 | https://github.com/syKevinPeng/TransDepth/tree/2282039da7bc0812e19a27b2d73a25bdef97d739 |
SelfAttention | import torch
import torch.nn as nn
from scipy.sparse import *
class SelfAttention(nn.Module):
def __init__(self, input_size, hidden_size):
super(SelfAttention, self).__init__()
self.W1 = torch.Tensor(input_size, hidden_size)
self.W1 = nn.Parameter(nn.init.xavier_uniform_(self.W1))
... | 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.... | talha1503/RL-based-Graph2Seq-for-NQG | SelfAttention | false | 16,522 | [
"Apache-2.0"
] | 100 | 1039e0b6231ae7029ea6e4073b1e55df5ad2e928 | https://github.com/talha1503/RL-based-Graph2Seq-for-NQG/tree/1039e0b6231ae7029ea6e4073b1e55df5ad2e928 |
SEBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class SEBlock(nn.Module):
def __init__(self, input_channels, internal_neurons):
super(SEBlock, self).__init__()
self.down = nn.Conv2d(in_channels=input_channels, out_channels=
internal_neurons, kernel_size=1, stride=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
assert_... | sysu-shey/ACNet | SEBlock | false | 16,523 | [
"MIT"
] | 767 | 6d967d3fff2d79a37f85799b78a21ffbd9001bd2 | https://github.com/sysu-shey/ACNet/tree/6d967d3fff2d79a37f85799b78a21ffbd9001bd2 |
FocalLoss | import torch
import torch.nn as nn
class FocalLoss(nn.Module):
def __init__(self, gamma=0, alpha=None, device=None):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.alpha = alpha
if self.alpha is not None:
self.alpha = torch.FloatTensor([1 - alpha, 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.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | taconite/PTF | FocalLoss | false | 16,524 | [
"MIT"
] | 62 | a8789c9f752aea2944c2a75e04cc2aa21c7e4a00 | https://github.com/taconite/PTF/tree/a8789c9f752aea2944c2a75e04cc2aa21c7e4a00 |
ResnetBlockInplaceNormShallowConv1d | import torch
import torch.nn as nn
class ResnetBlockInplaceNormShallowConv1d(nn.Module):
""" Fully connected ResNet Block imeplemented with group convolutions and weight/spectral normalizations.
Args:
size_in (int): input dimension
groups (int): number of groups for group convolutions
... | 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.... | taconite/MetaAvatar-release | ResnetBlockInplaceNormShallowConv1d | false | 16,525 | [
"MIT"
] | 60 | c9403a478ee82232633d25f65f108befd21d04e9 | https://github.com/taconite/MetaAvatar-release/tree/c9403a478ee82232633d25f65f108befd21d04e9 |
ResnetBlockGroupNormConv1d | import torch
import torch.nn as nn
class GroupNorm1d(nn.Module):
""" Group normalization that does per-point group normalization.
Args:
groups (int): number of groups
f_dim (int): feature dimension, mush be divisible by groups
"""
def __init__(self, groups, f_dim, eps=1e-05, affine=T... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | taconite/MetaAvatar-release | ResnetBlockGroupNormConv1d | false | 16,526 | [
"MIT"
] | 60 | c9403a478ee82232633d25f65f108befd21d04e9 | https://github.com/taconite/MetaAvatar-release/tree/c9403a478ee82232633d25f65f108befd21d04e9 |
GatedFusion | import torch
import torch.nn as nn
from scipy.sparse import *
class GatedFusion(nn.Module):
def __init__(self, hidden_size):
super(GatedFusion, self).__init__()
"""GatedFusion module"""
self.fc_z = nn.Linear(4 * hidden_size, hidden_size, bias=True)
def forward(self, h_state, input):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from scipy.sparse import *
assert_size_stride = torch._C._... | talha1503/RL-based-Graph2Seq-for-NQG | GatedFusion | false | 16,527 | [
"Apache-2.0"
] | 100 | 1039e0b6231ae7029ea6e4073b1e55df5ad2e928 | https://github.com/talha1503/RL-based-Graph2Seq-for-NQG/tree/1039e0b6231ae7029ea6e4073b1e55df5ad2e928 |
ResnetBlockGroupNormShallowConv1d | import torch
import torch.nn as nn
class GroupNorm1d(nn.Module):
""" Group normalization that does per-point group normalization.
Args:
groups (int): number of groups
f_dim (int): feature dimension, mush be divisible by groups
"""
def __init__(self, groups, f_dim, eps=1e-05, affine=T... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | taconite/MetaAvatar-release | ResnetBlockGroupNormShallowConv1d | false | 16,528 | [
"MIT"
] | 60 | c9403a478ee82232633d25f65f108befd21d04e9 | https://github.com/taconite/MetaAvatar-release/tree/c9403a478ee82232633d25f65f108befd21d04e9 |
PatchEmbed | import torch
import torch.nn as nn
from torch import optim as optim
class PatchEmbed(nn.Module):
""" Image to Patch Embedding
"""
def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=768):
super().__init__()
num_patches = img_size // patch_size * (img_size // patch_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch import optim as optim
assert_size_stride = torc... | taokong/ibot | PatchEmbed | false | 16,529 | [
"Apache-2.0"
] | 327 | a2ee1ae7495d4ea8fb9ba100434c062f1bd3d1f0 | https://github.com/taokong/ibot/tree/a2ee1ae7495d4ea8fb9ba100434c062f1bd3d1f0 |
silog_loss | import torch
import torch.nn as nn
import torch.utils.data.distributed
class silog_loss(nn.Module):
def __init__(self, variance_focus):
super(silog_loss, self).__init__()
self.variance_focus = variance_focus
def forward(self, depth_est, depth_gt, mask):
d = torch.log(depth_est[mask])... | 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.utils.data.distributed
asse... | syKevinPeng/TransDepth | silog_loss | false | 16,530 | [
"MIT"
] | 118 | 2282039da7bc0812e19a27b2d73a25bdef97d739 | https://github.com/syKevinPeng/TransDepth/tree/2282039da7bc0812e19a27b2d73a25bdef97d739 |
SoftDiceLoss | import torch
import torch.nn as nn
class SoftDiceLoss(nn.Module):
def __init__(self):
super(SoftDiceLoss, self).__init__()
def forward(self, output, label):
probs = output.view(-1)
mask = label.view(-1)
smooth = 1
intersection = torch.sum(probs * mask)
den1 = ... | 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... | tdml13/NiftyNet | SoftDiceLoss | false | 16,531 | [
"Apache-2.0"
] | 1,403 | b35fa19ca307e81d229e2fe8269a417724833da2 | https://github.com/tdml13/NiftyNet/tree/b35fa19ca307e81d229e2fe8269a417724833da2 |
PatchMerging | import torch
import torch.nn as nn
import torch.nn.functional as F
from math import sqrt
from torch import optim as optim
class PatchMerging(nn.Module):
"""Patch Merging Layer.
Args:
input_resolution (tuple[int]): Resolution of input feature.
dim (int): Number of input channels.
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.triton_helpers import libdevice
import torch.nn as ... | taokong/ibot | PatchMerging | false | 16,532 | [
"Apache-2.0"
] | 327 | a2ee1ae7495d4ea8fb9ba100434c062f1bd3d1f0 | https://github.com/taokong/ibot/tree/a2ee1ae7495d4ea8fb9ba100434c062f1bd3d1f0 |
ITN2D | import torch
import torch.nn.functional as F
import torch.nn as nn
class ITN2D(nn.Module):
def __init__(self, input_channels):
super(ITN2D, self).__init__()
use_bias = True
self.conv11 = nn.Conv2d(input_channels, 2, kernel_size=3, padding=1,
bias=use_bias)
self.conv12 ... | 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_... | swaroopkml96/istn | ITN2D | false | 16,533 | [
"Apache-2.0"
] | 91 | 600543e071aa56907509aa090697295cdc69a6b1 | https://github.com/swaroopkml96/istn/tree/600543e071aa56907509aa090697295cdc69a6b1 |
Conv_Q | import torch
import torch.nn.functional as F
from torch.functional import F
from torch import nn
from typing import *
from torch.nn import functional as F
class Conv_Q(nn.Module):
def __init__(self, frames, num_actions):
super(Conv_Q, self).__init__()
self.c1 = nn.Conv2d(frames, 32, kernel_size=8... | 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.... | ssimonc/NeoRL | Conv_Q | false | 16,534 | [
"Apache-2.0"
] | 50 | 098c58c8e4c3e43e67803f6384619d3bfe7fce5d | https://github.com/ssimonc/NeoRL/tree/098c58c8e4c3e43e67803f6384619d3bfe7fce5d |
Dense | from torch.autograd import Function
from torch.nn import Module
import torch
from torch.nn import Parameter
class DenseFunction(Function):
@staticmethod
def forward(ctx, input, weight, bias=None):
output = input.mm(weight.t())
if bias is not None:
output += bias.unsqueeze(0).expan... | 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.autograd import Function
from torch.nn import Module
from torch.nn im... | tczhangzhi/pytorch-parallel | Dense | false | 16,535 | [
"MIT"
] | 117 | 8d8baf80dd48234386051d0bab616de5b55f8f5c | https://github.com/tczhangzhi/pytorch-parallel/tree/8d8baf80dd48234386051d0bab616de5b55f8f5c |
TripletLoss | import torch
from torch.nn.modules.distance import PairwiseDistance
class TripletLoss(torch.nn.Module):
def __init__(self, margin):
super(TripletLoss, self).__init__()
self.margin = margin
self.pdist = PairwiseDistance(2)
def forward(self, anchor, positive, negative):
pos_dis... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn.modules.distan... | tbmoon/facenet | TripletLoss | false | 16,536 | [
"MIT"
] | 231 | b3aec1a930f22a5a9597efa7072373c0ff93663f | https://github.com/tbmoon/facenet/tree/b3aec1a930f22a5a9597efa7072373c0ff93663f |
ConcatBlock | import torch
import torch.nn as nn
class ConcatBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(ConcatBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns, kernel_size=1,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | tea321000/SSL4MIS | ConcatBlock | false | 16,537 | [
"MIT"
] | 854 | 8d1b0be08cf089943481a47877b36eb6405fffb2 | https://github.com/tea321000/SSL4MIS/tree/8d1b0be08cf089943481a47877b36eb6405fffb2 |
OutPutBlock | import torch
import torch.nn as nn
class OutPutBlock(nn.Module):
def __init__(self, in_channels, out_channels):
super(OutPutBlock, self).__init__()
self.in_chns = in_channels
self.out_chns = out_channels
self.conv1 = nn.Conv2d(self.in_chns, self.in_chns // 2, kernel_size
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | tea321000/SSL4MIS | OutPutBlock | false | 16,538 | [
"MIT"
] | 854 | 8d1b0be08cf089943481a47877b36eb6405fffb2 | https://github.com/tea321000/SSL4MIS/tree/8d1b0be08cf089943481a47877b36eb6405fffb2 |
MinimalRNNCell | import torch
from torch import nn
from functools import partial
def get_initializer(name, activation):
if activation in ['id', 'identity', 'linear', 'modrelu']:
nonlinearity = 'linear'
elif activation in ['relu', 'tanh', 'sigmoid']:
nonlinearity = activation
else:
assert False, f'g... | 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... | tarepan/HiPPO | MinimalRNNCell | false | 16,539 | [
"Apache-2.0"
] | 57 | bc23e2dba13da6c307cb5a4ae248c2d2c56d465f | https://github.com/tarepan/HiPPO/tree/bc23e2dba13da6c307cb5a4ae248c2d2c56d465f |
AvgPoolShortening | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class AvgPoolShortening(Module):
"""
### Average pool shortening
This down-samples by a given factor with average pooling
"""
def __init__(self, k: 'int'):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride... | techthiyanes/annotated_deep_learning_paper_implementations | AvgPoolShortening | false | 16,540 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
MLPAutoencoder | import torch
def choose_nonlinearity(name):
nl = None
if name == 'tanh':
nl = torch.tanh
elif name == 'relu':
nl = torch.relu
elif name == 'sigmoid':
nl = torch.sigmoid
elif name == 'softplus':
nl = torch.nn.functional.softplus
elif name == 'selu':
nl = ... | 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
assert_size_stride ... | tailintalent/hamiltonian-nn | MLPAutoencoder | false | 16,541 | [
"Apache-2.0"
] | 293 | 1f6dd2d58ab84977a30584f0d1dd7f8b234e4049 | https://github.com/tailintalent/hamiltonian-nn/tree/1f6dd2d58ab84977a30584f0d1dd7f8b234e4049 |
ClippedValueFunctionLoss | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class ClippedValueFunctionLoss(Module):
"""
## Clipped Value Function Loss
Similarly we clip the value function update also.
egin{align}
V^{\\pi_ heta}_{CLIP}(s_t)
&= clip\\Big... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
import torch.utils.data
import torch.nn.functional
import tor... | techthiyanes/annotated_deep_learning_paper_implementations | ClippedValueFunctionLoss | false | 16,542 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
Loss | import torch
import torch.nn.functional as F
from torch import nn
def _iou(pred, target):
b = pred.shape[0]
IoU = 0.0
for i in range(0, b):
Iand1 = torch.sum(target[i, :, :] * pred[i, :, :])
Ior1 = torch.sum(target[i, :, :]) + torch.sum(pred[i, :, :]) - Iand1
IoU1 = Iand1 / Ior1
... | 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... | suyukun666/UFO | Loss | false | 16,543 | [
"MIT"
] | 122 | e57016948b03cd2f75155d2958cea69b6e4b56f8 | https://github.com/suyukun666/UFO/tree/e57016948b03cd2f75155d2958cea69b6e4b56f8 |
DPFP | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class DPFP(Module):
"""
## Deterministic Parameter Free Project (DPFP)
This is the new projection function $ extcolor{lightgreen}{\\phi}$ introduced in the paper.
DPF... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.... | techthiyanes/annotated_deep_learning_paper_implementations | DPFP | false | 16,544 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
DiscriminatorLoss | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class DiscriminatorLoss(Module):
"""
## Discriminator Loss
We want to find $w$ to maximize
$$\\mathbb{E}_{x \\sim \\mathbb{P}_r} [f_w(x)]- \\mathbb{E}_{z \... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
import torch.utils.data
import torch.nn.functional
import tor... | techthiyanes/annotated_deep_learning_paper_implementations | DiscriminatorLoss | false | 16,545 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
ITN3D | import torch
import torch.nn.functional as F
import torch.nn as nn
class ITN3D(nn.Module):
def __init__(self, input_channels):
super(ITN3D, self).__init__()
use_bias = True
self.conv11 = nn.Conv3d(input_channels, 2, kernel_size=3, padding=1,
bias=use_bias)
self.conv12 ... | 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_... | swaroopkml96/istn | ITN3D | false | 16,546 | [
"Apache-2.0"
] | 91 | 600543e071aa56907509aa090697295cdc69a6b1 | https://github.com/swaroopkml96/istn/tree/600543e071aa56907509aa090697295cdc69a6b1 |
CrossEntropyBayesRisk | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class CrossEntropyBayesRisk(Module):
"""
<a id="CrossEntropyBayesRisk"></a>
## Bayes Risk with Cross Entropy Loss
Bayes risk is the overall maximum cost of making incorrect estimates.
... | 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.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride = torch._C._dynamo.g... | techthiyanes/annotated_deep_learning_paper_implementations | CrossEntropyBayesRisk | false | 16,547 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
GatedRNNCell | import torch
from torch import nn
from functools import partial
def get_initializer(name, activation):
if activation in ['id', 'identity', 'linear', 'modrelu']:
nonlinearity = 'linear'
elif activation in ['relu', 'tanh', 'sigmoid']:
nonlinearity = activation
else:
assert False, f'g... | 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... | tarepan/HiPPO | GatedRNNCell | false | 16,548 | [
"Apache-2.0"
] | 57 | bc23e2dba13da6c307cb5a4ae248c2d2c56d465f | https://github.com/tarepan/HiPPO/tree/bc23e2dba13da6c307cb5a4ae248c2d2c56d465f |
MaximumLikelihoodLoss | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class MaximumLikelihoodLoss(Module):
"""
<a id="MaximumLikelihoodLoss"></a>
## Type II Maximum Likelihood Loss
The distribution $D(\\mathbf{p} ert extcolor{orange}{\\mathbf{lpha}})$ 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._inductor.runtime.triton_helpers import math as tl_math
from torch.nn import Module
import torch.utils.data
import torch.nn.funct... | techthiyanes/annotated_deep_learning_paper_implementations | MaximumLikelihoodLoss | false | 16,549 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
EqualizedWeight | import math
import torch
import numpy as np
from torch import nn
import torch.utils.data
from typing import List
import torch.nn.functional
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Parameter
This is based on equalize... | 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
from typing import List
import torch.nn.functional
import torch.... | techthiyanes/annotated_deep_learning_paper_implementations | EqualizedWeight | false | 16,550 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
MarginLoss | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class MarginLoss(Module):
'\n ## Margin loss for class existence\n\n A separate margin loss is used for each output capsule and the total loss is the sum of them.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
... | techthiyanes/annotated_deep_learning_paper_implementations | MarginLoss | false | 16,551 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
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 ... | techthiyanes/annotated_deep_learning_paper_implementations | Conv1dCompression | false | 16,552 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
MLP | import torch
def choose_nonlinearity(name):
nl = None
if name == 'tanh':
nl = torch.tanh
elif name == 'relu':
nl = torch.relu
elif name == 'sigmoid':
nl = torch.sigmoid
elif name == 'softplus':
nl = torch.nn.functional.softplus
elif name == 'selu':
nl = ... | 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
assert_size_stride ... | tailintalent/hamiltonian-nn | MLP | false | 16,553 | [
"Apache-2.0"
] | 293 | 1f6dd2d58ab84977a30584f0d1dd7f8b234e4049 | https://github.com/tailintalent/hamiltonian-nn/tree/1f6dd2d58ab84977a30584f0d1dd7f8b234e4049 |
ChannelNorm | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class ChannelNorm(Module):
"""
## Channel Normalization
This is similar to [Group Normalization](../group_norm/index.html) but affine transform is done group wise.
""... | 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... | techthiyanes/annotated_deep_learning_paper_implementations | ChannelNorm | false | 16,554 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
KLDivLoss | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class KLDivLoss(Module):
"""
## KL-Divergence loss
This calculates the KL divergence between a given normal distribution and $\\mathcal{N}(0, 1)$
"""
def forward(self, sigma_hat: 'to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn import M... | techthiyanes/annotated_deep_learning_paper_implementations | KLDivLoss | false | 16,555 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
BinaryClassificationHead | from _paritybench_helpers import _mock_config
import torch
class BinaryClassificationHead(torch.nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.dense = torch.nn.Linear(config.hidden_size, config.hidden_size)
self.dropout = torch.nn.Dropout(conf... | 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
assert_size_stride ... | techthiyanes/DeepPavlov | BinaryClassificationHead | false | 16,556 | [
"Apache-2.0"
] | 5,893 | 08555428388fed3c7b036c0a82a70a25efcabcff | https://github.com/techthiyanes/DeepPavlov/tree/08555428388fed3c7b036c0a82a70a25efcabcff |
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 ... | techthiyanes/annotated_deep_learning_paper_implementations | MiniBatchStdDev | false | 16,557 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
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... | techthiyanes/annotated_deep_learning_paper_implementations | GroupNorm | false | 16,558 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
SquaredReLU | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SquaredReLU(Module):
"""
## Squared ReLU activation
$$y = {\\max(x, 0)}^2$$
Squared ReLU is used as the activation function in the
[position wise feedforw... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.... | techthiyanes/annotated_deep_learning_paper_implementations | SquaredReLU | false | 16,559 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
LSTMCell | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class LSTMCell(Module):
"""
## Long Short-Term Memory Cell
LSTM Cell computes $c$, and $h$. $c$ is like the long-term memory,
and $h$ is like the short term memory.
... | 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.nn impor... | techthiyanes/annotated_deep_learning_paper_implementations | LSTMCell | false | 16,560 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
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... | techthiyanes/annotated_deep_learning_paper_implementations | InstanceNorm | false | 16,561 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
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... | techthiyanes/annotated_deep_learning_paper_implementations | Conv2d | false | 16,562 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
SelfAttention | import torch
class SelfAttention(torch.nn.Module):
def __init__(self, num_heads, model_dim, dropout_keep_prob):
super(SelfAttention, self).__init__()
self.num_heads = num_heads
self.model_dim = model_dim
self.dropout_keep_prob = dropout_keep_prob
self.q_layer = torch.nn.Li... | 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.... | tech-srl/bottleneck | SelfAttention | false | 16,563 | [
"MIT"
] | 56 | b8c629ad25e02f53ba3389dd33a90bbeb83ea447 | https://github.com/tech-srl/bottleneck/tree/b8c629ad25e02f53ba3389dd33a90bbeb83ea447 |
EnDeWithPooling | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class EnDeWithPooling(nn.Module):
def __init__(self, activation, initType, numChannels, batchnorm=False,
softmax=False):
super(EnDeWithPooling, self).__init__()
self.batchnorm = batchnorm
self.bi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | talsperre/INFER | EnDeWithPooling | false | 16,564 | [
"MIT"
] | 56 | 38fb2356700c5a92991788b7eb9a267c99a07c5b | https://github.com/talsperre/INFER/tree/38fb2356700c5a92991788b7eb9a267c99a07c5b |
SpatialDepthWiseSharedConvolution | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SpatialDepthWiseSharedConvolution(Module):
"""
## Spatial Depth Wise Shared Convolution
We share the same kernel across all channels.
"""
def __init__(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.nn import Module
from torch import nn
import torch.utils.data
import ... | techthiyanes/annotated_deep_learning_paper_implementations | SpatialDepthWiseSharedConvolution | false | 16,565 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
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... | techthiyanes/annotated_deep_learning_paper_implementations | DownSample | false | 16,566 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
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... | techthiyanes/annotated_deep_learning_paper_implementations | Smooth | false | 16,567 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
ATLoss | import torch
from torch import Tensor
import torch.nn as nn
import torch.nn.functional as F
class ATLoss(nn.Module):
def __init__(self):
super().__init__()
def forward(self, logits: 'Tensor', labels: 'Tensor') ->float:
"""
Args:
logits: predicted probabilities (shape: bat... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import Tens... | techthiyanes/DeepPavlov | ATLoss | false | 16,568 | [
"Apache-2.0"
] | 5,893 | 08555428388fed3c7b036c0a82a70a25efcabcff | https://github.com/techthiyanes/DeepPavlov/tree/08555428388fed3c7b036c0a82a70a25efcabcff |
SpatialDepthWisePerHeadConvolution | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SpatialDepthWisePerHeadConvolution(Module):
"""
## Spatial Depth Wise Per Head Convolution
"""
def __init__(self, heads: 'int', d_k: 'int', kernel_size: 'int'=3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import ... | techthiyanes/annotated_deep_learning_paper_implementations | SpatialDepthWisePerHeadConvolution | false | 16,569 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
Squash | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Squash(Module):
'\n ## Squash\n\n This is **squashing** function from paper, given by equation $(1)$.\n\n $$\\mathbf{v}_j = \x0crac{{\\lVert \\mathbf{s}_j \rVert}^2}{1 + {\\lVert \\math... | 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
import torch.utils.data
import torch.nn.functional
... | techthiyanes/annotated_deep_learning_paper_implementations | Squash | false | 16,570 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
SpacialGatingUnit | import torch
from torch import nn
import torch.utils.data
from typing import Optional
import torch.nn.functional
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... | techthiyanes/annotated_deep_learning_paper_implementations | SpacialGatingUnit | false | 16,571 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
SpatialDepthWiseConvolution | from torch.nn import Module
import math
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SpatialDepthWiseConvolution(Module):
"""
## Spatial Depth Wise Convolution
This is actually slower
"""
def __init__(self, d_k: 'int', kernel_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.nn import Module
import math
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert... | techthiyanes/annotated_deep_learning_paper_implementations | SpatialDepthWiseConvolution | false | 16,572 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
PatchEmbeddings | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class PatchEmbeddings(Module):
"""
<a id="PatchEmbeddings"></a>
## Get patch embeddings
The paper splits the image into patches of equal size and do a linear transfo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import ... | techthiyanes/annotated_deep_learning_paper_implementations | PatchEmbeddings | false | 16,573 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
ToRGB | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
from typing import List
import torch.nn.functional
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Paramete... | 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... | techthiyanes/annotated_deep_learning_paper_implementations | ToRGB | false | 16,574 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
DiceLoss | import torch
import torch.nn as nn
import torch.hub
def dice_loss(input, target):
smooth = 1.0
input = torch.sigmoid(input)
if input.dim() == 4:
B, C, _H, _W = input.size()
iflat = input.view(B * C, -1)
tflat = target.view(B * C, -1)
else:
assert input.dim() == 3
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.hub
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | thangnx183/kaggle-understanding-clouds | DiceLoss | false | 16,575 | [
"BSD-2-Clause"
] | 207 | 15ad2a9029958262437b899cb00525579da23911 | https://github.com/thangnx183/kaggle-understanding-clouds/tree/15ad2a9029958262437b899cb00525579da23911 |
StyleBlock | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
from typing import Optional
from typing import List
import torch.nn.functional
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rat... | 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 ... | techthiyanes/annotated_deep_learning_paper_implementations | StyleBlock | false | 16,576 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
AddTensors | import torch
import torch.nn as nn
import torch.hub
class AddTensors(nn.Module):
""" Adds all its inputs together. """
def forward(self, xs):
return sum(xs)
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
import torch.hub
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | theoway/raster-vision | AddTensors | false | 16,577 | [
"Apache-2.0"
] | 1,577 | dab675517f904771e2ce8c052494f8a6f1ddc026 | https://github.com/theoway/raster-vision/tree/dab675517f904771e2ce8c052494f8a6f1ddc026 |
ACGANDiscriminator | import torch
import torch.nn as nn
import torch.nn.utils as utils
import torch.nn.functional as F
from torchvision import utils
def global_pooling(input, pooling='mean'):
if pooling == 'mean':
return input.mean(3).mean(2)
elif pooling == 'sum':
return input.sum(3).sum(2)
else:
rais... | 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 ... | takuhirok/rGAN | ACGANDiscriminator | false | 16,578 | [
"MIT"
] | 103 | 6f7a092de5814c662fd17224b3d48bebe7e03c2f | https://github.com/takuhirok/rGAN/tree/6f7a092de5814c662fd17224b3d48bebe7e03c2f |
EqualizedLinear | import math
import torch
import numpy as np
from torch import nn
import torch.nn.functional as F
import torch.utils.data
from typing import List
import torch.nn.functional
import torch.autograd
class EqualizedWeight(nn.Module):
"""
<a id="equalized_weight"></a>
## Learning-rate Equalized Weights Paramete... | 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
from... | techthiyanes/annotated_deep_learning_paper_implementations | EqualizedLinear | false | 16,579 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
SymmetricBCELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.hub
class SymmetricBCELoss(nn.Module):
def __init__(self, alpha=0.1, beta=0.1):
super().__init__()
self.alpha = alpha
self.beta = beta
def forward(self, input, target):
y_true = target
y_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... | thangnx183/kaggle-understanding-clouds | SymmetricBCELoss | false | 16,580 | [
"BSD-2-Clause"
] | 207 | 15ad2a9029958262437b899cb00525579da23911 | https://github.com/thangnx183/kaggle-understanding-clouds/tree/15ad2a9029958262437b899cb00525579da23911 |
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... | techthiyanes/annotated_deep_learning_paper_implementations | UpSample | false | 16,581 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertSelfAttention(nn.Module):
"""
self attention层
原理可看这篇博客: http://jalammar.github.io/illustrated-transformer/
"""
def __init__(self, config):
super(BertSelfAttention, self).__init__... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | techthiyanes/nlp-notebook | BertAttention | false | 16,582 | [
"MIT"
] | 136 | 0e5f4b75e635128d4056c89a6c65bea60c15e836 | https://github.com/techthiyanes/nlp-notebook/tree/0e5f4b75e635128d4056c89a6c65bea60c15e836 |
moving_avg | import torch
import torch.nn as nn
class moving_avg(nn.Module):
"""
Moving average block to highlight the trend of time series
"""
def __init__(self, kernel_size, stride):
super(moving_avg, self).__init__()
self.kernel_size = kernel_size
self.avg = nn.AvgPool1d(kernel_size=ker... | 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... | thuml/Autoformer | moving_avg | false | 16,583 | [
"MIT"
] | 263 | 6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab | https://github.com/thuml/Autoformer/tree/6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab |
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
from typing import Optional
from typing import List
import torch.nn.functional
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 ... | techthiyanes/annotated_deep_learning_paper_implementations | GeneratorBlock | false | 16,584 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
BiasAdd | from _paritybench_helpers import _mock_config
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class BiasAdd(nn.Module):
def __init__(self, channels, opts, act='linear', alpha=None, gain=None,
lrmul=1):
"""
BiasAdd
"""
super(BiasAdd... | 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... | tomguluson92/StyleGAN2_PyTorch | BiasAdd | false | 16,585 | [
"MIT"
] | 89 | 4ab7354c85cb986d2b77f5238c4a18c5efd1db1b | https://github.com/tomguluson92/StyleGAN2_PyTorch/tree/4ab7354c85cb986d2b77f5238c4a18c5efd1db1b |
GLU | import torch
import torch.nn as nn
def initialize_weight(x):
nn.init.xavier_uniform_(x.weight)
if x.bias is not None:
nn.init.constant_(x.bias, 0)
class GLU(nn.Module):
def __init__(self, in_features, dropout_rate):
super(GLU, self).__init__()
self.sigm = nn.Sigmoid()
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | tijsmaas/transformer-pytorch | GLU | false | 16,586 | [
"MIT"
] | 237 | bb517979d62c416f68d66325f51826bbbf4ba1bd | https://github.com/tijsmaas/transformer-pytorch/tree/bb517979d62c416f68d66325f51826bbbf4ba1bd |
SquaredErrorBayesRisk | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class SquaredErrorBayesRisk(Module):
"""
<a id="SquaredErrorBayesRisk"></a>
## Bayes Risk with Squared Error Loss
Here the cost function is squared error,
$$\\sum_{k=1}^K (y_k - p_k)... | 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.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride = torch._C._dynamo.g... | techthiyanes/annotated_deep_learning_paper_implementations | SquaredErrorBayesRisk | false | 16,587 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
series_decomp | import torch
import torch.nn as nn
class moving_avg(nn.Module):
"""
Moving average block to highlight the trend of time series
"""
def __init__(self, kernel_size, stride):
super(moving_avg, self).__init__()
self.kernel_size = kernel_size
self.avg = nn.AvgPool1d(kernel_size=ker... | 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... | thuml/Autoformer | series_decomp | false | 16,588 | [
"MIT"
] | 263 | 6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab | https://github.com/thuml/Autoformer/tree/6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab |
DilatedNet | import torch
import torchvision.transforms.functional as F
from torch.nn import functional as F
from torch import nn
class DilatedNet(nn.Module):
def __init__(self, filters):
super().__init__()
self.filters = filters
self.conv1 = nn.Conv2d(self.filters[-1], self.filters[-1], 3,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | tilacyn/dsb2018_topcoders | DilatedNet | false | 16,589 | [
"MIT"
] | 413 | e0f95ef70bc062d4dea321d2aa73231a9538cd63 | https://github.com/tilacyn/dsb2018_topcoders/tree/e0f95ef70bc062d4dea321d2aa73231a9538cd63 |
my_Layernorm | import torch
import torch.nn as nn
class my_Layernorm(nn.Module):
"""
Special designed layernorm for the seasonal part
"""
def __init__(self, channels):
super(my_Layernorm, self).__init__()
self.layernorm = nn.LayerNorm(channels)
def forward(self, x):
x_hat = self.layerno... | 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_... | thuml/Autoformer | my_Layernorm | false | 16,590 | [
"MIT"
] | 263 | 6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab | https://github.com/thuml/Autoformer/tree/6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab |
Minibatch_stddev_layer | import torch
import torch.nn as nn
class Minibatch_stddev_layer(nn.Module):
"""
Minibatch standard deviation layer. (D_stylegan2)
"""
def __init__(self, group_size=4, num_new_features=1):
super().__init__()
self.group_size = group_size
self.num_new_features = num_new_featu... | 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_... | tomguluson92/StyleGAN2_PyTorch | Minibatch_stddev_layer | false | 16,591 | [
"MIT"
] | 89 | 4ab7354c85cb986d2b77f5238c4a18c5efd1db1b | https://github.com/tomguluson92/StyleGAN2_PyTorch/tree/4ab7354c85cb986d2b77f5238c4a18c5efd1db1b |
LearnedPositionalEmbeddings | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class LearnedPositionalEmbeddings(Module):
"""
<a id="LearnedPositionalEmbeddings"></a>
## Add parameterized positional encodings
This adds learned positional embedd... | 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 import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride... | techthiyanes/annotated_deep_learning_paper_implementations | LearnedPositionalEmbeddings | false | 16,592 | [
"MIT"
] | 3,714 | 8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 | https://github.com/techthiyanes/annotated_deep_learning_paper_implementations/tree/8af24da2dd39a9a87482a4d18c2dc829bbd3fd47 |
Aggregator | import torch
import torchvision.transforms.functional as F
from torch.nn import functional as F
from torch import nn
class Aggregator(nn.Module):
def __init__(self, in_channels, mid_channels, upsample_factor):
super().__init__()
self.upsample = nn.Upsample(scale_factor=2 ** upsample_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 import triton_helpers
from torch import nn
assert_s... | tilacyn/dsb2018_topcoders | Aggregator | false | 16,593 | [
"MIT"
] | 413 | e0f95ef70bc062d4dea321d2aa73231a9538cd63 | https://github.com/tilacyn/dsb2018_topcoders/tree/e0f95ef70bc062d4dea321d2aa73231a9538cd63 |
AdaptiveMaxPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class _SpikeAdaptiveMaxPoolNd(nn.Module):
def __init__(self, output_size):
super(_SpikeAdaptiveMaxPoolNd, self).__init__()
self.output_size = output_size
self.return_indices = True
def reset_state(self):
pass
... | 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... | tomking/PySNN | AdaptiveMaxPool2d | false | 16,594 | [
"MIT"
] | 175 | c99ba6cd28a518dc07cab765acac9b69ac6fe36b | https://github.com/tomking/PySNN/tree/c99ba6cd28a518dc07cab765acac9b69ac6fe36b |
TokenEmbedding | import torch
import torch.nn as nn
class TokenEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(TokenEmbedding, self).__init__()
padding = 1 if torch.__version__ >= '1.5.0' else 2
self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model,
kernel_size=3, pa... | 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... | thuml/Autoformer | TokenEmbedding | false | 16,595 | [
"MIT"
] | 263 | 6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab | https://github.com/thuml/Autoformer/tree/6bf300d0bf3e7f3cb4d795dd8ed14ede2000a9ab |
ActNorm | import torch
import torch.nn as nn
class ActNorm(nn.Module):
"""
ActNorm layer.
[Kingma and Dhariwal, 2018.]
"""
def __init__(self, dim):
super().__init__()
self.dim = dim
self.mu = nn.Parameter(torch.zeros(dim, dtype=torch.float))
self.log_sigma = nn.Parameter(to... | 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... | tonyduan/hybrid-models | ActNorm | false | 16,596 | [
"MIT"
] | 238 | a29bff4756d8306cd24515f2fb825763a71c3d90 | https://github.com/tonyduan/hybrid-models/tree/a29bff4756d8306cd24515f2fb825763a71c3d90 |
GatedMaskedConv2d | import torch
import torch.utils.data
from torch import nn
import torch.nn.functional as F
class GatedMaskedConv2d(nn.Module):
def __init__(self, in_dim, out_dim=None, kernel_size=3, mask='B'):
super(GatedMaskedConv2d, self).__init__()
if out_dim is None:
out_dim = in_dim
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
import torch.utils.... | tom-pelsmaeker/vae-lagging-encoder | GatedMaskedConv2d | false | 16,597 | [
"MIT"
] | 173 | b190239019a94c85858d188a0853886eb48ce4be | https://github.com/tom-pelsmaeker/vae-lagging-encoder/tree/b190239019a94c85858d188a0853886eb48ce4be |
MaxPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class _SpikeMaxPoolNd(nn.Module):
def __init__(self, kernel_size, stride=None, padding=0, dilation=1,
ceil_mode=False):
super(_SpikeMaxPoolNd, self).__init__()
self.kernel_size = kernel_size
self.stride = stride or... | 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... | tomking/PySNN | MaxPool2d | false | 16,598 | [
"MIT"
] | 175 | c99ba6cd28a518dc07cab765acac9b69ac6fe36b | https://github.com/tomking/PySNN/tree/c99ba6cd28a518dc07cab765acac9b69ac6fe36b |
DisAlignFastRCNNOutputLayers | import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
from itertools import product as product
from math import sqrt as sqrt
import torch.nn
def cat(tensors, dim=0):
"""
Efficient version of torch.cat that avoids a copy if there is only a single element in a list
"""
assert isi... | 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
import torch.utils.data
from itertools ... | tonysy/cvpods | DisAlignFastRCNNOutputLayers | false | 16,599 | [
"Apache-2.0"
] | 548 | e322d7842ca0e34b1ef6237ea6d350633efc793a | https://github.com/tonysy/cvpods/tree/e322d7842ca0e34b1ef6237ea6d350633efc793a |
RNN | import torch
import torch.nn as nn
from torch.autograd import Variable
class RNN(nn.Module):
def __init__(self, input_size, hidden_size, output_size, all_categories,
n_categories, all_letters, n_letters):
super(RNN, self).__init__()
self.hidden_size = hidden_size
self.all_categori... | 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.... | tom-kuchler/vhive | RNN | false | 16,600 | [
"MIT"
] | 138 | ae1f2f5920e7607e9902ed1060bda62b56e332ac | https://github.com/tom-kuchler/vhive/tree/ae1f2f5920e7607e9902ed1060bda62b56e332ac |
Upsample2d | from _paritybench_helpers import _mock_config
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def _setup_kernel(k):
k = np.asarray(k, dtype=np.float32)
if k.ndim == 1:
k = np.outer(k, k)
k /= np.sum(k)
assert k.ndim == 2
assert k.shape[0] == k.shape[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 numpy as np
import tor... | tomguluson92/StyleGAN2_PyTorch | Upsample2d | false | 16,601 | [
"MIT"
] | 89 | 4ab7354c85cb986d2b77f5238c4a18c5efd1db1b | https://github.com/tomguluson92/StyleGAN2_PyTorch/tree/4ab7354c85cb986d2b77f5238c4a18c5efd1db1b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.