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 |
|---|---|---|---|---|---|---|---|---|---|---|
TripletLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import *
def _batch_hard(mat_distance, mat_similarity, indice=False):
sorted_mat_distance, positive_indices = torch.sort(mat_distance + -
9999999.0 * (1 - mat_similarity), dim=1, descending=True)
hard_p = sorted_mat_dista... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | LunarShen/SECRET | TripletLoss | false | 2,601 | [
"MIT"
] | 0 | 0f652e63ce760ece8690cbad013f0d9bdb341e84 | https://github.com/LunarShen/SECRET/tree/0f652e63ce760ece8690cbad013f0d9bdb341e84 |
BridgeFeatLoss | import torch
from torch import nn
from torch.optim.lr_scheduler import *
class BridgeFeatLoss(nn.Module):
def __init__(self):
super(BridgeFeatLoss, self).__init__()
def forward(self, feats_s, feats_t, feats_mixed, lam):
dist_mixed2s = ((feats_mixed - feats_s) ** 2).sum(1, keepdim=True)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | Luxios22/IDM | BridgeFeatLoss | false | 2,602 | [
"MIT"
] | 0 | 8d51103b7c252e6304e2a361976e16ed4b523944 | https://github.com/Luxios22/IDM/tree/8d51103b7c252e6304e2a361976e16ed4b523944 |
TripletLoss | import torch
from torch import nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import *
def _batch_hard(mat_distance, mat_similarity, indice=False):
sorted_mat_distance, positive_indices = torch.sort(mat_distance + -
9999999.0 * (1 - mat_similarity), dim=1, descending=True)
hard_p = s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Luxios22/IDM | TripletLoss | false | 2,603 | [
"MIT"
] | 0 | 8d51103b7c252e6304e2a361976e16ed4b523944 | https://github.com/Luxios22/IDM/tree/8d51103b7c252e6304e2a361976e16ed4b523944 |
SysModel | import torch
import torch.nn as nn
import torch.nn.functional as F
class SysModel(nn.Module):
def __init__(self, state_size, action_size, fc1_units=400, fc2_units=300):
super(SysModel, self).__init__()
self.l1 = nn.Linear(state_size + action_size, fc1_units)
self.l2 = nn.Linear(fc1_units,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | LuckierDodge/ROS_Dockerfiles | SysModel | false | 2,604 | [
"MIT"
] | 0 | 42fd0e7ecfef86d792fcc29197fcd79dcb789122 | https://github.com/LuckierDodge/ROS_Dockerfiles/tree/42fd0e7ecfef86d792fcc29197fcd79dcb789122 |
ConvReLUNorm | import torch
import torch.utils.data
import torch.cuda
import torch.optim
class ConvReLUNorm(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, dropout=0.0):
super(ConvReLUNorm, self).__init__()
self.conv = torch.nn.Conv1d(in_channels, out_channels, kernel_size=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Malkovsky/NeMo | ConvReLUNorm | false | 2,605 | [
"Apache-2.0"
] | 0 | 8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 | https://github.com/Malkovsky/NeMo/tree/8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 |
AvgPool2d | from torch.nn import Module
import torch
import torch as th
class AvgPool2d(Module):
"""
This class is the beginning of an exact python port of the torch.nn.AvgPool2d
module. Because PySyft cannot hook into layers which are implemented in C++,
our special functionalities (such as encrypted computation... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._em... | MaksymPetyak/PySyft | AvgPool2d | false | 2,606 | [
"Apache-2.0"
] | 0 | 94f442f114b94d058b244ebd469ffe4d9758d7a1 | https://github.com/MaksymPetyak/PySyft/tree/94f442f114b94d058b244ebd469ffe4d9758d7a1 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
"""
Args:
state_size: state dimension
action_size: action dimension
fc_units: number of neurons in one fully connected hidden layer
"""
def __init__(self, state_size, action_size, seed,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | LuckierDodge/ROS_Dockerfiles | Critic | false | 2,607 | [
"MIT"
] | 0 | 42fd0e7ecfef86d792fcc29197fcd79dcb789122 | https://github.com/LuckierDodge/ROS_Dockerfiles/tree/42fd0e7ecfef86d792fcc29197fcd79dcb789122 |
ConvGLU | import torch
from torch import nn
import torch.utils.data
import torch.cuda
import torch.optim
def str2act(txt):
"""Translates text to neural network activation"""
return {'sigmoid': nn.Sigmoid(), 'relu': nn.ReLU(), 'none': nn.
Sequential(), 'lrelu': nn.LeakyReLU(0.2), 'selu': nn.SELU()}[txt.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.cuda
import torch.opti... | Malkovsky/NeMo | ConvGLU | false | 2,608 | [
"Apache-2.0"
] | 0 | 8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 | https://github.com/Malkovsky/NeMo/tree/8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
from torch import nn as nn
from torch.nn import functional as F
from torch.nn import init as init
from torchvision.models import vgg as vgg
import torch.utils.data
from torch.utils import data as data
from torch import autograd as autograd
def make_resample... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.autograd... | Lotayou/BasicSR | ModulatedConv2d | false | 2,609 | [
"Apache-2.0",
"MIT"
] | 0 | 6cf9a706dd680d54f7dc26e87318ff79f76c0dbf | https://github.com/Lotayou/BasicSR/tree/6cf9a706dd680d54f7dc26e87318ff79f76c0dbf |
CenteredLayer | import torch
from torch import nn
class CenteredLayer(nn.Module):
def __init__(self):
super().__init__()
def forward(self, X):
return X - X.mean()
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | JunoCheon/D2L | CenteredLayer | false | 2,610 | [
"MIT"
] | 0 | 9464709862e55151aec28fc637c5942738bdd72b | https://github.com/JunoCheon/D2L/tree/9464709862e55151aec28fc637c5942738bdd72b |
MultiHeadAttn | import torch
from torch.nn import functional as F
from torch import nn
import torch.utils.data
import torch.cuda
import torch.optim
class MultiHeadAttn(nn.Module):
def __init__(self, n_head, d_model, d_head, dropout, dropatt=0.1,
pre_lnorm=False):
super(MultiHeadAttn, self).__init__()
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.... | Malkovsky/NeMo | MultiHeadAttn | false | 2,611 | [
"Apache-2.0"
] | 0 | 8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 | https://github.com/Malkovsky/NeMo/tree/8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 |
Block | import torch
import torch.nn as nn
class Block(nn.Module):
expansion = 1
def __init__(self, in_channels, out_channels, i_downsample=None, stride=1):
super(Block, self).__init__()
self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3,
padding=1, stride=stride, bias=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.... | MagazzuGaetano/Weather-Classifier | Block | false | 2,612 | [
"MIT"
] | 0 | 2bfac1918eea4aaa37563ef4ffabdc290e411d76 | https://github.com/MagazzuGaetano/Weather-Classifier/tree/2bfac1918eea4aaa37563ef4ffabdc290e411d76 |
Actor | import torch
import torch.nn as nn
import torch.nn.functional as F
class Actor(nn.Module):
def __init__(self, state_size, action_size, seed, fc_units=400,
fc1_units=300):
super(Actor, self).__init__()
self.seed = torch.manual_seed(seed)
self.fc1 = nn.Linear(state_size, fc_units)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | LuckierDodge/ROS_Dockerfiles | Actor | false | 2,613 | [
"MIT"
] | 0 | 42fd0e7ecfef86d792fcc29197fcd79dcb789122 | https://github.com/LuckierDodge/ROS_Dockerfiles/tree/42fd0e7ecfef86d792fcc29197fcd79dcb789122 |
ConformerFeedForward | import torch
from torch import nn
import torch.utils.data
import torch.cuda
import torch.optim
class Swish(nn.SiLU):
"""
Swish activation function introduced in 'https://arxiv.org/abs/1710.05941'
Mathematically identical to SiLU. See note in nn.SiLU for references.
"""
class ConformerFeedForward(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 import nn
import torch.utils.data
import torch.cuda
import torch.opti... | Malkovsky/NeMo | ConformerFeedForward | false | 2,614 | [
"Apache-2.0"
] | 0 | 8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 | https://github.com/Malkovsky/NeMo/tree/8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 |
MaskedInstanceNorm1d | import torch
from torch import nn
import torch.utils.data
import torch.cuda
import torch.optim
class MaskedInstanceNorm1d(nn.Module):
"""Instance norm + masking."""
MAX_CNT = 100000.0
def __init__(self, d_channel: 'int', unbiased: 'bool'=True, affine:
'bool'=False):
super().__init__()
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
import ... | Malkovsky/NeMo | MaskedInstanceNorm1d | false | 2,615 | [
"Apache-2.0"
] | 0 | 8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 | https://github.com/Malkovsky/NeMo/tree/8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 |
LosslessYCbCr | import torch
import torch.nn.parallel
import torch.utils.data
from torch import nn
import torch.fft
class LosslessYCbCr(nn.Module):
def forward(self, rgb: 'torch.Tensor'):
return torch.cat([(rgb[:, 0:1] + 2 * rgb[:, 1:2] + rgb[:, 2:3]) / 4,
rgb[:, 2:3] - rgb[:, 1:2], rgb[:, 0:1] - rgb[:, 1:2]... | 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.parallel
import torch.utils.data
from torch import nn
import torch.fft
assert_size_stride = torch._C._dynamo.guards.assert_s... | KazutakaYamanouchi/bachelor-study | LosslessYCbCr | false | 2,616 | [
"Apache-2.0"
] | 0 | a5b8392459e7649cb8a35d09e65bd269d13b5297 | https://github.com/KazutakaYamanouchi/bachelor-study/tree/a5b8392459e7649cb8a35d09e65bd269d13b5297 |
IIDIsotropicGaussianUVLoss | import math
import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class IIDIsotropicGaussianUVLoss(nn.Module):
"""
Loss for the case of iid residuals with isotropic covariance:
$Sigma_i = sigma_i^2 I$
The loss (negative log likelihood) is then:
$1/2 sum_{i=1}^n ... | 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 math... | Magixxxxxx/detectron2 | IIDIsotropicGaussianUVLoss | false | 2,617 | [
"Apache-2.0"
] | 0 | c1ee8cf73777c96cc8a89463d0dca6e0ffe148f4 | https://github.com/Magixxxxxx/detectron2/tree/c1ee8cf73777c96cc8a89463d0dca6e0ffe148f4 |
LosslessRGB | import torch
import torch.nn.parallel
import torch.utils.data
from torch import nn
import torch.fft
class LosslessRGB(nn.Module):
def forward(self, ycbcr: 'torch.Tensor'):
return torch.cat([ycbcr[:, 2:3] + ycbcr[:, 0:1] - 0.25 * ycbcr[:, 1
:2] - 0.25 * ycbcr[:, 2:3], ycbcr[:, 0:1] - 0.25 * yc... | 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.parallel
import torch.utils.data
from torch import nn
import torch.fft
assert_size_stride = torch._C._dynamo.guards.assert_s... | KazutakaYamanouchi/bachelor-study | LosslessRGB | false | 2,618 | [
"Apache-2.0"
] | 0 | a5b8392459e7649cb8a35d09e65bd269d13b5297 | https://github.com/KazutakaYamanouchi/bachelor-study/tree/a5b8392459e7649cb8a35d09e65bd269d13b5297 |
GeneralizedDiceLoss | import collections
import torch
import warnings
from typing import Optional
from typing import Union
from typing import Any
from typing import Callable
from typing import Tuple
import torch.nn
from torch.nn.modules.loss import _Loss
from enum import Enum
import collections.abc
def issequenceiterable(obj: 'Any') ->boo... | 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 collections
from typi... | LucasFidon/MONAI | GeneralizedDiceLoss | false | 2,619 | [
"Apache-2.0"
] | 0 | a7ef9d567775dd7a222f93bab08191c0e3532c92 | https://github.com/LucasFidon/MONAI/tree/a7ef9d567775dd7a222f93bab08191c0e3532c92 |
DilatedResidualLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class DilatedResidualLayer(nn.Module):
def __init__(self, dilation, in_channels, out_channels):
super(DilatedResidualLayer, self).__init__()
self.conv_dilated = nn.Conv1d(in_channels, out_channels, 3, padding
=dilation... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | MarahGamdou/sign-segmentation | DilatedResidualLayer | false | 2,620 | [
"MIT"
] | 0 | f6ef1f23b252d09b66031bfb802f18cfb4b1f4c6 | https://github.com/MarahGamdou/sign-segmentation/tree/f6ef1f23b252d09b66031bfb802f18cfb4b1f4c6 |
SoftBinaryCrossEntropyLoss | import torch
class SoftBinaryCrossEntropyLoss(torch.nn.Module):
def __init__(self, tau=1.0):
super().__init__()
self.tau = tau
self.bce_logit = torch.nn.BCEWithLogitsLoss()
def forward(self, pred, true):
logits = pred / self.tau
l = self.bce_logit(logits, true)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
assert_size... | MargauxMasson/semanticGAN_code | SoftBinaryCrossEntropyLoss | false | 2,621 | [
"BSD-2-Clause",
"MIT"
] | 0 | a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 | https://github.com/MargauxMasson/semanticGAN_code/tree/a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 |
NeuralSort | import torch
from torch import Tensor
class NeuralSort(torch.nn.Module):
def __init__(self, tau=1.0, hard=False):
super(NeuralSort, self).__init__()
self.hard = hard
self.tau = tau
def forward(self, input: 'Tensor', scores: 'Tensor', cuda=None):
"""
:param 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MaestroGraph/quicksort | NeuralSort | false | 2,622 | [
"MIT"
] | 0 | 54e1aba3b8a1acf3cd5326f5efab2b0a853f4b40 | https://github.com/MaestroGraph/quicksort/tree/54e1aba3b8a1acf3cd5326f5efab2b0a853f4b40 |
LossyYCbCr | import torch
import torch.nn.parallel
import torch.utils.data
from torch import nn
import torch.fft
class LossyYCbCr(nn.Module):
def forward(self, rgb: 'torch.Tensor'):
return torch.cat([0.299 * rgb[:, 0:1] + 0.587 * rgb[:, 1:2] + 0.114 *
rgb[:, 2:3], -0.16875 * rgb[:, 0:1] - 0.33126 * rgb[:,... | 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.parallel
import torch.utils.data
from torch import nn
import torch.fft
assert_size_stride = torch._C._dynamo.guards.assert_s... | KazutakaYamanouchi/bachelor-study | LossyYCbCr | false | 2,623 | [
"Apache-2.0"
] | 0 | a5b8392459e7649cb8a35d09e65bd269d13b5297 | https://github.com/KazutakaYamanouchi/bachelor-study/tree/a5b8392459e7649cb8a35d09e65bd269d13b5297 |
TSAFusion | import torch
from torch import nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
import torch.utils.data
from torch.utils import data as data
from torch import autograd as autograd
class TSAFusion(nn.Module):
"""Temporal Spatial Attention (TSA) fusion module.
Temporal: Calc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 as nn
fr... | Lotayou/BasicSR | TSAFusion | false | 2,624 | [
"Apache-2.0",
"MIT"
] | 0 | 6cf9a706dd680d54f7dc26e87318ff79f76c0dbf | https://github.com/Lotayou/BasicSR/tree/6cf9a706dd680d54f7dc26e87318ff79f76c0dbf |
LossyRGB | import torch
import torch.nn.parallel
import torch.utils.data
from torch import nn
import torch.fft
class LossyRGB(nn.Module):
def forward(self, ycbcr: 'torch.Tensor'):
return torch.cat([ycbcr[:, 0:1] + 1.402 * ycbcr[:, 2:3], ycbcr[:, 0
:1] - 0.34413 * ycbcr[:, 1:2] - 0.71414 * ycbcr[:, 2: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.parallel
import torch.utils.data
from torch import nn
import torch.fft
assert_size_stride = torch._C._dynamo.guards.assert_s... | KazutakaYamanouchi/bachelor-study | LossyRGB | false | 2,625 | [
"Apache-2.0"
] | 0 | a5b8392459e7649cb8a35d09e65bd269d13b5297 | https://github.com/KazutakaYamanouchi/bachelor-study/tree/a5b8392459e7649cb8a35d09e65bd269d13b5297 |
LogCoshLoss | import torch
class LogCoshLoss(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, true, pred):
loss = true - pred
return torch.mean(torch.log(torch.cosh(loss + 1e-12)))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def g... | 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... | MargauxMasson/semanticGAN_code | LogCoshLoss | false | 2,626 | [
"BSD-2-Clause",
"MIT"
] | 0 | a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 | https://github.com/MargauxMasson/semanticGAN_code/tree/a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 |
MultiHeadAttention | import math
import torch
from torch import nn
import torch.utils.data
import torch.cuda
import torch.optim
class MultiHeadAttention(nn.Module):
"""
Multi-head scaled dot-product attention layer.
Args:
hidden_size: size of the embeddings in the model, also known as d_model
num_attention_he... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Malkovsky/NeMo | MultiHeadAttention | false | 2,627 | [
"Apache-2.0"
] | 0 | 8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 | https://github.com/Malkovsky/NeMo/tree/8cf9aad8ecba36f1bd7b096cf274c2bc8ac695c3 |
CondInjection | import torch
import torch.nn as nn
class CondInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, labels, noise=None):
if noise is None:
batch, _, height, width = image.shape
noise = i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | MargauxMasson/semanticGAN_code | CondInjection | false | 2,628 | [
"BSD-2-Clause",
"MIT"
] | 0 | a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 | https://github.com/MargauxMasson/semanticGAN_code/tree/a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 |
SoftmaxLoss | import torch
class SoftmaxLoss(torch.nn.Module):
def __init__(self, tau=1.0):
super().__init__()
self.tau = tau
self.ce_loss = torch.nn.CrossEntropyLoss()
def forward(self, pred, true):
logits = pred / self.tau
l = self.ce_loss(logits, true)
return l
def get... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | MargauxMasson/semanticGAN_code | SoftmaxLoss | false | 2,629 | [
"BSD-2-Clause",
"MIT"
] | 0 | a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 | https://github.com/MargauxMasson/semanticGAN_code/tree/a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 |
Sys_R | import torch
import torch.nn as nn
import torch.nn.functional as F
class Sys_R(nn.Module):
def __init__(self, state_size, action_size, fc1_units=256, fc2_units=256):
super(Sys_R, self).__init__()
self.l1 = nn.Linear(2 * state_size + action_size, fc1_units)
self.l2 = nn.Linear(fc1_units, 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
import torch.nn as nn
assert_... | LuckierDodge/ROS_Dockerfiles | Sys_R | false | 2,630 | [
"MIT"
] | 0 | 42fd0e7ecfef86d792fcc29197fcd79dcb789122 | https://github.com/LuckierDodge/ROS_Dockerfiles/tree/42fd0e7ecfef86d792fcc29197fcd79dcb789122 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self):
super(DiceLoss, self).__init__()
def forward(self, input, target):
N, _H, _W = target.size(0), target.size(2), target.size(3)
smooth = 1
input_flat = input.view(N, -1)
target_flat = targ... | 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... | MargeryLab/Inf-Net | DiceLoss | false | 2,631 | [
"MIT"
] | 0 | e2f16b64b3d91f45961bf627277b249f8211c143 | https://github.com/MargeryLab/Inf-Net/tree/e2f16b64b3d91f45961bf627277b249f8211c143 |
EPE3DLoss | import torch
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn as nn
class EPE3DLoss(nn.Module):
def __init__(self):
super(EPE3DLoss, self).__init__()
def forward(self, input, target):
return torch.norm(input - target, p=2, dim=1)
def get_inputs():
ret... | 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.parallel
import torch.optim
import torch.utils.data
import torc... | MayankSingal/TrackThisFlow | EPE3DLoss | false | 2,632 | [
"MIT"
] | 0 | 3a76d2a5f2f43ab24c14468d9c751d9f25ee6f3c | https://github.com/MayankSingal/TrackThisFlow/tree/3a76d2a5f2f43ab24c14468d9c751d9f25ee6f3c |
Decoder | import torch
from torch import nn
class Decoder(nn.Module):
def __init__(self, latent_dim, hidden_dim, output_dim):
super(Decoder, self).__init__()
self.FC_hidden = nn.Linear(latent_dim, hidden_dim)
self.FC_output = nn.Linear(hidden_dim, output_dim)
def forward(self, x):
h = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | Markussorensen/mlops_exercises | Decoder | false | 2,633 | [
"Apache-2.0"
] | 0 | 52a3198367b66bbe0a5cfdc7a9424789b03273db | https://github.com/Markussorensen/mlops_exercises/tree/52a3198367b66bbe0a5cfdc7a9424789b03273db |
D_UpBlock | import torch
from torchvision.transforms import *
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1,
padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_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 torchvision.transforms import *
assert_size_stride = torch._C._dynamo.guard... | DengZeshuai/DBPN-Pytorch | D_UpBlock | false | 2,634 | [
"MIT"
] | 0 | a90d241a1c4b07830c6d812ad8389d13e8cf05d1 | https://github.com/DengZeshuai/DBPN-Pytorch/tree/a90d241a1c4b07830c6d812ad8389d13e8cf05d1 |
ResidualBlockNoBN | import torch
from torch import nn as nn
from torch.nn import init as init
from torch.nn.modules.batchnorm import _BatchNorm
from torchvision.models import vgg as vgg
import torch.utils.data
from torch.utils import data as data
from torch import autograd as autograd
@torch.no_grad()
def default_init_weights(module_lis... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 as nn
fr... | Lotayou/BasicSR | ResidualBlockNoBN | false | 2,635 | [
"Apache-2.0",
"MIT"
] | 0 | 6cf9a706dd680d54f7dc26e87318ff79f76c0dbf | https://github.com/Lotayou/BasicSR/tree/6cf9a706dd680d54f7dc26e87318ff79f76c0dbf |
Encoder | import torch
from torch import nn
class Encoder(nn.Module):
def __init__(self, input_dim, hidden_dim, latent_dim):
super(Encoder, self).__init__()
self.FC_input = nn.Linear(input_dim, hidden_dim)
self.FC_mean = nn.Linear(hidden_dim, latent_dim)
self.FC_var = nn.Linear(hidden_dim, ... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from... | Markussorensen/mlops_exercises | Encoder | false | 2,636 | [
"Apache-2.0"
] | 0 | 52a3198367b66bbe0a5cfdc7a9424789b03273db | https://github.com/Markussorensen/mlops_exercises/tree/52a3198367b66bbe0a5cfdc7a9424789b03273db |
OneLayerFCBodyWithAction | import torch
from torch.nn import functional as F
import torch.nn as nn
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class OneLayerFCBodyWithAction(nn.Module):
def __init__(self, sta... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 function... | Marianoetchart/DeepRL | OneLayerFCBodyWithAction | false | 2,637 | [
"Apache-2.0"
] | 0 | 40d4825694c0890440859166de56701fc1f61d5b | https://github.com/Marianoetchart/DeepRL/tree/40d4825694c0890440859166de56701fc1f61d5b |
CNNLayerNorm | import torch
import torch.nn as nn
class CNNLayerNorm(nn.Module):
"""Layer normalization built for cnns input"""
def __init__(self, n_feats):
super(CNNLayerNorm, self).__init__()
self.layer_norm = nn.LayerNorm(n_feats)
def forward(self, x):
x = x.transpose(2, 3).contiguous()
... | 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_... | MatyashDare/DLA | CNNLayerNorm | false | 2,638 | [
"MIT"
] | 0 | a1783a1298d9e5c7edc82bb2e7f17ba59743152e | https://github.com/MatyashDare/DLA/tree/a1783a1298d9e5c7edc82bb2e7f17ba59743152e |
GraphConv | import torch
from torch import nn
import torch.nn
import torch.autograd
def sparse_bmm(sparse_matrix, dense_matrix_batch):
"""
Perform torch.bmm on an unbatched sparse matrix and a batched dense matrix.
Args:
sparse_matrix (torch.sparse.FloatTensor): Shape = (m, n)
dense_matrix_batch (tor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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.nn
import torch.autograd
assert_size_stride = ... | Mason-McGough/kaolin | GraphConv | false | 2,639 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 2b628842cda7dac7452eedcf05881849a38b90b1 | https://github.com/Mason-McGough/kaolin/tree/2b628842cda7dac7452eedcf05881849a38b90b1 |
IndepAnisotropicGaussianUVLoss | import math
import torch
import torch.utils.data
import torch.nn.functional as F
from torch import nn
class IndepAnisotropicGaussianUVLoss(nn.Module):
"""
Loss for the case of independent residuals with anisotropic covariances:
$Sigma_i = sigma_i^2 I + r_i r_i^T$
The loss (negative log likelihood) is ... | 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 math... | Magixxxxxx/detectron2 | IndepAnisotropicGaussianUVLoss | false | 2,640 | [
"Apache-2.0"
] | 0 | c1ee8cf73777c96cc8a89463d0dca6e0ffe148f4 | https://github.com/Magixxxxxx/detectron2/tree/c1ee8cf73777c96cc8a89463d0dca6e0ffe148f4 |
SRCNN | import torch
from torchvision.transforms import *
import torch.nn as nn
class SRCNN(nn.Module):
def __init__(self):
super(SRCNN, self).__init__()
self.input = nn.Conv2d(in_channels=3, out_channels=64, kernel_size=
9, padding=9 // 2)
self.conv = nn.Conv2d(in_channels=64, out_ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torchvision.transforms i... | FYLSunghwan/VDSR-pytorch | SRCNN | false | 2,641 | [
"MIT"
] | 0 | fb862e97756078db2d5def095d46cc22a07cd014 | https://github.com/FYLSunghwan/VDSR-pytorch/tree/fb862e97756078db2d5def095d46cc22a07cd014 |
ToSEG | from torch.autograd import Function
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def fused_leaky_relu(input, bias=None, negative_slope=0.2, scale=2 ** 0.5):
if input.device.type == 'cpu':
if bias is not None:
rest_dim = [1] * (input.ndim - bias.ndim - 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.autograd import Function
import math
import torch.nn as nn
import tor... | MargauxMasson/semanticGAN_code | ToSEG | false | 2,642 | [
"BSD-2-Clause",
"MIT"
] | 0 | a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 | https://github.com/MargauxMasson/semanticGAN_code/tree/a5b7fbbc505f8ae08c8aab8e199aa6406fffdb07 |
Net | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv = nn.Conv2d(1, 1, 3)
def forward(self, x):
return self.conv(x)
def get_inputs():
return [torch.rand([4, 1, 64, 64])]
def get_init_inputs():
return [[], {}]
| import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | MattToast/SmartRedis | Net | false | 2,643 | [
"BSD-2-Clause"
] | 0 | de169429f05d1777ab68ae9fe20bfd34b51e9b81 | https://github.com/MattToast/SmartRedis/tree/de169429f05d1777ab68ae9fe20bfd34b51e9b81 |
SpaceToDepth | import torch
import torch.optim
import torch.nn as nn
import torch.utils.data
class SpaceToDepth(nn.Module):
def __init__(self, block_size):
super(SpaceToDepth, self).__init__()
self.block_size = block_size
self.block_size_sq = block_size * block_size
def forward(self, input):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.optim
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strid... | Merical/pytorch-superpoint | SpaceToDepth | false | 2,644 | [
"MIT"
] | 0 | b1f6e587b0f68a8a647773e4128b4f504edb4d58 | https://github.com/Merical/pytorch-superpoint/tree/b1f6e587b0f68a8a647773e4128b4f504edb4d58 |
APLoss | import torch
import numpy as np
import torch.optim
import torch.nn as nn
import torch.utils.data
class APLoss(nn.Module):
""" differentiable AP loss, through quantization.
Input: (N, M) values in [min, max]
label: (N, M) values in {0, 1}
Returns: list of query AP (for each n in {1..N... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | Merical/pytorch-superpoint | APLoss | false | 2,645 | [
"MIT"
] | 0 | b1f6e587b0f68a8a647773e4128b4f504edb4d58 | https://github.com/Merical/pytorch-superpoint/tree/b1f6e587b0f68a8a647773e4128b4f504edb4d58 |
SoftGate | import torch
from torch import nn as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
import torch.utils.data
from torch.utils import data as data
from torch import autograd as autograd
class SoftGate(nn.Module):
COEFF = 12.0
def __init__(self):
super(SoftGate, self).__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 as nn
from torch.nn import init as init
from torchvision.models import vgg as vgg
import torch.utils.data
from torch.ut... | Lotayou/BasicSR | SoftGate | false | 2,646 | [
"Apache-2.0",
"MIT"
] | 0 | 6cf9a706dd680d54f7dc26e87318ff79f76c0dbf | https://github.com/Lotayou/BasicSR/tree/6cf9a706dd680d54f7dc26e87318ff79f76c0dbf |
ExponentialClass | import torch
import torch.cuda
import torch.distributed
from torch.cuda.amp import autocast as autocast
import torch.utils.data
import torch.optim
class ExponentialClass(torch.nn.Module):
def __init__(self):
super(ExponentialClass, self).__init__()
def forward(self, x):
return torch.exp(x)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.cuda
import torch.distributed
from torch.cuda.amp import aut... | MikyasDesta/NeMo | ExponentialClass | false | 2,647 | [
"Apache-2.0"
] | 0 | 4995477e6ce49de55b123723e42021c9eff8e2c0 | https://github.com/MikyasDesta/NeMo/tree/4995477e6ce49de55b123723e42021c9eff8e2c0 |
AffineConstantFlow | import torch
import torch.nn as nn
class AffineConstantFlow(nn.Module):
"""
Scales + Shifts the flow by (learned) constants per dimension.
In NICE paper there is a Scaling layer which is a special case of this where t is None
"""
def __init__(self, dim, scale=True, shift=True):
super()._... | 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... | LamaLenny/DeepGenerativeModels | AffineConstantFlow | false | 2,648 | [
"MIT"
] | 0 | c2a40e4e71af844f8357da5267b1d017f762a235 | https://github.com/LamaLenny/DeepGenerativeModels/tree/c2a40e4e71af844f8357da5267b1d017f762a235 |
BottleneckLayerLayer | import torch
import torch.cuda
from torch.nn import functional as F
from torch import nn
import torch.distributed
from torch.cuda.amp import autocast as autocast
import torch.utils.data
import torch.optim
class ConvNorm(torch.nn.Module):
def __init__(self, in_channels, out_channels, 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
from torch._inductor.runtime.... | MikyasDesta/NeMo | BottleneckLayerLayer | false | 2,649 | [
"Apache-2.0"
] | 0 | 4995477e6ce49de55b123723e42021c9eff8e2c0 | https://github.com/MikyasDesta/NeMo/tree/4995477e6ce49de55b123723e42021c9eff8e2c0 |
MyMetric | import torch
import torch.nn as nn
class MyMetric(nn.Module):
def __init__(self):
super().__init__()
def forward(self, output, target):
pred = output.argmax(dim=1, keepdim=True)
return pred.eq(target.view_as(pred)).sum() / output.size(0)
def get_inputs():
return [torch.rand([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... | Min-Sheng/template | MyMetric | false | 2,650 | [
"MIT"
] | 0 | c58b2c41383668c45cd7851a88c9b0e222d7a25b | https://github.com/Min-Sheng/template/tree/c58b2c41383668c45cd7851a88c9b0e222d7a25b |
DDPGConvBody | import torch
from torch.nn import functional as F
import torch.nn as nn
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class DDPGConvBody(nn.Module):
def __init__(self, in_channels=4):... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Marianoetchart/DeepRL | DDPGConvBody | false | 2,651 | [
"Apache-2.0"
] | 0 | 40d4825694c0890440859166de56701fc1f61d5b | https://github.com/Marianoetchart/DeepRL/tree/40d4825694c0890440859166de56701fc1f61d5b |
TemperatureTanh | import torch
from torch import Tensor
from torch.functional import Tensor
from torch import nn as nn
class TemperatureTanh(nn.Module):
def __init__(self, temperature: 'float'=1.0) ->None:
"""The hyperbolic tangent with an optional temperature."""
super().__init__()
assert temperature != 0... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_... | Mingxiao-Li/vln-ce-eval | TemperatureTanh | false | 2,652 | [
"MIT"
] | 0 | 2217513e9d9b6352bf0939d3b76a359c64e89dda | https://github.com/Mingxiao-Li/vln-ce-eval/tree/2217513e9d9b6352bf0939d3b76a359c64e89dda |
DWT | import torch
import torch.nn.parallel
import torch.utils.data
from torch import nn
import torch.fft
class LossyYCbCr(nn.Module):
def forward(self, rgb: 'torch.Tensor'):
return torch.cat([0.299 * rgb[:, 0:1] + 0.587 * rgb[:, 1:2] + 0.114 *
rgb[:, 2:3], -0.16875 * rgb[:, 0:1] - 0.33126 * rgb[:,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | KazutakaYamanouchi/bachelor-study | DWT | false | 2,653 | [
"Apache-2.0"
] | 0 | a5b8392459e7649cb8a35d09e65bd269d13b5297 | https://github.com/KazutakaYamanouchi/bachelor-study/tree/a5b8392459e7649cb8a35d09e65bd269d13b5297 |
Policy | import torch
from copy import deepcopy
import torch.nn as nn
from typing import *
import torch.utils
import torch.optim
class Policy(nn.Module):
def __init__(self, max_nodes, search_space):
super(Policy, self).__init__()
self.max_nodes = max_nodes
self.search_space = deepcopy(search_space... | 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 copy import deepc... | Mirofil/AutoDL-Projects | Policy | false | 2,654 | [
"MIT"
] | 0 | e7ee9fe27e5c5561a4b9fd1c1ee185677ef30893 | https://github.com/Mirofil/AutoDL-Projects/tree/e7ee9fe27e5c5561a4b9fd1c1ee185677ef30893 |
AsymmetricLossOptimized | import torch
from torchvision import datasets as datasets
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data.distributed
class AsymmetricLossOptimized(nn.Module):
""" Notice - optimized version, minimizes memory allocation and gpu uploading,
favors inplace operations"""
... | 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 torchv... | MinliangLin/ASL | AsymmetricLossOptimized | false | 2,655 | [
"MIT"
] | 0 | beda0989a8e30ac51a7ce9f9e247a12bbe84ec96 | https://github.com/MinliangLin/ASL/tree/beda0989a8e30ac51a7ce9f9e247a12bbe84ec96 |
Myloss | import torch
import torch.nn as nn
class Myloss(nn.Module):
def __init__(self, epsilon=1e-08):
super(Myloss, self).__init__()
self.epsilon = epsilon
return
def forward(self, input_, label, weight):
entropy = -label * torch.log(input_ + self.epsilon) - (1 - label
)... | 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
... | MoriZSJ/GVB | Myloss | false | 2,656 | [
"MIT"
] | 0 | 9b954660ef377ead81c8e631c4a0f4a17075b2ea | https://github.com/MoriZSJ/GVB/tree/9b954660ef377ead81c8e631c4a0f4a17075b2ea |
WNConv2d | import torch
from torch import nn
class WNConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True, activation=None):
super().__init__()
self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel,
kernel_size, stride=st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | MioChiu/vqvae2 | WNConv2d | false | 2,657 | [
"MIT"
] | 0 | e57cc7546d3bd02c61387367936f7cd76b75eaae | https://github.com/MioChiu/vqvae2/tree/e57cc7546d3bd02c61387367936f7cd76b75eaae |
Pooler | import torch
import torch.nn as nn
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn.functional as F
from torch.nn.modules.linear import Linear
import torch.nn.init as init
from torch.nn.parameter import Parameter
from torch.nn import Parameter
class Pooler(nn.Module):
"""Poole... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | ExtremeViscent/ColossalAI-Examples | Pooler | false | 2,658 | [
"Apache-2.0"
] | 0 | 98ced2435d8d814f06740ab10d3e277ca91a83c7 | https://github.com/ExtremeViscent/ColossalAI-Examples/tree/98ced2435d8d814f06740ab10d3e277ca91a83c7 |
LRN | import torch
import torch.nn as nn
class LRN(nn.Module):
def __init__(self, local_size=1, alpha=1.0, beta=0.75, ACROSS_CHANNELS=True
):
super(LRN, self).__init__()
self.ACROSS_CHANNELS = ACROSS_CHANNELS
if ACROSS_CHANNELS:
self.average = nn.AvgPool3d(kernel_size=(local... | 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_... | MoriZSJ/GVB | LRN | false | 2,659 | [
"MIT"
] | 0 | 9b954660ef377ead81c8e631c4a0f4a17075b2ea | https://github.com/MoriZSJ/GVB/tree/9b954660ef377ead81c8e631c4a0f4a17075b2ea |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self, weight=None, size_average=True):
super(FocalLoss, self).__init__()
def forward(self, inputs, targets, alpha=0.8, gamma=2, smooth=1):
inputs = inputs.view(-1)
targets = ta... | 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... | NakedKoala/sed_time_freq_segmentation | FocalLoss | false | 2,660 | [
"MIT"
] | 0 | 5379e9cdddfba34b6ce4a243580671d32afdac9a | https://github.com/NakedKoala/sed_time_freq_segmentation/tree/5379e9cdddfba34b6ce4a243580671d32afdac9a |
TwoLayerFCBodyWithAction | import torch
from torch.nn import functional as F
import torch.nn as nn
def layer_init(layer, w_scale=1.0):
nn.init.orthogonal_(layer.weight.data)
layer.weight.data.mul_(w_scale)
nn.init.constant_(layer.bias.data, 0)
return layer
class TwoLayerFCBodyWithAction(nn.Module):
def __init__(self, sta... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 function... | Marianoetchart/DeepRL | TwoLayerFCBodyWithAction | false | 2,662 | [
"Apache-2.0"
] | 0 | 40d4825694c0890440859166de56701fc1f61d5b | https://github.com/Marianoetchart/DeepRL/tree/40d4825694c0890440859166de56701fc1f61d5b |
IBWDCT | import torch
import numpy as np
import torch.nn.parallel
import torch.utils.data
from torch import nn
import torch.fft
class IBWDCT(nn.Module):
def __init__(self):
super().__init__()
self.ibwdct = nn.ConvTranspose2d(64, 1, 8, 8, bias=False)
self.ibwdct.weight.requires_grad = 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
import numpy as np
import torch.nn.parallel
import torch.utils.data
from torch i... | KazutakaYamanouchi/bachelor-study | IBWDCT | false | 2,663 | [
"Apache-2.0"
] | 0 | a5b8392459e7649cb8a35d09e65bd269d13b5297 | https://github.com/KazutakaYamanouchi/bachelor-study/tree/a5b8392459e7649cb8a35d09e65bd269d13b5297 |
ResidualUnit | import torch
import torch.nn as nn
import torch.utils.model_zoo
def default_conv(in_channels, out_channels, kernel_size, bias=True):
return nn.Conv2d(in_channels, out_channels, kernel_size, padding=
kernel_size // 2, bias=bias)
class ResidualUnit(nn.Module):
def __init__(self, inChannel, outChannel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.model_zoo
assert_size_stride = torch._C... | NawaNae/ESRT-Huawei | ResidualUnit | false | 2,664 | [
"MIT"
] | 0 | edea1c0bafec940dc7ea8e5110c355a83188665c | https://github.com/NawaNae/ESRT-Huawei/tree/edea1c0bafec940dc7ea8e5110c355a83188665c |
AdaptiveAvgMaxPool2d | import torch
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
from torch import optim as optim
import torch.nn.parallel
def adaptive_avgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max = F.adaptive_max_... | 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.utils.data
import torchvision.transforms.functional as F
import torch.nn as ... | Exir-lxr/crldr-prune-pytorch | AdaptiveAvgMaxPool2d | false | 2,665 | [
"Apache-2.0"
] | 0 | adeb5e0b24ce66ff9531d4d947f72412c1b5c033 | https://github.com/Exir-lxr/crldr-prune-pytorch/tree/adeb5e0b24ce66ff9531d4d947f72412c1b5c033 |
InverseDepthSmoothnessLoss | import torch
import torch.nn as nn
class InverseDepthSmoothnessLoss(nn.Module):
"""Criterion that computes image-aware inverse depth smoothness loss.
.. math::
\\text{loss} = \\left | \\partial_x d_{ij} \\right | e^{-\\left \\|
\\partial_x I_{ij} \\right \\|} + \\left |
\\partial_y d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | MareenaKunjachan/kornia | InverseDepthSmoothnessLoss | false | 2,666 | [
"Apache-2.0"
] | 0 | 0a3cbb02850ac78059e0615da93144b5a64d3330 | https://github.com/MareenaKunjachan/kornia/tree/0a3cbb02850ac78059e0615da93144b5a64d3330 |
CE_Loss | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils
class CE_Loss(nn.Module):
def __init__(self, temperature=1):
super(CE_Loss, self).__init__()
self.T = temperature
def forward(self, output_batch, teacher_outputs):
output_batch = F.log_softmax(output... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
i... | NeutrinoLiu/FedML | CE_Loss | false | 2,667 | [
"Apache-2.0"
] | 0 | 1670b2a3f0b2d63c374a9a4a19449090c694bc78 | https://github.com/NeutrinoLiu/FedML/tree/1670b2a3f0b2d63c374a9a4a19449090c694bc78 |
ARFB | import torch
import torch.nn as nn
import torch.utils.model_zoo
def default_conv(in_channels, out_channels, kernel_size, bias=True):
return nn.Conv2d(in_channels, out_channels, kernel_size, padding=
kernel_size // 2, bias=bias)
class ResidualUnit(nn.Module):
def __init__(self, inChannel, outChannel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.model_zoo
assert_size_stride = torch._C... | NawaNae/ESRT-Huawei | ARFB | false | 2,668 | [
"MIT"
] | 0 | edea1c0bafec940dc7ea8e5110c355a83188665c | https://github.com/NawaNae/ESRT-Huawei/tree/edea1c0bafec940dc7ea8e5110c355a83188665c |
KL_Loss | import torch
from torch import nn
import torch.nn.functional as F
import torch.utils
class KL_Loss(nn.Module):
def __init__(self, temperature=1):
super(KL_Loss, self).__init__()
self.T = temperature
def forward(self, output_batch, teacher_outputs):
output_batch = F.log_softmax(output... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch ... | NeutrinoLiu/FedML | KL_Loss | false | 2,669 | [
"Apache-2.0"
] | 0 | 1670b2a3f0b2d63c374a9a4a19449090c694bc78 | https://github.com/NeutrinoLiu/FedML/tree/1670b2a3f0b2d63c374a9a4a19449090c694bc78 |
SmallDecoder4_16x | import torch
import torch.nn as nn
class SmallDecoder4_16x(nn.Module):
def __init__(self):
super(SmallDecoder4_16x, self).__init__()
self.conv41 = nn.Conv2d(128, 64, 3, 1, 0)
self.conv34 = nn.Conv2d(64, 64, 3, 1, 0, dilation=1)
self.conv33 = nn.Conv2d(64, 64, 3, 1, 0, dilation=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.... | MingSun-Tse/pytorch-AdaIN | SmallDecoder4_16x | false | 2,670 | [
"MIT"
] | 0 | 02ae320345232983c754ea233613aedc21e4d348 | https://github.com/MingSun-Tse/pytorch-AdaIN/tree/02ae320345232983c754ea233613aedc21e4d348 |
Conv_Block | import torch
from torchvision.transforms import *
import torch.nn as nn
class Conv_Block(nn.Module):
def __init__(self):
super(Conv_Block, self).__init__()
self.conv = nn.Conv2d(in_channels=64, out_channels=64, kernel_size=
3, stride=1, padding=1, bias=False)
nn.init.xavier_un... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 torchvision.transforms i... | FYLSunghwan/VDSR-pytorch | Conv_Block | false | 2,671 | [
"MIT"
] | 0 | fb862e97756078db2d5def095d46cc22a07cd014 | https://github.com/FYLSunghwan/VDSR-pytorch/tree/fb862e97756078db2d5def095d46cc22a07cd014 |
CausalConv2d | import torch
from torch import nn
class WNConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True, activation=None):
super().__init__()
self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_channel,
kernel_size, stride=st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | MioChiu/vqvae2 | CausalConv2d | false | 2,672 | [
"MIT"
] | 0 | e57cc7546d3bd02c61387367936f7cd76b75eaae | https://github.com/MioChiu/vqvae2/tree/e57cc7546d3bd02c61387367936f7cd76b75eaae |
MLP | import torch
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, input_dim, hidden_dim, num_layers, output_dim):
super(MLP, self).__init__()
self.hidden_dim = hidden_dim
self.num_layers = num_layers
self.fc1 = nn.Linear(input_dim, hidden_dim)
self.act = nn.ReLU(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | NefeliTav/Stock-Prediction | MLP | false | 2,673 | [
"Apache-2.0"
] | 0 | b422a246c762685ceb94c9714a2322fce71186e1 | https://github.com/NefeliTav/Stock-Prediction/tree/b422a246c762685ceb94c9714a2322fce71186e1 |
Rot180 | import torch
import torch.nn as nn
def rot180(input: 'torch.Tensor') ->torch.Tensor:
return torch.flip(input, [-2, -1])
class Rot180(nn.Module):
"""Rotate a tensor image or a batch of tensor images
180 degrees. Input must be a tensor of shape (C, H, W)
or a batch of tensors :math:`(*, C, H, 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... | NickleDave/kornia | Rot180 | false | 2,674 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
BinaryFocalLossWithLogits | import torch
import torch.nn as nn
def binary_focal_loss_with_logits(input: 'torch.Tensor', target:
'torch.Tensor', alpha: 'float'=0.25, gamma: 'float'=2.0, reduction:
'str'='none', eps: 'float'=1e-08) ->torch.Tensor:
"""Function that computes Binary Focal loss.
.. math::
\\text{FL}(p_t) = -... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | NickleDave/kornia | BinaryFocalLossWithLogits | false | 2,675 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
Invertible1x1Conv | import torch
import torch.nn.functional as F
from torch.autograd import Variable
import torch.utils.data
class Invertible1x1Conv(torch.nn.Module):
"""
The layer outputs both the convolution, and the log determinant
of its weight matrix. If reverse=True it does convolution with
inverse
"""
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
import torch.nn.functional as F
from torch.autograd import Variable
import torch... | Moon-sung-woo/VAE_Tacotron_korean | Invertible1x1Conv | false | 2,676 | [
"BSD-3-Clause"
] | 0 | dafa4ea557235350211b7a2187da1d6855eb5e9f | https://github.com/Moon-sung-woo/VAE_Tacotron_korean/tree/dafa4ea557235350211b7a2187da1d6855eb5e9f |
RKDAngleLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class RKDAngleLoss(nn.Module):
"""
Module for calculating RKD Angle Loss
"""
def forward(self, teacher, student, normalize=True):
"""
Forward function
:param teacher (torch.FloatTensor): Prediction made by the... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | NeelayS/KD_Lib | RKDAngleLoss | false | 2,677 | [
"MIT"
] | 0 | c3f8c7cef76772d14862260e61c1d1c52c58f58e | https://github.com/NeelayS/KD_Lib/tree/c3f8c7cef76772d14862260e61c1d1c52c58f58e |
CNN | import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self, input_dim, hidden_dim, output_dim):
super(CNN, self).__init__()
self.hidden_dim = hidden_dim
self.conv1 = nn.Conv1d(input_dim, input_dim, kernel_size=1)
self.conv2 = 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
import torch.nn as nn
assert_... | NefeliTav/Stock-Prediction | CNN | false | 2,678 | [
"Apache-2.0"
] | 0 | b422a246c762685ceb94c9714a2322fce71186e1 | https://github.com/NefeliTav/Stock-Prediction/tree/b422a246c762685ceb94c9714a2322fce71186e1 |
ATLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class ATLoss(nn.Module):
"""
Module for calculating AT Loss
:param norm_type (int): Norm to be used in calculating loss
"""
def __init__(self, norm_type=2):
super(ATLoss, self).__init__()
self.p = norm_type
d... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import... | NeelayS/KD_Lib | ATLoss | false | 2,679 | [
"MIT"
] | 0 | c3f8c7cef76772d14862260e61c1d1c52c58f58e | https://github.com/NeelayS/KD_Lib/tree/c3f8c7cef76772d14862260e61c1d1c52c58f58e |
HFM | import torch
import torch.nn as nn
import torch.utils.model_zoo
class HFM(nn.Module):
def __init__(self, k=2):
super().__init__()
self.k = k
self.net = nn.Sequential(nn.AvgPool2d(kernel_size=self.k, stride=
self.k), nn.Upsample(scale_factor=self.k, mode='nearest'))
def fo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.model_zoo
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | NawaNae/ESRT-Huawei | HFM | false | 2,680 | [
"MIT"
] | 0 | edea1c0bafec940dc7ea8e5110c355a83188665c | https://github.com/NawaNae/ESRT-Huawei/tree/edea1c0bafec940dc7ea8e5110c355a83188665c |
ExtractTensorPatches | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple
from typing import Union
from typing import Optional
from torch.nn.modules.utils import _pair
def _extract_tensor_patchesnd(input: 'torch.Tensor', window_sizes:
'Tuple[int, ...]', strides: 'Tuple[int, ...]') ->torch.Tensor... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
from typing import Tuple
from typing import Union
from typing import Optional
from tor... | NickleDave/kornia | ExtractTensorPatches | false | 2,681 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
SoftArgmax2D | import torch
import torch.nn as nn
from typing import Optional
def create_meshgrid(x: 'torch.Tensor', normalized_coordinates: 'Optional[bool]'
) ->torch.Tensor:
assert len(x.shape) == 4, x.shape
_, _, height, width = x.shape
_device, _dtype = x.device, x.dtype
if normalized_coordinates:
xs... | 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
... | Mykko/Human-Path-Prediction | SoftArgmax2D | false | 2,682 | [
"MIT"
] | 0 | 956fcf16b98c81cf8e23133f9a766192e17e63e0 | https://github.com/Mykko/Human-Path-Prediction/tree/956fcf16b98c81cf8e23133f9a766192e17e63e0 |
RgbaToBgr | import torch
import torch.nn as nn
def bgr_to_rgb(image: 'torch.Tensor') ->torch.Tensor:
"""Convert a BGR image to RGB.
Args:
image (torch.Tensor): BGR Image to be converted to BGR of shape :math:`(*,3,H,W)`.
Returns:
torch.Tensor: RGB version of the image with shape of shape :math:`(*,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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | NickleDave/kornia | RgbaToBgr | false | 2,683 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
TotalVariation | import torch
import torch.nn as nn
def total_variation(img: 'torch.Tensor') ->torch.Tensor:
"""Function that computes Total Variation according to [1].
Args:
img (torch.Tensor): the input image with shape :math:`(N, C, H, W)` or :math:`(C, H, W)`.
Return:
torch.Tensor: a scalar with the ... | 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... | NickleDave/kornia | TotalVariation | false | 2,684 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
RgbaToRgb | import torch
import torch.nn as nn
def rgba_to_rgb(image: 'torch.Tensor') ->torch.Tensor:
"""Convert an image from RGBA to RGB.
Args:
image (torch.Tensor): RGBA Image to be converted to RGB of shape :math:`(*,4,H,W)`.
Returns:
torch.Tensor: RGB version of the image with shape :math:`(*,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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | NickleDave/kornia | RgbaToRgb | false | 2,685 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self, alpha=1, gamma=2):
super().__init__()
self.alpha = alpha
self.gamma = gamma
def forward(self, x, y):
ce = F.binary_cross_entropy_with_logits(x, y)
fc = se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Nightmare4214/FracNet | FocalLoss | false | 2,686 | [
"Apache-2.0"
] | 0 | db397adb50f71387155d9d110302a5968f86f756 | https://github.com/Nightmare4214/FracNet/tree/db397adb50f71387155d9d110302a5968f86f756 |
InvDepth | import torch
import torch.nn as nn
class InvDepth(nn.Module):
def __init__(self, height, width, min_depth=0.5, max_depth=25.0):
super(InvDepth, self).__init__()
self._min_range = 1.0 / max_depth
self._max_range = 1.0 / min_depth
self.w = nn.Parameter(self._init_weights(height, wid... | 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... | MareenaKunjachan/kornia | InvDepth | false | 2,687 | [
"Apache-2.0"
] | 0 | 0a3cbb02850ac78059e0615da93144b5a64d3330 | https://github.com/MareenaKunjachan/kornia/tree/0a3cbb02850ac78059e0615da93144b5a64d3330 |
AdaptiveCatAvgMaxPool2d | import torch
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
from torch import optim as optim
import torch.nn.parallel
def adaptive_catavgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max = F.adaptive_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 import triton_helpers
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as ... | Exir-lxr/crldr-prune-pytorch | AdaptiveCatAvgMaxPool2d | false | 2,688 | [
"Apache-2.0"
] | 0 | adeb5e0b24ce66ff9531d4d947f72412c1b5c033 | https://github.com/Exir-lxr/crldr-prune-pytorch/tree/adeb5e0b24ce66ff9531d4d947f72412c1b5c033 |
GapAggregator | import torch
import torch.nn as nn
class GapAggregator(nn.Module):
def __init__(self):
super().__init__()
self.pool = nn.AdaptiveAvgPool2d(1)
def forward(self, x):
x = self.pool(x).squeeze(3).squeeze(2)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | NeverendingNotification/pytorch-xai-analyze | GapAggregator | false | 2,689 | [
"MIT"
] | 0 | fba91bf98c3281ffee5acaa87f2e44191897e0d7 | https://github.com/NeverendingNotification/pytorch-xai-analyze/tree/fba91bf98c3281ffee5acaa87f2e44191897e0d7 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, image=False):
super().__init__()
self.image = image
def forward(self, x, y):
x = x.sigmoid()
i, u = [(t.flatten(1).sum(1) if self.image else t.sum()) for t in [
x * y, x + y]]
... | 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... | Nightmare4214/FracNet | DiceLoss | false | 2,690 | [
"Apache-2.0"
] | 0 | db397adb50f71387155d9d110302a5968f86f756 | https://github.com/Nightmare4214/FracNet/tree/db397adb50f71387155d9d110302a5968f86f756 |
Vflip | import torch
import torch.nn as nn
def vflip(input: 'torch.Tensor') ->torch.Tensor:
return torch.flip(input, [-2])
class Vflip(nn.Module):
"""Vertically flip a tensor image or a batch of tensor images. Input must
be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.
Args:
... | 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... | NickleDave/kornia | Vflip | false | 2,691 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
PSNRLoss | import torch
import torch.nn as nn
from torch.nn.functional import mse_loss as mse
def psnr(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float'
) ->torch.Tensor:
"""Creates a function that calculates the PSNR between 2 images.
PSNR is Peek Signal to Noise Ratio, which is similar to mean squar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from t... | NickleDave/kornia | PSNRLoss | false | 2,692 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
dehaze_net | import torch
import torch.nn as nn
import torch.optim
class dehaze_net(nn.Module):
def __init__(self):
super(dehaze_net, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.e_conv1 = nn.Conv2d(3, 3, 1, 1, 0, bias=True)
self.e_conv2 = nn.Conv2d(3, 3, 3, 1, 1, bias=True)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | NeilDG/PyTorch-Image-Dehazing | dehaze_net | false | 2,693 | [
"MIT"
] | 0 | 25aeebd4d5759efc1c7d5c2015cd381f805f99b2 | https://github.com/NeilDG/PyTorch-Image-Dehazing/tree/25aeebd4d5759efc1c7d5c2015cd381f805f99b2 |
TransformDecoder4 | import torch
import torch.nn as nn
class TransformDecoder4(nn.Module):
def __init__(self):
super(TransformDecoder4, self).__init__()
self.conv41 = nn.Conv2d(1024, 256, 3, 1, 0)
self.conv34 = nn.Conv2d(256, 256, 3, 1, 0)
self.conv33 = nn.Conv2d(256, 256, 3, 1, 0)
self.conv3... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | MingSun-Tse/pytorch-AdaIN | TransformDecoder4 | false | 2,694 | [
"MIT"
] | 0 | 02ae320345232983c754ea233613aedc21e4d348 | https://github.com/MingSun-Tse/pytorch-AdaIN/tree/02ae320345232983c754ea233613aedc21e4d348 |
DomainAdaptationLayer | import torch
import torch.nn as nn
class DomainAdaptationLayer(nn.Module):
"""
This class is for the Domain Adaptation Layer. For now, the layer works only in source domain
arguments (function forward):
image: the input image (type: tensor) (size: batch x 384 x W x H)
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... | Muntasir13/Face-Spoofing-Detection-using-Depth-Wise-Convolution | DomainAdaptationLayer | false | 2,695 | [
"MIT"
] | 0 | f5b1b5d2ad2f29286afbc14e98075534b572c555 | https://github.com/Muntasir13/Face-Spoofing-Detection-using-Depth-Wise-Convolution/tree/f5b1b5d2ad2f29286afbc14e98075534b572c555 |
Hflip | import torch
import torch.nn as nn
def hflip(input: 'torch.Tensor') ->torch.Tensor:
return torch.flip(input, [-1])
class Hflip(nn.Module):
"""Horizontally flip a tensor image or a batch of tensor images. Input must
be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.
Args:
... | 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... | NickleDave/kornia | Hflip | false | 2,696 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | 5392651d0bc268da577fa0a49aa50f957289c7dd | https://github.com/NickleDave/kornia/tree/5392651d0bc268da577fa0a49aa50f957289c7dd |
SuperPointNet | import torch
import torch.optim
import torch.utils.data
class SuperPointNet(torch.nn.Module):
""" Pytorch definition of SuperPoint Network. """
def __init__(self):
super(SuperPointNet, self).__init__()
self.relu = torch.nn.ReLU(inplace=True)
self.pool = torch.nn.MaxPool2d(kernel_size=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Merical/pytorch-superpoint | SuperPointNet | false | 2,697 | [
"MIT"
] | 0 | b1f6e587b0f68a8a647773e4128b4f504edb4d58 | https://github.com/Merical/pytorch-superpoint/tree/b1f6e587b0f68a8a647773e4128b4f504edb4d58 |
SpatialSELayer3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class SpatialSELayer3D(nn.Module):
"""
3D extension of SE block -- squeezing spatially and exciting channel-wise described in:
*Roy et al., Concurrent Spatial and Channel Squeeze & Excitation in Fully Convolutional Networks, MICCAI 201... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Nightmare4214/FracNet | SpatialSELayer3D | false | 2,698 | [
"Apache-2.0"
] | 0 | db397adb50f71387155d9d110302a5968f86f756 | https://github.com/Nightmare4214/FracNet/tree/db397adb50f71387155d9d110302a5968f86f756 |
ResizeTransform | import torch
import torch.nn as nn
import torch.nn.functional as nnf
class ResizeTransform(nn.Module):
"""
Resize a transform, which involves resizing the vector field *and* rescaling it.
"""
def __init__(self, vel_resize, ndims):
super().__init__()
self.factor = 1.0 / vel_resize
... | 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... | NingAnMe/voxelmorph | ResizeTransform | false | 2,699 | [
"Apache-2.0"
] | 0 | 3a1a4c2f456af2dba5552efc1b08c68af38e54dc | https://github.com/NingAnMe/voxelmorph/tree/3a1a4c2f456af2dba5552efc1b08c68af38e54dc |
MedianPool2d | import torch
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from torch.nn.modules.utils import _quadruple
from torch import optim as optim
import torch.nn.parallel
class MedianPool2d(nn.Module):
"... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.utils.data
import torch.nn as nn
from torch.nn.modules.utils... | Exir-lxr/crldr-prune-pytorch | MedianPool2d | false | 2,700 | [
"Apache-2.0"
] | 0 | adeb5e0b24ce66ff9531d4d947f72412c1b5c033 | https://github.com/Exir-lxr/crldr-prune-pytorch/tree/adeb5e0b24ce66ff9531d4d947f72412c1b5c033 |
PlanarNormalizingFlow | import torch
import torch.nn.functional as F
import torch.nn as nn
class PlanarNormalizingFlow(nn.Module):
"""
Planar normalizing flow [Rezende & Mohamed 2015].
Provides a tighter bound on the ELBO by giving more expressive
power to the approximate distribution, such as by introducing
covariance b... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | NightmareNyx/semi-supervised-pytorch | PlanarNormalizingFlow | false | 2,701 | [
"MIT"
] | 0 | 43bb86bc6757345bd7a4eb37d6948ee62a268f7e | https://github.com/NightmareNyx/semi-supervised-pytorch/tree/43bb86bc6757345bd7a4eb37d6948ee62a268f7e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.