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 |
|---|---|---|---|---|---|---|---|---|---|---|
UpsampleConvLayer | import torch
import torch.nn as nn
class UpsampleConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(UpsampleConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = torch.nn.ReflectionPad2d(reflection_paddin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | joaquingv12/Solving-Image-Processing-Problems-with-Python-Part1 | UpsampleConvLayer | false | 6,969 | [
"MIT"
] | 1 | 42512672d1dc660dabc2d4570e891315f5264b12 | https://github.com/joaquingv12/Solving-Image-Processing-Problems-with-Python-Part1/tree/42512672d1dc660dabc2d4570e891315f5264b12 |
GATModelVAE | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import torch.nn.functional as F
class GraphConvolution(nn.Module):
def __init__(self, input_dim, output_dim, dropout, bias=False):
super(GraphConvolution, self).__init__()
self.input_dim = input_dim
self.output_di... | 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... | jiangnanboy/gcn_for_prediction_of_protein_interactions | GATModelVAE | false | 6,970 | [
"Apache-2.0"
] | 1 | b2a9eb06cdfe0971d0c352299db1075ec4827dd9 | https://github.com/jiangnanboy/gcn_for_prediction_of_protein_interactions/tree/b2a9eb06cdfe0971d0c352299db1075ec4827dd9 |
ResidualBlock | import torch
import torch.nn as nn
class ConvLayer(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kernel_size // 2
self.reflection_pad = nn.ReflectionPad2d(reflection_padding)
self.conv2d = nn.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | joaquingv12/Solving-Image-Processing-Problems-with-Python-Part1 | ResidualBlock | false | 6,971 | [
"MIT"
] | 1 | 42512672d1dc660dabc2d4570e891315f5264b12 | https://github.com/joaquingv12/Solving-Image-Processing-Problems-with-Python-Part1/tree/42512672d1dc660dabc2d4570e891315f5264b12 |
Net | import torch
import torch.nn.functional as F
class Net(torch.nn.Module):
def __init__(self):
super(Net, self).__init__()
self.l1 = torch.nn.Linear(784, 512)
self.l2 = torch.nn.Linear(512, 256)
self.l3 = torch.nn.Linear(256, 128)
self.l4 = torch.nn.Linear(128, 64)
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
assert_size_stride = torch._C... | jobsfan/pytorch | Net | false | 6,972 | [
"Apache-2.0"
] | 1 | 221ae8e3673f8d2fbf0a58f40a30553c76084831 | https://github.com/jobsfan/pytorch/tree/221ae8e3673f8d2fbf0a58f40a30553c76084831 |
ElectraClassificationHead | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.nn.functional as F
class ElectraClassificationHead(nn.Module):
"""CLS分类"""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.dr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | johnson7788/TextBrewer | ElectraClassificationHead | false | 6,973 | [
"Apache-2.0"
] | 1 | fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a | https://github.com/johnson7788/TextBrewer/tree/fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a |
ComboLoss | import torch
import torch.nn as nn
class ComboLoss(nn.Module):
def __init__(self, weight=None, size_average=True, alpha=0.5, ce_ratio=0.5
):
super(ComboLoss, self).__init__()
self.alpha = alpha
self.ce_ratio = ce_ratio
def forward(self, inputs, targets, smooth=1):
e =... | 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
... | johnugeorge/medperf | ComboLoss | false | 6,974 | [
"Apache-2.0"
] | 1 | 5bc3f643064df14e9476bd4d4c1a4c0cce5337d5 | https://github.com/johnugeorge/medperf/tree/5bc3f643064df14e9476bd4d4c1a4c0cce5337d5 |
ImagenetNorm | import torch
import torch.nn as nn
class ImagenetNorm(nn.Module):
def __init__(self, from_raw=True):
"""
:param from_raw: whether the input image lies in the range of [0, 255]
"""
super().__init__()
self.from_raw = from_raw
self.mean = nn.Parameter(torch.tensor([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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | jokingbear/DM | ImagenetNorm | false | 6,975 | [
"MIT"
] | 1 | 9c4dada1756f3d866455a397511d4f3bacfadc60 | https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60 |
GlobalAverage | import torch
import torch.nn as nn
class GlobalAverage(nn.Module):
def __init__(self, rank=2, keepdims=False):
"""
:param rank: dimension of image
:param keepdims: whether to preserve shape after averaging
"""
super().__init__()
self.axes = list(range(2, 2 + rank))... | 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... | jokingbear/DM | GlobalAverage | false | 6,976 | [
"MIT"
] | 1 | 9c4dada1756f3d866455a397511d4f3bacfadc60 | https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60 |
FocalLoss | import torch
import torch.nn as nn
def _assert_inputs(pred, true):
assert pred.shape == true.shape, f'predition shape {pred.shape} is not the same as label shape {true.shape}'
class FocalLoss(nn.Module):
def __init__(self, gamma=2, binary=False):
super().__init__()
self.gamma = gamma
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | jokingbear/DM | FocalLoss | false | 6,977 | [
"MIT"
] | 1 | 9c4dada1756f3d866455a397511d4f3bacfadc60 | https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60 |
FbetaLoss | import torch
import torch.nn as nn
def _assert_inputs(pred, true):
assert pred.shape == true.shape, f'predition shape {pred.shape} is not the same as label shape {true.shape}'
class FbetaLoss(nn.Module):
def __init__(self, beta=1, axes=(0,), binary=False, smooth=1e-07):
super().__init__()
s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | jokingbear/DM | FbetaLoss | false | 6,978 | [
"MIT"
] | 1 | 9c4dada1756f3d866455a397511d4f3bacfadc60 | https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60 |
Accuracy | import torch
import torch.nn as nn
class Accuracy(nn.Module):
def __init__(self, binary=False):
super().__init__()
self.binary = binary
def forward(self, preds, trues):
if self.binary:
preds = preds >= 0.5
else:
preds = preds.argmax(dim=1)
resu... | 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... | jokingbear/DM | Accuracy | false | 6,979 | [
"MIT"
] | 1 | 9c4dada1756f3d866455a397511d4f3bacfadc60 | https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60 |
GCN_encoder | import torch
import torch.nn as nn
import torch.nn.init as init
class GraphConv(nn.Module):
def __init__(self, input_dim, output_dim):
super(GraphConv, self).__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.weight = nn.Parameter(torch.FloatTensor(input_dim, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | jonathangomesselman/graph-generation | GCN_encoder | false | 6,980 | [
"MIT"
] | 1 | 72a8be30d54a414fcca9ea0fad1a62e38b85ee2f | https://github.com/jonathangomesselman/graph-generation/tree/72a8be30d54a414fcca9ea0fad1a62e38b85ee2f |
PolicyNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class PolicyNet(nn.Module):
def __init__(self, state_dim, actions_dim, hidden_dim=64):
super(PolicyNet, self).__init__()
self.input_layer = nn.Linear(state_dim, hidden_dim)
self.hidden = nn.Linear(hidden_dim, actions_dim)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | johntiger1/vaal_querying | PolicyNet | false | 6,981 | [
"BSD-2-Clause"
] | 1 | c20da3b0b5ca9f25334523f831d0ba8a11f710ca | https://github.com/johntiger1/vaal_querying/tree/c20da3b0b5ca9f25334523f831d0ba8a11f710ca |
LabelSmoothingLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
class LabelSmoothingLoss(nn.Module):
def __init__(self, smoothing=0.0):
super(LabelSmoothingLoss, self).__init__()
self.smoothing = smoothing
def smooth_one_hot(self, target: 'torch.Tensor', classes: 'int',
smoothing:... | 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
... | jordiae/DeepLearning-MAI | LabelSmoothingLoss | false | 6,982 | [
"MIT"
] | 1 | e12b6975d8de6cbe89f812bf691a7f7e95213552 | https://github.com/jordiae/DeepLearning-MAI/tree/e12b6975d8de6cbe89f812bf691a7f7e95213552 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSelfAttention, self).__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | johnson7788/TextBrewer | BertSelfAttention | false | 6,983 | [
"Apache-2.0"
] | 1 | fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a | https://github.com/johnson7788/TextBrewer/tree/fa7fa4d4a2a8debde5b148d448238f3b4fa1aa9a |
TVLoss | import torch
import numpy as np
import torch.nn as nn
class TVLoss(nn.Module):
def __init__(self, norm=2):
super().__init__()
self.norm = norm
def forward(self, x):
rank = len(x.shape[2:])
shift_h = torch.cat([x[:, :, 1:], x[:, :, :1]], dim=2)
shift_w = torch.cat([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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | jokingbear/DM | TVLoss | false | 6,984 | [
"MIT"
] | 1 | 9c4dada1756f3d866455a397511d4f3bacfadc60 | https://github.com/jokingbear/DM/tree/9c4dada1756f3d866455a397511d4f3bacfadc60 |
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... | jsk389/RGB-PowerSpectra-v2 | ActNorm | false | 6,985 | [
"MIT"
] | 1 | 47ca7cae256ad09a7e5a40fe9da82d48c32ff7cc | https://github.com/jsk389/RGB-PowerSpectra-v2/tree/47ca7cae256ad09a7e5a40fe9da82d48c32ff7cc |
ConvEncoder | import torch
import numpy as np
import torch.nn as nn
from typing import Tuple
def to_sate_tensor(s, device):
""" converts a numpy array to a Tensor suitable for passing through DQNs """
return torch.from_numpy(s)
class ConvEncoder(nn.Module):
def __init__(self, state_shape: 'Tuple', device=None):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
from ty... | jondeaton/AgarAI | ConvEncoder | false | 6,986 | [
"MIT"
] | 1 | 0c60896465a969ba6832a4b417cf6199715799a1 | https://github.com/jondeaton/AgarAI/tree/0c60896465a969ba6832a4b417cf6199715799a1 |
UpSample | import torch
import torch.nn as nn
class UpSample(nn.Module):
def __init__(self, feat_in, feat_out, out_shape=None, scale=2):
super().__init__()
self.conv = nn.Conv2d(feat_in, feat_out, kernel_size=(3, 3), stride
=1, padding=1)
self.out_shape, self.scale = out_shape, scale
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | jpjuvo/deepfake-video-detector | UpSample | false | 6,987 | [
"MIT"
] | 1 | 7c5ea5f36277ff5405d8466e48e68d00a085fa7e | https://github.com/jpjuvo/deepfake-video-detector/tree/7c5ea5f36277ff5405d8466e48e68d00a085fa7e |
TestNet2 | import torch
import torch.nn as nn
import torch.nn.functional as F
class TestNet2(nn.Module):
def __init__(self):
super(TestNet2, self).__init__()
self.conv1 = nn.Conv2d(3, 18, 7, padding=3)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(18, 36, 5, padding=2)
self.c... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | jjmachan/Cifar-pytorch | TestNet2 | false | 6,988 | [
"Apache-2.0"
] | 1 | 11268af2f9f5230b721ac554a2ce83496c41d06c | https://github.com/jjmachan/Cifar-pytorch/tree/11268af2f9f5230b721ac554a2ce83496c41d06c |
SReLU | import torch
import torch.nn as nn
class SReLU(nn.Module):
"""Shifted ReLU"""
def __init__(self, nc):
super(SReLU, self).__init__()
self.srelu_bias = nn.Parameter(torch.Tensor(1, nc, 1, 1))
self.srelu_relu = nn.ReLU(inplace=True)
nn.init.constant_(self.srelu_bias, -1.0)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | juancprzs/ISONet | SReLU | false | 6,989 | [
"MIT"
] | 1 | a0422942b53255d093197aa93c77cc3fa941bcdf | https://github.com/juancprzs/ISONet/tree/a0422942b53255d093197aa93c77cc3fa941bcdf |
LOGMSELoss | import torch
import torch.nn as nn
class LOGMSELoss(nn.Module):
def __init__(self):
super().__init__()
self.mse = nn.MSELoss()
def forward(self, input, target):
return torch.log(self.mse(input, target))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | julschoen/Latent-Space-Exploration-CT | LOGMSELoss | false | 6,990 | [
"MIT"
] | 1 | 39440c83362181efc48cad69777e5671a7bf3de9 | https://github.com/julschoen/Latent-Space-Exploration-CT/tree/39440c83362181efc48cad69777e5671a7bf3de9 |
NavigatorUnit | import torch
import torch.nn as nn
def conv1x1(in_channels, out_channels, stride=1, groups=1, bias=False):
"""
Convolution 1x1 layer.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
stride : int or tuple/list... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | iofthetiger/pkuad | NavigatorUnit | false | 6,991 | [
"Apache-2.0"
] | 1 | 07496d108c614c84be028f344830becc9cac8fe5 | https://github.com/iofthetiger/pkuad/tree/07496d108c614c84be028f344830becc9cac8fe5 |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
class GAT(nn.Module):
def __init__(self, num_feats):
super(GAT, self).__init__()
self.num_feats = num_feats
self.weight_key = nn.Parameter(torch.zeros(size=(self.num_feats, 1)))
self.weight_query = nn.Parameter(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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | juaduan/babybrainguardian | GAT | false | 6,992 | [
"MIT"
] | 1 | b871e3a83fef98c2e05dd8857721a3c964a46418 | https://github.com/juaduan/babybrainguardian/tree/b871e3a83fef98c2e05dd8857721a3c964a46418 |
GeneralizedDiceLoss | import torch
from torch import nn as nn
from torch.autograd import Variable
def expand_as_one_hot(input, C, ignore_index=None):
"""
Converts NxDxHxW label image to NxCxDxHxW, where each label is stored in a separate channel
:param input: 4D input image (NxDxHxW)
:param C: number of channels/labels
... | 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 as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_strid... | junweiy/pcs_seg | GeneralizedDiceLoss | false | 6,993 | [
"MIT"
] | 1 | 38ed98130b34a6d3d0b986cad98b08b791760f0b | https://github.com/junweiy/pcs_seg/tree/38ed98130b34a6d3d0b986cad98b08b791760f0b |
LinearScale | import torch
import torch.nn as nn
class LinearScale(nn.Module):
def __init__(self, scale, bias):
super(LinearScale, self).__init__()
self.scale_v = scale
self.bias_v = bias
pass
def forward(self, x):
out = x * self.scale_v + self.bias_v
return out
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... | justinjohn0306/CIPS-3D | LinearScale | false | 6,994 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
EqualLinear | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class EqualLinear(nn.Module):
def __init__(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1.0,
activation=None):
"""
:param in_dim:
:param out_dim:
:param bias:
:param bias_init:
:param lr_m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | justinjohn0306/CIPS-3D | EqualLinear | false | 6,995 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
DiceLoss | import torch
from torch import nn as nn
from torch.autograd import Variable
def expand_as_one_hot(input, C, ignore_index=None):
"""
Converts NxDxHxW label image to NxCxDxHxW, where each label is stored in a separate channel
:param input: 4D input image (NxDxHxW)
:param C: number of channels/labels
... | 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 as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_strid... | junweiy/pcs_seg | DiceLoss | false | 6,997 | [
"MIT"
] | 1 | 38ed98130b34a6d3d0b986cad98b08b791760f0b | https://github.com/junweiy/pcs_seg/tree/38ed98130b34a6d3d0b986cad98b08b791760f0b |
AdvResNet | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class AdvLinearNet(nn.Module):
"""
Adversarial linear network.
"""
def __init__(self, n_inputs: 'int', n_outputs: 'int', epsilon: 'float'=
0.0, q: 'int'=1):
"""
Initialize a linear network.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | jtkhim/tree_transform | AdvResNet | false | 6,998 | [
"MIT"
] | 1 | f0bf85ede0e28f3d16de5b8b0826be38fe2d89bf | https://github.com/jtkhim/tree_transform/tree/f0bf85ede0e28f3d16de5b8b0826be38fe2d89bf |
FiLMLayer_PreSin | import torch
import numpy as np
import torch.nn as nn
class FiLMLayer_PreSin(nn.Module):
def __init__(self, in_dim, out_dim, style_dim, use_style_fc=True,
which_linear=nn.Linear, **kwargs):
super(FiLMLayer_PreSin, self).__init__()
self.in_dim = in_dim
self.out_dim = out_dim
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy ... | justinjohn0306/CIPS-3D | FiLMLayer_PreSin | false | 6,999 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
ResidualBlock_noBN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, nn.Conv2d):
init.kaimin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | jtang98/FFDNet-speckle | ResidualBlock_noBN | false | 7,000 | [
"MIT"
] | 1 | 084fa2782f0197d0e01ee8c595a16414aaf4ab8d | https://github.com/jtang98/FFDNet-speckle/tree/084fa2782f0197d0e01ee8c595a16414aaf4ab8d |
CoordConv | import torch
import torch.nn as nn
class AddCoords(nn.Module):
"""
Source: https://github.com/mkocabas/CoordConv-pytorch/blob/master/CoordConv.py
"""
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
Arg... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | justinjohn0306/CIPS-3D | CoordConv | false | 7,001 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
EqualConvTranspose2d | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class EqualConvTranspose2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True):
super().__init__()
self.weight = nn.Parameter(torch.randn(in_channel, out_channel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.a... | justinjohn0306/CIPS-3D | EqualConvTranspose2d | false | 7,002 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
FiLMLayer | import torch
import torch.nn as nn
class FiLMLayer(nn.Module):
def __init__(self, input_dim, hidden_dim):
super().__init__()
self.layer = nn.Linear(input_dim, hidden_dim)
def forward(self, x, freq, phase_shift):
x = self.layer(x)
freq = freq.unsqueeze(1).expand_as(x)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | justinjohn0306/CIPS-3D | FiLMLayer | false | 7,003 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
CoordConvSinAct | import torch
import torch.nn as nn
class SinAct(nn.Module):
def __init__(self):
super(SinAct, self).__init__()
def forward(self, x):
return torch.sin(x)
class CoordConvSinAct(nn.Module):
"""
Source: https://github.com/mkocabas/CoordConv-pytorch/blob/master/CoordConv.py
"""
def... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | justinjohn0306/CIPS-3D | CoordConvSinAct | false | 7,004 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
Sine | import torch
import torch.nn as nn
class Sine(nn.Module):
"""Sine Activation Function."""
def __init__(self):
super().__init__()
def forward(self, x):
return torch.sin(30.0 * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | justinjohn0306/CIPS-3D | Sine | false | 7,005 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
FiLMLayerEqualFC | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class EqualLinear(nn.Module):
def __init__(self, in_dim, out_dim, bias=True, bias_init=0, lr_mul=1.0,
activation=None):
"""
:param in_dim:
:param out_dim:
:param bias:
:param bias_init:
:param lr_m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
i... | justinjohn0306/CIPS-3D | FiLMLayerEqualFC | false | 7,006 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
CLNLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class CLN(nn.Module):
def __init__(self, in_dim, use_style_fc=False, style_dim=None,
which_linear=nn.Linear, spectral_norm=False, eps=1e-05, **kwargs):
super(CLN, self).__init__()
self.in_dim = in_dim
self.use_styl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | justinjohn0306/CIPS-3D | CLNLayer | false | 7,007 | [
"MIT"
] | 1 | 69a910a7841846419a6b5e03182c8cf061a82584 | https://github.com/justinjohn0306/CIPS-3D/tree/69a910a7841846419a6b5e03182c8cf061a82584 |
TVLoss | import torch
import torch.nn as nn
class TVLoss(nn.Module):
def __init__(self, weight=1.0):
super(TVLoss, self).__init__()
self.weight = weight
self.l1 = nn.L1Loss(reduction='mean')
def forward(self, out, gt):
grad_out_x = out[:, :, :, 1:] - out[:, :, :, :-1]
grad_out... | 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... | juyongjiang/Simple-SR | TVLoss | false | 7,008 | [
"MIT"
] | 1 | 76820511abc04fbe6e4a79d23c67aee97406d563 | https://github.com/juyongjiang/Simple-SR/tree/76820511abc04fbe6e4a79d23c67aee97406d563 |
ResidualBlock_noBN | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, nn.Conv2d):
init.kaimin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | juyongjiang/Simple-SR | ResidualBlock_noBN | false | 7,009 | [
"MIT"
] | 1 | 76820511abc04fbe6e4a79d23c67aee97406d563 | https://github.com/juyongjiang/Simple-SR/tree/76820511abc04fbe6e4a79d23c67aee97406d563 |
Attention | import torch
import torch.nn as nn
class Attention(nn.Module):
"""
Implements Bahdanau Attention.
Arguments:
encoder_dim (int): Size of the encoder.
decoder_dim (int): Size of the decoder.
attention_dim (int): Size of the attention layer.
"""
def __init__(self, encoder... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | kad99kev/Image-Captioning | Attention | false | 7,010 | [
"MIT"
] | 1 | a38d7c6469306d7f226d8003bba92f21b3d9a06c | https://github.com/kad99kev/Image-Captioning/tree/a38d7c6469306d7f226d8003bba92f21b3d9a06c |
CNN_decoder_attention | import torch
import torch.nn as nn
import torch.nn.init as init
class CNN_decoder_attention(nn.Module):
def __init__(self, input_size, output_size, stride=2):
super(CNN_decoder_attention, self).__init__()
self.input_size = input_size
self.output_size = output_size
self.relu = nn.R... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | jonathangomesselman/graph-generation | CNN_decoder_attention | false | 7,011 | [
"MIT"
] | 1 | 72a8be30d54a414fcca9ea0fad1a62e38b85ee2f | https://github.com/jonathangomesselman/graph-generation/tree/72a8be30d54a414fcca9ea0fad1a62e38b85ee2f |
PreNet | import torch
import torch.nn as nn
class PreNet(nn.Module):
def __init__(self):
super(PreNet, self).__init__()
self.conv1 = nn.Conv2d(4, 8, 3, padding=1)
self.act1 = nn.LeakyReLU(0.2, inplace=False)
self.conv2 = nn.Conv2d(8, 16, 3, padding=1)
self.act2 = nn.LeakyReLU(0.2, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | karavik18/Federated_Learning_for_Missing_MRI_Sequence | PreNet | false | 7,012 | [
"Apache-2.0"
] | 1 | 42924f8475f354e6b429d05867f99530aa485b96 | https://github.com/karavik18/Federated_Learning_for_Missing_MRI_Sequence/tree/42924f8475f354e6b429d05867f99530aa485b96 |
TransformerFFN | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-05):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self).__init__()
s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | katsura-jp/generate-syosetu-title | TransformerFFN | false | 7,014 | [
"MIT"
] | 1 | f1db8f87d6ebd58117df1e7c0b76a4fe92cae810 | https://github.com/katsura-jp/generate-syosetu-title/tree/f1db8f87d6ebd58117df1e7c0b76a4fe92cae810 |
SurfaceLoss | import torch
import torch.nn as nn
class SurfaceLoss(nn.Module):
def __init__(self, epsilon=1e-05, softmax=True):
super(SurfaceLoss, self).__init__()
self.weight_map = []
def forward(self, x, distmap):
x = torch.softmax(x, dim=1)
self.weight_map = distmap
score = x.fl... | 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
... | kbarkevich/RITnet | SurfaceLoss | false | 7,015 | [
"MIT"
] | 1 | 5df66c656734aecd2987cf27d9359416b136af2e | https://github.com/kbarkevich/RITnet/tree/5df66c656734aecd2987cf27d9359416b136af2e |
GlobalMaxPooling | import torch
import torch.nn as nn
class GlobalMaxPooling(nn.Module):
def __init__(self, dim=0):
super(self.__class__, self).__init__()
self.dim = dim
def forward(self, x):
return x.max(dim=self.dim)[0]
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs()... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | kbrodt/clog-loss | GlobalMaxPooling | false | 7,016 | [
"MIT"
] | 1 | 0831b3a01b079609a71490bb921633110927206c | https://github.com/kbrodt/clog-loss/tree/0831b3a01b079609a71490bb921633110927206c |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class BertLayerNorm(nn.Module):
"""
LayerNorm层
"""
def __init__(self, hidden_size, eps=1e-12):
super(BertLayerNorm, self).__init__()
self.gamma = nn.Parameter(torch.ones(hidden_size))
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.... | kalanile/JDQA | BertAttention | false | 7,017 | [
"MIT"
] | 1 | 68e1d0259d316b3577a1f2fafa773b50f1885762 | https://github.com/kalanile/JDQA/tree/68e1d0259d316b3577a1f2fafa773b50f1885762 |
GlobalSoftMaxPooling | import torch
import torch.nn as nn
class GlobalSoftMaxPooling(nn.Module):
def __init__(self, dim=0):
super(self.__class__, self).__init__()
self.dim = dim
def forward(self, x):
return torch.sum(x * torch.softmax(x, dim=self.dim), dim=self.dim)
def get_inputs():
return [torch.ra... | 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
... | kbrodt/clog-loss | GlobalSoftMaxPooling | false | 7,018 | [
"MIT"
] | 1 | 0831b3a01b079609a71490bb921633110927206c | https://github.com/kbrodt/clog-loss/tree/0831b3a01b079609a71490bb921633110927206c |
TemporalFusion | import torch
import torch.nn as nn
class TemporalFusion(nn.Module):
def __init__(self, nf, n_frame):
super(TemporalFusion, self).__init__()
self.n_frame = n_frame
self.ref_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True)
self.nbr_conv = nn.Conv2d(nf, nf, 3, 1, 1, bias=True)
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... | juyongjiang/Simple-SR | TemporalFusion | false | 7,019 | [
"MIT"
] | 1 | 76820511abc04fbe6e4a79d23c67aee97406d563 | https://github.com/juyongjiang/Simple-SR/tree/76820511abc04fbe6e4a79d23c67aee97406d563 |
ConvRelu | import torch
from torch import nn
import torch.nn.functional as F
import torch.cuda
import torch.backends.cudnn
import torch.backends.mkl
import torch.backends.cuda
import torch.backends.quantized
class ConvRelu(nn.Module):
def __init__(self):
super(ConvRelu, self).__init__()
self.conv = torch.nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | kevin-14/intel-extension-for-pytorch | ConvRelu | false | 7,020 | [
"Apache-2.0"
] | 1 | f0cdcc602658340a957a964447d8e76bf413f66a | https://github.com/kevin-14/intel-extension-for-pytorch/tree/f0cdcc602658340a957a964447d8e76bf413f66a |
DenseNet2D_up_block_concat | import torch
import torch.nn as nn
class DenseNet2D_up_block_concat(nn.Module):
def __init__(self, skip_channels, input_channels, output_channels,
up_stride, dropout=False, prob=0):
super(DenseNet2D_up_block_concat, self).__init__()
self.conv11 = nn.Conv2d(skip_channels + input_channels,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | kbarkevich/RITnet | DenseNet2D_up_block_concat | false | 7,021 | [
"MIT"
] | 1 | 5df66c656734aecd2987cf27d9359416b136af2e | https://github.com/kbarkevich/RITnet/tree/5df66c656734aecd2987cf27d9359416b136af2e |
BiLinearSim | from _paritybench_helpers import _mock_config
import torch
from torch.optim.lr_scheduler import *
class BiLinearSim(torch.nn.Module):
def __init__(self, config):
super().__init__()
self.linear = torch.nn.Linear(config.hidden_size, config.
hidden_size, bias=False)
def forward(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.optim.lr_scheduler import *
assert_size_stride = torch._C._dynamo.gua... | kiminh/mt-dnn | BiLinearSim | false | 7,022 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
FreqEncoder | import torch
import torch.nn as nn
class FreqEncoder(nn.Module):
def __init__(self, input_dim, max_freq_log2, N_freqs, log_sampling=True,
include_input=True, periodic_fns=(torch.sin, torch.cos)):
super().__init__()
self.input_dim = input_dim
self.include_input = include_input
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | kevin-thankyou-lin/torch-ngp | FreqEncoder | false | 7,023 | [
"MIT"
] | 1 | 2bb55fb09512e7e8680db434d787c6bea1fa1cda | https://github.com/kevin-thankyou-lin/torch-ngp/tree/2bb55fb09512e7e8680db434d787c6bea1fa1cda |
Discriminator | import torch
import torch.nn as nn
class Discriminator(nn.Module):
def __init__(self):
super(Discriminator, self).__init__()
self.conv1 = nn.Conv2d(2, 16, 4, 2, 1, bias=False)
self.act1 = nn.LeakyReLU(0.2, inplace=False)
self.conv2 = nn.Conv2d(16, 32, 4, 2, 1, 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
import torch.nn as nn
assert_... | karavik18/Federated_Learning_for_Missing_MRI_Sequence | Discriminator | false | 7,024 | [
"Apache-2.0"
] | 1 | 42924f8475f354e6b429d05867f99530aa485b96 | https://github.com/karavik18/Federated_Learning_for_Missing_MRI_Sequence/tree/42924f8475f354e6b429d05867f99530aa485b96 |
CeCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn.modules.... | kiminh/mt-dnn | CeCriterion | false | 7,025 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
FC | import torch
import torch.nn as nn
import torch.nn.functional as F
class FC(nn.Module):
def __init__(self, cin, cout):
super(FC, self).__init__()
self.fc1 = nn.Linear(cin, 200)
self.fc2 = nn.Linear(200, 100)
self.fc3 = nn.Linear(100, 40)
self.fc4 = nn.Linear(40, 10)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | kim-younghan/Instance3D | FC | false | 7,026 | [
"MIT"
] | 1 | 2b7fc3f68594763c47033b55d692ab8ef6d0304a | https://github.com/kim-younghan/Instance3D/tree/2b7fc3f68594763c47033b55d692ab8ef6d0304a |
MseCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.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 import triton_helpers
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
assert_siz... | kiminh/mt-dnn | MseCriterion | false | 7,027 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
Conv3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv3D(nn.Module):
def __init__(self, cin, cout):
super(Conv3D, self).__init__()
self.conv1 = nn.Conv2d(cin, 8, 3, 1, 1)
self.conv2 = nn.Conv2d(8, 16, 3, 1, 1)
self.conv3 = nn.Conv2d(16, 32, 3, 1, 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_... | kim-younghan/Instance3D | Conv3D | false | 7,028 | [
"MIT"
] | 1 | 2b7fc3f68594763c47033b55d692ab8ef6d0304a | https://github.com/kim-younghan/Instance3D/tree/2b7fc3f68594763c47033b55d692ab8ef6d0304a |
KlCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.... | kiminh/mt-dnn | KlCriterion | false | 7,029 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
HLCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.... | kiminh/mt-dnn | HLCriterion | false | 7,030 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
NsKlCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
def stable_kl(logit, target, epsilon=1e-06, reduce=True):
logit = logit.view(-1, logit.size(-1)).float()
target = target.view(-1, target.size(-1)).float()
bs = logit.size(0)
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 math as tl_math
import torch.nn.functi... | kiminh/mt-dnn | NsKlCriterion | false | 7,031 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
SelfAttentionWide | import torch
from torch import nn
import torch.nn.functional as F
def mask_(matrices, maskval=0.0, mask_diagonal=True):
"""
Masks out all values in the given batch of matrices where i <= j holds,
i < j if mask_diagonal is false
In place operation
:param tns:
:return:
"""
_b, h, w = m... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | kewlcoder/former | SelfAttentionWide | false | 7,032 | [
"MIT"
] | 1 | 975cbdeedc69dd4fc3df6732fffbeb1c020b6982 | https://github.com/kewlcoder/former/tree/975cbdeedc69dd4fc3df6732fffbeb1c020b6982 |
JSCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.... | kiminh/mt-dnn | JSCriterion | false | 7,033 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
NsSymKlCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
def stable_kl(logit, target, epsilon=1e-06, reduce=True):
logit = logit.view(-1, logit.size(-1)).float()
target = target.view(-1, target.size(-1)).float()
bs = logit.size(0)
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 math as tl_math
import torch.nn.functi... | kiminh/mt-dnn | NsSymKlCriterion | false | 7,034 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
BERTLhuc | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class BERTLhuc(nn.Module):
def __init__(self, config):
super(BERTLhuc, self).__init__()
self.lhuc = Parameter(torch.zeros(config.hidden_size))
def forward(self, hidden_st... | 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
from torch.nn.parameter import Parameter
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided... | DAQuestionAnswering/Bert-n-Pals | BERTLhuc | false | 7,035 | [
"MIT"
] | 1 | d5a288b9ac62259e70c249635108ba3906e19f00 | https://github.com/DAQuestionAnswering/Bert-n-Pals/tree/d5a288b9ac62259e70c249635108ba3906e19f00 |
Cosine | from _paritybench_helpers import _mock_config
import torch
from torch.optim.lr_scheduler import *
class Cosine(torch.nn.Module):
def __init__(self, config):
super().__init__()
def forward(self, src, tgt):
src = src.float()
tgt = tgt.float()
return (torch.matmul(src, tgt.trans... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.optim.lr... | kiminh/mt-dnn | Cosine | false | 7,036 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
ConvLayer | import torch
from torch import nn
class ConvLayer(nn.Module):
"""1-D Convolution layer to extract high-level features of each time-series input
:param n_features: Number of input features/nodes
:param window_size: length of the input sequence
:param kernel_size: size of kernel to use in the convolutio... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | kj21choi/LATAD | ConvLayer | false | 7,037 | [
"MIT"
] | 1 | 80d91e0f251ad0225342ee30e2461a39fa9cca97 | https://github.com/kj21choi/LATAD/tree/80d91e0f251ad0225342ee30e2461a39fa9cca97 |
SymKlCriterion | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.optim.lr_scheduler import *
class Criterion(_Loss):
def __init__(self, alpha=1.0, name='criterion'):
super().__init__()
"""Alpha is used to weight each loss term
"""
self.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.... | kiminh/mt-dnn | SymKlCriterion | false | 7,038 | [
"MIT"
] | 1 | 133884b380244dbe74acc4d7507e551b2c5035b3 | https://github.com/kiminh/mt-dnn/tree/133884b380244dbe74acc4d7507e551b2c5035b3 |
NN1 | import torch
import torch.nn as nn
class NN1(nn.Module):
def __init__(self, input_dimension):
super(NN1, self).__init__()
self.linear1 = nn.Linear(input_dimension, 60)
self.linear2 = nn.Linear(60, 25)
self.linear3 = nn.Linear(25, 1)
self.sig = nn.Sigmoid()
self.rel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | kirtanp/MAMO-fair | NN1 | false | 7,039 | [
"Apache-2.0"
] | 1 | fd0fc39383f11a9e1ec401233b89c2399860fb94 | https://github.com/kirtanp/MAMO-fair/tree/fd0fc39383f11a9e1ec401233b89c2399860fb94 |
Transformation | import torch
from torch import nn
class Transformation(torch.nn.Module):
def __init__(self, input_size):
super(Transformation, self).__init__()
self.input_size = input_size
self.linear1 = torch.nn.Linear(self.input_size, self.input_size)
self.linear2 = torch.nn.Linear(self.input_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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | kj21choi/LATAD | Transformation | false | 7,040 | [
"MIT"
] | 1 | 80d91e0f251ad0225342ee30e2461a39fa9cca97 | https://github.com/kj21choi/LATAD/tree/80d91e0f251ad0225342ee30e2461a39fa9cca97 |
TemporalAttentionLayer | import torch
from torch import nn
class TemporalAttentionLayer(nn.Module):
"""Single Graph Temporal Attention Layer
:param n_features: number of input features/nodes
:param window_size: length of the input sequence
:param dropout: percentage of nodes to dropout
:param alpha: negative slope used in... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | kj21choi/LATAD | TemporalAttentionLayer | false | 7,041 | [
"MIT"
] | 1 | 80d91e0f251ad0225342ee30e2461a39fa9cca97 | https://github.com/kj21choi/LATAD/tree/80d91e0f251ad0225342ee30e2461a39fa9cca97 |
UpConv | import torch
import torch.nn as nn
class UpConv(nn.Module):
def __init__(self, input_nc, output_nc, kernel_size):
super(UpConv, self).__init__()
self.deconv = nn.ConvTranspose2d(in_channels=input_nc, out_channels
=output_nc, kernel_size=2, bias=True, stride=2, padding=0)
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.nn as ... | kkrish39/realtime-depth-prediction-from-monocular-videos | UpConv | false | 7,042 | [
"BSD-3-Clause"
] | 1 | 9cde9c1a6df6c91af1ada80b3aaeebae03fc59dc | https://github.com/kkrish39/realtime-depth-prediction-from-monocular-videos/tree/9cde9c1a6df6c91af1ada80b3aaeebae03fc59dc |
FeatureAttentionLayer | import torch
from torch import nn
class FeatureAttentionLayer(nn.Module):
"""Single Graph Feature/Spatial Attention Layer
:param n_features: Number of input features/nodes
:param window_size: length of the input sequence
:param dropout: percentage of nodes to dropout
:param alpha: negative slope u... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | kj21choi/LATAD | FeatureAttentionLayer | false | 7,043 | [
"MIT"
] | 1 | 80d91e0f251ad0225342ee30e2461a39fa9cca97 | https://github.com/kj21choi/LATAD/tree/80d91e0f251ad0225342ee30e2461a39fa9cca97 |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def __init__(self, nf=64):
super(Attention, self).__init__()
self.sAtt_1 = nn.Conv2d(nf, nf, 1, 1, bias=True)
self.max_pool = nn.MaxPool2d(3, stride=2, padding=1)
self.avg_pool = nn.AvgP... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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_... | juyongjiang/Simple-SR | Attention | false | 7,044 | [
"MIT"
] | 1 | 76820511abc04fbe6e4a79d23c67aee97406d563 | https://github.com/juyongjiang/Simple-SR/tree/76820511abc04fbe6e4a79d23c67aee97406d563 |
MSELoss | import torch
import torch.nn as nn
import torch.utils.data
class MSELoss(nn.Module):
def __init__(self):
super(self.__class__, self).__init__()
def forward(self, input, target):
return torch.mean(torch.sum((input - target) ** 2, 1))
def get_inputs():
return [torch.rand([4, 4, 4, 4]), t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C.... | klovbe/UnsupervisedDeepLearning-Pytorch | MSELoss | false | 7,045 | [
"MIT"
] | 1 | 35e8e49cd4024179db173f3dab2e6d1a5d037d35 | https://github.com/klovbe/UnsupervisedDeepLearning-Pytorch/tree/35e8e49cd4024179db173f3dab2e6d1a5d037d35 |
BCELoss | import torch
import torch.nn as nn
import torch.utils.data
class BCELoss(nn.Module):
def __init__(self):
super(self.__class__, self).__init__()
def forward(self, input, target):
return -torch.mean(torch.sum(target * torch.log(torch.clamp(input,
min=1e-10)) + (1 - target) * torch.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | klovbe/UnsupervisedDeepLearning-Pytorch | BCELoss | false | 7,046 | [
"MIT"
] | 1 | 35e8e49cd4024179db173f3dab2e6d1a5d037d35 | https://github.com/klovbe/UnsupervisedDeepLearning-Pytorch/tree/35e8e49cd4024179db173f3dab2e6d1a5d037d35 |
MaxMarginCriterion | import torch
import torch.nn as nn
class MaxMarginCriterion(nn.Module):
def __init__(self, visual_rank_weight, lang_rank_weight, margin):
super(MaxMarginCriterion, self).__init__()
self.visual_rank = visual_rank_weight > 0
self.lang_rank = lang_rank_weight > 0
self.visual_rank_wei... | 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... | kmario23/MAttNet | MaxMarginCriterion | false | 7,047 | [
"MIT"
] | 1 | 0d66321eb5dc9c8523a5ebf45f608b0672b051ab | https://github.com/kmario23/MAttNet/tree/0d66321eb5dc9c8523a5ebf45f608b0672b051ab |
TanhTransform | import torch
import torch.nn as nn
def arctanh(x, eps=1e-06):
"""
Calculates the inverse hyperbolic tangent.
"""
x *= 1.0 - eps
return torch.log((1 + x) / (1 - x)) * 0.5
class TanhTransform(nn.Module):
"""
Computes the tanh transform used to
remove box constraints from C&W paper
... | 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_... | knalbant/oppel | TanhTransform | false | 7,048 | [
"MIT"
] | 1 | 03f840565ef64587ddb7a8b4145d8df7fb0279a3 | https://github.com/knalbant/oppel/tree/03f840565ef64587ddb7a8b4145d8df7fb0279a3 |
BCEFocalLoss | import torch
import torch.nn as nn
class BCEFocalLoss(nn.Module):
def __init__(self, alpha=0.25, gamma=2.0):
super().__init__()
self.alpha = alpha
self.gamma = gamma
def forward(self, preds, targets):
bce_loss = nn.BCEWithLogitsLoss(reduction='none')(preds, targets)
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... | koukyo1994/riadd-competition | BCEFocalLoss | false | 7,049 | [
"MIT"
] | 1 | 0e399305aef21d40125cadccee55be1f0b310216 | https://github.com/koukyo1994/riadd-competition/tree/0e399305aef21d40125cadccee55be1f0b310216 |
LSEPLoss | import torch
import torch.nn as nn
def lsep_loss_stable(input, target, average=True):
n = input.size(0)
differences = input.unsqueeze(1) - input.unsqueeze(2)
where_lower = (target.unsqueeze(1) < target.unsqueeze(2)).float()
differences = differences.view(n, -1)
where_lower = where_lower.view(n, -1... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | koukyo1994/riadd-competition | LSEPLoss | false | 7,050 | [
"MIT"
] | 1 | 0e399305aef21d40125cadccee55be1f0b310216 | https://github.com/koukyo1994/riadd-competition/tree/0e399305aef21d40125cadccee55be1f0b310216 |
SwaVLoss | import torch
import torch.nn.functional as F
from typing import List
import torch.nn as nn
@torch.no_grad()
def sinkhorn(out: 'torch.Tensor', iterations: 'int'=3, epsilon: 'float'=0.05):
"""Distributed sinkhorn algorithm.
As outlined in [0] and implemented in [1].
[0]: SwaV, 2020, https://arxiv.org/abs/... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn.functi... | jianzhnie/self_supervised | SwaVLoss | false | 7,051 | [
"Apache-2.0"
] | 1 | d1e0f31ab032150ab0ad007c1e19773135a5fb79 | https://github.com/jianzhnie/self_supervised/tree/d1e0f31ab032150ab0ad007c1e19773135a5fb79 |
UNet | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
from torch.cuda import *
def conv3x3(in_channels, out_channels):
return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1,
padding=1, bias=True)
def maxpool2x2():
return nn.MaxPoo... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | jabae/detectEM | UNet | false | 7,052 | [
"MIT"
] | 1 | 2d1a5116164d0bed0a8ea767a227d05a8970a448 | https://github.com/jabae/detectEM/tree/2d1a5116164d0bed0a8ea767a227d05a8970a448 |
SoftEntropy | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import *
from torch.optim.lr_scheduler import *
class SoftEntropy(nn.Module):
def __init__(self):
super(SoftEntropy, self).__init__()
self.logsoftmax = nn.LogSoftmax(dim=1)
def forward(self, inputs, targets):
... | 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
f... | knifefield/uda-reid-contest | SoftEntropy | false | 7,053 | [
"MIT"
] | 1 | 8b642cb4c5e63bb1dbfb07d0ac6dacdc26729e91 | https://github.com/knifefield/uda-reid-contest/tree/8b642cb4c5e63bb1dbfb07d0ac6dacdc26729e91 |
AugCNN | import torch
import torch.nn as nn
from torch.nn import functional as F
def apply_init_(modules):
"""
Initialize NN modules
"""
for m in modules:
if isinstance(m, nn.Conv2d):
nn.init.xavier_uniform_(m.weight)
if m.bias is not None:
nn.init.constant_(m.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
import torch.nn as nn
from torch.nn import functional as F
assert_size_stride = ... | krg-nandu/prj-taxRL | AugCNN | false | 7,054 | [
"MIT"
] | 1 | be65d004c196aff73714dcb346c814ae97db30e2 | https://github.com/krg-nandu/prj-taxRL/tree/be65d004c196aff73714dcb346c814ae97db30e2 |
PSNRLoss | import torch
import torch.nn as nn
from torch.nn.functional import mse_loss
def psnr_loss(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float'
) ->torch.Tensor:
"""Function that computes PSNR
See :class:`~kornia.losses.PSNR` for details.
"""
if not torch.is_tensor(input) or not torch.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 import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from t... | kshitij12345/kornia | PSNRLoss | false | 7,055 | [
"Apache-2.0"
] | 1 | 4fcc9a570dfa38f67ec812c8fdfabe434b3e466e | https://github.com/kshitij12345/kornia/tree/4fcc9a570dfa38f67ec812c8fdfabe434b3e466e |
SeparatedLoss | import torch
import torch.nn as nn
class BCEFocalLoss(nn.Module):
def __init__(self, alpha=0.25, gamma=2.0):
super().__init__()
self.alpha = alpha
self.gamma = gamma
def forward(self, preds, targets):
bce_loss = nn.BCEWithLogitsLoss(reduction='none')(preds, targets)
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... | koukyo1994/riadd-competition | SeparatedLoss | false | 7,056 | [
"MIT"
] | 1 | 0e399305aef21d40125cadccee55be1f0b310216 | https://github.com/koukyo1994/riadd-competition/tree/0e399305aef21d40125cadccee55be1f0b310216 |
MyNet | import torch
import torch.nn as nn
from torch.testing._internal.common_utils import *
class MyNet(nn.Module):
def __init__(self):
super().__init__()
self.elu = nn.ELU()
def forward(self, x):
return self.elu(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_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 libdevice
import torch.nn as nn
from torch.testing._internal.common_utils import *
assert... | LexcaliburR/notebook | MyNet | false | 7,057 | [
"MIT"
] | 1 | 84a8f3801dff20d07caa0ed2584e722656fb5726 | https://github.com/LexcaliburR/notebook/tree/84a8f3801dff20d07caa0ed2584e722656fb5726 |
TripletLoss | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import *
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, descendi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | knifefield/uda-reid-contest | TripletLoss | false | 7,058 | [
"MIT"
] | 1 | 8b642cb4c5e63bb1dbfb07d0ac6dacdc26729e91 | https://github.com/knifefield/uda-reid-contest/tree/8b642cb4c5e63bb1dbfb07d0ac6dacdc26729e91 |
BinaryFocalLoss | import torch
class BinaryFocalLoss(torch.nn.Module):
""" from https://github.com/qubvel/segmentation_models"""
def __init__(self, gamma=2.0, alpha=0.25, eps=1e-07):
super().__init__()
self.gamma = gamma
self.alpha = alpha
self.eps = eps
def forward(self, pr, gt):
... | 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... | kungfuai/d3m-segmentation-research | BinaryFocalLoss | false | 7,059 | [
"MIT"
] | 1 | 5bc44ddd0e8522fb2b369866ad47aa62a24a8f63 | https://github.com/kungfuai/d3m-segmentation-research/tree/5bc44ddd0e8522fb2b369866ad47aa62a24a8f63 |
PredictiveEntropy | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class PredictiveEntropy(nn.Module):
def __init__(self):
super(PredictiveEntropy, self).__init__()
def forward(self, x):
b = F.softmax(x, dim=1) * F.log_softmax(x, dim=1)
b = -1.0 * b.sum(dim=1)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | kowshikthopalli/MULDENS | PredictiveEntropy | false | 7,060 | [
"MIT"
] | 1 | e2d5f8ec51024c5bdda6d1fcde4a96a3f31e6930 | https://github.com/kowshikthopalli/MULDENS/tree/e2d5f8ec51024c5bdda6d1fcde4a96a3f31e6930 |
CalibrationModel | import torch
class CalibrationModel(torch.nn.Module):
""" Adds temperature scaling parameters to trained model"""
def __init__(self):
super().__init__()
self.temperature = torch.nn.Parameter(torch.ones(1) * 1.5)
def forward(self, logits, device=torch.device('cpu')):
return logits... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | kungfuai/d3m-segmentation-research | CalibrationModel | false | 7,061 | [
"MIT"
] | 1 | 5bc44ddd0e8522fb2b369866ad47aa62a24a8f63 | https://github.com/kungfuai/d3m-segmentation-research/tree/5bc44ddd0e8522fb2b369866ad47aa62a24a8f63 |
BasicBlock | import torch
import torch.nn as nn
from torch.nn import functional as F
def apply_init_(modules):
"""
Initialize NN modules
"""
for m in modules:
if isinstance(m, nn.Conv2d):
nn.init.xavier_uniform_(m.weight)
if m.bias is not None:
nn.init.constant_(m.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
import torch.nn as nn
from to... | krg-nandu/prj-taxRL | BasicBlock | false | 7,062 | [
"MIT"
] | 1 | be65d004c196aff73714dcb346c814ae97db30e2 | https://github.com/krg-nandu/prj-taxRL/tree/be65d004c196aff73714dcb346c814ae97db30e2 |
Linear_2L_KFRA | import torch
import torch.nn as nn
import torch.utils.data
def sample_K_laplace_MN(MAP, upper_Qinv, lower_HHinv):
Z = MAP.data.new(MAP.size()).normal_(mean=0, std=1)
all_mtx_sample = MAP + torch.matmul(torch.matmul(lower_HHinv, Z),
upper_Qinv)
weight_mtx_sample = all_mtx_sample[:, :-1]
bias_mt... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | kw-lee/Bayesian-Neural-Networks | Linear_2L_KFRA | false | 7,063 | [
"MIT"
] | 1 | 3327fcf85e47c15d86c872211427bff133880c34 | https://github.com/kw-lee/Bayesian-Neural-Networks/tree/3327fcf85e47c15d86c872211427bff133880c34 |
GaussianSubnetBlock | import torch
from torch import nn
class GaussianSubnetBlock(nn.Module):
def __init__(self, in_channels, out_channels, kernel, tanh=False):
super().__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel, padding=1 if
kernel > 1 else 0)
self.activation = nn.Tanh() if... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | laitalaj/cvpce | GaussianSubnetBlock | false | 7,064 | [
"MIT"
] | 1 | 7509e7d7783039f39a88edc6e411333bcf6fb2af | https://github.com/laitalaj/cvpce/tree/7509e7d7783039f39a88edc6e411333bcf6fb2af |
Detector | import torch
from torch import nn
import torch.nn.functional as F
class Detector(nn.Module):
def __init__(self):
super(Detector, self).__init__()
self.conv1 = nn.Conv2d(50, 50, 3, 1, 1)
self.conv2 = nn.Conv2d(50, 50, 3, 1, 1)
self.fc1 = nn.Linear(2 * 2 * 50, 50)
self.fc2 =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ksivaman/observer-networks | Detector | false | 7,065 | [
"MIT"
] | 1 | a0cd540c762751c5500f714dc3979d3a62b9ea77 | https://github.com/ksivaman/observer-networks/tree/a0cd540c762751c5500f714dc3979d3a62b9ea77 |
BahdanauAttention | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.utils.data
from typing import *
from torch.nn import Parameter
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
class BaseAttention(nn.Module):
"""Base class for attention layers."""
def ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | lahiruts/espresso | BahdanauAttention | false | 7,066 | [
"MIT"
] | 1 | 940a1bf3c2c3d4a057d543b875c329b0515e6b55 | https://github.com/lahiruts/espresso/tree/940a1bf3c2c3d4a057d543b875c329b0515e6b55 |
EncoderNO2 | import torch
import torch.nn as nn
class EncoderNO2(nn.Module):
def __init__(self, D, H, M):
super().__init__()
self.D = D
self.M = M
self.H = H
self.enc1 = nn.Linear(in_features=self.D, out_features=self.H)
self.enc2 = nn.Linear(in_features=self.H, out_features=se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | le0x99/deep-generative-modeling | EncoderNO2 | false | 7,067 | [
"MIT"
] | 1 | 40ffd1640dc3e5a6a2b4ba16a1d767034f081475 | https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475 |
Decoder2 | import torch
import torch.nn as nn
class Decoder2(nn.Module):
def __init__(self, M, H, D):
super().__init__()
self.D = D
self.M = M
self.H = H
self.dec1 = nn.Linear(in_features=self.M, out_features=self.H * 2)
self.dec2 = nn.Linear(in_features=self.H * 2, out_featu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | le0x99/deep-generative-modeling | Decoder2 | false | 7,068 | [
"MIT"
] | 1 | 40ffd1640dc3e5a6a2b4ba16a1d767034f081475 | https://github.com/le0x99/deep-generative-modeling/tree/40ffd1640dc3e5a6a2b4ba16a1d767034f081475 |
InnerProductDecoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class InnerProductDecoder(nn.Module):
def __init__(self, activation=torch.sigmoid, dropout=0.1):
super().__init__()
self.dropout = dropout
self.activation = activation
def forward(self, z):
z = F.dropout(z, 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... | leiyu-thunder/gae_dgl | InnerProductDecoder | false | 7,069 | [
"Apache-2.0"
] | 1 | c743acc96e24c4ca3ae72d08956381f302b373bd | https://github.com/leiyu-thunder/gae_dgl/tree/c743acc96e24c4ca3ae72d08956381f302b373bd |
NN_logsoftmax | import torch
from torch import nn
import torch.nn.functional as F
class NN_logsoftmax(nn.Module):
"""Build a new class for the network you want to run, returning log
softmax"""
def set_parameters(self, initializers):
"""Set the parameter values obtained from vanilla NN as initializers"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | laravomfell/tvd_loss | NN_logsoftmax | false | 7,070 | [
"MIT"
] | 1 | b30a925f95985a03ff70bfa40a6ec3662432779d | https://github.com/laravomfell/tvd_loss/tree/b30a925f95985a03ff70bfa40a6ec3662432779d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.