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 |
|---|---|---|---|---|---|---|---|---|---|---|
SMAPELoss | import torch
import torch.nn as nn
class SMAPELoss(nn.Module):
def forward(self, input, target):
return (torch.abs(input - target) / (torch.abs(input) + torch.abs(
target) + 0.01)).mean()
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | LongerVision/oidn | SMAPELoss | false | 5,556 | [
"Apache-2.0"
] | 1 | 2f9e59f8b747b217f78c5c274f4f2bff347a03a7 | https://github.com/LongerVision/oidn/tree/2f9e59f8b747b217f78c5c274f4f2bff347a03a7 |
GradientLoss | import torch
import torch.nn as nn
def gradient(input):
input0 = input[..., :-1, :-1]
didy = input[..., 1:, :-1] - input0
didx = input[..., :-1, 1:] - input0
return torch.cat((didy, didx), -3)
class GradientLoss(nn.Module):
def forward(self, input, target):
return torch.abs(gradient(inp... | 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
... | LongerVision/oidn | GradientLoss | false | 5,557 | [
"Apache-2.0"
] | 1 | 2f9e59f8b747b217f78c5c274f4f2bff347a03a7 | https://github.com/LongerVision/oidn/tree/2f9e59f8b747b217f78c5c274f4f2bff347a03a7 |
ResHead | from torch.nn import Module
import torch
import torch.nn as nn
import torch.utils.data
def gap2d(_w_in):
"""Helper for building a gap2d layer."""
return nn.AdaptiveAvgPool2d((1, 1))
def gap2d_cx(cx, _w_in):
"""Accumulates complexity of gap2d into cx = (h, w, flops, params, acts)."""
flops, params, a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import torch.nn as nn
import torch.utils.data
assert... | MAC-AutoML/XCompression | ResHead | false | 5,558 | [
"MIT"
] | 1 | 9f76eb3ccfb3057110ecf12aa48dec00a4667a25 | https://github.com/MAC-AutoML/XCompression/tree/9f76eb3ccfb3057110ecf12aa48dec00a4667a25 |
MaxPool | import torch
import torch.nn as nn
import torch.optim
import torch.utils.data
class MaxPool(nn.Module):
def __init__(self, kernel_size, stride=1, padding=1, zero_pad=False):
super(MaxPool, self).__init__()
self.zero_pad = nn.ZeroPad2d((1, 0, 1, 0)) if zero_pad else None
self.pool = nn.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.nn as nn
import torch.optim
import torch.utils.data
assert_size_stride = tor... | LongKt7/Face_Recognize_Pytorch | MaxPool | false | 5,559 | [
"MIT"
] | 1 | baa02e633d379abe1001c8b8acb942617177329c | https://github.com/LongKt7/Face_Recognize_Pytorch/tree/baa02e633d379abe1001c8b8acb942617177329c |
UsBlock_nounpool | import torch
import torch.nn as nn
def conv3x3(in_channels, out_channels, stride=1, padding=1, bias=True):
return nn.Conv3d(in_channels, out_channels, kernel_size=3, stride=
stride, padding=padding, bias=bias)
class UsBlock_nounpool(nn.Module):
def __init__(self, in_channels, out_channels, up_mode=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | MATHplus-Young-Academy/P2-Cardiac-Motion | UsBlock_nounpool | false | 5,560 | [
"Apache-2.0"
] | 1 | 844995e8e5760f981c425d13c0bd7f2f3bb8baec | https://github.com/MATHplus-Young-Academy/P2-Cardiac-Motion/tree/844995e8e5760f981c425d13c0bd7f2f3bb8baec |
WDV29LayerNormalization | import numbers
import torch
import torch.nn.functional as F
import torch.utils.data
from torch.nn import Parameter
import torch.onnx.operators
from torch.nn.parameter import Parameter
from torch.nn import init
import torch.optim
import torch.optim.lr_scheduler
class WDV29LayerNormalization(torch.nn.Module):
"""Ap... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numbers
import torch.utils.data
from torch.nn import Parameter
import to... | Lollipop321/weight-distillation | WDV29LayerNormalization | false | 5,561 | [
"BSD-3-Clause"
] | 1 | cfc76ec58e3e88094dde1825287b2968f9718431 | https://github.com/Lollipop321/weight-distillation/tree/cfc76ec58e3e88094dde1825287b2968f9718431 |
WDV29Linear | import math
import torch
import torch.nn.functional as F
import torch.utils.data
from torch.nn import Parameter
import torch.onnx.operators
from torch.nn.parameter import Parameter
from torch.nn import init
import torch.optim
import torch.optim.lr_scheduler
class WDV29Linear(torch.nn.Module):
"""Applies a linear ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | Lollipop321/weight-distillation | WDV29Linear | false | 5,562 | [
"BSD-3-Clause"
] | 1 | cfc76ec58e3e88094dde1825287b2968f9718431 | https://github.com/Lollipop321/weight-distillation/tree/cfc76ec58e3e88094dde1825287b2968f9718431 |
WDV52LayerNormalization | import numbers
import torch
import torch.nn.functional as F
import torch.utils.data
from torch.nn import Parameter
import torch.onnx.operators
from torch.nn.parameter import Parameter
from torch.nn import init
import torch.optim
import torch.optim.lr_scheduler
class WDV52LayerNormalization(torch.nn.Module):
"""Ap... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numbers
impo... | Lollipop321/weight-distillation | WDV52LayerNormalization | false | 5,563 | [
"BSD-3-Clause"
] | 1 | cfc76ec58e3e88094dde1825287b2968f9718431 | https://github.com/Lollipop321/weight-distillation/tree/cfc76ec58e3e88094dde1825287b2968f9718431 |
UsBlockRes | import torch
import torch.nn as nn
def conv3x3(in_channels, out_channels, stride=1, padding=1, bias=True):
return nn.Conv3d(in_channels, out_channels, kernel_size=3, stride=
stride, padding=padding, bias=bias)
def conv1x1(in_channels, out_channels):
return nn.Conv3d(in_channels, out_channels, kernel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | MATHplus-Young-Academy/P2-Cardiac-Motion | UsBlockRes | false | 5,564 | [
"Apache-2.0"
] | 1 | 844995e8e5760f981c425d13c0bd7f2f3bb8baec | https://github.com/MATHplus-Young-Academy/P2-Cardiac-Motion/tree/844995e8e5760f981c425d13c0bd7f2f3bb8baec |
ContinousRotReprDecoder | import torch
import torch.nn as nn
import torch.nn.functional as F
class ContinousRotReprDecoder(nn.Module):
def __init__(self):
super(ContinousRotReprDecoder, self).__init__()
def forward(self, module_input):
reshaped_input = module_input.view(-1, 3, 2)
b1 = F.normalize(reshaped_inp... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | LuckyDC/human_body_prior | ContinousRotReprDecoder | false | 5,565 | [
"Xnet",
"X11"
] | 1 | 6a46613b4cbd9c62d888359f1435cec501643af3 | https://github.com/LuckyDC/human_body_prior/tree/6a46613b4cbd9c62d888359f1435cec501643af3 |
BCEWithLogitsLoss2d | import torch
import numpy as np
import torch.nn as nn
class BCEWithLogitsLoss2d(nn.Module):
"""Computationally stable version of 2D BCE loss
"""
def __init__(self, weight=None, reduction='elementwise_mean'):
super(BCEWithLogitsLoss2d, self).__init__()
if isinstance(weight, np.ndarray):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import nump... | MIPT-Oulu/3D-Histo-Grading | BCEWithLogitsLoss2d | false | 5,566 | [
"MIT"
] | 1 | b779a154d0e5b104fc152c8952124768fb7b1dc6 | https://github.com/MIPT-Oulu/3D-Histo-Grading/tree/b779a154d0e5b104fc152c8952124768fb7b1dc6 |
ViTStemPatchify | from torch.nn import Module
import torch
import torch.nn as nn
import torch.utils.data
def patchify2d(w_in, w_out, k, *, bias=True):
"""Helper for building a patchify layer as used by ViT models."""
return nn.Conv2d(w_in, w_out, k, stride=k, padding=0, bias=bias)
def patchify2d_cx(cx, w_in, w_out, k, *, bia... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
import torch.nn as nn
import torch.utils.data
assert... | MAC-AutoML/XCompression | ViTStemPatchify | false | 5,567 | [
"MIT"
] | 1 | 9f76eb3ccfb3057110ecf12aa48dec00a4667a25 | https://github.com/MAC-AutoML/XCompression/tree/9f76eb3ccfb3057110ecf12aa48dec00a4667a25 |
WDV52Linear | import math
import torch
import torch.nn.functional as F
import torch.utils.data
from torch.nn import Parameter
import torch.onnx.operators
from torch.nn.parameter import Parameter
from torch.nn import init
import torch.optim
import torch.optim.lr_scheduler
class WDV52Linear(torch.nn.Module):
"""Applies a linear ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | Lollipop321/weight-distillation | WDV52Linear | false | 5,568 | [
"BSD-3-Clause"
] | 1 | cfc76ec58e3e88094dde1825287b2968f9718431 | https://github.com/Lollipop321/weight-distillation/tree/cfc76ec58e3e88094dde1825287b2968f9718431 |
DsBlock | import torch
import torch.nn as nn
def conv3x3(in_channels, out_channels, stride=1, padding=1, bias=True):
return nn.Conv3d(in_channels, out_channels, kernel_size=3, stride=
stride, padding=padding, bias=bias)
class DsBlock(nn.Module):
def __init__(self, in_channels, out_channels, pooling):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | MATHplus-Young-Academy/P2-Cardiac-Motion | DsBlock | false | 5,569 | [
"Apache-2.0"
] | 1 | 844995e8e5760f981c425d13c0bd7f2f3bb8baec | https://github.com/MATHplus-Young-Academy/P2-Cardiac-Motion/tree/844995e8e5760f981c425d13c0bd7f2f3bb8baec |
BinaryDiceLoss | import torch
import torch.nn as nn
class BinaryDiceLoss(nn.Module):
"""SoftDice loss
"""
def __init__(self):
super(BinaryDiceLoss, self).__init__()
self.SM = nn.Sigmoid()
def forward(self, logits, labels):
num = labels.size(0)
m1 = self.SM(logits).view(num, -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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | MIPT-Oulu/3D-Histo-Grading | BinaryDiceLoss | false | 5,570 | [
"MIT"
] | 1 | b779a154d0e5b104fc152c8952124768fb7b1dc6 | https://github.com/MIPT-Oulu/3D-Histo-Grading/tree/b779a154d0e5b104fc152c8952124768fb7b1dc6 |
MultiHeadAttention | import torch
import torch.nn as nn
class MultiHeadAttention(nn.Module):
def __init__(self, hidden_size, attention_dropout_rate, num_heads):
super(MultiHeadAttention, self).__init__()
self.num_heads = num_heads
self.att_size = att_size = hidden_size // num_heads
self.scale = att_si... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Luo-Chang/Graphormer | MultiHeadAttention | false | 5,571 | [
"MIT"
] | 1 | b35b3ca6369e25cdae80e1617bfc3921feeb3158 | https://github.com/Luo-Chang/Graphormer/tree/b35b3ca6369e25cdae80e1617bfc3921feeb3158 |
Discrete | import torch
import torch.nn as nn
class Discrete(nn.Module):
def __init__(self):
super(Discrete, self).__init__()
def forward(self, x):
return nn.functional.softmax(x, dim=0)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | MPGek/client | Discrete | false | 5,572 | [
"Apache-2.0"
] | 1 | 541d760c5cb8776b1ad5fcf1362d7382811cbc61 | https://github.com/MPGek/client/tree/541d760c5cb8776b1ad5fcf1362d7382811cbc61 |
AttentionPool2d | import math
import torch
import numpy as np
import torch as th
import torch.nn as nn
def count_flops_attn(model, _x, y):
"""
A counter for the `thop` package to count the operations in an
attention operation.
Meant to be used like:
macs, params = thop.profile(
model,
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.... | Liujingxiu23/guided-diffusion | AttentionPool2d | false | 5,573 | [
"MIT"
] | 1 | 0ba878e517b276c45d1195eb29f6f5f72659a05b | https://github.com/Liujingxiu23/guided-diffusion/tree/0ba878e517b276c45d1195eb29f6f5f72659a05b |
CrossEntropyDiceLoss | import torch
from typing import Union
from typing import Optional
from typing import Iterable
from torch import nn
class FScoreLoss(nn.modules.loss._WeightedLoss):
"""Uses the 1 - F-score as a loss.
.. math::
F = rac{ (1 + eta^2) TP }{ (1 + eta^2) TP + eta^2 FN + FP }
Args:
beta: 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
from typing import Union
from typing import Optional
from typing import I... | MIC-DKFZ/image-time-series | CrossEntropyDiceLoss | false | 5,574 | [
"MIT"
] | 1 | 0480d5cb6936c7d9e839b6741f18c10893d78d8a | https://github.com/MIC-DKFZ/image-time-series/tree/0480d5cb6936c7d9e839b6741f18c10893d78d8a |
AvgPoolPad | import torch
from torch import nn
class AvgPoolPad(nn.Module):
def __init__(self, stride=2, padding=1):
super(AvgPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.AvgPool2d(3, stride=stride, padding=padding,
count_include_pad=False)
def forwar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | MarioProjects/pytorchlib | AvgPoolPad | false | 5,575 | [
"MIT"
] | 1 | 81ea32304d899fbd10ae1efe1d124c0d7bc96f5c | https://github.com/MarioProjects/pytorchlib/tree/81ea32304d899fbd10ae1efe1d124c0d7bc96f5c |
MaxPoolPad | import torch
from torch import nn
class MaxPoolPad(nn.Module):
def __init__(self):
super(MaxPoolPad, self).__init__()
self.pad = nn.ZeroPad2d((1, 0, 1, 0))
self.pool = nn.MaxPool2d(3, stride=2, padding=1)
def forward(self, x):
x = self.pad(x)
x = self.pool(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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | MarioProjects/pytorchlib | MaxPoolPad | false | 5,576 | [
"MIT"
] | 1 | 81ea32304d899fbd10ae1efe1d124c0d7bc96f5c | https://github.com/MarioProjects/pytorchlib/tree/81ea32304d899fbd10ae1efe1d124c0d7bc96f5c |
Conv2d | import torch
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
class Conv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, NL
='relu', same_padding=False, bn=False):
super(Conv2d, self).__init__()
padding = int((... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ma... | MONICA-Project/sfn | Conv2d | false | 5,577 | [
"Apache-2.0"
] | 1 | 40509e520e83441068b5a2d151864fe3a5814d5e | https://github.com/MONICA-Project/sfn/tree/40509e520e83441068b5a2d151864fe3a5814d5e |
Policy | import torch
from copy import deepcopy
import torch.nn as nn
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)
self.edge2index = {}
for i in range(1, ma... | 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... | MUST-AI-Lab/NAS-Projects | Policy | false | 5,578 | [
"MIT"
] | 1 | fcb2aae34a2b3c02877fbdb41cda45e1e73327a6 | https://github.com/MUST-AI-Lab/NAS-Projects/tree/fcb2aae34a2b3c02877fbdb41cda45e1e73327a6 |
FScoreLoss | import torch
from typing import Union
from typing import Optional
from typing import Iterable
from torch import nn
class FScoreLoss(nn.modules.loss._WeightedLoss):
"""Uses the 1 - F-score as a loss.
.. math::
F = rac{ (1 + eta^2) TP }{ (1 + eta^2) TP + eta^2 FN + FP }
Args:
beta: 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 typing import Union
from typing import Optional
from typing import Iterable
from torch import nn
assert_size_stride = torch._C._dynamo.... | MIC-DKFZ/image-time-series | FScoreLoss | false | 5,579 | [
"MIT"
] | 1 | 0480d5cb6936c7d9e839b6741f18c10893d78d8a | https://github.com/MIC-DKFZ/image-time-series/tree/0480d5cb6936c7d9e839b6741f18c10893d78d8a |
Conv_Block_gn | import torch
import torch.nn as nn
from torch.autograd.variable import *
class Conv_Block_gn(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, groups, stride=1
):
super(Conv_Block_gn, self).__init__()
self.conv = nn.Conv2d(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.triton_helpers import libdevice
import torch.nn as ... | MRLoghmani/Separate_to_Adapt | Conv_Block_gn | false | 5,580 | [
"MIT"
] | 1 | 09c734448aa22b3879186f59952d9fd596d4a1f8 | https://github.com/MRLoghmani/Separate_to_Adapt/tree/09c734448aa22b3879186f59952d9fd596d4a1f8 |
FCNet | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from typing import *
class FCNet(nn.Module):
def __init__(self, input_size, output_size):
super().__init__()
self.l1 = nn.Linear(input_size, 5)
self.relu = nn.ReLU()
self.l2 = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Markus92/nni | FCNet | false | 5,581 | [
"MIT"
] | 1 | 2641c7343f4b411b002bea4f5648941268194ed7 | https://github.com/Markus92/nni/tree/2641c7343f4b411b002bea4f5648941268194ed7 |
PFLDLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from typing import *
class PFLDLoss(nn.Module):
"""Weighted loss of L2 distance with the pose angle for PFLD."""
def __init__(self):
super(PFLDLoss, self).__init__()
def forward(self, landmark_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import ... | Markus92/nni | PFLDLoss | false | 5,582 | [
"MIT"
] | 1 | 2641c7343f4b411b002bea4f5648941268194ed7 | https://github.com/Markus92/nni/tree/2641c7343f4b411b002bea4f5648941268194ed7 |
VarifocalLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | MatthewInkawhich/object_localization_network | VarifocalLoss | false | 5,583 | [
"Apache-2.0"
] | 1 | 3fddaacfcef33f03af48b746e95ebd7d74dbb27f | https://github.com/MatthewInkawhich/object_localization_network/tree/3fddaacfcef33f03af48b746e95ebd7d74dbb27f |
EncoderLayer | import torch
import torch.nn as nn
class FeedForwardNetwork(nn.Module):
def __init__(self, hidden_size, ffn_size, dropout_rate):
super(FeedForwardNetwork, self).__init__()
self.layer1 = nn.Linear(hidden_size, ffn_size)
self.gelu = nn.GELU()
self.layer2 = nn.Linear(ffn_size, hidden... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Luo-Chang/Graphormer | EncoderLayer | false | 5,584 | [
"MIT"
] | 1 | b35b3ca6369e25cdae80e1617bfc3921feeb3158 | https://github.com/Luo-Chang/Graphormer/tree/b35b3ca6369e25cdae80e1617bfc3921feeb3158 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(4, 32, 3, padding=1)
self.conv2 = nn.Conv2d(32, 64, 3, padding=1)
self.conv3 = nn.Conv2d(64, 128, 3, padding=1)
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.... | LouisCaixuran/gomoku | Net | false | 5,585 | [
"Apache-2.0"
] | 1 | c1b6d508522d9e8c78be827f326bbee54c4dfd8b | https://github.com/LouisCaixuran/gomoku/tree/c1b6d508522d9e8c78be827f326bbee54c4dfd8b |
Binarizer | from torch.autograd import Function
import torch
import torch.nn as nn
import torch.nn.functional as F
class SignFunction(Function):
def __init__(self):
super(SignFunction, self).__init__()
@staticmethod
def forward(ctx, input, is_training=True):
if is_training:
prob = 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.triton_helpers import libdevice
from torch.autograd... | MeMihir/SuperResCompression | Binarizer | false | 5,586 | [
"MIT"
] | 1 | c76bcf6b12d56ce3ad81ebb1b204fc0425f0e633 | https://github.com/MeMihir/SuperResCompression/tree/c76bcf6b12d56ce3ad81ebb1b204fc0425f0e633 |
Sign | from torch.autograd import Function
import torch
import torch.nn as nn
class SignFunction(Function):
def __init__(self):
super(SignFunction, self).__init__()
@staticmethod
def forward(ctx, input, is_training=True):
if is_training:
prob = input.new(input.size()).uniform_()
... | 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.autograd import Function
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda... | MeMihir/SuperResCompression | Sign | false | 5,587 | [
"MIT"
] | 1 | c76bcf6b12d56ce3ad81ebb1b204fc0425f0e633 | https://github.com/MeMihir/SuperResCompression/tree/c76bcf6b12d56ce3ad81ebb1b204fc0425f0e633 |
GLU | import torch
import torch.nn as nn
class GLU(nn.Module):
def __init__(self, input_channel, output_channel):
super(GLU, self).__init__()
self.linear_left = nn.Linear(input_channel, output_channel)
self.linear_right = nn.Linear(input_channel, output_channel)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | MichaelHopwood/GLRM | GLU | false | 5,588 | [
"MIT"
] | 1 | 80930762e6964afb8ef0db9e5ae3a10cfcc975b2 | https://github.com/MichaelHopwood/GLRM/tree/80930762e6964afb8ef0db9e5ae3a10cfcc975b2 |
AverageAttention | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class ActivationFunction(object):
relu = 'relu'
gelu = 'gelu'
class PositionwiseFeedForward(nn.Module):
""" A two-layer Feed-Forward-Network with residual layer norm.
Args:
d_model (int): the size of input for 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
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_size_str... | MaxatTezekbayev/OpenNMT-py-lexical | AverageAttention | false | 5,589 | [
"MIT"
] | 1 | 44182999b863fc4074d67e0281c5bdab19abddfe | https://github.com/MaxatTezekbayev/OpenNMT-py-lexical/tree/44182999b863fc4074d67e0281c5bdab19abddfe |
SRNet | import torch
import torch.nn as nn
import torch.optim
class SRNet(nn.Module):
def __init__(self):
super(SRNet, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.Conv1 = nn.Conv2d(3, 64, 3, 1, 1, bias=True)
self.Conv2 = nn.Conv2d(64, 64, 3, 1, 1, bias=True)
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
import torch.nn as nn
import ... | MayankSingal/PyTorch-Zero-Shot-Super-Resolution | SRNet | false | 5,590 | [
"MIT"
] | 1 | 3521b02fd338fc90eef88c551a8bed4afc54c8c6 | https://github.com/MayankSingal/PyTorch-Zero-Shot-Super-Resolution/tree/3521b02fd338fc90eef88c551a8bed4afc54c8c6 |
Sparsemax | import torch
import torch.nn as nn
class Sparsemax(nn.Module):
"""Sparsemax function."""
def __init__(self, dim=None):
"""Initialize sparsemax activation
Args:
dim (int, optional): The dimension over which to apply the sparsemax function.
"""
super(Sparsem... | import torch
from torch import device
import triton
import triton.language as tl
from 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.guar... | Max-luo-song/fs-map-project | Sparsemax | false | 5,591 | [
"Apache-2.0"
] | 1 | 4e9d86e182d9a4b969e86b12d72f227e4fd4fd09 | https://github.com/Max-luo-song/fs-map-project/tree/4e9d86e182d9a4b969e86b12d72f227e4fd4fd09 |
NTXent | import torch
import torch.nn as nn
import torch.nn.functional as F
class NTXent(nn.Module):
def __init__(self, metric: 'str'='CosineSimilarity', temperature:
'float'=0.5, reduction: 'str'='mean'):
super().__init__()
if metric not in ['CosineSimilarity']:
raise ValueError('Unde... | 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... | Meteor-han/ReLMole | NTXent | false | 5,592 | [
"MIT"
] | 1 | ec8f2d3ec7b8edb6cd34aede36a980bab3dc35c2 | https://github.com/Meteor-han/ReLMole/tree/ec8f2d3ec7b8edb6cd34aede36a980bab3dc35c2 |
GlobalAttention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments
), 'Not ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MaxatTezekbayev/OpenNMT-py-lexical | GlobalAttention | false | 5,593 | [
"MIT"
] | 1 | 44182999b863fc4074d67e0281c5bdab19abddfe | https://github.com/MaxatTezekbayev/OpenNMT-py-lexical/tree/44182999b863fc4074d67e0281c5bdab19abddfe |
NetModel | import torch
import torch.nn.functional as F
import torch.utils.data.dataloader
class NetModel(torch.nn.Module):
def __init__(self):
super(NetModel, self).__init__()
self.hidden = torch.nn.Linear(28 * 28, 300)
self.output = torch.nn.Linear(300, 10)
def forward(self, x):
x = x... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data.datal... | Michaelzhouisnotwhite/Learning-Gan | NetModel | false | 5,594 | [
"MIT"
] | 1 | cf1cff1f2afba296489db55f5de9ebb8405feb0e | https://github.com/Michaelzhouisnotwhite/Learning-Gan/tree/cf1cff1f2afba296489db55f5de9ebb8405feb0e |
PairwiseLoss | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
class PairwiseLoss(nn.Module):
def __init__(self):
super(PairwiseLoss, self).__init__()
def forward(self, x, y):
diff = x - y
return torch.sum(diff * diff)
def get_inputs():
return [torch.rand([... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
assert_size_stride... | MinesNicaicai/large-scale-pointcloud-matching | PairwiseLoss | false | 5,595 | [
"MIT"
] | 1 | cfe140f2be1110ed75b6edd27538021e513a31c9 | https://github.com/MinesNicaicai/large-scale-pointcloud-matching/tree/cfe140f2be1110ed75b6edd27538021e513a31c9 |
MLP | import torch
from torch import nn
import torch.utils
class MLP(torch.nn.Module):
def __init__(self, input_dim, output_dim):
super(MLP, self).__init__()
self.d1 = torch.nn.Linear(input_dim, 32)
self.d2 = torch.nn.Linear(32, 16)
self.d3 = torch.nn.Linear(16, output_dim)
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MichaelLee-ceo/FedSAUC | MLP | false | 5,596 | [
"Apache-2.0"
] | 1 | 8c00008772213562ff6a07bf9fa92c3831713118 | https://github.com/MichaelLee-ceo/FedSAUC/tree/8c00008772213562ff6a07bf9fa92c3831713118 |
CNN_DropOut | import torch
from torch import nn
import torch.utils
class CNN_DropOut(torch.nn.Module):
"""
Recommended model by "Adaptive Federated Optimization" (https://arxiv.org/pdf/2003.00295.pdf)
Used for EMNIST experiments.
When `only_digits=True`, the summary of returned model is
```
Model:
_____... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | MichaelLee-ceo/FedSAUC | CNN_DropOut | false | 5,597 | [
"Apache-2.0"
] | 1 | 8c00008772213562ff6a07bf9fa92c3831713118 | https://github.com/MichaelLee-ceo/FedSAUC/tree/8c00008772213562ff6a07bf9fa92c3831713118 |
ContrastiveLoss | import torch
import torch.utils.data
import torch.nn.functional as F
import torch.nn.parallel
class ContrastiveLoss(torch.nn.Module):
"""
Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin=2.0):
super(Contra... | 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.utils.data
impo... | MinesNicaicai/large-scale-pointcloud-matching | ContrastiveLoss | false | 5,598 | [
"MIT"
] | 1 | cfe140f2be1110ed75b6edd27538021e513a31c9 | https://github.com/MinesNicaicai/large-scale-pointcloud-matching/tree/cfe140f2be1110ed75b6edd27538021e513a31c9 |
Attention | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
def forward(self, query, key, value, mask=None, dropout=None):
"""Compute 'Scaled Dot Product Attention'"""
d_k = query.size(-1)
scores = torch.matmul(query, key.transpose(-2, -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.... | Moymix/BERT-pytorch | Attention | false | 5,599 | [
"Apache-2.0"
] | 1 | f0b9c3ae53e05c00adcc761e0422e4222d8b5619 | https://github.com/Moymix/BERT-pytorch/tree/f0b9c3ae53e05c00adcc761e0422e4222d8b5619 |
VDSR_F64B6 | import torch
import torch.nn as nn
def load_param(model1_path, model2):
dict_param1 = torch.load(model1_path)
dict_param2 = dict(model2.named_parameters())
for name2 in dict_param2:
if name2 in dict_param1:
dict_param2[name2].data.copy_(dict_param1[name2].data)
model2.load_state_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MingSun-Tse/pytorch-vdsr | VDSR_F64B6 | false | 5,600 | [
"MIT"
] | 1 | 597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 | https://github.com/MingSun-Tse/pytorch-vdsr/tree/597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 |
SmallVDSR_16x | import torch
import torch.nn as nn
def load_param(model1_path, model2):
dict_param1 = torch.load(model1_path)
dict_param2 = dict(model2.named_parameters())
for name2 in dict_param2:
if name2 in dict_param1:
dict_param2[name2].data.copy_(dict_param1[name2].data)
model2.load_state_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MingSun-Tse/pytorch-vdsr | SmallVDSR_16x | false | 5,601 | [
"MIT"
] | 1 | 597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 | https://github.com/MingSun-Tse/pytorch-vdsr/tree/597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 |
Squash | import torch
import torch.nn as nn
class Squash(nn.Module):
def forward(self, x, dim=-1):
squared_norm = (x ** 2).sum(dim=dim, keepdim=True)
scale = squared_norm / (1 + squared_norm)
return scale * x / (squared_norm.sqrt() + 1e-08)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | MobtgZhang/MWMLNet | Squash | false | 5,602 | [
"MIT"
] | 1 | 125bb39935916b6b4be505c51cb6a04eb49b96d0 | https://github.com/MobtgZhang/MWMLNet/tree/125bb39935916b6b4be505c51cb6a04eb49b96d0 |
ResConnectionLayer | import math
import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""Construct a layernorm module (See citation for details)."""
def __init__(self, features, eps=1e-06):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(features))
self.b_2 = nn.Parameter(to... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | MobtgZhang/MWMLNet | ResConnectionLayer | false | 5,603 | [
"MIT"
] | 1 | 125bb39935916b6b4be505c51cb6a04eb49b96d0 | https://github.com/MobtgZhang/MWMLNet/tree/125bb39935916b6b4be505c51cb6a04eb49b96d0 |
AE | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
class AE(nn.Module):
def __init__(self):
super(AE, self).__init__()
self.conv1 = nn.Conv2d(1, 16, kernel_size=19, padding=9)
self.conv2 = nn.Conv2d(16, 4, kernel_size=15, padding=7)
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | Minauras/deepdefresneling | AE | false | 5,604 | [
"BSD-2-Clause"
] | 1 | e17168e9a8d322201998c73da54efbd334b0ffb9 | https://github.com/Minauras/deepdefresneling/tree/e17168e9a8d322201998c73da54efbd334b0ffb9 |
Lookahead | import torch
import torch.utils.data.distributed
import torch.nn as nn
import torch.nn.functional as F
class Lookahead(nn.Module):
def __init__(self, n_features, context):
super(Lookahead, self).__init__()
assert context > 0
self.context = context
self.n_features = n_features
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.utils.data.distributed
import torch.nn as nn
assert_size_stride = t... | MrXJC/deepspeech.pytorch | Lookahead | false | 5,605 | [
"MIT"
] | 1 | 6379c18d3f56cad8896a51d45166ea979423e0bf | https://github.com/MrXJC/deepspeech.pytorch/tree/6379c18d3f56cad8896a51d45166ea979423e0bf |
VDSR | import torch
import torch.nn as nn
def load_param(model1_path, model2):
dict_param1 = torch.load(model1_path)
dict_param2 = dict(model2.named_parameters())
for name2 in dict_param2:
if name2 in dict_param1:
dict_param2[name2].data.copy_(dict_param1[name2].data)
model2.load_state_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MingSun-Tse/pytorch-vdsr | VDSR | false | 5,606 | [
"MIT"
] | 1 | 597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 | https://github.com/MingSun-Tse/pytorch-vdsr/tree/597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 |
DepthwiseSeparableConv | import torch
import torch.nn.functional as F
import torch.nn as nn
class DepthwiseSeparableConv(nn.Module):
def __init__(self, in_ch, out_ch, k, bias=True):
super().__init__()
self.depthwise_conv = nn.Conv1d(in_channels=in_ch, out_channels=
in_ch, kernel_size=k, groups=in_ch, padding=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MobtgZhang/MWMLNet | DepthwiseSeparableConv | false | 5,607 | [
"MIT"
] | 1 | 125bb39935916b6b4be505c51cb6a04eb49b96d0 | https://github.com/MobtgZhang/MWMLNet/tree/125bb39935916b6b4be505c51cb6a04eb49b96d0 |
SFU | import torch
import torch.nn as nn
class SFU(nn.Module):
"""Semantic Fusion Unit
The ouput vector is expected to not only retrieve correlative information from fusion vectors,
but also retain partly unchange as the input vector
"""
def __init__(self, input_size, fusion_size):
super(SFU, s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | MobtgZhang/MWMLNet | SFU | false | 5,608 | [
"MIT"
] | 1 | 125bb39935916b6b4be505c51cb6a04eb49b96d0 | https://github.com/MobtgZhang/MWMLNet/tree/125bb39935916b6b4be505c51cb6a04eb49b96d0 |
Attention | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class Attention(nn.Module):
"""
Compute 'Scaled Dot Product Attention
"""
def forward(self, query, key, value, mask=None, dropout=None):
scores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(query
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | MobtgZhang/MWMLNet | Attention | false | 5,609 | [
"MIT"
] | 1 | 125bb39935916b6b4be505c51cb6a04eb49b96d0 | https://github.com/MobtgZhang/MWMLNet/tree/125bb39935916b6b4be505c51cb6a04eb49b96d0 |
Sharpen_Block | import torch
import numpy as np
import torch.nn as nn
class Sharpen_Block(nn.Module):
def __init__(self):
super(Sharpen_Block, self).__init__()
self.pad = nn.ReflectionPad2d((1, 1, 1, 1))
self.conv = nn.Conv2d(1, 1, 3, 1, 0, bias=False)
self.conv.weight = nn.Parameter(torch.from_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.triton_helpers import math as tl_math
import numpy ... | MingSun-Tse/pytorch-vdsr | Sharpen_Block | false | 5,610 | [
"MIT"
] | 1 | 597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 | https://github.com/MingSun-Tse/pytorch-vdsr/tree/597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 |
SmallVDSR_F8 | import torch
import torch.nn as nn
def load_param(model1_path, model2):
dict_param1 = torch.load(model1_path)
dict_param2 = dict(model2.named_parameters())
for name2 in dict_param2:
if name2 in dict_param1:
dict_param2[name2].data.copy_(dict_param1[name2].data)
model2.load_state_di... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | MingSun-Tse/pytorch-vdsr | SmallVDSR_F8 | false | 5,611 | [
"MIT"
] | 1 | 597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 | https://github.com/MingSun-Tse/pytorch-vdsr/tree/597bacb4ec7385c8cc6cdf91e26e64ef2e6808b7 |
Dense_block | import torch
import torch.nn as nn
class Dense_block(nn.Module):
""" This is the initial dense block as in the paper """
def __init__(self, in_channels, out_channels):
super(Dense_block, self).__init__()
self.Dense = torch.nn.Linear(in_channels, out_channels)
nn.init.xavier_uniform(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... | Mohanned-Elkholy/ResNet-GAN | Dense_block | false | 5,612 | [
"MIT"
] | 1 | 81b01294d8b5035131aee24d486e2cb879030832 | https://github.com/Mohanned-Elkholy/ResNet-GAN/tree/81b01294d8b5035131aee24d486e2cb879030832 |
MatrixTree | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
class MatrixTree(nn.Module):
"""Implementation of the matrix-tree theorem for computing marginals
of non-projective dependency parsing. This attention layer is used
in the paper "Learning Structured Text Representations"
:ci... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.cuda
import torch.distributed
assert_s... | MaxatTezekbayev/OpenNMT-py-lexical | MatrixTree | false | 5,613 | [
"MIT"
] | 1 | 44182999b863fc4074d67e0281c5bdab19abddfe | https://github.com/MaxatTezekbayev/OpenNMT-py-lexical/tree/44182999b863fc4074d67e0281c5bdab19abddfe |
RandomShiftsAug | import torch
import torch.nn as nn
import torch.nn.functional as F
class RandomShiftsAug(nn.Module):
def __init__(self, pad):
super().__init__()
self.pad = pad
def forward(self, x):
x = x.float()
n, _c, h, w = x.size()
assert h == w
padding = tuple([self.pad] ... | import torch
from torch import device
import triton
import triton.language 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._d... | MishaLaskin/url_benchmark | RandomShiftsAug | false | 5,614 | [
"MIT"
] | 1 | a81aed0a0aec3a7dad83d930e54d480f97cf535d | https://github.com/MishaLaskin/url_benchmark/tree/a81aed0a0aec3a7dad83d930e54d480f97cf535d |
FeedForwardNetwork | import math
import torch
import torch.nn as nn
class GELU(nn.Module):
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x +
0.044715 * torch.pow(x, 3))))
class FeedForwardNetwork(nn.Module):
def __init__(self, in_dim, hid_dim) ->None:
super().__i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
import ... | MobtgZhang/MWMLNet | FeedForwardNetwork | false | 5,615 | [
"MIT"
] | 1 | 125bb39935916b6b4be505c51cb6a04eb49b96d0 | https://github.com/MobtgZhang/MWMLNet/tree/125bb39935916b6b4be505c51cb6a04eb49b96d0 |
BERTNextSentence | import torch
import torch.nn as nn
class BERTNextSentence(nn.Module):
def __init__(self, hidden):
super().__init__()
self.linear = nn.Linear(hidden, 2)
self.softmax = nn.LogSoftmax(dim=-1)
def forward(self, x):
return self.softmax(self.linear(x[:, 0]))
def get_inputs():
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Moymix/BERT-pytorch | BERTNextSentence | false | 5,616 | [
"Apache-2.0"
] | 1 | f0b9c3ae53e05c00adcc761e0422e4222d8b5619 | https://github.com/Moymix/BERT-pytorch/tree/f0b9c3ae53e05c00adcc761e0422e4222d8b5619 |
Upsample2d | from _paritybench_helpers import _mock_config
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def _setup_kernel(k):
k = np.asarray(k, dtype=np.float32)
if k.ndim == 1:
k = np.outer(k, k)
k /= np.sum(k)
assert k.ndim == 2
assert k.shape[0] == k.shape[1]... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | Iceland-Leo/StyleGAN2_PyTorch | Upsample2d | false | 5,617 | [
"MIT"
] | 1 | 3621f5e4ba1c7fde7e2fae1f4700d050656a0b02 | https://github.com/Iceland-Leo/StyleGAN2_PyTorch/tree/3621f5e4ba1c7fde7e2fae1f4700d050656a0b02 |
TanhGaussianDistParams | import torch
from typing import Tuple
import torch.nn as nn
import torch.nn.functional as F
from typing import Callable
from torch.distributions import Normal
def identity(x: 'torch.Tensor') ->torch.Tensor:
"""Return input without any change."""
return x
def init_layer_uniform(layer: 'nn.Linear', init_w: 'f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MrSyee/rl_algorithms | TanhGaussianDistParams | false | 5,618 | [
"MIT"
] | 1 | 5b5276982032f8a8a614b9466849b7b3ef245b3e | https://github.com/MrSyee/rl_algorithms/tree/5b5276982032f8a8a614b9466849b7b3ef245b3e |
DuelingMLP | import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Callable
def identity(x: 'torch.Tensor') ->torch.Tensor:
"""Return input without any change."""
return x
def init_layer_uniform(layer: 'nn.Linear', init_w: 'float'=0.003) ->nn.Linear:
"""Init uniform parameters on 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
import torch.nn as nn
import ... | MrSyee/rl_algorithms | DuelingMLP | false | 5,619 | [
"MIT"
] | 1 | 5b5276982032f8a8a614b9466849b7b3ef245b3e | https://github.com/MrSyee/rl_algorithms/tree/5b5276982032f8a8a614b9466849b7b3ef245b3e |
RollLayer | import torch
class RollLayer(torch.nn.Module):
"""
Layer which shifts the dimensions for performing the coupling permutations
on different dimensions
"""
def __init__(self, shift):
super(RollLayer, self).__init__()
self.shift = shift
def forward(self, x):
retu... | 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... | NGoetz/NF | RollLayer | false | 5,620 | [
"MIT"
] | 1 | 935886db48f4675db1a2c42f7c264b12d5014ed8 | https://github.com/NGoetz/NF/tree/935886db48f4675db1a2c42f7c264b12d5014ed8 |
CocoLinear | import torch
import torch.nn as nn
import torch.nn.functional as F
class CocoLinear(nn.Module):
"""Congenerous Cosine linear module (for CoCo loss)
Parameters
----------
nfeat : int
Embedding dimension
nclass : int
Number of classes
alpha : float
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Mymoza/pyannote-audio | CocoLinear | false | 5,621 | [
"MIT"
] | 1 | 9ac612ee6b854a1a65c3d8992856550304969674 | https://github.com/Mymoza/pyannote-audio/tree/9ac612ee6b854a1a65c3d8992856550304969674 |
SelfAttnMatch | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class GELU(nn.Module):
def forward(self, x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x +
0.044715 * torch.pow(x, 3))))
class SelfAttnMatch(nn.Module):
"""Given sequences X and Y, match seq... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MobtgZhang/MWMLNet | SelfAttnMatch | false | 5,622 | [
"MIT"
] | 1 | 125bb39935916b6b4be505c51cb6a04eb49b96d0 | https://github.com/MobtgZhang/MWMLNet/tree/125bb39935916b6b4be505c51cb6a04eb49b96d0 |
Merge | import torch
import torch.nn as nn
import torch.optim
class Merge(nn.Module):
def __init__(self, hidden_size, embedding_size, dropout=0.5):
super(Merge, self).__init__()
self.embedding_size = embedding_size
self.hidden_size = hidden_size
self.em_dropout = nn.Dropout(dropout)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Myeongchan-Kim/SVAMP | Merge | false | 5,623 | [
"MIT"
] | 1 | 9ff9ad471a61aa390199df4b99beb3b654f5c943 | https://github.com/Myeongchan-Kim/SVAMP/tree/9ff9ad471a61aa390199df4b99beb3b654f5c943 |
MultiLabelSoftMarginLoss | import torch
from torch.nn.modules.loss import _WeightedLoss
import torch.nn.parallel
import torch.optim
import torch.utils.data
def binary_cross_entropy(input, target, eps=1e-10):
"""if not (target.size() == input.size()):
warnings.warn("Using a target size ({}) that is different to the input size ({}) i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn.modules.loss import _WeightedLoss
import torch.nn.parallel
... | NIRVANALAN/microscopy | MultiLabelSoftMarginLoss | false | 5,624 | [
"MIT"
] | 1 | 4e48e51ebb11d8af44b71e8b497cc5da3b097c9b | https://github.com/NIRVANALAN/microscopy/tree/4e48e51ebb11d8af44b71e8b497cc5da3b097c9b |
Reshape | import torch
class Reshape(torch.nn.Module):
"""
Reshaping layer
"""
def __init__(self, shapes1, shapes2):
super(Reshape, self).__init__()
self.shapes = shapes1, shapes2
def forward(self, tensor):
return torch.reshape(tensor.clone(), (tensor.shape[0], self.shapes[
... | 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... | NGoetz/NF | Reshape | false | 5,625 | [
"MIT"
] | 1 | 935886db48f4675db1a2c42f7c264b12d5014ed8 | https://github.com/NGoetz/NF/tree/935886db48f4675db1a2c42f7c264b12d5014ed8 |
Lift | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import kaiming_normal
def ZeroInitializer(param):
shape = param.size()
init = np.zeros(shape).astype(np.float32)
param.data.set_(torch.from_numpy(init))
def Linear(initializer=kaiming_normal, bias_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.triton_helpers import libdevice
import numpy as np
... | NLP-Discourse-SoochowU/rst_dp2019Bottom2Up | Lift | false | 5,626 | [
"MIT"
] | 1 | ac1624127c9c8a3301685193ac8239357e01f6ca | https://github.com/NLP-Discourse-SoochowU/rst_dp2019Bottom2Up/tree/ac1624127c9c8a3301685193ac8239357e01f6ca |
Attention | from torch.nn import Module
import torch
from torch.nn.modules import Module
from torch.nn.functional import softmax
from torch.nn import Linear
def neginf(dtype):
"""
Return a representable finite
number near -inf for a dtype.
"""
if dtype is torch.float16:
return -65504
else:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Mrpatekful/supervised-translation | Attention | false | 5,627 | [
"MIT"
] | 1 | d03db6a0fc25900fd42b8057a12adad0b8d025f8 | https://github.com/Mrpatekful/supervised-translation/tree/d03db6a0fc25900fd42b8057a12adad0b8d025f8 |
GCN | from torch.nn import Module
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.optim
class GraphConvolution(Module):
"""
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
i... | Myeongchan-Kim/SVAMP | GCN | false | 5,628 | [
"MIT"
] | 1 | 9ff9ad471a61aa390199df4b99beb3b654f5c943 | https://github.com/Myeongchan-Kim/SVAMP/tree/9ff9ad471a61aa390199df4b99beb3b654f5c943 |
Autoencoder | import torch
import torch.nn as nn
import torch.nn.functional as F
def Conv(in_channels, out_channels):
return nn.Conv2d(in_channels, out_channels, 3, padding=1)
def concat(a, b):
return torch.cat((a, b), 1)
def pool(x):
return F.max_pool2d(x, 2, 2)
def relu(x):
return F.relu(x, inplace=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 ... | LongerVision/oidn | Autoencoder | false | 5,629 | [
"Apache-2.0"
] | 1 | 2f9e59f8b747b217f78c5c274f4f2bff347a03a7 | https://github.com/LongerVision/oidn/tree/2f9e59f8b747b217f78c5c274f4f2bff347a03a7 |
MLP | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import kaiming_normal
def ZeroInitializer(param):
shape = param.size()
init = np.zeros(shape).astype(np.float32)
param.data.set_(torch.from_numpy(init))
def Linear(initializer=kaiming_normal, bias_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.... | NLP-Discourse-SoochowU/rst_dp2019Bottom2Up | MLP | false | 5,630 | [
"MIT"
] | 1 | ac1624127c9c8a3301685193ac8239357e01f6ca | https://github.com/NLP-Discourse-SoochowU/rst_dp2019Bottom2Up/tree/ac1624127c9c8a3301685193ac8239357e01f6ca |
PEM | from _paritybench_helpers import _mock_config
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import init
import torch.nn.parallel
class PEM(torch.nn.Module):
def __init__(self, opt):
super(PEM, self).__init__()
self.feat_dim = opt['pem_feat_dim']
self.bat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | NEUdeep/BSN | PEM | false | 5,631 | [
"MIT"
] | 1 | e987cc159976ebe54027b562d833a92a5aadf864 | https://github.com/NEUdeep/BSN/tree/e987cc159976ebe54027b562d833a92a5aadf864 |
FocalLoss2d | import torch
from torch import nn
class FocalLoss2d(nn.Module):
def __init__(self, gamma=2, ignore_index=255):
super().__init__()
self.gamma = gamma
self.ignore_index = ignore_index
def forward(self, outputs, targets):
outputs = outputs.contiguous()
targets = 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Nareshvrao/Understanding-Clouds-from-Satellite-Images | FocalLoss2d | false | 5,632 | [
"MIT"
] | 1 | 14c5e1f15e803e9638d7a3fa8b9e0d929a6015b6 | https://github.com/Nareshvrao/Understanding-Clouds-from-Satellite-Images/tree/14c5e1f15e803e9638d7a3fa8b9e0d929a6015b6 |
LayerNormalization | import torch
import torch.nn as nn
class LayerNormalization(nn.Module):
def __init__(self, hidden_size, eps=1e-05):
super(LayerNormalization, self).__init__()
self.eps = eps
self.a2 = nn.Parameter(torch.ones(1, hidden_size), requires_grad=True)
self.b2 = nn.Parameter(torch.zeros(1... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | NLP-Discourse-SoochowU/rst_dp2019Bottom2Up | LayerNormalization | false | 5,633 | [
"MIT"
] | 1 | ac1624127c9c8a3301685193ac8239357e01f6ca | https://github.com/NLP-Discourse-SoochowU/rst_dp2019Bottom2Up/tree/ac1624127c9c8a3301685193ac8239357e01f6ca |
TEM | from _paritybench_helpers import _mock_config
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import init
import torch.nn.parallel
class TEM(torch.nn.Module):
def __init__(self, opt):
super(TEM, self).__init__()
self.feat_dim = opt['tem_feat_dim']
self.tem... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | NEUdeep/BSN | TEM | false | 5,634 | [
"MIT"
] | 1 | e987cc159976ebe54027b562d833a92a5aadf864 | https://github.com/NEUdeep/BSN/tree/e987cc159976ebe54027b562d833a92a5aadf864 |
WeightedBCE | import torch
from torch import nn
import torch.nn.functional as F
class WeightedBCE(nn.Module):
def __init__(self, weights=None):
super(WeightedBCE, self).__init__()
self.weights = weights
def forward(self, logit, truth):
batch_size, num_class = truth.shape
logit = logit.view... | 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 ... | Nareshvrao/Understanding-Clouds-from-Satellite-Images | WeightedBCE | false | 5,635 | [
"MIT"
] | 1 | 14c5e1f15e803e9638d7a3fa8b9e0d929a6015b6 | https://github.com/Nareshvrao/Understanding-Clouds-from-Satellite-Images/tree/14c5e1f15e803e9638d7a3fa8b9e0d929a6015b6 |
CNNCifar | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.nn.functional as F
class CNNCifar(nn.Module):
def __init__(self, args):
super(CNNCifar, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
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
from torch._inductor.runtime.... | Ilcyb/Federated-Learning-PyTorch | CNNCifar | false | 5,636 | [
"MIT"
] | 1 | 4830a89ffa1ac0ad0e52a4551338532cfb4ca210 | https://github.com/Ilcyb/Federated-Learning-PyTorch/tree/4830a89ffa1ac0ad0e52a4551338532cfb4ca210 |
SoftDiceLoss | import torch
from torch import nn
import torch.nn.functional as F
class SoftDiceLoss(nn.Module):
def __init__(self):
super(SoftDiceLoss, self).__init__()
def forward(self, logits, targets):
eps = 1e-09
num = targets.size(0)
probs = F.sigmoid(logits)
m1 = probs.view(nu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | Nareshvrao/Understanding-Clouds-from-Satellite-Images | SoftDiceLoss | false | 5,637 | [
"MIT"
] | 1 | 14c5e1f15e803e9638d7a3fa8b9e0d929a6015b6 | https://github.com/Nareshvrao/Understanding-Clouds-from-Satellite-Images/tree/14c5e1f15e803e9638d7a3fa8b9e0d929a6015b6 |
SoftDiceLoss_binary | import torch
from torch import nn
import torch.nn.functional as F
class SoftDiceLoss_binary(nn.Module):
def __init__(self):
super(SoftDiceLoss_binary, self).__init__()
def forward(self, input, target):
smooth = 0.01
batch_size = input.size(0)
input = F.sigmoid(input).view(bat... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | Nareshvrao/Understanding-Clouds-from-Satellite-Images | SoftDiceLoss_binary | false | 5,638 | [
"MIT"
] | 1 | 14c5e1f15e803e9638d7a3fa8b9e0d929a6015b6 | https://github.com/Nareshvrao/Understanding-Clouds-from-Satellite-Images/tree/14c5e1f15e803e9638d7a3fa8b9e0d929a6015b6 |
Atten | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.nn.functional as F
class Atten(nn.Module):
def __init__(self, config):
super(Atten, self).__init__()
hidden_size = config.hidden_size
classifier_dropout = (config.classifier_dropout if config.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | NTDXYG/EL-CodeBert | Atten | false | 5,639 | [
"MIT"
] | 1 | 62a2364db567f8887a339c40e2c7f7807bedfd50 | https://github.com/NTDXYG/EL-CodeBert/tree/62a2364db567f8887a339c40e2c7f7807bedfd50 |
ActorCritic | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.distributions import Categorical
class ActorCritic(nn.Module):
def __init__(self):
super().__init__()
self.affine1 = nn.Linear(4, 128)
self.action_head = nn.Linear(128, 2)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | NeilWangziyu/torch_light | ActorCritic | false | 5,640 | [
"MIT"
] | 1 | daf8fd62f57885cf182f1b3edc3152156d229ef3 | https://github.com/NeilWangziyu/torch_light/tree/daf8fd62f57885cf182f1b3edc3152156d229ef3 |
NlpCrossEntropy | import torch
import torch.nn as nn
class NlpCrossEntropy(nn.Module):
def __init__(self):
super().__init__()
def forward(self, props, tgt):
tgt_props = props.gather(2, tgt.unsqueeze(2)).squeeze()
mask = (tgt > 0).float()
return -(tgt_props * mask).sum() / mask.sum()
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | NeilWangziyu/torch_light | NlpCrossEntropy | false | 5,641 | [
"MIT"
] | 1 | daf8fd62f57885cf182f1b3edc3152156d229ef3 | https://github.com/NeilWangziyu/torch_light/tree/daf8fd62f57885cf182f1b3edc3152156d229ef3 |
SelfCriticCriterion | import torch
import torch.nn as nn
class SelfCriticCriterion(nn.Module):
def __init__(self):
super().__init__()
def forward(self, props, s_words, tgt, advantage):
advantage = (advantage - advantage.mean()) / advantage.std().clamp(min
=1e-08)
s_props = props.gather(2, s_wo... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | NeilWangziyu/torch_light | SelfCriticCriterion | false | 5,642 | [
"MIT"
] | 1 | daf8fd62f57885cf182f1b3edc3152156d229ef3 | https://github.com/NeilWangziyu/torch_light/tree/daf8fd62f57885cf182f1b3edc3152156d229ef3 |
LeastSquaresGenerativeAdversarialLoss | import torch
import torch.nn as nn
import torch.utils.data
class LeastSquaresGenerativeAdversarialLoss(nn.Module):
"""
Loss for `Least Squares Generative Adversarial Network (LSGAN) <https://arxiv.org/abs/1611.04076>`_
Args:
reduction (str, optional): Specifies the reduction to apply to the outpu... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dynamo.guard... | Neronjust2017/TransferBed | LeastSquaresGenerativeAdversarialLoss | false | 5,643 | [
"MIT"
] | 1 | eaa703a4bc10eaf6216fe1394cd272f6e75489e2 | https://github.com/Neronjust2017/TransferBed/tree/eaa703a4bc10eaf6216fe1394cd272f6e75489e2 |
LayerNorm | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
super().__init__()
self.eps = eps
self.weight = nn.Parameter(torch.ones(hidden_size))
self.bias = nn.Parameter(torch.zeros(hidden_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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | NeilWangziyu/torch_light | LayerNorm | false | 5,644 | [
"MIT"
] | 1 | daf8fd62f57885cf182f1b3edc3152156d229ef3 | https://github.com/NeilWangziyu/torch_light/tree/daf8fd62f57885cf182f1b3edc3152156d229ef3 |
VanillaGenerativeAdversarialLoss | import torch
import torch.nn as nn
import torch.utils.data
class VanillaGenerativeAdversarialLoss(nn.Module):
"""
Loss for `Vanilla Generative Adversarial Network <https://arxiv.org/abs/1406.2661>`_
Args:
reduction (str, optional): Specifies the reduction to apply to the output:
``'none... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Neronjust2017/TransferBed | VanillaGenerativeAdversarialLoss | false | 5,645 | [
"MIT"
] | 1 | eaa703a4bc10eaf6216fe1394cd272f6e75489e2 | https://github.com/Neronjust2017/TransferBed/tree/eaa703a4bc10eaf6216fe1394cd272f6e75489e2 |
QMaxPooling2d | from torch.autograd import Function
import torch
import torch.nn as nn
import torch.nn.functional as F
def calcScaleZeroPoint(min_val, max_val, num_bits=8):
qmin = 0.0
qmax = 2.0 ** num_bits - 1.0
scale = float((max_val - min_val) / (qmax - qmin))
zero_point = qmax - max_val / scale
if zero_point ... | 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.autograd import Function
import torch.nn as nn
import torch.nn.functional as F... | NeekHua/quantization_pytorch_demo | QMaxPooling2d | false | 5,646 | [
"Apache-2.0"
] | 1 | 930b03de977e48c0652d3801c710510ffc40aa38 | https://github.com/NeekHua/quantization_pytorch_demo/tree/930b03de977e48c0652d3801c710510ffc40aa38 |
AdaptiveFeatureNorm | import torch
import torch.nn as nn
import torch.utils.data
class AdaptiveFeatureNorm(nn.Module):
"""
The `Stepwise Adaptive Feature Norm loss (ICCV 2019) <https://arxiv.org/pdf/1811.07456v2.pdf>`_
Instead of using restrictive scalar R to match the corresponding feature norm, Stepwise Adaptive Feature Nor... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dy... | Neronjust2017/TransferBed | AdaptiveFeatureNorm | false | 5,647 | [
"MIT"
] | 1 | eaa703a4bc10eaf6216fe1394cd272f6e75489e2 | https://github.com/Neronjust2017/TransferBed/tree/eaa703a4bc10eaf6216fe1394cd272f6e75489e2 |
ANet | import torch
import torch.nn as nn
import torch.utils.data
class ANet(nn.Module):
def __init__(self, in_feature):
super(ANet, self).__init__()
self.layer = nn.Linear(in_feature, 1)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
x = self.layer(x)
x = self.sigmoid(x)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | Neronjust2017/TransferBed | ANet | false | 5,648 | [
"MIT"
] | 1 | eaa703a4bc10eaf6216fe1394cd272f6e75489e2 | https://github.com/Neronjust2017/TransferBed/tree/eaa703a4bc10eaf6216fe1394cd272f6e75489e2 |
Auto_Encoder_Model | import torch
import torch.nn as nn
import torch.nn.functional as F
class Auto_Encoder_Model(nn.Module):
def __init__(self):
super(Auto_Encoder_Model, self).__init__()
self.conv1 = nn.Conv2d(1, 64, padding=1, kernel_size=3)
self.max_pool1 = nn.MaxPool2d(2)
self.conv2 = nn.Conv2d(64... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | NNDEV1/QandMedicAid | Auto_Encoder_Model | false | 5,649 | [
"MIT"
] | 1 | f229f7dcf192fd79715eba07a2e5121a13c7a571 | https://github.com/NNDEV1/QandMedicAid/tree/f229f7dcf192fd79715eba07a2e5121a13c7a571 |
AtteMatchLay | import torch
import torch.nn as nn
from torch.nn.functional import cosine_similarity
def multi_perspective_expand_for_2D(in_tensor, decompose_params):
"""
Return: [batch_size, decompse_dim, dim]
"""
in_tensor = in_tensor.unsqueeze(1)
decompose_params = decompose_params.unsqueeze(0)
return torc... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | NeilWangziyu/torch_light | AtteMatchLay | false | 5,650 | [
"MIT"
] | 1 | daf8fd62f57885cf182f1b3edc3152156d229ef3 | https://github.com/NeilWangziyu/torch_light/tree/daf8fd62f57885cf182f1b3edc3152156d229ef3 |
ChanNorm | import torch
from torch import nn
class ChanNorm(nn.Module):
def __init__(self, dim, eps=1e-05):
super().__init__()
self.eps = eps
self.g = nn.Parameter(torch.ones(1, dim, 1, 1))
self.b = nn.Parameter(torch.zeros(1, dim, 1, 1))
def forward(self, x):
std = torch.var(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 libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Netruk44/stylegan2-deepspeed | ChanNorm | false | 5,651 | [
"MIT"
] | 1 | d6efe64a2f8cdfa9477d2229652c5e1a2348d52d | https://github.com/Netruk44/stylegan2-deepspeed/tree/d6efe64a2f8cdfa9477d2229652c5e1a2348d52d |
Out | import torch
import torch.nn as nn
class Out(nn.Module):
def __init__(self, in_channels, out_channels):
super().__init__()
self.conv = nn.Conv3d(in_channels, out_channels, kernel_size=1)
def forward(self, x):
return self.conv(x)
def get_inputs():
return [torch.rand([4, 4, 4, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Neuro-Vision/NeuroVision | Out | false | 5,652 | [
"MIT"
] | 1 | 3da7bcc671b23693e979218e3acabb7098b77187 | https://github.com/Neuro-Vision/NeuroVision/tree/3da7bcc671b23693e979218e3acabb7098b77187 |
Critic | import torch
import torch.nn as nn
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, input_size):
super(Critic, self).__init__()
self.fc1 = nn.Linear(input_size, 200)
self.output = nn.Linear(200, 1)
def forward(self, x):
x = F.relu(self.fc1(x))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | NeuralFlux/rl-analysis | Critic | false | 5,653 | [
"MIT"
] | 1 | bb45e1f8bb9da4683cce4bd0a5e687770a4005e2 | https://github.com/NeuralFlux/rl-analysis/tree/bb45e1f8bb9da4683cce4bd0a5e687770a4005e2 |
MockAccuracy | import torch
class _Metric(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor'):
raise NotImplementedError()
class Accuracy(_Metric):
def __init__(self):
super().__init__()
def forward(self, input: 'torc... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | NestLakerJasonLIN/MusicTransformer-pytorch | MockAccuracy | false | 5,654 | [
"MIT"
] | 1 | 5f183374833ff6b7e17f3a24e3594dedd93a5fe5 | https://github.com/NestLakerJasonLIN/MusicTransformer-pytorch/tree/5f183374833ff6b7e17f3a24e3594dedd93a5fe5 |
ACNetwork | import torch
import torch.nn as nn
import torch.nn.functional as F
class ACNetwork(nn.Module):
def __init__(self, input_size, action_size):
super(ACNetwork, self).__init__()
self.fc1 = nn.Linear(input_size, 256)
self.fc2 = nn.Linear(256, 256)
self.logits_p = nn.Linear(256, action_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | NeuralFlux/rl-analysis | ACNetwork | false | 5,655 | [
"MIT"
] | 1 | bb45e1f8bb9da4683cce4bd0a5e687770a4005e2 | https://github.com/NeuralFlux/rl-analysis/tree/bb45e1f8bb9da4683cce4bd0a5e687770a4005e2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.