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 |
|---|---|---|---|---|---|---|---|---|---|---|
DiceLoss | import torch
from torch import nn
from torch.autograd import Variable
def flatten(tensor):
"""Flattens a given tensor such that the channel axis is first.
The shapes are transformed as follows:
(N, C, D, H, W) -> (C, N * D * H * W)
"""
C = tensor.size(1)
axis_order = (1, 0) + tuple(range(2,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | zzz123xyz/pytorch-3dunet | DiceLoss | false | 11,039 | [
"MIT"
] | 0 | 5bab6968b23cff5c6ae456b343285bfa9b104294 | https://github.com/zzz123xyz/pytorch-3dunet/tree/5bab6968b23cff5c6ae456b343285bfa9b104294 |
RPN | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
def conv(in_channels, out_channels, kernel_size=3, padding=1, bn=True,
dilation=1, stride=1, relu=True, bias=True):
modules = [nn.Conv2d(in_channels, out_channels, kernel_size, str... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | vadimadr/openvino_training_extensions | RPN | false | 11,040 | [
"Apache-2.0"
] | 0 | 5d64b8423c8eb7b374ed629fad938359d34a07d2 | https://github.com/vadimadr/openvino_training_extensions/tree/5d64b8423c8eb7b374ed629fad938359d34a07d2 |
CGRU_cell | import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as f
from math import sqrt as sqrt
from itertools import product as product
class CGRU_cell(nn.Module):
"""Initialize a basic Conv GRU cell.
Args:
filter_size: int that is the height and width of the filter... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | zhujiagang/realtime-refined-random | CGRU_cell | false | 11,041 | [
"MIT"
] | 0 | 3aa8169049ab8be8b1ea5a78bbe9b89ac6c15593 | https://github.com/zhujiagang/realtime-refined-random/tree/3aa8169049ab8be8b1ea5a78bbe9b89ac6c15593 |
ResBlockWithFusedBN | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
class ResBlockWithFusedBN(nn.Module):
""" Bottleneck Residual Block """
def __init__(self, inplanes, outplanes, innerplanes, stride=1, dilation
=1, group=1, stride_1x1=True):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | vadimadr/openvino_training_extensions | ResBlockWithFusedBN | false | 11,042 | [
"Apache-2.0"
] | 0 | 5d64b8423c8eb7b374ed629fad938359d34a07d2 | https://github.com/vadimadr/openvino_training_extensions/tree/5d64b8423c8eb7b374ed629fad938359d34a07d2 |
BertSelfOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.onnx
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, 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
from torch import n... | xerothermic/examples | BertSelfOutput | false | 11,043 | [
"MIT"
] | 0 | d9d0ad02bac27fc483079d27c86b54145e45f81b | https://github.com/xerothermic/examples/tree/d9d0ad02bac27fc483079d27c86b54145e45f81b |
CenterLoss | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
class CenterLoss(nn.Module):
"""Implements the Center loss from https://ydwen.github.io/papers/WenECCV16.pdf"""
def __init__(self, num_classes, embed_size, cos_dist=True):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
from to... | vadimadr/openvino_training_extensions | CenterLoss | false | 11,044 | [
"Apache-2.0"
] | 0 | 5d64b8423c8eb7b374ed629fad938359d34a07d2 | https://github.com/vadimadr/openvino_training_extensions/tree/5d64b8423c8eb7b374ed629fad938359d34a07d2 |
spatial_attn_layer | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class BasicConv(nn.Module):
def __init__(self, in_planes, out_planes, kernel_size, stride=1,
padding=0, dilation=1, groups=1, relu=True, bn=False, bias=False):
super(BasicConv, self).__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | zhanzhibingshang/deblurganv2_mirnet | spatial_attn_layer | false | 11,045 | [
"BSD-3-Clause"
] | 0 | 12fcc94ee0ff33335c557cf46a776a13cae3804b | https://github.com/zhanzhibingshang/deblurganv2_mirnet/tree/12fcc94ee0ff33335c557cf46a776a13cae3804b |
FocalDiceLoss | import torch
import torch.nn as nn
class FocalDiceLoss(nn.Module):
def __init__(self, gamma=2.0):
super().__init__()
self.gamma = gamma
def forward(self, score, target):
target = target.float()
smooth = 1e-06
intersect = torch.sum(score * target)
y_sum = 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 libdevice
import torch.nn as nn
assert... | xuyangcao/AttD2UNet | FocalDiceLoss | false | 11,046 | [
"MIT"
] | 0 | b76ed8104a4183140b3cbd7f9671ca99d36e3b3e | https://github.com/xuyangcao/AttD2UNet/tree/b76ed8104a4183140b3cbd7f9671ca99d36e3b3e |
FocalTiLoss | import torch
import torch.nn as nn
class FocalTiLoss(nn.Module):
def __init__(self, alpha=0.7, beta=0.4, gamma=0.75):
super().__init__()
self.alpha = alpha
self.beta = beta
self.gamma = gamma
self.eps = 1e-06
def forward(self, output, target):
output = output.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | xuyangcao/AttD2UNet | FocalTiLoss | false | 11,047 | [
"MIT"
] | 0 | b76ed8104a4183140b3cbd7f9671ca99d36e3b3e | https://github.com/xuyangcao/AttD2UNet/tree/b76ed8104a4183140b3cbd7f9671ca99d36e3b3e |
attention | import torch
import torch.utils
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class attention(nn.Module):
def __init__(self, input_channels, map_size):
super(attention, self).__init__()
self.pool = nn.AvgPool... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
import tor... | yaowenlong/clique | attention | false | 11,048 | [
"MIT"
] | 0 | a9814ef643f7dac6080cebf76ab804d942c9cd8e | https://github.com/yaowenlong/clique/tree/a9814ef643f7dac6080cebf76ab804d942c9cd8e |
Attention | import math
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data.distributed
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class Atten... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xurantju/densecap | Attention | false | 11,049 | [
"BSD-3-Clause"
] | 0 | 2e58501e453bf98b9cc892e5b64997f5c1dfc808 | https://github.com/xurantju/densecap/tree/2e58501e453bf98b9cc892e5b64997f5c1dfc808 |
MultiHead | import math
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data.distributed
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class Atten... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xurantju/densecap | MultiHead | false | 11,050 | [
"BSD-3-Clause"
] | 0 | 2e58501e453bf98b9cc892e5b64997f5c1dfc808 | https://github.com/xurantju/densecap/tree/2e58501e453bf98b9cc892e5b64997f5c1dfc808 |
CosineBasisLinear | import torch
import numpy as np
from torch import nn
def cosine_basis_functions(x, n_basis_functions=64):
"""Cosine basis functions used to embed quantile thresholds.
Args:
x (torch.Tensor): Input.
n_basis_functions (int): Number of cosine basis functions.
Returns:
ndarray: Embed... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | tarokiritani/pfrl | CosineBasisLinear | false | 11,051 | [
"MIT"
] | 0 | 284ed1f43b32654a2ec1569b16a0f6b9acbd5e79 | https://github.com/tarokiritani/pfrl/tree/284ed1f43b32654a2ec1569b16a0f6b9acbd5e79 |
EncoderLayer | import math
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.data.distributed
def matmul(x, y):
if x.dim() == y.dim():
return x @ y
if x.dim() == y.dim() - 1:
return (x.unsqueeze(-2) @ y).squeeze(-2)
return (x @ y.unsqueeze(-2)).squeeze(-2)
class FeedF... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xurantju/densecap | EncoderLayer | false | 11,052 | [
"BSD-3-Clause"
] | 0 | 2e58501e453bf98b9cc892e5b64997f5c1dfc808 | https://github.com/xurantju/densecap/tree/2e58501e453bf98b9cc892e5b64997f5c1dfc808 |
BertOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
import torch.utils.data
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).__ini... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | zdxdsw/WebQA_VLP | BertOutput | false | 11,053 | [
"Apache-2.0"
] | 0 | 443bcd7e9b36db47e2ab4502abaaa3724800f394 | https://github.com/zdxdsw/WebQA_VLP/tree/443bcd7e9b36db47e2ab4502abaaa3724800f394 |
CNN | import torch
from torch import nn
import torch.nn.functional as F
class CNN(nn.Module):
def __init__(self, last_layer_channels):
super().__init__()
self.conv1 = nn.Conv2d(1, 32, (3, 3), padding='same')
self.conv2 = nn.Conv2d(32, 32, (3, 3), padding='same')
self.pool1 = nn.MaxPool2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | zitkat/transformer-HTR | CNN | false | 11,054 | [
"Apache-2.0"
] | 0 | fa14dc99f1050c022cd54bc82abe9bc8dbfbc95a | https://github.com/zitkat/transformer-HTR/tree/fa14dc99f1050c022cd54bc82abe9bc8dbfbc95a |
CCCLoss | import torch
import torch.nn as nn
class CCCLoss(nn.Module):
"""CCC loss for VA regression
"""
def __init__(self, reduction='mean', loss_weight=1.0):
super().__init__()
self.reduction = reduction
self.loss_weight = loss_weight
def get_name(self):
return 'CCC_loss'
... | 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... | youqingxiaozhua/ABAW3 | CCCLoss | false | 11,055 | [
"Apache-2.0"
] | 0 | 51ab58ab311ecd6603a8485a45af0dcc39880e69 | https://github.com/youqingxiaozhua/ABAW3/tree/51ab58ab311ecd6603a8485a45af0dcc39880e69 |
Unet | import torch
import torch.nn as nn
class ConvBlock(nn.Module):
def __init__(self, in_channels, out_channels, dropout=False, norm=
'batch', residual=True, activation='leakyrelu', transpose=False):
super(ConvBlock, self).__init__()
self.dropout = dropout
self.residual = residual
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | tim-vdl/noise2self | Unet | false | 11,056 | [
"MIT"
] | 0 | 2cf10d20d988dc7b6c1278150f170aa3e3335b28 | https://github.com/tim-vdl/noise2self/tree/2cf10d20d988dc7b6c1278150f170aa3e3335b28 |
MSELoss | import torch
import torch.nn as nn
class MSELoss(nn.Module):
"""MSE loss.
Args:
reduction (str): The method used to reduce the loss.
Options are "none", "mean" and "sum". Defaults to 'mean'.
loss_weight (float): Weight of the loss. Defaults to 1.0.
"""
def __init__(self,... | 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... | youqingxiaozhua/ABAW3 | MSELoss | false | 11,057 | [
"Apache-2.0"
] | 0 | 51ab58ab311ecd6603a8485a45af0dcc39880e69 | https://github.com/youqingxiaozhua/ABAW3/tree/51ab58ab311ecd6603a8485a45af0dcc39880e69 |
Net1 | import torch
def square(x):
return x * x
class Net1(torch.nn.Module):
def __init__(self, hidden=64, output=10):
super().__init__()
self.conv1 = torch.nn.Conv2d(1, 4, kernel_size=7, padding=0, stride=3)
self.fc1 = torch.nn.Linear(256, hidden)
self.fc2 = torch.nn.Linear(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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | yxtj/henn | Net1 | false | 11,058 | [
"MIT"
] | 0 | 5093f3e637ba0bb3e48c4f890b3b469c3617f2c5 | https://github.com/yxtj/henn/tree/5093f3e637ba0bb3e48c4f890b3b469c3617f2c5 |
AsymmetricLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | youqingxiaozhua/ABAW3 | AsymmetricLoss | false | 11,059 | [
"Apache-2.0"
] | 0 | 51ab58ab311ecd6603a8485a45af0dcc39880e69 | https://github.com/youqingxiaozhua/ABAW3/tree/51ab58ab311ecd6603a8485a45af0dcc39880e69 |
Net2 | import torch
def square(x):
return x * x
class Net2(torch.nn.Module):
def __init__(self, act=square, output=10):
super().__init__()
self.act = act
self.conv1 = torch.nn.Conv2d(1, 8, kernel_size=5, stride=2, padding=0)
self.conv2 = torch.nn.Conv2d(8, 64, kernel_size=3, stride... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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_cu... | yxtj/henn | Net2 | false | 11,060 | [
"MIT"
] | 0 | 5093f3e637ba0bb3e48c4f890b3b469c3617f2c5 | https://github.com/yxtj/henn/tree/5093f3e637ba0bb3e48c4f890b3b469c3617f2c5 |
MutualInfoLoss | import torch
from torch import nn
class MutualInfoLoss(nn.Module):
"""
Mutual Information Loss derived from ss-with-RIM that also applied in
this work.
First term enforces to generate a sparse nSpixel dimension vector for
each pixel; Second term indicates the cardinality of each sp... | 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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_... | yueyu-stu/EdgeAwareSpixel | MutualInfoLoss | false | 11,061 | [
"MIT"
] | 0 | f7f9fcb15bfa8e31bd4ad9473f9058c44a8391d7 | https://github.com/yueyu-stu/EdgeAwareSpixel/tree/f7f9fcb15bfa8e31bd4ad9473f9058c44a8391d7 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def reduce_loss(loss, reduction):
"""Reduce loss as specified.
Args:
loss (Tensor): Elementwise loss tensor.
reduction (str): Options are "none", "mean" and "sum".
Return:
Tensor: Reduced loss tensor.
"""
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | youqingxiaozhua/ABAW3 | FocalLoss | false | 11,062 | [
"Apache-2.0"
] | 0 | 51ab58ab311ecd6603a8485a45af0dcc39880e69 | https://github.com/youqingxiaozhua/ABAW3/tree/51ab58ab311ecd6603a8485a45af0dcc39880e69 |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
import torch.utils.data
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,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | zdxdsw/WebQA_VLP | BertAttention | false | 11,063 | [
"Apache-2.0"
] | 0 | 443bcd7e9b36db47e2ab4502abaaa3724800f394 | https://github.com/zdxdsw/WebQA_VLP/tree/443bcd7e9b36db47e2ab4502abaaa3724800f394 |
LearnedPositionalEmbeddings | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class LearnedPositionalEmbeddings(Module):
"""
<a id="LearnedPositionalEmbeddings">
## Add parameterized positional encodings
</a>
This adds learned positional em... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
assert_size_stride... | ppvalluri09/annotated_deep_learning_paper_implementations | LearnedPositionalEmbeddings | false | 11,064 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
ClippedValueFunctionLoss | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class ClippedValueFunctionLoss(Module):
"""
## Clipped Value Function Loss
Similarly we clip the value function update also.
egin{align}
V^{\\pi_ heta}_{CLIP}(s_t)
&= clip\\Big... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
import torch.utils.data
import torch.nn.functional
import tor... | ppvalluri09/annotated_deep_learning_paper_implementations | ClippedValueFunctionLoss | false | 11,065 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
DPFP | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class DPFP(Module):
"""
## Deterministic Parameter Free Project (DPFP)
This is the new projection function $\\color{lightgreen}{\\phi}$ introduced in the paper.
DPFP ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
from torch import nn
import torch.utils.data
import torch.nn.... | ppvalluri09/annotated_deep_learning_paper_implementations | DPFP | false | 11,066 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
DiscriminatorLoss | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class DiscriminatorLoss(Module):
"""
## Discriminator Loss
We want to find $w$ to maximize
$$\\mathbb{E}_{x \\sim \\mathbb{P}_r} [f_w(x)]- \\mathbb{E}_{z \... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
import torch.utils.data
import torch.nn.functional
import tor... | ppvalluri09/annotated_deep_learning_paper_implementations | DiscriminatorLoss | false | 11,067 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
PatchEmbeddings | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class PatchEmbeddings(Module):
"""
<a id="PatchEmbeddings">
## Get patch embeddings
</a>
The paper splits the image into patches of equal size and do a linear tra... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.nn import Module
from torch import nn
import torch.utils.data
import ... | ppvalluri09/annotated_deep_learning_paper_implementations | PatchEmbeddings | false | 11,068 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
LSTMCell | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class LSTMCell(Module):
"""
## Long Short-Term Memory Cell
LSTM Cell computes $c$, and $h$. $c$ is like the long-term memory,
and $h$ is like the short term memory.
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn impor... | ppvalluri09/annotated_deep_learning_paper_implementations | LSTMCell | false | 11,069 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
ChannelNorm | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class ChannelNorm(Module):
"""
## Channel Normalization
This is similar to [Group Normalization](../group_norm/index.html) but affine transform is done group wise.
""... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
from torch import nn
import torch.utils.data
import... | ppvalluri09/annotated_deep_learning_paper_implementations | ChannelNorm | false | 11,070 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
SmoothContourLoss | import torch
from torch import nn
class SmoothContourLoss(nn.Module):
"""
Loss function that contains smoothness loss derived from ss-with-RIM
and contour-aware loss.
Smoothness loss concerns about smoothness of local patterns, while
contour-aware loss is interested in whether two ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | yueyu-stu/EdgeAwareSpixel | SmoothContourLoss | false | 11,071 | [
"MIT"
] | 0 | f7f9fcb15bfa8e31bd4ad9473f9058c44a8391d7 | https://github.com/yueyu-stu/EdgeAwareSpixel/tree/f7f9fcb15bfa8e31bd4ad9473f9058c44a8391d7 |
MaskedThing | import torch
import torch.nn as nn
import torch.nn.functional as F
class MaskedThing(nn.Module):
l1 = nn.L1Loss()
mse = nn.MSELoss()
def forward(self, pred, target, mask):
pred = torch.log1p(F.relu(pred))
target = torch.log1p(F.relu(target))
pred = torch.mul(pred, mask)
ta... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | vegetablejuiceftw/soft-pointer-networks | MaskedThing | false | 11,072 | [
"MIT"
] | 0 | 9705d9688b6b69db3948172771df4c367165c948 | https://github.com/vegetablejuiceftw/soft-pointer-networks/tree/9705d9688b6b69db3948172771df4c367165c948 |
PositionMSELoss | import torch
import torch.nn as nn
class PositionMSELoss(nn.Module):
mse = nn.MSELoss()
def forward(self, pred, target, mask):
pred = torch.mul(pred, mask.unsqueeze(2))
return self.mse(pred, target)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), 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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | vegetablejuiceftw/soft-pointer-networks | PositionMSELoss | false | 11,073 | [
"MIT"
] | 0 | 9705d9688b6b69db3948172771df4c367165c948 | https://github.com/vegetablejuiceftw/soft-pointer-networks/tree/9705d9688b6b69db3948172771df4c367165c948 |
CosineLoss | import torch
import torch.nn as nn
class CosineLoss(nn.Module):
cos = nn.CosineSimilarity(dim=2, eps=1e-06)
def forward(self, pred, target, mask):
pred = torch.mul(pred, mask.unsqueeze(2))
return (1.0 - self.cos(pred, target)).mean()
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | vegetablejuiceftw/soft-pointer-networks | CosineLoss | false | 11,074 | [
"MIT"
] | 0 | 9705d9688b6b69db3948172771df4c367165c948 | https://github.com/vegetablejuiceftw/soft-pointer-networks/tree/9705d9688b6b69db3948172771df4c367165c948 |
MaskedLoss | import torch
import torch.nn as nn
class MaskedLoss(nn.Module):
mse = nn.MSELoss()
def forward(self, pred, target, mask):
pred = torch.log1p(pred).contiguous().view(-1)
target = torch.log1p(target).contiguous().view(-1)
mask = mask.view(-1)
pred = (mask * pred.T).T
ret... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert... | vegetablejuiceftw/soft-pointer-networks | MaskedLoss | false | 11,075 | [
"MIT"
] | 0 | 9705d9688b6b69db3948172771df4c367165c948 | https://github.com/vegetablejuiceftw/soft-pointer-networks/tree/9705d9688b6b69db3948172771df4c367165c948 |
MaskedSoftL1 | import torch
import torch.nn as nn
class MaskedSoftL1(nn.Module):
loss = nn.SmoothL1Loss()
def __init__(self, factor=5):
super().__init__()
self.factor = factor
def forward(self, pred, target, mask):
pred = torch.mul(pred, mask)
return self.loss(pred / self.factor, target... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | vegetablejuiceftw/soft-pointer-networks | MaskedSoftL1 | false | 11,076 | [
"MIT"
] | 0 | 9705d9688b6b69db3948172771df4c367165c948 | https://github.com/vegetablejuiceftw/soft-pointer-networks/tree/9705d9688b6b69db3948172771df4c367165c948 |
MaskedMSE | import torch
import torch.nn as nn
class MaskedMSE(nn.Module):
mse = nn.MSELoss()
def forward(self, pred, target, mask):
pred = torch.mul(pred, mask)
return self.mse(pred, target)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4]), torch.rand(
[4, 4, 4,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | vegetablejuiceftw/soft-pointer-networks | MaskedMSE | false | 11,077 | [
"MIT"
] | 0 | 9705d9688b6b69db3948172771df4c367165c948 | https://github.com/vegetablejuiceftw/soft-pointer-networks/tree/9705d9688b6b69db3948172771df4c367165c948 |
Squash | from torch.nn import Module
import torch
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Squash(Module):
'\n ## Squash\n\n This is **squashing** function from paper, given by equation $(1)$.\n\n $$\\mathbf{v}_j = \x0crac{{\\lVert \\mathbf{s}_j \rVert}^2}{1 + {\\lVert \\math... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
import torch.utils.data
import torch.nn.functional
... | ppvalluri09/annotated_deep_learning_paper_implementations | Squash | false | 11,078 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
MarginLoss | from torch.nn import Module
import torch
import torch.nn.functional as F
import torch.utils.data
import torch.nn.functional
import torch.autograd
class MarginLoss(Module):
'\n ## Margin loss for class existence\n\n A separate margin loss is used for each output capsule and the total loss is the sum of them.... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
... | ppvalluri09/annotated_deep_learning_paper_implementations | MarginLoss | false | 11,079 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
MaskedL1 | import torch
import torch.nn as nn
class MaskedL1(nn.Module):
l1 = nn.L1Loss()
def forward(self, pred, target, mask):
pred = torch.mul(pred, mask)
target = torch.mul(target, mask)
return self.l1(pred, target)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | vegetablejuiceftw/soft-pointer-networks | MaskedL1 | false | 11,080 | [
"MIT"
] | 0 | 9705d9688b6b69db3948172771df4c367165c948 | https://github.com/vegetablejuiceftw/soft-pointer-networks/tree/9705d9688b6b69db3948172771df4c367165c948 |
tfAvgPool3D | import torch
from torch import Tensor
from torch import nn
class tfAvgPool3D(nn.Module):
def __init__(self):
super().__init__()
self.avgf = nn.AvgPool3d((1, 3, 3), stride=(1, 2, 2))
def forward(self, x: 'Tensor') ->Tensor:
if x.shape[-1] != x.shape[-2]:
raise RuntimeError... | 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... | zinzinhust96/MoViNet-pytorch | tfAvgPool3D | false | 11,081 | [
"MIT"
] | 0 | f16528a76516427a192524c512c7a7cd8e1ce2f0 | https://github.com/zinzinhust96/MoViNet-pytorch/tree/f16528a76516427a192524c512c7a7cd8e1ce2f0 |
LayerNorm | import torch
from torch import nn
class LayerNorm(nn.Module):
def __init__(self, num_channels, eps=1e-05):
super().__init__()
self.num_channels = num_channels
self.eps = eps
self.weight = nn.Parameter(torch.Tensor(num_channels))
self.bias = nn.Parameter(torch.Tensor(num_ch... | 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... | yoshipon/spl2021_neural-fca | LayerNorm | false | 11,082 | [
"MIT"
] | 0 | a316026667dd6bd888547c8348cab8cd3d88e84c | https://github.com/yoshipon/spl2021_neural-fca/tree/a316026667dd6bd888547c8348cab8cd3d88e84c |
SqueezeExcitation | import torch
from torch import Tensor
import torch.nn.functional as F
from typing import Optional
from torch import nn
def _make_divisible(v: 'float', divisor: 'int', min_value: 'Optional[int]'=None
) ->int:
"""
This function is taken from the original tf repo.
It ensures that all layers have a channe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 Tensor
import torch.nn.functional as F
from typing import Opti... | zinzinhust96/MoViNet-pytorch | SqueezeExcitation | false | 11,083 | [
"MIT"
] | 0 | f16528a76516427a192524c512c7a7cd8e1ce2f0 | https://github.com/zinzinhust96/MoViNet-pytorch/tree/f16528a76516427a192524c512c7a7cd8e1ce2f0 |
LayerScale | import torch
from torch import nn
class LayerScale(nn.Module):
"""Layer scale from [Touvron et al 2021] (https://arxiv.org/pdf/2103.17239.pdf).
This rescales diagonaly residual outputs close to 0 initially, then learnt.
"""
def __init__(self, channels: 'int', init: 'float'=0):
super().__init_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | xvdp/demucs | LayerScale | false | 11,084 | [
"MIT"
] | 0 | 0a5e3b72c6388801cf0086c2b84d09f6d73c389c | https://github.com/xvdp/demucs/tree/0a5e3b72c6388801cf0086c2b84d09f6d73c389c |
Value | import torch
from torch import nn
from torch.nn import functional as F
class Value(nn.Module):
def __init__(self, state_size, fcs1_units=400, fc2_units=300):
super(Value, self).__init__()
self.conv1 = nn.Conv2d(1, 20, 5, 1)
self.conv2 = nn.Conv2d(20, 50, 5, 1)
self.fc1 = nn.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 import triton_helpers
from torch import nn
assert_s... | zwc662/disentangling-vae | Value | false | 11,085 | [
"MIT"
] | 0 | 7eeace2a30f8034e222be6a906f53748b3b2bb6e | https://github.com/zwc662/disentangling-vae/tree/7eeace2a30f8034e222be6a906f53748b3b2bb6e |
Net | import torch
from torch import nn
from torch.nn import functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 20, 5, 1)
self.conv2 = nn.Conv2d(20, 50, 5, 1)
self.fc1 = nn.Linear(5 * 5 * 50, 500)
self.fc2 = nn.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 import triton_helpers
from torch._inductor.runtime.... | zwc662/disentangling-vae | Net | false | 11,086 | [
"MIT"
] | 0 | 7eeace2a30f8034e222be6a906f53748b3b2bb6e | https://github.com/zwc662/disentangling-vae/tree/7eeace2a30f8034e222be6a906f53748b3b2bb6e |
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 ... | yutian-zhao/MICCAI19-MedVQA | Auto_Encoder_Model | false | 11,087 | [
"MIT"
] | 0 | 7df92c529ed87d67281efb2f568fc6c57cebfef1 | https://github.com/yutian-zhao/MICCAI19-MedVQA/tree/7df92c529ed87d67281efb2f568fc6c57cebfef1 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, c1=32, c2=64, c3=128, c4=256, l1=512, d1=0.0):
super().__init__()
self.conv1 = nn.Conv2d(9, c1, (5, 5))
self.conv2 = nn.Conv2d(c1, c2, (5, 5))
self.conv3 = nn.Conv2d(c2, c3,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | vtomi97/LHYP | Net | false | 11,088 | [
"MIT"
] | 0 | 3db91f889c0f6b866b9537975f664f072e021ea9 | https://github.com/vtomi97/LHYP/tree/3db91f889c0f6b866b9537975f664f072e021ea9 |
LocalState | import math
import torch
from torch import nn
class LocalState(nn.Module):
"""Local state allows to have attention based only on data (no positional embedding),
but while setting a constraint on the time window (e.g. decaying penalty term).
Also a failed experiments with trying to provide some frequency ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | xvdp/demucs | LocalState | false | 11,089 | [
"MIT"
] | 0 | 0a5e3b72c6388801cf0086c2b84d09f6d73c389c | https://github.com/xvdp/demucs/tree/0a5e3b72c6388801cf0086c2b84d09f6d73c389c |
Fcn8s | import torch
import numpy as np
import torch.nn as nn
def _upsampling_weights(in_channels, out_channels, kernel_size):
factor = (kernel_size + 1) // 2
if kernel_size % 2 == 1:
center = factor - 1
else:
center = factor - 0.5
og = np.ogrid[:kernel_size, :kernel_size]
filt = (1 - abs(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | lxxue/cil-road-segmentation-2019 | Fcn8s | false | 11,090 | [
"MIT"
] | 0 | c6477556dc3d6d9c8ed2f2a3f185b4d986a03bb4 | https://github.com/lxxue/cil-road-segmentation-2019/tree/c6477556dc3d6d9c8ed2f2a3f185b4d986a03bb4 |
Rescale | import torch
import torch.nn as nn
class Rescale(nn.Module):
def __init__(self, sign):
super(Rescale, self).__init__()
rgb_mean = 0.4488, 0.4371, 0.404
bias = sign * torch.Tensor(rgb_mean).reshape(1, 3, 1, 1)
self.bias = nn.Parameter(bias, requires_grad=False)
def forward(sel... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | zeta1999/torchSR | Rescale | false | 11,091 | [
"MIT"
] | 0 | 8f8154486f6c0f09942ccf86cdcbf496e2309d4e | https://github.com/zeta1999/torchSR/tree/8f8154486f6c0f09942ccf86cdcbf496e2309d4e |
TransformerEncoderLayer_MLP | from torch.nn import Module
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn import Dropout
from torch.nn import LayerNorm
from torch.nn import Identity
def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False):
"""Drop paths (Stochastic Depth) pe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn impor... | yifanc96/yifanc-DL | TransformerEncoderLayer_MLP | false | 11,092 | [
"MIT"
] | 0 | 25d56cec776fb151c8f6bcbd997bca94f07f3597 | https://github.com/yifanc96/yifanc-DL/tree/25d56cec776fb151c8f6bcbd997bca94f07f3597 |
OneDilate | import torch
import torch.nn as nn
import torch.nn.functional as F
class OneDilate(nn.Module):
def __init__(self, kernel_size=10, channels=3, gpu=True):
super(OneDilate, self).__init__()
self.kernel_size = kernel_size
self.channels = channels
gaussian_kernel = torch.ones(1, 1, sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | williamyang1991/DeepPS | OneDilate | false | 11,093 | [
"MIT"
] | 0 | f3eb6ba4b0f2ef068361a4bbbd3d6c2c2f6726b4 | https://github.com/williamyang1991/DeepPS/tree/f3eb6ba4b0f2ef068361a4bbbd3d6c2c2f6726b4 |
BasicDeconv | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicDeconv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
use_bn=False):
super(BasicDeconv, self).__init__()
self.use_bn = use_bn
self.tconv = nn.ConvTranspose2d(in_channels... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | vghost2008/C-3-Framework | BasicDeconv | false | 11,094 | [
"MIT"
] | 0 | dc6f1f67e403aff4dbb60f8ed06461c843407501 | https://github.com/vghost2008/C-3-Framework/tree/dc6f1f67e403aff4dbb60f8ed06461c843407501 |
Block_MLP | import torch
import torch.nn as nn
def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
This is the same as the DropConnect impl I created for EfficientNet, etc networks, however,
the original name is... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | yifanc96/yifanc-DL | Block_MLP | false | 11,095 | [
"MIT"
] | 0 | 25d56cec776fb151c8f6bcbd997bca94f07f3597 | https://github.com/yifanc96/yifanc-DL/tree/25d56cec776fb151c8f6bcbd997bca94f07f3597 |
ParityPonderGRU | from torch.nn import Module
import torch
from torch import nn
from typing import Tuple
import torch.utils.data
import torch.nn.functional
import torch.autograd
class ParityPonderGRU(Module):
"""
## PonderNet with GRU for Parity Task
This is a simple model that uses a [GRU Cell](https://pytorch.org/docs/s... | 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.nn import Module
from torch import nn
import... | ppvalluri09/annotated_deep_learning_paper_implementations | ParityPonderGRU | false | 11,096 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
GaussianFilter | import torch
import torch.utils.data
import torch
from torch import nn
class GaussianFilter(nn.Module):
def __init__(self, kernel_size=13, stride=1, padding=6):
super(GaussianFilter, self).__init__()
mean = (kernel_size - 1) / 2.0
variance = ((kernel_size - 1) / 6.0) ** 2.0
x_coor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch
from torch import nn
assert_size_stride = t... | zsameem/real-world-sr | GaussianFilter | false | 11,097 | [
"MIT"
] | 0 | ed108f3fd2fe4090c18c871c143f30f480de8fb6 | https://github.com/zsameem/real-world-sr/tree/ed108f3fd2fe4090c18c871c143f30f480de8fb6 |
AdaptiveInstanceNorm | import torch
import torch.nn as nn
class AdaptiveInstanceNorm(nn.Module):
def __init__(self, style_dim, in_channel):
super(AdaptiveInstanceNorm, self).__init__()
self.norm = nn.InstanceNorm2d(in_channel)
self.style = nn.Linear(style_dim, in_channel * 2)
self.style.bias.data[:in_ch... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | williamyang1991/DeepPS | AdaptiveInstanceNorm | false | 11,098 | [
"MIT"
] | 0 | f3eb6ba4b0f2ef068361a4bbbd3d6c2c2f6726b4 | https://github.com/williamyang1991/DeepPS/tree/f3eb6ba4b0f2ef068361a4bbbd3d6c2c2f6726b4 |
ResidualBlock | import torch
import torch.utils.data
import torch
from torch import nn
class ResidualBlock(nn.Module):
def __init__(self, channels):
super(ResidualBlock, self).__init__()
self.conv1 = nn.Conv2d(channels, channels, kernel_size=3, padding=1)
self.prelu = nn.PReLU()
self.conv2 = nn.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
import torch.utils.data
import torch
from torch import nn
assert_size_stride = t... | zsameem/real-world-sr | ResidualBlock | false | 11,099 | [
"MIT"
] | 0 | ed108f3fd2fe4090c18c871c143f30f480de8fb6 | https://github.com/zsameem/real-world-sr/tree/ed108f3fd2fe4090c18c871c143f30f480de8fb6 |
SAModule_Head | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicConv(nn.Module):
def __init__(self, in_channels, out_channels, use_bn=False, **kwargs):
super(BasicConv, self).__init__()
self.use_bn = use_bn
self.conv = nn.Conv2d(in_channels, out_channels, bias=not 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.... | vghost2008/C-3-Framework | SAModule_Head | false | 11,100 | [
"MIT"
] | 0 | dc6f1f67e403aff4dbb60f8ed06461c843407501 | https://github.com/vghost2008/C-3-Framework/tree/dc6f1f67e403aff4dbb60f8ed06461c843407501 |
LayerScaleBlock | import torch
import torch.nn as nn
def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
This is the same as the DropConnect impl I created for EfficientNet, etc networks, however,
the original name is... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yifanc96/yifanc-DL | LayerScaleBlock | false | 11,101 | [
"MIT"
] | 0 | 25d56cec776fb151c8f6bcbd997bca94f07f3597 | https://github.com/yifanc96/yifanc-DL/tree/25d56cec776fb151c8f6bcbd997bca94f07f3597 |
LinearScale | import torch
from torch import 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 __r... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | xh-liu-tech/CIPS-3D | LinearScale | false | 11,102 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
FiLMLayer | import torch
from torch import 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)
p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 im... | xh-liu-tech/CIPS-3D | FiLMLayer | false | 11,103 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
MyDilateBlur | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class MyDilateBlur(nn.Module):
def __init__(self, kernel_size=7, channels=3, sigma=0.8):
super(MyDilateBlur, self).__init__()
self.kernel_size = kernel_size
self.channels = channels
x_cord = torch.arang... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 math
import torch.nn a... | williamyang1991/DeepPS | MyDilateBlur | false | 11,104 | [
"MIT"
] | 0 | f3eb6ba4b0f2ef068361a4bbbd3d6c2c2f6726b4 | https://github.com/williamyang1991/DeepPS/tree/f3eb6ba4b0f2ef068361a4bbbd3d6c2c2f6726b4 |
CoordFC | import torch
import numpy as np
from torch import nn
class SinActivation(nn.Module):
def __init__(self):
super(SinActivation, self).__init__()
def forward(self, x):
return torch.sin(x)
class CoordFC(nn.Module):
def __init__(self, input_dim, hidden_dim):
super().__init__()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy ... | xh-liu-tech/CIPS-3D | CoordFC | false | 11,105 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
GlobalAveragePooling | import torch
from torch import nn
class GlobalAveragePooling(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return x.mean([2, 3])
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | xh-liu-tech/CIPS-3D | GlobalAveragePooling | false | 11,106 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
FiLMLayerEqualFC | import math
import torch
import torch.nn.functional as F
from torch import nn
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_mu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | xh-liu-tech/CIPS-3D | FiLMLayerEqualFC | false | 11,107 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
EqualConvTranspose2d | import math
import torch
import torch.nn.functional as F
from torch import nn
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
from torch import nn
assert_size_stride = torch._C._dynamo.guards.as... | xh-liu-tech/CIPS-3D | EqualConvTranspose2d | false | 11,108 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
CLNLayer | import torch
import torch.nn.functional as F
from torch import nn
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_style... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.fun... | xh-liu-tech/CIPS-3D | CLNLayer | false | 11,109 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
CoordConvSinAct | import torch
from torch import 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
from torch im... | xh-liu-tech/CIPS-3D | CoordConvSinAct | false | 11,110 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
FiLMLayer_PreSin | import torch
import numpy as np
from torch import 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 ... | xh-liu-tech/CIPS-3D | FiLMLayer_PreSin | false | 11,113 | [
"MIT"
] | 0 | 8910dfcf19bb86aab2287d652ae4e3666806b511 | https://github.com/xh-liu-tech/CIPS-3D/tree/8910dfcf19bb86aab2287d652ae4e3666806b511 |
SmallMnistNoDropout | import torch
import torch.nn as nn
import torch.nn
import torch.utils.data
import torch.utils.tensorboard._pytorch_graph
class SmallMnistNoDropout(nn.Module):
def __init__(self):
super(SmallMnistNoDropout, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.relu1 = nn.ReLU(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | quic-akhobare/aimet | SmallMnistNoDropout | false | 11,114 | [
"BSD-3-Clause"
] | 0 | 1811a0ef58a75d103e173731b436876ee5dc4c49 | https://github.com/quic-akhobare/aimet/tree/1811a0ef58a75d103e173731b436876ee5dc4c49 |
SmallMnistNoDropoutWithPassThrough | import torch
import torch.nn as nn
import torch.nn
import torch.utils.data
import torch.utils.tensorboard._pytorch_graph
class PassThroughOp(torch.nn.Module):
"""
This is a pass-through op, used for purpose of making an op a no-op
"""
def forward(self, inputx):
return inputx
class SmallMnis... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | quic-akhobare/aimet | SmallMnistNoDropoutWithPassThrough | false | 11,115 | [
"BSD-3-Clause"
] | 0 | 1811a0ef58a75d103e173731b436876ee5dc4c49 | https://github.com/quic-akhobare/aimet/tree/1811a0ef58a75d103e173731b436876ee5dc4c49 |
TransposedConvModel | import torch
import torch.cuda
import torch.nn
import torch.utils.data
import torch.fx
import torch.utils.tensorboard._pytorch_graph
class TransposedConvModel(torch.nn.Module):
def __init__(self):
super(TransposedConvModel, self).__init__()
self.conv1 = torch.nn.ConvTranspose2d(10, 10, 3)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.cuda
import torc... | mikeseven/aimet | TransposedConvModel | false | 11,116 | [
"BSD-3-Clause"
] | 0 | 63211a4f259b6457c58dfae1097c70acb93319fe | https://github.com/mikeseven/aimet/tree/63211a4f259b6457c58dfae1097c70acb93319fe |
Router | from torch.nn import Module
import torch
from torch import nn
import torch.utils.data
import torch.nn.functional
import torch.autograd
class Squash(Module):
'\n ## Squash\n\n This is **squashing** function from paper, given by equation $(1)$.\n\n $$\\mathbf{v}_j = \x0crac{{\\lVert \\mathbf{s}_j \rVert}^2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ppvalluri09/annotated_deep_learning_paper_implementations | Router | false | 11,117 | [
"MIT"
] | 0 | 387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 | https://github.com/ppvalluri09/annotated_deep_learning_paper_implementations/tree/387b6dfd1ef1f6d295e9394c24b5798071d9a3e4 |
DotRole | from _paritybench_helpers import _mock_config
import torch
import torch as th
import torch.nn as nn
class DotRole(nn.Module):
def __init__(self, args):
super(DotRole, self).__init__()
self.args = args
self.n_actions = args.n_actions
self.q_fc = nn.Linear(args.rnn_hidden_dim, args.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 as th
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | NagisaZj/RODE | DotRole | false | 11,118 | [
"Apache-2.0"
] | 0 | f7f6831fee58a7910e1d7c3a8ae19cef82ab8d03 | https://github.com/NagisaZj/RODE/tree/f7f6831fee58a7910e1d7c3a8ae19cef82ab8d03 |
TwoLinearsModel | import torch
import torch.cuda
from torch import nn
import torch.nn
import torch.utils.data
import torch.fx
import torch.utils.tensorboard._pytorch_graph
class TwoLinearsModel(nn.Module):
def __init__(self, per_sample_shape: 'list', hidden_size: 'int',
output_size: 'int'):
super(TwoLinearsModel, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.cuda
from torch ... | mikeseven/aimet | TwoLinearsModel | false | 11,119 | [
"BSD-3-Clause"
] | 0 | 63211a4f259b6457c58dfae1097c70acb93319fe | https://github.com/mikeseven/aimet/tree/63211a4f259b6457c58dfae1097c70acb93319fe |
BertPredictionHeadTransform | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
def gelu(x):
"""Gaussian Error Linear Unitという活性化関数です。
LeLUが0でカクっと不連続なので、そこを連続になるように滑らかにした形のLeLUです。
"""
return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0)))
class BertLayerNorm(nn.Module):
def __init__(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import math
from to... | Cyndi-Tokyotech/Fin_Text_Analysis_ML | BertPredictionHeadTransform | false | 11,120 | [
"MIT"
] | 0 | 7f9b6c1ea78f8e6f32c003b2de32809722df88d4 | https://github.com/Cyndi-Tokyotech/Fin_Text_Analysis_ML/tree/7f9b6c1ea78f8e6f32c003b2de32809722df88d4 |
ActorNetwork | import torch
import torch as T
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.distributions import Normal
class ActorNetwork(nn.Module):
def __init__(self, alpha, input_dims, fc1_dims, fc2_dims, max_action,
n_actions):
super(ActorNetwork, self).__init... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch as T
import torc... | MonteyMontey/deep-reinforcement-learning-sandbox | ActorNetwork | false | 11,121 | [
"MIT"
] | 0 | 0e93760a994b6af54f0a665f5bc4f9d5ffd45c0a | https://github.com/MonteyMontey/deep-reinforcement-learning-sandbox/tree/0e93760a994b6af54f0a665f5bc4f9d5ffd45c0a |
BertCoAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class BertCoAttention(nn.Module):
def __init__(self, config):
super(BertCoAttention, 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.... | KDD2022-MSCMT/MSCMT | BertCoAttention | false | 11,122 | [
"MIT"
] | 0 | 6a3e1e6230aa519a57345f6dbb0731b3ed6fe1ce | https://github.com/KDD2022-MSCMT/MSCMT/tree/6a3e1e6230aa519a57345f6dbb0731b3ed6fe1ce |
MaskedTransformerEncoderLayer | from torch.nn import Module
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Linear
from torch.nn import Dropout
from torch.nn import LayerNorm
from torch.nn import Identity
def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False):
"""Drop paths (Stochastic Depth) pe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yifanc96/yifanc-DL | MaskedTransformerEncoderLayer | false | 11,123 | [
"MIT"
] | 0 | 25d56cec776fb151c8f6bcbd997bca94f07f3597 | https://github.com/yifanc96/yifanc-DL/tree/25d56cec776fb151c8f6bcbd997bca94f07f3597 |
_TestNetStrided | import torch
import torch.cuda
import torch.nn.functional as F
import torch.nn
import torch.utils.data
import torch.fx
import torch.utils.tensorboard._pytorch_graph
class _TestNetStrided(torch.nn.Module):
def __init__(self):
super(_TestNetStrided, self).__init__()
self.conv1 = torch.nn.Conv2d(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.... | mikeseven/aimet | _TestNetStrided | false | 11,124 | [
"BSD-3-Clause"
] | 0 | 63211a4f259b6457c58dfae1097c70acb93319fe | https://github.com/mikeseven/aimet/tree/63211a4f259b6457c58dfae1097c70acb93319fe |
DotSelector | from _paritybench_helpers import _mock_config
import torch
import torch as th
from torch.distributions import Categorical
import torch.nn as nn
import torch.nn.functional as F
class DotSelector(nn.Module):
def __init__(self, input_shape, args):
super(DotSelector, self).__init__()
self.args = args... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 as th
from torch... | NagisaZj/RODE | DotSelector | false | 11,125 | [
"Apache-2.0"
] | 0 | f7f6831fee58a7910e1d7c3a8ae19cef82ab8d03 | https://github.com/NagisaZj/RODE/tree/f7f6831fee58a7910e1d7c3a8ae19cef82ab8d03 |
Net | from _paritybench_helpers import _mock_config
import torch
class Net(torch.nn.Module):
def __init__(self, configs):
super(Net, self).__init__()
self.fc1 = torch.nn.Linear(configs['input_size'], configs[
'hidden_size'])
self.fc1_activate = torch.nn.ReLU()
self.fc2 = 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.... | Lovestarni/Reinforcement-learning-with-tensorflow | Net | false | 11,126 | [
"MIT"
] | 0 | 822a4ae812b044687c11138ef9c9db1e1190f98c | https://github.com/Lovestarni/Reinforcement-learning-with-tensorflow/tree/822a4ae812b044687c11138ef9c9db1e1190f98c |
MemoryUpdater | 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.... | Sy-Zhang/recurrent-transformer | MemoryUpdater | false | 11,127 | [
"MIT"
] | 0 | f66ba49a2c9ec42759d3d00d497b49ffe39e18de | https://github.com/Sy-Zhang/recurrent-transformer/tree/f66ba49a2c9ec42759d3d00d497b49ffe39e18de |
RobertaClassificationHead | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class RobertaClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size * 2, config.hidden_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 ... | claudiosv/CodeBERT | RobertaClassificationHead | false | 11,128 | [
"MIT"
] | 0 | a276f5c2d2ea726837002f3d9f840e4bd1baa2aa | https://github.com/claudiosv/CodeBERT/tree/a276f5c2d2ea726837002f3d9f840e4bd1baa2aa |
BertAttention | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertLayerNorm, self).__init__... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Sy-Zhang/recurrent-transformer | BertAttention | false | 11,129 | [
"MIT"
] | 0 | f66ba49a2c9ec42759d3d00d497b49ffe39e18de | https://github.com/Sy-Zhang/recurrent-transformer/tree/f66ba49a2c9ec42759d3d00d497b49ffe39e18de |
TransformerEncoderLayer_attn | from torch.nn import Module
import torch
import torch.nn as nn
from torch.nn import Linear
from torch.nn import Dropout
from torch.nn import LayerNorm
from torch.nn import Identity
def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False):
"""Drop paths (Stochastic Depth) per sample (when applied in main p... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | yifanc96/yifanc-DL | TransformerEncoderLayer_attn | false | 11,130 | [
"MIT"
] | 0 | 25d56cec776fb151c8f6bcbd997bca94f07f3597 | https://github.com/yifanc96/yifanc-DL/tree/25d56cec776fb151c8f6bcbd997bca94f07f3597 |
BertOutput | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class BertLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""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... | Sy-Zhang/recurrent-transformer | BertOutput | false | 11,132 | [
"MIT"
] | 0 | f66ba49a2c9ec42759d3d00d497b49ffe39e18de | https://github.com/Sy-Zhang/recurrent-transformer/tree/f66ba49a2c9ec42759d3d00d497b49ffe39e18de |
CNNCOVID19 | from _paritybench_helpers import _mock_config
import torch
import torch.nn.functional as F
import torch.nn as nn
class CNNCOVID19(nn.Module):
def __init__(self, args):
super(CNNCOVID19, self).__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=8, kernel_size=3)
self.fc1 = nn.Lin... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | NaiboWang/HFL-CS6203-NaiboShiqi | CNNCOVID19 | false | 11,133 | [
"MIT"
] | 0 | 4bab35a20f1ec1229b0011c952d93c341579c402 | https://github.com/NaiboWang/HFL-CS6203-NaiboShiqi/tree/4bab35a20f1ec1229b0011c952d93c341579c402 |
CNNCifar | from _paritybench_helpers import _mock_config
import torch
import torch.nn.functional as nn_fnx
from torch import nn
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... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | amanapte/Federated-Learning-PyTorch | CNNCifar | false | 11,134 | [
"MIT"
] | 0 | ef48ed1457ba7deb53811e8e2a767f65bf82ae94 | https://github.com/amanapte/Federated-Learning-PyTorch/tree/ef48ed1457ba7deb53811e8e2a767f65bf82ae94 |
BertOutAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
class BertOutAttention(nn.Module):
def __init__(self, config, ctx_dim=None):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0:
raise ValueError(
'The ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | chanhee-luke/Recurrent-VLN-BERT | BertOutAttention | false | 11,135 | [
"MIT"
] | 0 | 31db5e02efb0a4685df22949ac4643a9e37ed26a | https://github.com/chanhee-luke/Recurrent-VLN-BERT/tree/31db5e02efb0a4685df22949ac4643a9e37ed26a |
BertPredictionHeadTransform | from _paritybench_helpers import _mock_config
import math
import torch
from torch import nn
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI GPT"s gelu is slightly different (and gives slightly different results):
0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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
from to... | Sy-Zhang/recurrent-transformer | BertPredictionHeadTransform | false | 11,136 | [
"MIT"
] | 0 | f66ba49a2c9ec42759d3d00d497b49ffe39e18de | https://github.com/Sy-Zhang/recurrent-transformer/tree/f66ba49a2c9ec42759d3d00d497b49ffe39e18de |
Attention | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import *
class Attention(nn.Module):
def __init__(self, opt):
super(Attention, self).__init__()
self.rnn_size = opt.rnn_size
self.att_hid_size = opt.att_hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Zhendong-Wang/arsm_image_captioning | Attention | false | 11,137 | [
"MIT"
] | 0 | 2282b76ab03b53952269d94d6c4b19ab98636ca5 | https://github.com/Zhendong-Wang/arsm_image_captioning/tree/2282b76ab03b53952269d94d6c4b19ab98636ca5 |
BertTextPooler | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class BertTextPooler(nn.Module):
def __init__(self, config):
super(BertTextPooler, self).__init__()
self.dense = nn.Linear(config.hidden_size, config.bi_hidden_size)
self.activation = nn.ReLU()
def forwa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | aditya10/vilbert-multi-task | BertTextPooler | false | 11,138 | [
"MIT"
] | 0 | dda8c16187ac6cc4f6266a823fbde528f65af720 | https://github.com/aditya10/vilbert-multi-task/tree/dda8c16187ac6cc4f6266a823fbde528f65af720 |
RobertaClassificationHead | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class RobertaClassificationHead(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | burakisikli/Contra-OOD | RobertaClassificationHead | false | 11,139 | [
"MIT"
] | 0 | 0affc280a8db54940c66d822efb2a8722cafdf52 | https://github.com/burakisikli/Contra-OOD/tree/0affc280a8db54940c66d822efb2a8722cafdf52 |
BertSelfAttention | from _paritybench_helpers import _mock_config
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
class BertSelfAttention(nn.Module):
def __init__(self, config):
super(BertSe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Neo9061/amazon-sagemaker-examples | BertSelfAttention | false | 11,140 | [
"Apache-2.0"
] | 0 | da58c2950286a2e40bd53a5d5135b1e23fd79e63 | https://github.com/Neo9061/amazon-sagemaker-examples/tree/da58c2950286a2e40bd53a5d5135b1e23fd79e63 |
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.... | Sy-Zhang/recurrent-transformer | BertSelfAttention | false | 11,141 | [
"MIT"
] | 0 | f66ba49a2c9ec42759d3d00d497b49ffe39e18de | https://github.com/Sy-Zhang/recurrent-transformer/tree/f66ba49a2c9ec42759d3d00d497b49ffe39e18de |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.