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 |
|---|---|---|---|---|---|---|---|---|---|---|
DWT | import torch
import torch.nn as nn
import torch.fft
class DWT(nn.Module):
"""
2D Discrete Wavelet Transform as implemented in [1]_.
References
----------
.. [1] Liu, Pengju, et al. “Multi-Level Wavelet-CNN for Image Restoration.” ArXiv:1805.07071 [Cs], May 2018.
arXiv.org, http://arxiv.org/a... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.fft
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo... | directgroup/direct | DWT | false | 15,187 | [
"Apache-2.0"
] | 55 | 78cdd530b3c93e31c11d8963880e6329f0989243 | https://github.com/directgroup/direct/tree/78cdd530b3c93e31c11d8963880e6329f0989243 |
CReLU_IN | import torch
import torch.nn.functional as F
import torch.nn as nn
class CReLU_IN(nn.Module):
def __init__(self, channels):
super(CReLU_IN, self).__init__()
self.bn = nn.InstanceNorm2d(channels * 2, eps=1e-05, momentum=0.1,
affine=True)
def forward(self, x):
cat = torch.c... | 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_... | dipikakhullar/ocr | CReLU_IN | false | 15,188 | [
"MIT"
] | 284 | a55e70d82f42803be5ed63f8f59e4fa597fcf8d6 | https://github.com/dipikakhullar/ocr/tree/a55e70d82f42803be5ed63f8f59e4fa597fcf8d6 |
BinaryCrossEntropyLabelSmooth | import torch
class BinaryCrossEntropyLabelSmooth(torch.nn.BCEWithLogitsLoss):
def __init__(self, num_classes, epsilon=0.1, weight=None, size_average=
None, reduce=None, reduction='mean', pos_weight=None):
super(BinaryCrossEntropyLabelSmooth, self).__init__(weight,
size_average, reduce... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
assert_size... | dianjixz/AutoDL | BinaryCrossEntropyLabelSmooth | false | 15,189 | [
"Apache-2.0"
] | 1,044 | 48db4eb04d55ce69e93d4a3bdc24592bdb34a868 | https://github.com/dianjixz/AutoDL/tree/48db4eb04d55ce69e93d4a3bdc24592bdb34a868 |
ProteinResNetPooler | from _paritybench_helpers import _mock_config
import torch
from torch import nn
class ProteinResNetPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.attention_weights = nn.Linear(config.hidden_size, 1)
self.dense = nn.Linear(config.hidden_size, 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, math as tl_math
fr... | IC-hub/ProteinLM | ProteinResNetPooler | false | 15,190 | [
"Apache-2.0"
] | 59 | 58fbf1f674569cf814becf32f71dd0d8f0c592fa | https://github.com/IC-hub/ProteinLM/tree/58fbf1f674569cf814becf32f71dd0d8f0c592fa |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, loss_weight=1.0):
super(DiceLoss, self).__init__()
self.loss_weight = loss_weight
def forward(self, input, target, mask, reduce=True):
batch_size = input.size(0)
input = torch.sigmoid(input)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | doem97/PSENet | DiceLoss | false | 15,192 | [
"Apache-2.0"
] | 1,213 | 4d95395658662f2223805c36dcd573d9e190ce26 | https://github.com/doem97/PSENet/tree/4d95395658662f2223805c36dcd573d9e190ce26 |
Net | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(4, 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, 2)
def forward(self, x):
x = torch.tanh(self.fc1(x))
x = torch.tanh(self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | dongminlee94/Samsung-DRL-Code | Net | false | 15,193 | [
"MIT"
] | 116 | c96f8739a09cfd708c265954ee8ecf0ea3b67395 | https://github.com/dongminlee94/Samsung-DRL-Code/tree/c96f8739a09cfd708c265954ee8ecf0ea3b67395 |
MNISTClassifier | import torch
import torchvision
import torchvision.ops
from torch import nn
class DeformableConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1,
padding=1, bias=False):
super(DeformableConv2d, self).__init__()
assert type(kernel_size) == tuple or type(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 torchvision
import tor... | developer0hye/PyTorch-Deformable-Convolution-v2 | MNISTClassifier | false | 15,194 | [
"MIT"
] | 70 | 3ed601fa70ee111278b95b134caf29e085642bc2 | https://github.com/developer0hye/PyTorch-Deformable-Convolution-v2/tree/3ed601fa70ee111278b95b134caf29e085642bc2 |
Net | import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import Parameter
class Conv1dExt(nn.Conv1d):
def __init__(self, *args, **kwargs):
super(Conv1dExt, self).__init__(*args, **kwargs)
self.init_ncc()
self.input_tied_modules = []
self.output_tied_mod... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | dhpollack/fast-wavenet.pytorch | Net | false | 15,195 | [
"MIT"
] | 98 | 853f6ecb1e8d23a5c01fc2455640c6637d30f2f9 | https://github.com/dhpollack/fast-wavenet.pytorch/tree/853f6ecb1e8d23a5c01fc2455640c6637d30f2f9 |
ReduceBranch | import torch
import torch.nn as nn
import torch.nn.functional as F
class ReduceBranch(nn.Module):
def __init__(self, planes, stride=2):
super(ReduceBranch, self).__init__()
self.conv1 = nn.Conv2d(planes, planes, kernel_size=1, stride=1,
padding=0, bias=False)
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.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | dnddnjs/pytorch-vision | ReduceBranch | false | 15,196 | [
"MIT"
] | 48 | d432b467774f838bef37372d6cff3576c6559803 | https://github.com/dnddnjs/pytorch-vision/tree/d432b467774f838bef37372d6cff3576c6559803 |
InstanceNorm | import torch
import torch.utils.data
import torch.nn as nn
from torch.nn.parameter import Parameter
class InstanceNorm(nn.Module):
def __init__(self, num_features, affine=True, eps=1e-05):
"""`num_features` number of feature channels
"""
super(InstanceNorm, self).__init__()
self.n... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
import torch.nn as nn
from torch.nn.parameter import Pa... | doantientai/augmented_cyclegan | InstanceNorm | false | 15,197 | [
"MIT"
] | 133 | 821274577e71c412198356ad6302c982554d558c | https://github.com/doantientai/augmented_cyclegan/tree/821274577e71c412198356ad6302c982554d558c |
Actor | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class Actor(nn.Module):
def __init__(self, state_size, action_size, args, log_std_min=-20,
log_std_max=2):
super(Actor, self).__init__()
self.log_std_min = log_std_min
self.log_std_max = log_std_max
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dongminlee94/Samsung-DRL-Code | Actor | false | 15,198 | [
"MIT"
] | 116 | c96f8739a09cfd708c265954ee8ecf0ea3b67395 | https://github.com/dongminlee94/Samsung-DRL-Code/tree/c96f8739a09cfd708c265954ee8ecf0ea3b67395 |
MultiHeadedAttention | import torch
from torch import nn
from torch.nn import functional as F
def same_tensor(tensor, *args):
""" Do the input tensors all point to the same underlying data """
for other in args:
if not torch.is_tensor(other):
return False
if tensor.device != other.device:
ret... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dojoteef/synst | MultiHeadedAttention | false | 15,199 | [
"BSD-3-Clause"
] | 81 | a1842682cf757e8a501cd9cee16f20e1a14158f1 | https://github.com/dojoteef/synst/tree/a1842682cf757e8a501cd9cee16f20e1a14158f1 |
GeneralizedMeanPooling | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.modules import Module
class GeneralizedMeanPooling(Module):
"""Applies a 2D power-average adaptive pooling over an input signal composed of several input planes.
The function computed is: :math:`f(X) = pow(sum(pow(X, p)), ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
from torch.nn import Module
... | dongan-beta/deep-image-retrieval | GeneralizedMeanPooling | false | 15,200 | [
"BSD-3-Clause"
] | 253 | 3e0885f88da328aefb7abb2fa350f8860a4bd52d | https://github.com/dongan-beta/deep-image-retrieval/tree/3e0885f88da328aefb7abb2fa350f8860a4bd52d |
TripletLogExpLoss | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
class TripletLogExpLoss(nn.Module):
"""Creates a criterion that measures the triplet loss given an input
tensors x1, x2, x3.
This is used for measuring a relative similarity between samples. A triplet
is composed by ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import numpy as np
import torch.nn as nn
assert_size_stride = ... | dongan-beta/deep-image-retrieval | TripletLogExpLoss | false | 15,201 | [
"BSD-3-Clause"
] | 253 | 3e0885f88da328aefb7abb2fa350f8860a4bd52d | https://github.com/dongan-beta/deep-image-retrieval/tree/3e0885f88da328aefb7abb2fa350f8860a4bd52d |
APLoss_dist | import torch
import numpy as np
import torch.nn as nn
def sim_to_dist(scores):
return 1 - torch.sqrt(2.001 - 2 * scores)
class APLoss(nn.Module):
""" Differentiable AP loss, through quantization. From the paper:
Learning with Average Precision: Training Image Retrieval with a Listwise Loss
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dongan-beta/deep-image-retrieval | APLoss_dist | false | 15,202 | [
"BSD-3-Clause"
] | 253 | 3e0885f88da328aefb7abb2fa350f8860a4bd52d | https://github.com/dongan-beta/deep-image-retrieval/tree/3e0885f88da328aefb7abb2fa350f8860a4bd52d |
Conv | import torch
from torch import nn
from torch.nn.functional import interpolate
from typing import cast
class Interpolate(nn.Module):
def __init__(self, scale_factor: 'float'=1.0, mode: 'str'='nearest'
) ->None:
super().__init__()
self.scale_factor = scale_factor
self.mode = 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
from torch._inductor.runtime.... | dooglewoogle/pystiche | Conv | false | 15,203 | [
"BSD-3-Clause"
] | 129 | 14b61123ede2abdb00daaa5b4981de6d7edaf034 | https://github.com/dooglewoogle/pystiche/tree/14b61123ede2abdb00daaa5b4981de6d7edaf034 |
_nms | import torch
import torch.utils.data
import torch
import torch.nn as nn
class _nms(nn.Module):
def __init__(self):
super(_nms, self).__init__()
kernel = 3
pad = (kernel - 1) // 2
self.maxpool = nn.MaxPool2d(kernel_size=kernel, stride=1, padding=pad)
def forward(self, heat):
... | 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
import torch.nn as nn
assert_size_stride = torch._C.... | donnyyou/centerX | _nms | false | 15,204 | [
"Apache-2.0"
] | 350 | 6e381cb669a6014d02e31a43915271237690531c | https://github.com/donnyyou/centerX/tree/6e381cb669a6014d02e31a43915271237690531c |
UpConv | import torch
import torch.nn as nn
class UpConv(nn.Module):
def __init__(self, input_nc, output_nc, kernel_size):
super(UpConv, self).__init__()
self.deconv = nn.ConvTranspose2d(in_channels=input_nc, out_channels
=output_nc, kernel_size=2, bias=True, stride=2, padding=0)
self.... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | dong1015323606/LKVOLearner | UpConv | false | 15,205 | [
"BSD-3-Clause"
] | 237 | 6ac9fb5d3c22d6a81529063f8c52d6aa34166b2a | https://github.com/dong1015323606/LKVOLearner/tree/6ac9fb5d3c22d6a81529063f8c52d6aa34166b2a |
DetLoss | import torch
from torch import nn
class DetLoss(nn.Module):
def __init__(self):
super().__init__()
self.hm_criterion = nn.BCEWithLogitsLoss(reduction='none')
self.ori_criterion = nn.SmoothL1Loss(reduction='none')
self.box_criterion = nn.SmoothL1Loss(reduction='none')
def forw... | 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 ... | dotchen/LAV | DetLoss | false | 15,206 | [
"Apache-2.0"
] | 122 | dc9b4cfca39abd50c7438e8749d49f6ac0fe5e4e | https://github.com/dotchen/LAV/tree/dc9b4cfca39abd50c7438e8749d49f6ac0fe5e4e |
Critic | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
class Critic(nn.Module):
def __init__(self, state_size, action_size, args):
super(Critic, self).__init__()
self.fc1 = nn.Linear(state_size + action_size, args.hidden_size)
self.fc2 = nn.Linear(args.hidden_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | dongminlee94/Samsung-DRL-Code | Critic | false | 15,207 | [
"MIT"
] | 116 | c96f8739a09cfd708c265954ee8ecf0ea3b67395 | https://github.com/dongminlee94/Samsung-DRL-Code/tree/c96f8739a09cfd708c265954ee8ecf0ea3b67395 |
AngleSimpleLinear | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
from torch.nn import Parameter
from torch.nn.parameter import Parameter
import torch.onnx
import torch.nn
class AngleSimpleLinear(nn.Module):
"""Computes cos of angles between input vectors and weights ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dqawami/openvino_training_extensions | AngleSimpleLinear | false | 15,208 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
LogitKLDivLoss | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class LogitKLDivLoss(nn.Module):
"""Kullback–Leibler divergence loss. Inputs predicted and ground truth logits.
Args:
T (float): Softmax temperature.
"... | 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 ... | dqawami/openvino_training_extensions | LogitKLDivLoss | false | 15,209 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
LengthPredictor | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class LengthPredictionLoss(nn.Module):
def __init__(self, max_delta=50):
super().__init__()
self.max_delta = max_delta
def forward(self, logits, 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.nn import function... | dqawami/openvino_training_extensions | LengthPredictor | false | 15,210 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
ResNet_conv1 | import math
import torch
import torch.utils.data
import torch.nn as nn
class ResNet_conv1(nn.Module):
def __init__(self, block, layers, num_classes=1000):
self.inplanes = 64
super(ResNet_conv1, self).__init__()
self.conv1 = nn.Conv2d(3, 64, kernel_size=7, stride=1, padding=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
import math
import torch.utils.data
import torch.nn as nn
assert_size_stride = t... | donegaci/memc-net | ResNet_conv1 | false | 15,211 | [
"MIT"
] | 145 | 9bdb0ab6ce99af22a165db2cedacd148dd6083c0 | https://github.com/donegaci/memc-net/tree/9bdb0ab6ce99af22a165db2cedacd148dd6083c0 |
Norm | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class Norm(nn.Module):
def __init__(self, dims):
super(Norm, self).__init__()
self.dims = dims
def forward(self, x):
z2 = torch.norm(x, p=2)
out = z2 - self.dims
out = out * out
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import... | doudoulaile/RL-GAN-Net | Norm | false | 15,212 | [
"MIT"
] | 112 | 9c221223d1878bc24f0f39ad34928c1bb2974ae3 | https://github.com/doudoulaile/RL-GAN-Net/tree/9c221223d1878bc24f0f39ad34928c1bb2974ae3 |
StateInitZero | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class StateInitZero(nn.Module):
def __init__(self, hidden_size, num_layers=1, batch_first=False):
super(StateInitZero, self).__init__()
self.hidden_size = hidden_size
self.num_laye... | 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
from torchvision import models as models
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards... | dqawami/openvino_training_extensions | StateInitZero | false | 15,213 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
ScaledDotProductAttention | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class ScaledDotProductAttention(nn.Module):
def __init__(self, dropout=0, scale=True):
super().__init__()
self.dropout = nn.Dropout(p=dropout)
self.softmax = nn.Softmax(dim=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.... | dqawami/openvino_training_extensions | ScaledDotProductAttention | false | 15,214 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
GateAddNorm | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, output_size, dropout=0):
super().__init__()
self.dropout = nn.Dropout(dropout)
self.w4 = nn.Linear(input_size, outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | dqawami/openvino_training_extensions | GateAddNorm | false | 15,215 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
_MCLSTMCell | from _paritybench_helpers import _mock_config
import torch
from typing import Tuple
import torch.nn as nn
class _Gate(nn.Module):
"""Utility class to implement a standard sigmoid gate"""
def __init__(self, in_features: 'int', out_features: 'int'):
super(_Gate, self).__init__()
self.fc = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DavidChoi76/neuralhydrology | _MCLSTMCell | false | 15,216 | [
"BSD-3-Clause"
] | 144 | a4c284b92934ee973c8b3fedf8a60df60c8feae1 | https://github.com/DavidChoi76/neuralhydrology/tree/a4c284b92934ee973c8b3fedf8a60df60c8feae1 |
GatedResidualNetwork | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, output_size, dropout=0):
super().__init__()
self.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
from torch import n... | dqawami/openvino_training_extensions | GatedResidualNetwork | false | 15,217 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
SpatialAttention | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class SpatialAttention(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.activation = nn.Sigmoid()
self.maxpool = nn.MaxPool2d((1, in_channels))
self.avg... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | dqawami/openvino_training_extensions | SpatialAttention | false | 15,218 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
Critic | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
class Critic(nn.Module):
def __init__(self, state_dim, action_dim):
super(Critic, self).__init__()
self.l1 = nn.Linear(state_dim + action_dim, 400)
self.l2 = nn.Linear(400, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | doudoulaile/RL-GAN-Net | Critic | false | 15,219 | [
"MIT"
] | 112 | 9c221223d1878bc24f0f39ad34928c1bb2974ae3 | https://github.com/doudoulaile/RL-GAN-Net/tree/9c221223d1878bc24f0f39ad34928c1bb2974ae3 |
SmallBlock | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class SmallBlock(nn.Module):
def __init__(self, channels):
super(SmallBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels=channels, out_channels=channels,
kernel_size=3,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
from tor... | dqawami/openvino_training_extensions | SmallBlock | false | 15,220 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
ResBlock | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class ResBlock(nn.Module):
def __init__(self, num_of_channels):
super(ResBlock, self).__init__()
self.conv1 = nn.Conv2d(in_channels=num_of_channels, out_channels=
num_of_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._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | dqawami/openvino_training_extensions | ResBlock | false | 15,221 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
EntmaxBisect | from torch.autograd import Function
import torch
import torch.nn as nn
def entmax_bisect(X, alpha=1.5, dim=-1, n_iter=50, ensure_sum_one=True):
"""alpha-entmax: normalizing sparse transform (a la softmax).
Solves the optimization problem:
max_p <x, p> - H_a(p) s.t. p >= 0, sum(p) == 1.
wh... | 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.autograd import F... | cifkao/entmax | EntmaxBisect | false | 15,222 | [
"MIT"
] | 298 | f18bab9318f9d2471a36545ee0b4c97be6d48a87 | https://github.com/cifkao/entmax/tree/f18bab9318f9d2471a36545ee0b4c97be6d48a87 |
Net | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 10, kernel_size=3)
self.conv2 = nn.Conv2d(10, 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.... | dqawami/openvino_training_extensions | Net | false | 15,223 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
EquivariantLayer | import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
from torch.nn.modules.batchnorm import _BatchNorm
class MyBatchNorm1d(_BatchNorm):
"""Applies Batch Normalization over a 2d or 3d input that is seen as a
mini-batch.
.. 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 import triton_helpers
import math
import torch.nn a... | doudoulaile/RL-GAN-Net | EquivariantLayer | false | 15,224 | [
"MIT"
] | 112 | 9c221223d1878bc24f0f39ad34928c1bb2974ae3 | https://github.com/doudoulaile/RL-GAN-Net/tree/9c221223d1878bc24f0f39ad34928c1bb2974ae3 |
FAdd | import torch
import numpy as np
import torch.nn as nn
class FAdd(nn.Module):
def __init__(self):
super(FAdd, self).__init__()
def forward(self, x, y):
x = x + y + np.float32(0.1)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_in... | 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... | dawnclaude/onnx2keras | FAdd | false | 15,225 | [
"MIT"
] | 115 | 3d2a47c0a228b91fd434232274e216e491da36e3 | https://github.com/dawnclaude/onnx2keras/tree/3d2a47c0a228b91fd434232274e216e491da36e3 |
Embedding_Net | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.functional as F
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1:
m.weight.data.normal_(0.0, 0.02)
m.bias.data.fill_(0)
elif classname.find('BatchNorm') !... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Huihui-z/CE-GZSL | Embedding_Net | false | 15,226 | [
"MIT"
] | 58 | 7bf5358ac4727ea1dc2dc9dec2f453b014500bd8 | https://github.com/Huihui-z/CE-GZSL/tree/7bf5358ac4727ea1dc2dc9dec2f453b014500bd8 |
GatedLinearUnit | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, output_size, dropout=0):
super().__init__()
self.dropout = nn.Dropout(dropout)
self.w4 = nn.Linear(input_size, outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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
from torchvision import models as models
import torch.onnx
... | dqawami/openvino_training_extensions | GatedLinearUnit | false | 15,227 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
Swish | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
def forward(self, x):
return 1.78718727865 * (x * torch.sigmoid(x) - 0.20662096414)
def get_inputs():
return [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
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty... | doudoulaile/RL-GAN-Net | Swish | false | 15,228 | [
"MIT"
] | 112 | 9c221223d1878bc24f0f39ad34928c1bb2974ae3 | https://github.com/doudoulaile/RL-GAN-Net/tree/9c221223d1878bc24f0f39ad34928c1bb2974ae3 |
GNNLayer | from torch.nn import Module
import torch
import torch.nn.functional as F
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
class GNNLayer(Module):
def __init__(self, in_features, out_features):
super(GNNLayer, self).__init__()
self.in_features = in_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
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
f... | drzhang3/SDCN | GNNLayer | false | 15,229 | [
"Apache-2.0"
] | 146 | 3d11365bcb4af2cbe9625362737f1224aeea3b72 | https://github.com/drzhang3/SDCN/tree/3d11365bcb4af2cbe9625362737f1224aeea3b72 |
RGBDiff | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class RGBDiff(nn.Module):
def __init__(self, dim=1):
super().__init__()
self.dim = dim
def forward(self, image):
"""
Args:
image (torch.Tensor): (N x T 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 import nn
from torchvision import models as models
import torch.onnx
import torch.nn
assert_size_stride = torch._C._dynamo.guards... | dqawami/openvino_training_extensions | RGBDiff | false | 15,230 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
StddevLayer | import torch
from torch import nn
class StddevLayer(nn.Module):
def __init__(self, group_size=4, num_new_features=1):
super().__init__()
self.group_size = 4
self.num_new_features = 1
def forward(self, x):
b, c, h, w = x.shape
group_size = min(self.group_size, b)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | dubtor/EditGAN-Robert | StddevLayer | false | 15,231 | [
"BSD-2-Clause"
] | 110 | 8e6d80e7647c3536827f11cf0a9abf51c42794b2 | https://github.com/dubtor/EditGAN-Robert/tree/8e6d80e7647c3536827f11cf0a9abf51c42794b2 |
Actor | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
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 import triton_helpers
import numpy as np
import tor... | drib861204/Soft-Actor-Critic-and-Extensions | Actor | false | 15,232 | [
"MIT"
] | 143 | 3075df7430c1c49177b3798d753a9e3f6226672e | https://github.com/drib861204/Soft-Actor-Critic-and-Extensions/tree/3075df7430c1c49177b3798d753a9e3f6226672e |
PositionWiseFeedForward | import torch
from torch.nn import functional as F
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class GatedLinearUnit(nn.Module):
def __init__(self, input_size, output_size, dropout=0):
super().__init__()
self.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
from torch.nn impor... | dqawami/openvino_training_extensions | PositionWiseFeedForward | false | 15,233 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
PositionwiseFeedForward | import torch
from torch import nn
from torchvision import models as models
import torch.onnx
import torch.nn
class Identity(nn.Module):
def forward(self, input_):
return input_
class LayerNormalization(nn.Module):
""" Layer normalization module """
def __init__(self, d_hid, eps=0.001):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dqawami/openvino_training_extensions | PositionwiseFeedForward | false | 15,234 | [
"Apache-2.0"
] | 256 | dddda1dfd651eaae2d59cecda84275b1b03bd0ad | https://github.com/dqawami/openvino_training_extensions/tree/dddda1dfd651eaae2d59cecda84275b1b03bd0ad |
C3D | import random
import torch
import torchvision
import torch.nn.parallel
import torch.optim
from torch import nn
class GroupMultiScaleCrop(object):
def __init__(self, input_size, scales=None, max_distort=1, fix_crop=
True, more_fix_crop=True):
self.scales = scales if scales is not None else [1, 875... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 random
import torchvis... | coderSkyChen/Action_Recognition_Zoo | C3D | false | 15,235 | [
"MIT"
] | 240 | 92ec5ec3efeee852aec5c057798298cd3a8e58ae | https://github.com/coderSkyChen/Action_Recognition_Zoo/tree/92ec5ec3efeee852aec5c057798298cd3a8e58ae |
DeepCritic | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class DeepCritic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | drib861204/Soft-Actor-Critic-and-Extensions | DeepCritic | false | 15,236 | [
"MIT"
] | 143 | 3075df7430c1c49177b3798d753a9e3f6226672e | https://github.com/drib861204/Soft-Actor-Critic-and-Extensions/tree/3075df7430c1c49177b3798d753a9e3f6226672e |
Critic | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | drib861204/Soft-Actor-Critic-and-Extensions | Critic | false | 15,237 | [
"MIT"
] | 143 | 3075df7430c1c49177b3798d753a9e3f6226672e | https://github.com/drib861204/Soft-Actor-Critic-and-Extensions/tree/3075df7430c1c49177b3798d753a9e3f6226672e |
SubNet | import torch
import torch.nn as nn
class SubNet(nn.Module):
"""
The subnetwork that is used in TFN for video and audio in the pre-fusion stage
"""
def __init__(self, in_size, hidden_size, n_class, dropout, modal_name=
'text'):
"""
Args:
in_size: input dimension
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | dumpmemory/Multimodal-Infomax | SubNet | false | 15,238 | [
"MIT"
] | 57 | 9a6dc8f2bfa861cd447ba65c6a037cd7dd24f473 | https://github.com/dumpmemory/Multimodal-Infomax/tree/9a6dc8f2bfa861cd447ba65c6a037cd7dd24f473 |
CondInjection | import torch
from torch import nn
class CondInjection(nn.Module):
def __init__(self):
super().__init__()
self.weight = nn.Parameter(torch.zeros(1))
def forward(self, image, labels, noise=None):
if noise is None:
batch, _, height, width = image.shape
noise = im... | 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... | dubtor/EditGAN-Robert | CondInjection | false | 15,239 | [
"BSD-2-Clause"
] | 110 | 8e6d80e7647c3536827f11cf0a9abf51c42794b2 | https://github.com/dubtor/EditGAN-Robert/tree/8e6d80e7647c3536827f11cf0a9abf51c42794b2 |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
def __init__(self, epsilon=1e-09):
"""Dice-Loss, 切块损失, 用于不均衡数据, 但是收敛困难, 不太稳定
paper: Dice Loss for Data-imbalanced NLP Tasks
url: https://arxiv.org/pdf/1911.02855.pdf
args:
reduction: str, Specifies the reduct... | 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... | dumpmemory/Pytorch-NLU | DiceLoss | false | 15,240 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
LayerNormLSTMCell | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
class LayerNormLSTMCell(nn.LSTMCell):
def __init__(self, input_size, hidden_size, bias=True):
super().__init__(input_size, hidden_size, bias)
self.ln_ih = nn.LayerNorm(4 * hidden_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.triton_helpers import libdevice
import torch.nn as ... | drgripa1/deepvecfont | LayerNormLSTMCell | false | 15,241 | [
"MIT"
] | 68 | a44d81ba19a22e43b4e576cd8ebc5c2fd961a621 | https://github.com/drgripa1/deepvecfont/tree/a44d81ba19a22e43b4e576cd8ebc5c2fd961a621 |
FocalLoss | import torch
from torch import nn
class FocalLoss(nn.Module):
def __init__(self, alpha=0.5, gamma=2, reduction='mean'):
"""FocalLoss
聚焦损失, 不确定的情况下alpha==0.5效果可能会好一点
url: https://github.com/CoinCheung/pytorch-loss
Usage is same as nn.BCEWithLogits:
>>> loss = criteria(log... | 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 ... | dumpmemory/Pytorch-NLU | FocalLoss | false | 15,242 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
CecaModule | import math
import torch
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
from torch import optim as optim
class CecaModule(nn.Module):
"""Constructs a circular ECA module.
ECA module where the conv uses circu... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.utils.data
import torch.nn as nn
import torch.nn.parall... | dumpmemory/NonDeepNetworks | CecaModule | false | 15,243 | [
"BSD-3-Clause"
] | 307 | 5513bf588f4e64c99583440507232675c2e21e34 | https://github.com/dumpmemory/NonDeepNetworks/tree/5513bf588f4e64c99583440507232675c2e21e34 |
AE | import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import Linear
class AE(nn.Module):
def __init__(self, n_enc_1, n_enc_2, n_enc_3, n_dec_1, n_dec_2, n_dec_3,
n_input, n_z):
super(AE, self).__init__()
self.enc_1 = Linear(n_input, n_enc_1)
self.enc_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
import torch.nn as nn
from to... | drzhang3/SDCN | AE | false | 15,244 | [
"Apache-2.0"
] | 146 | 3d11365bcb4af2cbe9625362737f1224aeea3b72 | https://github.com/drzhang3/SDCN/tree/3d11365bcb4af2cbe9625362737f1224aeea3b72 |
ConvSqu | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
from torch import optim as optim
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class ConvSqu(nn.Module):
def __init__(self, c1, c2, k=1, s=1, p=None, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
from torc... | dumpmemory/NonDeepNetworks | ConvSqu | false | 15,245 | [
"BSD-3-Clause"
] | 307 | 5513bf588f4e64c99583440507232675c2e21e34 | https://github.com/dumpmemory/NonDeepNetworks/tree/5513bf588f4e64c99583440507232675c2e21e34 |
DeepActor | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Normal
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class DeepActor(nn.Module):
"""Actor (Policy) Model."""
def __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
import numpy as np
import tor... | drib861204/Soft-Actor-Critic-and-Extensions | DeepActor | false | 15,246 | [
"MIT"
] | 143 | 3075df7430c1c49177b3798d753a9e3f6226672e | https://github.com/drib861204/Soft-Actor-Critic-and-Extensions/tree/3075df7430c1c49177b3798d753a9e3f6226672e |
AdaILN | import torch
import torch.nn as nn
import torch.utils.cpp_extension
class AdaILN(nn.Module):
def __init__(self, channels, resl, eps=1e-08):
super().__init__()
self.rho = nn.Parameter(torch.Tensor(1, channels, 1, 1))
self.rho.data.fill_(1.0)
self.instance_norm = nn.InstanceNorm2d(c... | 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.cpp_extension
assert_size_stride = tor... | STomoya/animeface | AdaILN | false | 15,247 | [
"MIT"
] | 61 | 37b3cd26097d7874559d4c152e41e5712b7a1a42 | https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42 |
DiceLossV1 | import torch
from torch import nn
class DiceLossV1(nn.Module):
def __init__(self, reduction='mean', epsilon=1e-09):
"""【ERROR, 不收敛-原因未知】Dice-Loss, 切块损失, 用于不均衡数据, 但是收敛困难
paper: Dice Loss for Data-imbalanced NLP Tasks
url: https://arxiv.org/pdf/1911.02855.pdf
args:
reduc... | 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... | dumpmemory/Pytorch-NLU | DiceLossV1 | false | 15,248 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
HighwayLayer | import torch
from torch import nn
import torch.utils.data
import torch.utils.data.distributed
import torch.utils.checkpoint
import torch.utils.tensorboard
def my_xavier_init(m, gain=1):
"""Xavier initialization: weights initialization that tries to make variance of outputs
of a layer equal to variance of its ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | ali-senguel/fairo | HighwayLayer | false | 15,249 | [
"MIT"
] | 669 | 1ec5d8ecbdfc782de63a92aad9bf8534110ce762 | https://github.com/ali-senguel/fairo/tree/1ec5d8ecbdfc782de63a92aad9bf8534110ce762 |
EcaModule | import math
import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
from torch import optim as optim
class EcaModule(nn.Module):
"""Constructs an ECA module.
Args:
channels: Number of channels of the input feature map for use in adaptive kernel sizes
for actual... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
import torch.utils.data
import torch.nn as nn
import torch.nn.parall... | dumpmemory/NonDeepNetworks | EcaModule | false | 15,250 | [
"BSD-3-Clause"
] | 307 | 5513bf588f4e64c99583440507232675c2e21e34 | https://github.com/dumpmemory/NonDeepNetworks/tree/5513bf588f4e64c99583440507232675c2e21e34 |
DownConv | import torch
import torch.nn as nn
import torch.nn.functional as F
def conv3x3(in_channels, out_channels, stride=1, padding=1, bias=True, groups=1
):
return nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=
stride, padding=padding, bias=bias, groups=groups)
class DownConv(nn.Module):
"... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | duchn92/transfer-object | DownConv | false | 15,251 | [
"MIT"
] | 80 | 4db96931545ac0d28891375fbca3c0a5a382fb32 | https://github.com/duchn92/transfer-object/tree/4db96931545ac0d28891375fbca3c0a5a382fb32 |
LabelSmoothingCrossEntropy | import torch
from torch import nn
class LabelSmoothingCrossEntropy(nn.Module):
def __init__(self, eps=0.1, reduction='mean', ignore_index=-100):
"""LabelSmoothingCrossEntropy, no-softmax-input
对logits进行smoothing, 即log_softmax后进行操作
args:
ignore_index: (int, optional): Specifies... | 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 ... | dumpmemory/Pytorch-NLU | LabelSmoothingCrossEntropy | false | 15,252 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
lstm_cell | import torch
import torch.nn as nn
class lstm_cell(nn.Module):
def __init__(self, input_num, hidden_num):
super(lstm_cell, self).__init__()
self.input_num = input_num
self.hidden_num = hidden_num
self.Wxi = nn.Linear(self.input_num, self.hidden_num, bias=True)
self.Whi = 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 libdevice
import torch.nn as ... | dreamer121121/action-recognition-models-pytorch | lstm_cell | false | 15,253 | [
"MIT"
] | 200 | 6a8a5e9678c359f795079d1f9f3cbdb9502b363d | https://github.com/dreamer121121/action-recognition-models-pytorch/tree/6a8a5e9678c359f795079d1f9f3cbdb9502b363d |
ConvSig | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
from torch import optim as optim
def autopad(k, p=None):
if p is None:
p = k // 2 if isinstance(k, int) else [(x // 2) for x in k]
return p
class ConvSig(nn.Module):
def __init__(self, c1, c2, k=1, s=1, p=None, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.utils.data
import torch.nn as nn
import torch.nn.parallel
from torc... | dumpmemory/NonDeepNetworks | ConvSig | false | 15,254 | [
"BSD-3-Clause"
] | 307 | 5513bf588f4e64c99583440507232675c2e21e34 | https://github.com/dumpmemory/NonDeepNetworks/tree/5513bf588f4e64c99583440507232675c2e21e34 |
CPC | import torch
import torch.nn as nn
class CPC(nn.Module):
"""
Contrastive Predictive Coding: score computation. See https://arxiv.org/pdf/1807.03748.pdf.
Args:
x_size (int): embedding size of input modality representation x
y_size (int): embedding size of input modality rep... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dumpmemory/Multimodal-Infomax | CPC | false | 15,255 | [
"MIT"
] | 57 | 9a6dc8f2bfa861cd447ba65c6a037cd7dd24f473 | https://github.com/dumpmemory/Multimodal-Infomax/tree/9a6dc8f2bfa861cd447ba65c6a037cd7dd24f473 |
GroupLinear | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class GroupLinear(nn.Module):
"""
Group Linear operator
"""
def __init__(self, in_planes, out_channels, groups=1, bias=True):
super(GroupLinear, self).__init__()
assert in_planes % groups == 0
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_si... | dumpmemory/TokenLabeling | GroupLinear | false | 15,256 | [
"Apache-2.0"
] | 367 | 9dbfd59aedecfe83f6f3253db4e99b82359d48ac | https://github.com/dumpmemory/TokenLabeling/tree/9dbfd59aedecfe83f6f3253db4e99b82359d48ac |
Biaffine | import torch
import torch.autograd
import torch.nn as nn
class Biaffine(nn.Module):
def __init__(self, n_in, n_out=1, bias_x=True, bias_y=True):
super(Biaffine, self).__init__()
self.n_in = n_in
self.n_out = n_out
self.bias_x = bias_x
self.bias_y = bias_y
weight = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.autograd
import torch.nn as nn
assert_size_stride = torch._C._dynam... | dumpmemory/W2NER | Biaffine | false | 15,257 | [
"MIT"
] | 128 | fb1b6eb1111eb001b1c965097d995244b840bdda | https://github.com/dumpmemory/W2NER/tree/fb1b6eb1111eb001b1c965097d995244b840bdda |
LabelSmoothingCrossEntropyV1 | import torch
from torch import nn
class LabelSmoothingCrossEntropyV1(nn.Module):
def __init__(self, eps=0.1, reduction='mean', ignore_index=-100):
"""【直接smooth输入logits效果不好】LabelSmoothingCrossEntropy, no-softmax-input
eps==0-1, 通过控制ce权重、新增后置项来处理来平滑
urls: [pytorch | labelSmooth](https://zhu... | 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 ... | dumpmemory/Pytorch-NLU | LabelSmoothingCrossEntropyV1 | false | 15,258 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
GroupNorm | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class GroupNorm(nn.Module):
def __init__(self, num_groups, embed_dim, eps=1e-05, affine=True):
super().__init__()
self.gn = nn.GroupNorm(num_groups, embed_dim, eps, affine)
def forward(self, x):
B, T,... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
assert_s... | dumpmemory/TokenLabeling | GroupNorm | false | 15,259 | [
"Apache-2.0"
] | 367 | 9dbfd59aedecfe83f6f3253db4e99b82359d48ac | https://github.com/dumpmemory/TokenLabeling/tree/9dbfd59aedecfe83f6f3253db4e99b82359d48ac |
FCLayer | import torch
from torch import nn
class FCLayer(nn.Module):
def __init__(self, input_dim, output_dim, dropout_rate=0.1, is_active=
True, is_dropout=True, active_type='mish'):
"""
FC-Layer, mostly last output of model
args:
input_dim: input dimension, 输入维度, eg. 768
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
fr... | dumpmemory/Pytorch-NLU | FCLayer | false | 15,260 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
ClassifierHead | import torch
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
from torch import optim as optim
def adaptive_avgmax_pool2d(x, output_size=1):
x_avg = F.adaptive_avg_pool2d(x, output_size)
x_max = F.adaptive_max_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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 torchvision.transforms.functional as F
import tor... | dumpmemory/NonDeepNetworks | ClassifierHead | false | 15,261 | [
"BSD-3-Clause"
] | 307 | 5513bf588f4e64c99583440507232675c2e21e34 | https://github.com/dumpmemory/NonDeepNetworks/tree/5513bf588f4e64c99583440507232675c2e21e34 |
GroupNormAct | import torch
import torch.utils.data
import torchvision.transforms.functional as F
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
from torch import optim as optim
def swish(x, inplace: 'bool'=False):
"""Swish - Described in: https://arxiv.org/abs/1710.05941
"""
return x.mul... | 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... | dumpmemory/NonDeepNetworks | GroupNormAct | false | 15,262 | [
"BSD-3-Clause"
] | 307 | 5513bf588f4e64c99583440507232675c2e21e34 | https://github.com/dumpmemory/NonDeepNetworks/tree/5513bf588f4e64c99583440507232675c2e21e34 |
CXLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
class CXLoss(nn.Module):
def __init__(self, sigma=0.1, b=1.0, similarity='consine'):
super(CXLoss, self).__init__()
self.similarity = similarity
self.sigma = sigma
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.... | drgripa1/deepvecfont | CXLoss | false | 15,263 | [
"MIT"
] | 68 | a44d81ba19a22e43b4e576cd8ebc5c2fd961a621 | https://github.com/drgripa1/deepvecfont/tree/a44d81ba19a22e43b4e576cd8ebc5c2fd961a621 |
CriticNet | from _paritybench_helpers import _mock_config
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
class CriticNet(nn.Module):
def __init__(self, args):
super(CriticNet, self).__init__()
state_dim = args.state_dim
action_dim =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | doudoulaile/RL-GAN-Net | CriticNet | false | 15,264 | [
"MIT"
] | 112 | 9c221223d1878bc24f0f39ad34928c1bb2974ae3 | https://github.com/doudoulaile/RL-GAN-Net/tree/9c221223d1878bc24f0f39ad34928c1bb2974ae3 |
LabelSmoothingCrossEntropyV2 | import torch
from torch import nn
class LabelSmoothingCrossEntropyV2(nn.Module):
""" 平滑的交叉熵, LabelSommth-CrossEntropy
This is the autograd version, you can also try the LabelSmoothSoftmaxCEV2 that uses derived gradients
url: https://github.com/CoinCheung/pytorch-loss
examples:
>>> criteria = L... | 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... | dumpmemory/Pytorch-NLU | LabelSmoothingCrossEntropyV2 | false | 15,265 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
MLP | import torch
import torch.autograd
import torch.nn as nn
class MLP(nn.Module):
def __init__(self, n_in, n_out, dropout=0):
super().__init__()
self.linear = nn.Linear(n_in, n_out)
self.activation = nn.GELU()
self.dropout = nn.Dropout(dropout)
def forward(self, 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.triton_helpers import libdevice
import torch.autogr... | dumpmemory/W2NER | MLP | false | 15,266 | [
"MIT"
] | 128 | fb1b6eb1111eb001b1c965097d995244b840bdda | https://github.com/dumpmemory/W2NER/tree/fb1b6eb1111eb001b1c965097d995244b840bdda |
ConvMLPStage | from torch.nn import Module
import torch
import torch.nn as nn
from torch.nn import Linear
from torch.nn import LayerNorm
from torch.nn import Conv2d
from torch.nn import GELU
from torch.nn import Identity
def drop_path(x, drop_prob: 'float'=0.0, training: 'bool'=False):
"""
Obtained from: github.com:rwightma... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | dumpmemory/Convolutional-MLPs | ConvMLPStage | false | 15,267 | [
"Apache-2.0"
] | 117 | 89008c686e48803c012038f21f97e56276aa84ad | https://github.com/dumpmemory/Convolutional-MLPs/tree/89008c686e48803c012038f21f97e56276aa84ad |
ResNormLayer | import torch
from torch import nn
from torch import optim as optim
class ResNormLayer(nn.Module):
def __init__(self, linear_size):
super(ResNormLayer, self).__init__()
self.l_size = linear_size
self.nonlin1 = nn.ReLU(inplace=True)
self.nonlin2 = nn.ReLU(inplace=True)
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.... | dqshuai/MetaFormer | ResNormLayer | false | 15,268 | [
"MIT"
] | 67 | 669bf18c35fdb51e35b0a79fa86224a18cd38ac5 | https://github.com/dqshuai/MetaFormer/tree/669bf18c35fdb51e35b0a79fa86224a18cd38ac5 |
RegressionHead | import abc
import torch
import torch.nn as nn
import torch.utils.data.dataset
class BaseHead(nn.Module, metaclass=abc.ABCMeta):
"""Absract class for task heads"""
@abc.abstractmethod
def __init__(self):
super().__init__()
class RegressionHead(BaseHead):
def __init__(self, task, 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 abc
import t... | dumpmemory/jiant | RegressionHead | false | 15,269 | [
"MIT"
] | 1,108 | f9e0e7c9ecf88da0c26559c5f903aef0338c7bd9 | https://github.com/dumpmemory/jiant/tree/f9e0e7c9ecf88da0c26559c5f903aef0338c7bd9 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class DeepMind(nn.Module):
def __init__(self):
super(DeepMind, self).__init__()
self.conv1 = nn.Conv2d(4, 32, 8, stride=4)
self.conv2 = nn.Conv2d(32, 64, 4, stride=2)
self.conv3 = nn.Conv2d(64, 32, 3, stride=1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | TianhongDai/Self_Imitation_Learning | Net | false | 15,270 | [
"MIT"
] | 61 | e49003582fa3d875495d84682f2a3332d4922dbc | https://github.com/TianhongDai/Self_Imitation_Learning/tree/e49003582fa3d875495d84682f2a3332d4922dbc |
LayerNorm | import torch
import torch.autograd
import torch.nn as nn
class LayerNorm(nn.Module):
def __init__(self, input_dim, cond_dim=0, center=True, scale=True,
epsilon=None, conditional=False, hidden_units=None,
hidden_activation='linear', hidden_initializer='xaiver', **kwargs):
super(LayerNorm, ... | 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.autograd
import torch.nn as nn
assert_size_stride = torch._C._dyna... | dumpmemory/W2NER | LayerNorm | false | 15,271 | [
"MIT"
] | 128 | fb1b6eb1111eb001b1c965097d995244b840bdda | https://github.com/dumpmemory/W2NER/tree/fb1b6eb1111eb001b1c965097d995244b840bdda |
SoftTargetCrossEntropy | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.nn.functional as F
import torch.utils.data
class SoftTargetCrossEntropy(nn.Module):
def __init__(self):
super(SoftTargetCrossEntropy, self).__init__()
def forward(self, x, target):
N_rep = x.shape[0]
N = 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
... | dumpmemory/TokenLabeling | SoftTargetCrossEntropy | false | 15,272 | [
"Apache-2.0"
] | 367 | 9dbfd59aedecfe83f6f3253db4e99b82359d48ac | https://github.com/dumpmemory/TokenLabeling/tree/9dbfd59aedecfe83f6f3253db4e99b82359d48ac |
AddPositionEmb | import torch
from typing import Sequence
import torch.nn as nn
import torch._C
import torch.serialization
import torch.nn.parallel
class AddPositionEmb(nn.Module):
"""Module to add position embedding to input features
"""
def __init__(self, dim=384, spatial_shape=[14, 14]):
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 typing import Sequence
import torch.nn as nn
import torch._C
import torch.serialization
import torch.nn.parallel
assert_size_stride = t... | dumpmemory/poolformer | AddPositionEmb | false | 15,273 | [
"Apache-2.0"
] | 677 | d108be054469da760141f4789bf87c915c4fd0b2 | https://github.com/dumpmemory/poolformer/tree/d108be054469da760141f4789bf87c915c4fd0b2 |
AFTFull | import torch
from torch import nn
class AFTFull(nn.Module):
def __init__(self, max_seqlen, dim, hidden_dim=64):
super().__init__()
"""
max_seqlen: the maximum number of timesteps (sequence length) to be fed in
dim: the embedding dimension of the tokens
hidden_dim: the hidd... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | dumpmemory/aft-pytorch | AFTFull | false | 15,274 | [
"MIT"
] | 170 | 9a896966481f4042c2882f544d7bb1381e81dca1 | https://github.com/dumpmemory/aft-pytorch/tree/9a896966481f4042c2882f544d7bb1381e81dca1 |
AFTSimple | import torch
from torch import nn
class AFTSimple(nn.Module):
def __init__(self, max_seqlen, dim, hidden_dim=64):
super().__init__()
"""
max_seqlen: the maximum number of timesteps (sequence length) to be fed in
dim: the embedding dimension of the tokens
hidden_dim: the hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | dumpmemory/aft-pytorch | AFTSimple | false | 15,275 | [
"MIT"
] | 170 | 9a896966481f4042c2882f544d7bb1381e81dca1 | https://github.com/dumpmemory/aft-pytorch/tree/9a896966481f4042c2882f544d7bb1381e81dca1 |
PixelNorm | import torch
import torch.nn as nn
import torch.utils.cpp_extension
class PixelNorm(nn.Module):
"""pixel normalization"""
def forward(self, x):
x = x / x.pow(2).mean(dim=1, keepdim=True).sqrt().add(1e-08)
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.cpp_extension
assert_size_stride = tor... | STomoya/animeface | PixelNorm | false | 15,276 | [
"MIT"
] | 61 | 37b3cd26097d7874559d4c152e41e5712b7a1a42 | https://github.com/STomoya/animeface/tree/37b3cd26097d7874559d4c152e41e5712b7a1a42 |
SpanFCLayer | import torch
from torch import nn
class SpanFCLayer(nn.Module):
def __init__(self, input_dim, output_dim, dropout_rate=0.1, is_active=
True, is_dropout=True, active_type='mish'):
"""SpanFCLayer
Span-FC-Layer, mostly last output of span of model, 新增LayerNorm(条件层标准化)
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.triton_helpers import libdevice, math as tl_math
fr... | dumpmemory/Pytorch-NLU | SpanFCLayer | false | 15,277 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
LayerNorm | import torch
from torch import nn
class LayerNorm(nn.Module):
def __init__(self, dim, eps=1e-05):
super().__init__()
self.eps = eps
self.g = nn.Parameter(torch.ones(1, dim, 1, 1, 1))
self.b = nn.Parameter(torch.zeros(1, dim, 1, 1, 1))
def forward(self, x):
std = 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.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | dumpmemory/uniformer-pytorch | LayerNorm | false | 15,278 | [
"MIT"
] | 71 | 756c4edb7ab0947dc202c145f7c95571848e0594 | https://github.com/dumpmemory/uniformer-pytorch/tree/756c4edb7ab0947dc202c145f7c95571848e0594 |
h_swish | import torch
import torch.nn as nn
import torch.nn.functional as F
class h_swish(nn.Module):
def __init__(self, inplace=True):
super(h_swish, self).__init__()
self.inplace = inplace
def forward(self, x):
out = F.relu6(x + 3.0, self.inplace) / 6.0
return out * x
def get_inpu... | 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... | dx9527/MobileNetV3-pytorch | h_swish | false | 15,279 | [
"MIT"
] | 291 | 7812dbcedd5db4e3bbfc21122b82205848f742cf | https://github.com/dx9527/MobileNetV3-pytorch/tree/7812dbcedd5db4e3bbfc21122b82205848f742cf |
MultiplyLearned | import torch
import torch.fft
import torch.nn
class MultiplyLearned(torch.nn.Module):
def __init__(self, omega_0: 'float'):
"""
out = omega_0 * x, with a learned omega_0
"""
super().__init__()
self.omega_0 = torch.nn.Parameter(torch.Tensor(1))
with torch.no_grad():... | 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.fft
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guard... | dwromero/ckconv | MultiplyLearned | false | 15,280 | [
"MIT"
] | 74 | d44c6441a98792477d6259368c210089bb33fe7a | https://github.com/dwromero/ckconv/tree/d44c6441a98792477d6259368c210089bb33fe7a |
MultiLabelCircleLoss | import torch
from torch import nn
class MultiLabelCircleLoss(nn.Module):
def __init__(self, reduction='mean', inf=1000000000000.0):
"""CircleLoss of MultiLabel, 多个目标类的多标签分类场景,希望“每个目标类得分都不小于每个非目标类的得分”
多标签分类的交叉熵(softmax+crossentropy推广, N选K问题), LSE函数的梯度恰好是softmax函数
让同类相似度与非同类相似度之间拉开一定的margin... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | dumpmemory/Pytorch-NLU | MultiLabelCircleLoss | false | 15,281 | [
"Apache-2.0"
] | 115 | 864fb9acc7751fc51abd3d05d24b5a9a7eab7110 | https://github.com/dumpmemory/Pytorch-NLU/tree/864fb9acc7751fc51abd3d05d24b5a9a7eab7110 |
DotProductLoss | import torch
import torch.nn as nn
class DotProductLoss(nn.Module):
def __init__(self):
super(DotProductLoss, self).__init__()
def forward(self, output, target):
return -torch.dot(target.view(-1), output.view(-1)) / target.nelement()
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 import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | ehsanik/dogTorch | DotProductLoss | false | 15,282 | [
"MIT"
] | 74 | 3a898862f6283e6603833991eeb62427216f2af7 | https://github.com/ehsanik/dogTorch/tree/3a898862f6283e6603833991eeb62427216f2af7 |
ContrastiveLoss | import torch
import torch.nn.functional as F
class ContrastiveLoss(torch.nn.Module):
def __init__(self, margin=2):
super(ContrastiveLoss, self).__init__()
self.margin = margin
def forward(self, output1, output2, label):
euclidean_distance = F.pairwise_distance(output1, output2)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._... | e-Neural/OfflineSignatureVerification | ContrastiveLoss | false | 15,283 | [
"MIT"
] | 51 | ea11009a3b2ac82c7091075466c505602a50817a | https://github.com/e-Neural/OfflineSignatureVerification/tree/ea11009a3b2ac82c7091075466c505602a50817a |
ImageToSequence | import torch
from typing import NamedTuple
from torch.nn.utils.rnn import pack_padded_sequence
def image_to_sequence(x, columnwise=True, return_packed=False):
x, xs = (x.data, x.sizes) if isinstance(x, PaddedTensor) else (x, None)
if x.dim() == 2:
x = x.view(1, 1, x.size(0), x.size(1))
elif x.dim(... | 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 NamedTuple
from torch.nn.utils.rnn import pack_padded_sequence
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | eivtho/PyLaia | ImageToSequence | false | 15,284 | [
"MIT"
] | 89 | 2a7a6e2eeb9b5af68c0faed0c564b02063e72be0 | https://github.com/eivtho/PyLaia/tree/2a7a6e2eeb9b5af68c0faed0c564b02063e72be0 |
GaussianNoise | import torch
import torch.nn as nn
class GaussianNoise(nn.Module):
"""A gaussian noise module.
Args:
stddev (float): The standard deviation of the normal distribution.
Default: 0.1.
Shape:
- Input: (batch, *)
- Output: (batch, *) (same shape as input)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | eezkni/UEGAN | GaussianNoise | false | 15,285 | [
"MIT"
] | 73 | a6616ac559819d487cae0f301d98cf2922a11a09 | https://github.com/eezkni/UEGAN/tree/a6616ac559819d487cae0f301d98cf2922a11a09 |
LR_PAD | import torch
import torch.nn as nn
def lr_pad(x, padding=1):
""" Pad left/right-most to each other instead of zero padding """
return torch.cat([x[..., -padding:], x, x[..., :padding]], dim=3)
class LR_PAD(nn.Module):
""" Pad left/right-most to each other instead of zero padding """
def __init__(se... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ekbanasolutions/HorizonNet | LR_PAD | false | 15,286 | [
"MIT"
] | 254 | 4eff713f8d446c53c479d86b4d06af166b724a74 | https://github.com/ekbanasolutions/HorizonNet/tree/4eff713f8d446c53c479d86b4d06af166b724a74 |
fChannelAttention | import math
import torch
import torch.optim
import torch.utils.data
class fChannelAttention(torch.nn.Module):
def __init__(self, N_in, ratio=1):
super(fChannelAttention, self).__init__()
self.N_in = N_in
self.ratio = ratio
self.weight_fc1 = torch.nn.Parameter(torch.Tensor(self.N_i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import math
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dyn... | dwromero/att_gconvs | fChannelAttention | false | 15,287 | [
"MIT"
] | 53 | 872259cad49763fdcfa3e96e80b6b5c331adf084 | https://github.com/dwromero/att_gconvs/tree/872259cad49763fdcfa3e96e80b6b5c331adf084 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.