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 |
|---|---|---|---|---|---|---|---|---|---|---|
FCN | import torch
from torch import nn
import torch.nn.functional as F
class FCN(nn.Module):
def __init__(self, k=32):
super(FCN, self).__init__()
self.conv1 = nn.Conv2d(1, k, 3, stride=2, dilation=2, padding=2)
self.conv2 = nn.Conv2d(k, k, 3, stride=2, dilation=2, padding=2)
self.conv... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | JulianYu123456/icnn | FCN | false | 13,973 | [
"Apache-2.0"
] | 258 | 0aaf4b5cd13d71d98b0d05f367e1f71657ea6eb8 | https://github.com/JulianYu123456/icnn/tree/0aaf4b5cd13d71d98b0d05f367e1f71657ea6eb8 |
KDLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
class KDLoss(nn.Module):
"""Knowledge Distillation Loss"""
def __init__(self, T):
super().__init__()
self.t = T
def forward(self, stu_pred, tea_pred):
s = F.log_softmax(stu_pred / self.t, dim=1)
t = F.soft... | 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... | LANCEREN/simpleAICV-pytorch-ImageNet-COCO-training | KDLoss | false | 13,974 | [
"MIT"
] | 154 | 86c1b38df3cdcb195ec5b6229c343f07a52aeb7b | https://github.com/LANCEREN/simpleAICV-pytorch-ImageNet-COCO-training/tree/86c1b38df3cdcb195ec5b6229c343f07a52aeb7b |
forfilter | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.utils.data
class forfilter(nn.Module):
def __init__(self, inplanes):
super(forfilter, self).__init__()
self.forfilter1 = nn.Conv2d(1, 1, (7, 1), 1, (0, 0), bias=False)
self.inplanes = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | Kitsunetic/360SD-Net | forfilter | false | 13,975 | [
"MIT"
] | 134 | bb87f8e238cbfe086066f7ff2dd2883ff86885e9 | https://github.com/Kitsunetic/360SD-Net/tree/bb87f8e238cbfe086066f7ff2dd2883ff86885e9 |
SPP | import torch
import torch.nn as nn
class SPP(nn.Module):
"""
Spatial pyramid pooling layer used in YOLOv3-SPP
"""
def __init__(self, kernels=[5, 9, 13]):
super(SPP, self).__init__()
self.maxpool_layers = nn.ModuleList([nn.MaxPool2d(kernel_size=
kernel, stride=1, padding=ke... | 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... | LANCEREN/simpleAICV-pytorch-ImageNet-COCO-training | SPP | false | 13,976 | [
"MIT"
] | 154 | 86c1b38df3cdcb195ec5b6229c343f07a52aeb7b | https://github.com/LANCEREN/simpleAICV-pytorch-ImageNet-COCO-training/tree/86c1b38df3cdcb195ec5b6229c343f07a52aeb7b |
HardSwish | import torch
from torch import nn
import torch.nn.functional as F
def hard_swish(x: 'torch.Tensor', inplace: 'bool'=False) ->torch.Tensor:
inner = F.relu6(x + 3.0).div_(6.0)
return x.mul_(inner) if inplace else x.mul(inner)
class HardSwish(nn.Module):
"""
HardSwish activiation layer.
Applies th... | 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
import torch.nn.functional as F
assert_size_stride = torch._C._dynam... | L-Net-1992/towhee | HardSwish | false | 13,977 | [
"Apache-2.0"
] | 365 | 471de97bf9c5443efaf3b62fd440b3ebdb6d5903 | https://github.com/L-Net-1992/towhee/tree/471de97bf9c5443efaf3b62fd440b3ebdb6d5903 |
_ResLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
class _ResLayer(nn.Module):
def __init__(self, dim_in, dim_out, dim_hidden, act='tanh'):
super().__init__()
self.fc1 = nn.Linear(dim_in, dim_hidden, bias=True)
self.fc2 = nn.Linear(dim_hidden, dim_out, bias=True)
i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | KyleDavisSA/pde-surrogate | _ResLayer | false | 13,978 | [
"MIT"
] | 62 | 41ad2c9eb73c323e389174080f4b3df6cbd3c900 | https://github.com/KyleDavisSA/pde-surrogate/tree/41ad2c9eb73c323e389174080f4b3df6cbd3c900 |
Decoder | import math
import torch
from torch import nn
import torch.hub
def overlap_and_add(signal, frame_step):
outer_dimensions = signal.size()[:-2]
frames, frame_length = signal.size()[-2:]
subframe_length = math.gcd(frame_length, frame_step)
subframe_step = frame_step // subframe_length
subframes_per_f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import math
from torch import nn
import torch.hub
assert_size_stride = torch._C.... | KilianRuiz2B/demucs | Decoder | false | 13,979 | [
"MIT"
] | 3,013 | a6fbf3806b018634f68563887feaee64c5e36600 | https://github.com/KilianRuiz2B/demucs/tree/a6fbf3806b018634f68563887feaee64c5e36600 |
HorizontalMaxPool2d | import torch
import torch.nn as nn
class HorizontalMaxPool2d(nn.Module):
def __init__(self):
super(HorizontalMaxPool2d, self).__init__()
def forward(self, x):
inp_size = x.size()
return nn.functional.max_pool2d(input=x, kernel_size=(1, inp_size[3]))
def get_inputs():
return [to... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | LT1st/ReID_Alined_beginer | HorizontalMaxPool2d | false | 13,980 | [
"MIT"
] | 370 | 1a12403a32d99900451ac05cd3623a9b770f6d24 | https://github.com/LT1st/ReID_Alined_beginer/tree/1a12403a32d99900451ac05cd3623a9b770f6d24 |
LocationLoss | import torch
class LocationLoss(torch.nn.Module):
def __init__(self, crop_size=192, **kwargs):
super().__init__()
self._crop_size = crop_size
def forward(self, pred_locations, teac_locations):
pred_locations = pred_locations / (0.5 * self._crop_size) - 1
return torch.mean(tor... | 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | L-Net-1992/DI-drive | LocationLoss | false | 13,981 | [
"Apache-2.0"
] | 219 | cc7f47bedbf60922acbcf3a5f77fc8e274df62cf | https://github.com/L-Net-1992/DI-drive/tree/cc7f47bedbf60922acbcf3a5f77fc8e274df62cf |
Conv2dSame | import math
import torch
from torch import nn
from typing import List
from typing import Union
import torch.nn.functional as F
from typing import Optional
from typing import Tuple
from torch.nn.common_types import _size_2_t
def get_same_padding(x: 'int', k: 'int', s: 'int', d: 'int') ->int:
"""
Calculate asym... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
from typing import List
from typing import Unio... | L-Net-1992/towhee | Conv2dSame | false | 13,982 | [
"Apache-2.0"
] | 365 | 471de97bf9c5443efaf3b62fd440b3ebdb6d5903 | https://github.com/L-Net-1992/towhee/tree/471de97bf9c5443efaf3b62fd440b3ebdb6d5903 |
WeightedSmoothL1Loss | import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.autograd
class WeightedSmoothL1Loss(nn.Module):
"""
Code-wise Weighted Smooth L1 Loss modified based on fvcore.nn.smooth_l1_loss
https://github.com/facebookresearch/fvcore/blob/master/fvcore/nn/smooth_l1_loss.py
... | 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
import torch.utils.da... | LaudateCorpus1/LIGA-Stereo | WeightedSmoothL1Loss | false | 13,983 | [
"Apache-2.0"
] | 56 | aee3731a24a0ab1667e633e520cc89be2f135272 | https://github.com/LaudateCorpus1/LIGA-Stereo/tree/aee3731a24a0ab1667e633e520cc89be2f135272 |
MLP | import torch
from abc import *
import torch.nn.functional as F
from torch.optim import *
def orthogonal_init(layer, nonlinearity='relu'):
if isinstance(nonlinearity, str):
if nonlinearity == 'policy':
gain = 0.01
else:
gain = torch.nn.init.calculate_gain(nonlinearity)
e... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 abc import *
from torch.... | Kyushik/JORLDY | MLP | false | 13,984 | [
"Apache-2.0"
] | 300 | 6a24a2195e5e87ade157ee53f631af2221f0a188 | https://github.com/Kyushik/JORLDY/tree/6a24a2195e5e87ade157ee53f631af2221f0a188 |
InnerProductLoss | import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.autograd
class InnerProductLoss(nn.Module):
def __init__(self, code_weights: 'list'=None):
super(InnerProductLoss, self).__init__()
if code_weights is not None:
self.code_weights = np.array(code... | 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 numpy as np
import torch.nn as nn
import torch.utils.data
import torch.a... | LaudateCorpus1/LIGA-Stereo | InnerProductLoss | false | 13,985 | [
"Apache-2.0"
] | 56 | aee3731a24a0ab1667e633e520cc89be2f135272 | https://github.com/LaudateCorpus1/LIGA-Stereo/tree/aee3731a24a0ab1667e633e520cc89be2f135272 |
M1 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Conv2D(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, same_padding
=False, stride=1, relu=True, bn=False):
super(Conv2D, self).__init__()
padding = int((kernel_size - 1) / 2) if same_padding e... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Juggernaut93/SSH-pytorch | M1 | false | 13,986 | [
"MIT"
] | 63 | 8ea205fb1a3adfc32b5a4e35f68ed4d385ddbc31 | https://github.com/Juggernaut93/SSH-pytorch/tree/8ea205fb1a3adfc32b5a4e35f68ed4d385ddbc31 |
WeightedBinaryCrossEntropyLoss | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
import torch.autograd
class WeightedBinaryCrossEntropyLoss(nn.Module):
def __init__(self):
super(WeightedBinaryCrossEntropyLoss, self).__init__()
def forward(self, input: 'torch.Tensor', target: 'torch.Tensor'... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | LaudateCorpus1/LIGA-Stereo | WeightedBinaryCrossEntropyLoss | false | 13,987 | [
"Apache-2.0"
] | 56 | aee3731a24a0ab1667e633e520cc89be2f135272 | https://github.com/LaudateCorpus1/LIGA-Stereo/tree/aee3731a24a0ab1667e633e520cc89be2f135272 |
My_SmoothL1Loss | import torch
class My_SmoothL1Loss(torch.nn.Module):
def __init__(self):
super(My_SmoothL1Loss, self).__init__()
def forward(self, x, y):
total_loss = 0
assert x.shape == y.shape
z = (x - y).float()
mse_mask = (torch.abs(z) < 0.01).float()
l1_mask = (torch.abs... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = t... | LiderMyHand/AWR-Adaptive-Weighting-Regression | My_SmoothL1Loss | false | 13,988 | [
"MIT"
] | 90 | 81c4c98edd98cd03d423d820ca1fe9e01dbbb242 | https://github.com/LiderMyHand/AWR-Adaptive-Weighting-Regression/tree/81c4c98edd98cd03d423d820ca1fe9e01dbbb242 |
WeightedL2WithSigmaLoss | import math
import torch
import numpy as np
import torch.nn as nn
import torch.utils.data
import torch.autograd
class WeightedL2WithSigmaLoss(nn.Module):
def __init__(self, code_weights: 'list'=None):
super(WeightedL2WithSigmaLoss, self).__init__()
if code_weights is not None:
self.co... | 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 math
import numpy as np
import torch.nn as nn
import torch.utils.data
im... | LaudateCorpus1/LIGA-Stereo | WeightedL2WithSigmaLoss | false | 13,989 | [
"Apache-2.0"
] | 56 | aee3731a24a0ab1667e633e520cc89be2f135272 | https://github.com/LaudateCorpus1/LIGA-Stereo/tree/aee3731a24a0ab1667e633e520cc89be2f135272 |
KLMutualLoss | import torch
import torch.nn as nn
class KLMutualLoss(nn.Module):
def __init__(self):
super(KLMutualLoss, self).__init__()
self.kl_loss = nn.KLDivLoss(size_average=False)
self.log_softmax = nn.functional.log_softmax
self.softmax = nn.functional.softmax
def forward(self, pred1... | 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... | LT1st/ReID_Alined_beginer | KLMutualLoss | false | 13,990 | [
"MIT"
] | 370 | 1a12403a32d99900451ac05cd3623a9b770f6d24 | https://github.com/LT1st/ReID_Alined_beginer/tree/1a12403a32d99900451ac05cd3623a9b770f6d24 |
Upsample | import torch
import torch.nn as nn
import torch.nn.functional as F
class Upsample(nn.Module):
""" nn.Upsample is deprecated """
def __init__(self, scale_factor, mode='nearest'):
super(Upsample, self).__init__()
self.scale_factor = scale_factor
self.mode = mode
def forward(self, 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Liang813/GaitGraph | Upsample | false | 13,991 | [
"MIT"
] | 57 | df8cfd8d1e7a91a738190ba68bc52a67207188e5 | https://github.com/Liang813/GaitGraph/tree/df8cfd8d1e7a91a738190ba68bc52a67207188e5 |
HardMish | import torch
from torch import nn
def hard_mish(x, inplace: 'bool'=False):
if inplace:
return x.mul_(0.5 * (x + 2).clamp(min=0, max=2))
else:
return 0.5 * x * (x + 2).clamp(min=0, max=2)
class HardMish(nn.Module):
"""
Hard Mish
Experimental, based on notes by Mish author Diganta ... | 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... | L-Net-1992/towhee | HardMish | false | 13,992 | [
"Apache-2.0"
] | 365 | 471de97bf9c5443efaf3b62fd440b3ebdb6d5903 | https://github.com/L-Net-1992/towhee/tree/471de97bf9c5443efaf3b62fd440b3ebdb6d5903 |
Dropout2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class Dropout2d(nn.Dropout2d):
def forward(self, input):
return F.dropout2d(input, self.p, True, self.inplace)
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Lakonik/MonoRUn | Dropout2d | false | 13,993 | [
"MIT"
] | 86 | 5bcc5278ea7a6b9cac6b7933c66921fa3011ce9a | https://github.com/Lakonik/MonoRUn/tree/5bcc5278ea7a6b9cac6b7933c66921fa3011ce9a |
WeightedCrossEntropyLoss | import torch
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
import torch.autograd
class WeightedCrossEntropyLoss(nn.Module):
"""
Transform input to fit the fomation of PyTorch offical cross entropy loss
with anchor-wise weighting.
"""
def __init__(self):
sup... | 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
... | LaudateCorpus1/LIGA-Stereo | WeightedCrossEntropyLoss | false | 13,994 | [
"Apache-2.0"
] | 56 | aee3731a24a0ab1667e633e520cc89be2f135272 | https://github.com/LaudateCorpus1/LIGA-Stereo/tree/aee3731a24a0ab1667e633e520cc89be2f135272 |
Attention | import torch
from torch import nn
from torch.nn import functional as F
import torch.nn.init
class Attention(nn.Module):
"""
Applies an attention mechanism on the output features from the decoder.
"""
def __init__(self, dim):
super(Attention, self).__init__()
self.dim = dim
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | KunpengLi1994/VSRN | Attention | false | 13,995 | [
"Apache-2.0"
] | 238 | 777ae74326fdb6abe69dbd3911d0e545322520d1 | https://github.com/KunpengLi1994/VSRN/tree/777ae74326fdb6abe69dbd3911d0e545322520d1 |
AverageRC | import torch
import torch.nn as nn
class AverageRC(nn.Module):
def __init__(self):
super(AverageRC, self).__init__()
def forward(self, input):
input = input[:int(input.shape[0] / 2)] / 2 + input[int(input.shape
[0] / 2):] / 2
return input
def get_inputs():
return [t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Luma-1994/lama | AverageRC | false | 13,996 | [
"MIT"
] | 137 | 60d802e2e4cce789f03eea11b038212ba5f7fd1b | https://github.com/Luma-1994/lama/tree/60d802e2e4cce789f03eea11b038212ba5f7fd1b |
MarginLoss | from torch.nn import Module
import torch
from torch import ones_like
from torch.nn import MarginRankingLoss
class MarginLoss(Module):
"""Margin loss as it was defined in `TransE paper
<https://papers.nips.cc/paper/5071-translating-embeddings-for-modeling-multi-relational-data>`_
by Bordes et al. in 2013. ... | 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.nn import MarginRankingLoss
assert_size_stride = t... | MacOS/torchkge | MarginLoss | false | 13,997 | [
"BSD-3-Clause"
] | 248 | 89ed724368f3a5279c0f79c6ba1f948ed2a5696f | https://github.com/MacOS/torchkge/tree/89ed724368f3a5279c0f79c6ba1f948ed2a5696f |
LogisticLoss | from torch.nn import Module
import torch
from torch import ones_like
from torch.nn import SoftMarginLoss
class LogisticLoss(Module):
"""Logistic loss as it was defined in `TransE paper
<https://papers.nips.cc/paper/5071-translating-embeddings-for-modeling-multi-relational-data>`_
by Bordes et al. in 2013.... | 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.... | MacOS/torchkge | LogisticLoss | false | 13,998 | [
"BSD-3-Clause"
] | 248 | 89ed724368f3a5279c0f79c6ba1f948ed2a5696f | https://github.com/MacOS/torchkge/tree/89ed724368f3a5279c0f79c6ba1f948ed2a5696f |
BinaryCrossEntropyLoss | from torch.nn import Module
import torch
from torch import zeros_like
from torch import ones_like
from torch.nn import Sigmoid
from torch.nn import BCELoss
class BinaryCrossEntropyLoss(Module):
"""This class implements :class:`torch.nn.Module` interface.
"""
def __init__(self):
super().__init__(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch.... | MacOS/torchkge | BinaryCrossEntropyLoss | false | 13,999 | [
"BSD-3-Clause"
] | 248 | 89ed724368f3a5279c0f79c6ba1f948ed2a5696f | https://github.com/MacOS/torchkge/tree/89ed724368f3a5279c0f79c6ba1f948ed2a5696f |
ReCodeAlphabet | import torch
import torch.nn as nn
class ReCodeAlphabet(nn.Module):
def __init__(self):
super(ReCodeAlphabet, self).__init__()
def forward(self, input):
input_reordered = [input[:, i, ...] for i in [0, 2, 1, 3]]
input = torch.stack(input_reordered, dim=1)
return input
def g... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Luma-1994/lama | ReCodeAlphabet | false | 14,000 | [
"MIT"
] | 137 | 60d802e2e4cce789f03eea11b038212ba5f7fd1b | https://github.com/Luma-1994/lama/tree/60d802e2e4cce789f03eea11b038212ba5f7fd1b |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, latent_dim=4, obs_dim=2, nhidden=20):
super(Decoder, self).__init__()
self.relu = nn.ReLU(inplace=True)
self.fc1 = nn.Linear(latent_dim, nhidden)
self.fc2 = nn.Linear(nhidden, obs_dim)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | MaricelaM/torchdiffeq | Decoder | false | 14,001 | [
"MIT"
] | 4,088 | 4e070fb687167e53082a91f32e102af7f4521058 | https://github.com/MaricelaM/torchdiffeq/tree/4e070fb687167e53082a91f32e102af7f4521058 |
SineODE | import math
import torch
class SineODE(torch.nn.Module):
def forward(self, t, y):
return 2 * y / t + t ** 4 * torch.sin(2 * t) - t ** 2 + 4 * t ** 3
def y_exact(self, t):
return -0.5 * t ** 4 * torch.cos(2 * t) + 0.5 * t ** 3 * torch.sin(
2 * t) + 0.25 * t ** 2 * torch.cos(2 * t)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import math
assert_size_stride = torch._C._dynamo.guards.assert_size_stri... | MaricelaM/torchdiffeq | SineODE | false | 14,002 | [
"MIT"
] | 4,088 | 4e070fb687167e53082a91f32e102af7f4521058 | https://github.com/MaricelaM/torchdiffeq/tree/4e070fb687167e53082a91f32e102af7f4521058 |
ODEfunc | import torch
import torch.nn as nn
def norm(dim):
return nn.GroupNorm(min(32, dim), dim)
class ConcatConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False):
super(ConcatConv2d, self).__init__()
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
from torch._inductor.runtime.... | MaricelaM/torchdiffeq | ODEfunc | false | 14,003 | [
"MIT"
] | 4,088 | 4e070fb687167e53082a91f32e102af7f4521058 | https://github.com/MaricelaM/torchdiffeq/tree/4e070fb687167e53082a91f32e102af7f4521058 |
ResizeTransform | import torch
import torch.nn as nn
import torch.nn.functional as nnf
class ResizeTransform(nn.Module):
"""
Resize a transform, which involves resizing the vector field *and* rescaling it.
"""
def __init__(self, vel_resize, ndims):
super().__init__()
self.factor = 1.0 / vel_resize
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | McHz1s/voxelmorph | ResizeTransform | false | 14,004 | [
"Apache-2.0"
] | 1,532 | 0ca00ccf85be5c2d0ae73a166b64460e02c01d33 | https://github.com/McHz1s/voxelmorph/tree/0ca00ccf85be5c2d0ae73a166b64460e02c01d33 |
ConstantODE | import torch
class ConstantODE(torch.nn.Module):
def __init__(self):
super(ConstantODE, self).__init__()
self.a = torch.nn.Parameter(torch.tensor(0.2))
self.b = torch.nn.Parameter(torch.tensor(3.0))
def forward(self, t, y):
return self.a + (y - (self.a * t + self.b)) ** 5
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | MaricelaM/torchdiffeq | ConstantODE | false | 14,005 | [
"MIT"
] | 4,088 | 4e070fb687167e53082a91f32e102af7f4521058 | https://github.com/MaricelaM/torchdiffeq/tree/4e070fb687167e53082a91f32e102af7f4521058 |
SigmoidFocalClassificationLoss | import torch
import torch.nn as nn
class SigmoidFocalClassificationLoss(nn.Module):
"""
Sigmoid focal cross entropy loss.
"""
def __init__(self, gamma: 'float'=2.0, alpha: 'float'=0.25):
"""
Args:
gamma: Weighting parameter to balance loss for hard and easy examples.
... | 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... | MartinHahner/OpenPCDet | SigmoidFocalClassificationLoss | false | 14,006 | [
"Apache-2.0"
] | 1,984 | 9375908d30ee5023355ebdd77041d7f2cbfd7ec8 | https://github.com/MartinHahner/OpenPCDet/tree/9375908d30ee5023355ebdd77041d7f2cbfd7ec8 |
GDL | import torch
from torch import nn
class GDL(nn.Module):
def __init__(self, drop_rate=0.8, drop_th=0.7):
super(GDL, self).__init__()
if not 0 <= drop_rate <= 1:
raise ValueError('drop-rate must be in range [0, 1].')
if not 0 <= drop_th <= 1:
raise ValueError('drop-t... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
fro... | Lixy1997/Group-WSSS | GDL | false | 14,007 | [
"MIT"
] | 80 | 0afcc3a21c3bec69fbc5b6d1d4ee84ffd405d253 | https://github.com/Lixy1997/Group-WSSS/tree/0afcc3a21c3bec69fbc5b6d1d4ee84ffd405d253 |
UpdateNodeEmbeddingLayer | import torch
import torch.nn.functional as F
import torch.nn as nn
class UpdateNodeEmbeddingLayer(nn.Module):
def __init__(self, n_features):
super().__init__()
self.message_layer = nn.Linear(2 * n_features, n_features, bias=False)
self.update_layer = nn.Linear(2 * n_features, n_features,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | LanaLana/eco-dqn | UpdateNodeEmbeddingLayer | false | 14,008 | [
"MIT"
] | 57 | c9ac07618b906bc14faaa1ddc7df3f4b31d83c37 | https://github.com/LanaLana/eco-dqn/tree/c9ac07618b906bc14faaa1ddc7df3f4b31d83c37 |
BiaffineAttention | import torch
from torch import optim as optim
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
import torch.utils.checkpoint
class BiaffineAttention(torch.nn.Module):
"""Implements a biaffine attention operator for binary relation classification.
PyTorch ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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 optim as optim
import torch.utils.data
import torch.onnx.opera... | Maria-philna/unilm | BiaffineAttention | false | 14,009 | [
"MIT"
] | 5,129 | 5550a335c6d2ae5838b1a90e50cb46f81edcd50f | https://github.com/Maria-philna/unilm/tree/5550a335c6d2ae5838b1a90e50cb46f81edcd50f |
ResBlock | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
def norm(dim):
return nn.GroupNorm(min(32, dim), dim)
class ResBlock(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
from torch._inductor.runtime.... | MaricelaM/torchdiffeq | ResBlock | false | 14,010 | [
"MIT"
] | 4,088 | 4e070fb687167e53082a91f32e102af7f4521058 | https://github.com/MaricelaM/torchdiffeq/tree/4e070fb687167e53082a91f32e102af7f4521058 |
AddCoords | import torch
from torch import nn
class AddCoords(nn.Module):
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
Args:
input_tensor: shape(batch, channel, x_dim, y_dim)
"""
batch_size, _, ... | 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... | MingSungChao/IPN-hand | AddCoords | false | 14,011 | [
"MIT"
] | 54 | 0b061e4438f159e3e312af4959cb424917b5c367 | https://github.com/MingSungChao/IPN-hand/tree/0b061e4438f159e3e312af4959cb424917b5c367 |
Conv2d | import torch
import torch.nn as nn
from torch.nn import functional as F
class Conv2d(nn.Conv2d):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, dilation=1, groups=1, bias=True):
super(Conv2d, self).__init__(in_channels, out_channels, kernel_size,
strid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | MarcoForte/DeepInteractiveSegmentation | Conv2d | false | 14,012 | [
"MIT"
] | 95 | ddd7426ea9f36ff6a110d836b1b920a1215cbfee | https://github.com/MarcoForte/DeepInteractiveSegmentation/tree/ddd7426ea9f36ff6a110d836b1b920a1215cbfee |
CRF | import torch
import torch.nn as nn
import torch.nn.init
class CRF(nn.Module):
"""
Conditional Random Field Module
Parameters
----------
hidden_dim : ``int``, required.
the dimension of the input features.
tagset_size : ``int``, required.
the size of the target labels.
if_b... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.init
assert_size_stride = torch._C._dynamo... | LiyuanLucasLiu/LightNER | CRF | false | 14,013 | [
"Apache-2.0"
] | 115 | 4abb61f473b8144a08ceaf74569cc6c1e9fdb53e | https://github.com/LiyuanLucasLiu/LightNER/tree/4abb61f473b8144a08ceaf74569cc6c1e9fdb53e |
ResidualConvUnit | import torch
from torch import nn
import torch.nn.parallel
class ResidualConvUnit(nn.Module):
def __init__(self, features):
super().__init__()
self.conv1 = nn.Conv2d(features, features, kernel_size=3, stride=1,
padding=1, bias=True)
self.conv2 = nn.Conv2d(features, features, k... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | Minerva-J/Pytorch-Segmentation-multi-models | ResidualConvUnit | false | 14,014 | [
"Apache-2.0"
] | 84 | 0845b54d4fbc8d38c70f158054b7ab1be2b3ceb9 | https://github.com/Minerva-J/Pytorch-Segmentation-multi-models/tree/0845b54d4fbc8d38c70f158054b7ab1be2b3ceb9 |
SmallDecoder1_16x | import torch
import torch.nn as nn
class SmallDecoder1_16x(nn.Module):
def __init__(self, model=None, fixed=False):
super(SmallDecoder1_16x, self).__init__()
self.fixed = fixed
self.conv11 = nn.Conv2d(24, 3, 3, 1, 0, dilation=1)
self.relu = nn.ReLU(inplace=True)
self.pad =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | SmallDecoder1_16x | false | 14,015 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
Decoder1 | import torch
import torch.nn as nn
class Decoder1(nn.Module):
def __init__(self, model=None, fixed=False):
super(Decoder1, self).__init__()
self.fixed = fixed
self.conv11 = nn.Conv2d(64, 3, 3, 1, 0, dilation=1)
self.relu = nn.ReLU(inplace=True)
self.unpool = nn.UpsamplingN... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | Decoder1 | false | 14,016 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
Affine | import torch
import torch.nn as nn
import torch.autograd
import torch.utils.data
class Affine(nn.Module):
def __init__(self, dim):
super().__init__()
self.alpha = nn.Parameter(torch.ones((1, 1, dim)))
self.beta = nn.Parameter(torch.zeros((1, 1, dim)))
def forward(self, x):
re... | 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.autograd
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_st... | MinghuiChen43/CIL-ReID | Affine | false | 14,017 | [
"MIT"
] | 58 | 73c87500c4673db400f2760059aea27de7e08468 | https://github.com/MinghuiChen43/CIL-ReID/tree/73c87500c4673db400f2760059aea27de7e08468 |
Encoder1 | import torch
import torch.nn as nn
class Encoder1(nn.Module):
def __init__(self, model=None, fixed=False):
super(Encoder1, self).__init__()
self.fixed = fixed
self.conv0 = nn.Conv2d(3, 3, 1, 1, 0)
self.conv11 = nn.Conv2d(3, 64, 3, 1, 0, dilation=1)
self.relu = nn.ReLU(inpl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | Encoder1 | false | 14,018 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
CoordConv | import torch
from torch import nn
class AddCoords(nn.Module):
def __init__(self, with_r=False):
super().__init__()
self.with_r = with_r
def forward(self, input_tensor):
"""
Args:
input_tensor: shape(batch, channel, x_dim, y_dim)
"""
batch_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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | MingSungChao/IPN-hand | CoordConv | false | 14,019 | [
"MIT"
] | 54 | 0b061e4438f159e3e312af4959cb424917b5c367 | https://github.com/MingSungChao/IPN-hand/tree/0b061e4438f159e3e312af4959cb424917b5c367 |
SelfAttentionConv2d | import math
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
import torch.nn.init as init
from torch.nn.modules.utils import _pair
class SelfAttentionConv2d(nn.Module):
def __init__(self, in_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MerHS/SASA-pytorch | SelfAttentionConv2d | false | 14,020 | [
"MIT"
] | 47 | 7d113852dce2e25d4de23caf87ad7d33758c322e | https://github.com/MerHS/SASA-pytorch/tree/7d113852dce2e25d4de23caf87ad7d33758c322e |
Decoder2 | import torch
import torch.nn as nn
class Decoder2(nn.Module):
def __init__(self, model=None, fixed=False):
super(Decoder2, self).__init__()
self.fixed = fixed
self.conv21 = nn.Conv2d(128, 64, 3, 1, 0)
self.conv12 = nn.Conv2d(64, 64, 3, 1, 0, dilation=1)
self.conv11 = nn.Co... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | Decoder2 | false | 14,021 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
ASPP | import torch
from torch import nn
import torch.nn.functional as F
class ASPP(nn.Module):
"""
Atrous spatial pyramid pooling used in object detection and segmentation.
"""
def __init__(self, in_channel=512, depth=256):
super().__init__()
self.mean = nn.AdaptiveAvgPool2d((1, 1))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | L-Net-1992/towhee | ASPP | false | 14,022 | [
"Apache-2.0"
] | 365 | 471de97bf9c5443efaf3b62fd440b3ebdb6d5903 | https://github.com/L-Net-1992/towhee/tree/471de97bf9c5443efaf3b62fd440b3ebdb6d5903 |
PredictionConvolutions | import torch
from torch import nn
class PredictionConvolutions(nn.Module):
"""
Convolutions to predict class scores and bounding boxes using lower and higher-level feature maps.
The bounding boxes (locations) are predicted as encoded offsets w.r.t each of the 8732 prior (default) boxes.
See 'cxcy_to_g... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | HFAiLab/ffrecord | PredictionConvolutions | false | 14,023 | [
"MIT"
] | 47 | e916dc715ffa38a304a673ade7c5aa1efff5936d | https://github.com/HFAiLab/ffrecord/tree/e916dc715ffa38a304a673ade7c5aa1efff5936d |
InnerProductLayer | import torch
import torch.nn as nn
from sklearn.metrics import *
class InnerProductLayer(nn.Module):
"""InnerProduct Layer used in PNN that compute the element-wise
product or inner product between feature vectors.
Input shape
- a list of 3D tensor with shape: ``(batch_size,1,embedding_size)``.
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from sklearn.metrics import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = tor... | Fanxingye/DeepRS | InnerProductLayer | false | 14,024 | [
"Apache-2.0"
] | 1,770 | 06b98cf2cb2781656805eafc577fbd088f37d17d | https://github.com/Fanxingye/DeepRS/tree/06b98cf2cb2781656805eafc577fbd088f37d17d |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
import torch._utils
class MaxPoolStride1(nn.Module):
def __init__(self, kernel_size):
super(MaxPoolStride1, self).__init__()
self.kernel_size = kernel_size
self.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
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import ... | Minipeps/betapose | MaxPoolStride1 | false | 14,025 | [
"MIT"
] | 66 | 11f2cc4ca0711ac8ce8e5b72ce9eef583b179eaa | https://github.com/Minipeps/betapose/tree/11f2cc4ca0711ac8ce8e5b72ce9eef583b179eaa |
AsymmetricLossMultiLabel | import torch
import torch.nn as nn
import torch.autograd
import torch.utils.data
class AsymmetricLossMultiLabel(nn.Module):
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_focal_loss=False):
super(AsymmetricLossMultiLabel, self).__init__()
self.gamma_... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | MinghuiChen43/CIL-ReID | AsymmetricLossMultiLabel | false | 14,026 | [
"MIT"
] | 58 | 73c87500c4673db400f2760059aea27de7e08468 | https://github.com/MinghuiChen43/CIL-ReID/tree/73c87500c4673db400f2760059aea27de7e08468 |
AGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class AGRUCell(nn.Module):
""" Attention based GRU (AGRU)
Reference:
- Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, 2018.
"""
def __... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | Fanxingye/DeepRS | AGRUCell | false | 14,027 | [
"Apache-2.0"
] | 1,770 | 06b98cf2cb2781656805eafc577fbd088f37d17d | https://github.com/Fanxingye/DeepRS/tree/06b98cf2cb2781656805eafc577fbd088f37d17d |
FM | import torch
import torch.nn as nn
from sklearn.metrics import *
class FM(nn.Module):
"""Factorization Machine models pairwise (order-2) feature interactions
without linear term and bias.
Input shape
- 3D tensor with shape: ``(batch_size,field_size,embedding_size)``.
Output shape
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from sklearn.metrics import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = tor... | Fanxingye/DeepRS | FM | false | 14,028 | [
"Apache-2.0"
] | 1,770 | 06b98cf2cb2781656805eafc577fbd088f37d17d | https://github.com/Fanxingye/DeepRS/tree/06b98cf2cb2781656805eafc577fbd088f37d17d |
CosNorm_Classifier | import math
import torch
from torch import nn
from torch.nn.parameter import Parameter
class CosNorm_Classifier(nn.Module):
def __init__(self, in_dims, out_dims, scale=16, margin=0.5, init_std=0.001
):
super(CosNorm_Classifier, self).__init__()
self.in_dims = in_dims
self.out_dims... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | MathematicalModels/OpenLongTailRecognition-OLTR | CosNorm_Classifier | false | 14,029 | [
"BSD-3-Clause"
] | 765 | bd2a3d8adc271d1ffd6d6787353ae77f3d7fdfeb | https://github.com/MathematicalModels/OpenLongTailRecognition-OLTR/tree/bd2a3d8adc271d1ffd6d6787353ae77f3d7fdfeb |
Decoder3 | import torch
import torch.nn as nn
class Decoder3(nn.Module):
def __init__(self, model=None, fixed=False):
super(Decoder3, self).__init__()
self.fixed = fixed
self.conv31 = nn.Conv2d(256, 128, 3, 1, 0)
self.conv22 = nn.Conv2d(128, 128, 3, 1, 0)
self.conv21 = nn.Conv2d(128,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | Decoder3 | false | 14,030 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
TensorCumsum | import torch
class TensorCumsum(torch.nn.Module):
def __init__(self, dim=1):
super().__init__()
self.dim = dim
def forward(self, input):
return torch.cumsum(input, dim=self.dim)
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Minyus/pipelinex | TensorCumsum | false | 14,031 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
TensorConstantLinear | import torch
class TensorConstantLinear(torch.nn.Module):
def __init__(self, weight=1, bias=0):
self.weight = weight
self.bias = bias
super().__init__()
def forward(self, input):
return self.weight * input + self.bias
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Minyus/pipelinex | TensorConstantLinear | false | 14,032 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
TensorExp | import torch
class TensorExp(torch.nn.Module):
def forward(self, input):
return torch.exp(input)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | Minyus/pipelinex | TensorExp | false | 14,033 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
GumbelSoftMax | import torch
import torch.nn as nn
import torch.nn.functional as F
from math import sqrt as sqrt
from itertools import product as product
class _GumbelSoftMax(torch.autograd.Function):
"""
implementing the MixedOp, but carried out in a different way as DARTS
DARTS adds all operations together, then selec... | import torch
from torch import device
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_ma... | MinliangLin/lightDSFD | GumbelSoftMax | false | 14,034 | [
"MIT"
] | 87 | 5f04ab89ac08eaf69d16c96f6c9e237701f80281 | https://github.com/MinliangLin/lightDSFD/tree/5f04ab89ac08eaf69d16c96f6c9e237701f80281 |
CrossNet | import torch
import torch.nn as nn
from sklearn.metrics import *
class CrossNet(nn.Module):
"""The Cross Network part of Deep&Cross Network model,
which leans both low and high degree cross feature.
Input shape
- 2D tensor with shape: ``(batch_size, units)``.
Output shape
- 2D tens... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from sklearn.metrics import *
assert_size_stride = torch._... | Fanxingye/DeepRS | CrossNet | false | 14,035 | [
"Apache-2.0"
] | 1,770 | 06b98cf2cb2781656805eafc577fbd088f37d17d | https://github.com/Fanxingye/DeepRS/tree/06b98cf2cb2781656805eafc577fbd088f37d17d |
Encoder3 | import torch
import torch.nn as nn
class Encoder3(nn.Module):
def __init__(self, model=None, fixed=False):
super(Encoder3, self).__init__()
self.fixed = fixed
self.conv0 = nn.Conv2d(3, 3, 1, 1, 0)
self.conv11 = nn.Conv2d(3, 64, 3, 1, 0)
self.conv12 = nn.Conv2d(64, 64, 3, 1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | Encoder3 | false | 14,036 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
TensorMax | import torch
def tensor_max(input, dim, keepdim=False):
if isinstance(dim, int):
return torch.max(input, dim=dim, keepdim=keepdim)[0]
else:
if isinstance(dim, tuple):
dim = list(dim)
for d in dim:
input = torch.max(input, dim=d, keepdim=keepdim)[0]
retur... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Minyus/pipelinex | TensorMax | false | 14,037 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
TensorLog | import torch
class TensorLog(torch.nn.Module):
def forward(self, input):
return torch.log(input)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_str... | Minyus/pipelinex | TensorLog | false | 14,038 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
TensorNearestPad | import torch
class TensorNearestPad(torch.nn.Module):
def __init__(self, lower=1, upper=1):
super().__init__()
assert isinstance(lower, int) and lower >= 0
assert isinstance(upper, int) and upper >= 0
self.lower = lower
self.upper = upper
def forward(self, input):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Minyus/pipelinex | TensorNearestPad | false | 14,039 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
Encoder2 | import torch
import torch.nn as nn
class Encoder2(nn.Module):
def __init__(self, model=None, fixed=False):
super(Encoder2, self).__init__()
self.fixed = fixed
self.conv0 = nn.Conv2d(3, 3, 1, 1, 0)
self.conv11 = nn.Conv2d(3, 64, 3, 1, 0, dilation=1)
self.conv12 = nn.Conv2d(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | Encoder2 | false | 14,040 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
SmallDecoder3_16x | import torch
import torch.nn as nn
class SmallDecoder3_16x(nn.Module):
def __init__(self, model=None, fixed=False):
super(SmallDecoder3_16x, self).__init__()
self.fixed = fixed
self.conv31 = nn.Conv2d(64, 32, 3, 1, 0)
self.conv22 = nn.Conv2d(32, 32, 3, 1, 0)
self.conv21 = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | SmallDecoder3_16x | false | 14,041 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
TensorRange | import torch
def tensor_max(input, dim, keepdim=False):
if isinstance(dim, int):
return torch.max(input, dim=dim, keepdim=keepdim)[0]
else:
if isinstance(dim, tuple):
dim = list(dim)
for d in dim:
input = torch.max(input, dim=d, keepdim=keepdim)[0]
retur... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Minyus/pipelinex | TensorRange | false | 14,042 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
TensorSum | import torch
class StatModule(torch.nn.Module):
def __init__(self, dim, keepdim=False):
if isinstance(dim, list):
dim = tuple(dim)
if isinstance(dim, int):
dim = dim,
assert isinstance(dim, tuple)
self.dim = dim
self.keepdim = keepdim
super(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Minyus/pipelinex | TensorSum | false | 14,043 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
SmallDecoder4_16x | import torch
import torch.nn as nn
class SmallDecoder4_16x(nn.Module):
def __init__(self, model=None, fixed=False):
super(SmallDecoder4_16x, self).__init__()
self.fixed = fixed
self.conv41 = nn.Conv2d(128, 64, 3, 1, 0)
self.conv34 = nn.Conv2d(64, 64, 3, 1, 0)
self.conv33 =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | SmallDecoder4_16x | false | 14,044 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
TensorMin | import torch
def tensor_min(input, dim, keepdim=False):
if isinstance(dim, int):
return torch.min(input, dim=dim, keepdim=keepdim)[0]
else:
if isinstance(dim, tuple):
dim = list(dim)
for d in dim:
input = torch.min(input, dim=d, keepdim=keepdim)[0]
retur... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | Minyus/pipelinex | TensorMin | false | 14,045 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
SmoothL1Loss | import torch
import torch.nn as nn
import torch.cuda
import torch.distributed
import torch.multiprocessing
class SmoothL1Loss(nn.Module):
"""Smooth L1 Loss"""
def __init__(self, beta=0.11):
super().__init__()
self.beta = beta
def forward(self, pred, target):
x = (pred - target).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
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
import torch.cuda
import torch.distributed
import t... | Mo5mami/retinanet-examples | SmoothL1Loss | false | 14,046 | [
"BSD-3-Clause"
] | 848 | f7ad4ff6a99fe3e66f8a9c8e8a6e03b870f84700 | https://github.com/Mo5mami/retinanet-examples/tree/f7ad4ff6a99fe3e66f8a9c8e8a6e03b870f84700 |
InteractingLayer | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class InteractingLayer(nn.Module):
"""A Layer used in AutoInt that model the correlations between different feature fields by multi-head self-attention mechanism.
Input shape
- A 3D tensor with shape... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Fanxingye/DeepRS | InteractingLayer | false | 14,047 | [
"Apache-2.0"
] | 1,770 | 06b98cf2cb2781656805eafc577fbd088f37d17d | https://github.com/Fanxingye/DeepRS/tree/06b98cf2cb2781656805eafc577fbd088f37d17d |
AUGRUCell | import torch
import torch.nn as nn
import torch.nn.functional as F
from sklearn.metrics import *
class AUGRUCell(nn.Module):
""" Effect of GRU with attentional update gate (AUGRU)
Reference:
- Deep Interest Evolution Network for Click-Through Rate Prediction[J]. arXiv preprint arXiv:1809.03672, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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 ... | Fanxingye/DeepRS | AUGRUCell | false | 14,048 | [
"Apache-2.0"
] | 1,770 | 06b98cf2cb2781656805eafc577fbd088f37d17d | https://github.com/Fanxingye/DeepRS/tree/06b98cf2cb2781656805eafc577fbd088f37d17d |
InvGridSamplerNumerator | import torch
import numpy as np
import torch.utils.data
import torch
from torch import nn
import torch.nn.functional as F
def ravel_multi_index(indices, shape):
indices_ravel = indices[0]
for i in range(1, len(indices)):
indices_ravel = indices_ravel * shape[i] + indices[i]
return indices_ravel
... | 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 numpy as np
imp... | Minsoo2022/Pose-Transfer | InvGridSamplerNumerator | false | 14,049 | [
"MIT"
] | 692 | 10a60bb33d51a06e1200f5726f2367b5be4a6b79 | https://github.com/Minsoo2022/Pose-Transfer/tree/10a60bb33d51a06e1200f5726f2367b5be4a6b79 |
_final_conv_block | import torch
import torch.utils.data
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import Parameter
def l2normalize(v, eps=1e-12):
return v / (v.norm() + eps)
class SpectralNorm(nn.Module):
def __init__(self, module, name='weight', power_iterations=1):
super(Spectr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.... | Minsoo2022/Pose-Transfer | _final_conv_block | false | 14,050 | [
"MIT"
] | 692 | 10a60bb33d51a06e1200f5726f2367b5be4a6b79 | https://github.com/Minsoo2022/Pose-Transfer/tree/10a60bb33d51a06e1200f5726f2367b5be4a6b79 |
encoderVH | import torch
import torch.nn as nn
import torch.nn.functional as F
class encoderVH(nn.Module):
def __init__(self):
super(encoderVH, self).__init__()
self.conv1 = nn.Conv3d(in_channels=1, out_channels=64, kernel_size=
4, stride=2, padding=1, bias=True)
self.gn1 = nn.GroupNorm(4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Miles629/TransparentShapeRealData | encoderVH | false | 14,051 | [
"MIT"
] | 91 | b81098a2d1882f5fd33fba6167d7258dbe02d6d2 | https://github.com/Miles629/TransparentShapeRealData/tree/b81098a2d1882f5fd33fba6167d7258dbe02d6d2 |
TensorProba | import torch
class TensorProba(torch.nn.Module):
def __init__(self, dim=1):
self.dim = dim
super().__init__()
def forward(self, input):
total = torch.sum(input, dim=self.dim, keepdim=True)
return input / total
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def ge... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Minyus/pipelinex | TensorProba | false | 14,052 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
FocalLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.cuda
import torch.distributed
import torch.multiprocessing
class FocalLoss(nn.Module):
"""Focal Loss - https://arxiv.org/abs/1708.02002"""
def __init__(self, alpha=0.25, gamma=2):
super().__init__()
self.alpha = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Mo5mami/retinanet-examples | FocalLoss | false | 14,053 | [
"BSD-3-Clause"
] | 848 | f7ad4ff6a99fe3e66f8a9c8e8a6e03b870f84700 | https://github.com/Mo5mami/retinanet-examples/tree/f7ad4ff6a99fe3e66f8a9c8e8a6e03b870f84700 |
DenseCrossEntropy | import torch
import torch.nn as nn
import torch.nn.functional as F
class DenseCrossEntropy(nn.Module):
def __init__(self):
super(DenseCrossEntropy, self).__init__()
def forward(self, logits, labels):
logits = logits.float()
labels = labels.float()
logprobs = F.log_softmax(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 math as tl_math
import torch.nn as nn
... | Mo5mami/wtfml | DenseCrossEntropy | false | 14,054 | [
"MIT"
] | 283 | afddec88d9c3a94e30ab2897525daf3f5cf8b774 | https://github.com/Mo5mami/wtfml/tree/afddec88d9c3a94e30ab2897525daf3f5cf8b774 |
TensorMean | import torch
class StatModule(torch.nn.Module):
def __init__(self, dim, keepdim=False):
if isinstance(dim, list):
dim = tuple(dim)
if isinstance(dim, int):
dim = dim,
assert isinstance(dim, tuple)
self.dim = dim
self.keepdim = keepdim
super(... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Minyus/pipelinex | TensorMean | false | 14,055 | [
"Apache-2.0"
] | 188 | f35c524ec9c50751ee27d9a42d98317e16f1c544 | https://github.com/Minyus/pipelinex/tree/f35c524ec9c50751ee27d9a42d98317e16f1c544 |
BCE_LOSS | import math
import torch
from torch.nn.modules.loss import _Loss
import torch.optim
import torch._utils
import torch.nn
class BCE_LOSS(_Loss):
def __init__(self, loss_weight=1.0, bias=False):
super().__init__()
self.bce_loss = torch.nn.BCEWithLogitsLoss()
self.loss_weight = loss_weight
... | 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.... | ModelTC/EOD | BCE_LOSS | false | 14,056 | [
"Apache-2.0"
] | 196 | 164bff80486e9ae6a095a97667b365c46ceabd86 | https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86 |
SeparableConv2d_same | import torch
import torch.nn as nn
import torch.nn.functional as F
def fixed_padding(inputs, kernel_size, rate):
kernel_size_effective = kernel_size + (kernel_size - 1) * (rate - 1)
pad_total = kernel_size_effective - 1
pad_beg = pad_total // 2
pad_end = pad_total - pad_beg
padded_inputs = F.pad(i... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | Mnsy-Syl/new_20201103 | SeparableConv2d_same | false | 14,057 | [
"MIT"
] | 46 | 9ee39f1c69a4cba896b30f007560fcbe8ac89c02 | https://github.com/Mnsy-Syl/new_20201103/tree/9ee39f1c69a4cba896b30f007560fcbe8ac89c02 |
Space2Depth | import torch
import torch.nn as nn
import torch.optim
import torch._utils
import torch.nn
class Space2Depth(nn.Module):
def __init__(self, block_size):
super(Space2Depth, self).__init__()
self.bs = block_size
def forward(self, x):
N, C, H, W = x.size()
x = x.view(N, C, H // s... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.optim
import torch._utils
import torch.nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride... | ModelTC/EOD | Space2Depth | false | 14,058 | [
"Apache-2.0"
] | 196 | 164bff80486e9ae6a095a97667b365c46ceabd86 | https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86 |
CrossEntropyLoss | import torch
from torch.nn.modules.loss import _Loss
import torch.optim
import torch._utils
import torch.nn
class CrossEntropyLoss(_Loss):
def __init__(self, loss_weight=1.0):
super().__init__()
self.ce_loss = torch.nn.CrossEntropyLoss()
self.loss_weight = loss_weight
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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn.modules.... | ModelTC/EOD | CrossEntropyLoss | false | 14,059 | [
"Apache-2.0"
] | 196 | 164bff80486e9ae6a095a97667b365c46ceabd86 | https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86 |
GELU | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch._utils
import torch.nn
class GELU(nn.Module):
@staticmethod
def forward(x):
erf = F.tanh(np.sqrt(2 / np.pi) * (x + 0.044715 * torch.pow(x, 3)))
return 0.5 * x * (1 + erf)
de... | 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.optim
import torch._utils
import torch.nn
as... | ModelTC/EOD | GELU | false | 14,060 | [
"Apache-2.0"
] | 196 | 164bff80486e9ae6a095a97667b365c46ceabd86 | https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86 |
FeedForward | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch._utils
import torch.nn
def activation(act_type='swish'):
if act_type == 'swish':
act = swish()
return act
else:
act = nn.ReLU(inplace=True)
return act
class s... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import numpy as np
... | ModelTC/EOD | FeedForward | false | 14,061 | [
"Apache-2.0"
] | 196 | 164bff80486e9ae6a095a97667b365c46ceabd86 | https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86 |
SoftTargetCrossEntropy | import torch
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
import torch.optim
import torch._utils
import torch.nn
class SoftTargetCrossEntropy(_Loss):
def __init__(self, loss_weight=1.0):
super(SoftTargetCrossEntropy, self).__init__()
self.loss_weight = loss_weight
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch.nn.modules.... | ModelTC/EOD | SoftTargetCrossEntropy | false | 14,062 | [
"Apache-2.0"
] | 196 | 164bff80486e9ae6a095a97667b365c46ceabd86 | https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86 |
MulScalarNegative | import torch
from torch import nn
from torch.quantization import QuantStub
from torch.quantization import DeQuantStub
class MulScalarNegative(nn.Module):
def __init__(self):
super().__init__()
self.float_op = nn.quantized.FloatFunctional()
self.quant = QuantStub()
self.dequant = D... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torch.quantization import QuantStub
from torch.quantization import DeQuantStub
assert_size_stride = torch._C._dyna... | Mookel/tvm | MulScalarNegative | false | 14,063 | [
"Zlib",
"Unlicense",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0"
] | 90 | ae58f2c387de9944d241a083ce9a0dd4c9ae613d | https://github.com/Mookel/tvm/tree/ae58f2c387de9944d241a083ce9a0dd4c9ae613d |
SpatialGather_Module | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch._utils
import torch.nn
class SpatialGather_Module(nn.Module):
"""
Aggregate the context features according to the initial
predicted probability distribution.
Employ the soft-weighted method t... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ModelTC/EOD | SpatialGather_Module | false | 14,064 | [
"Apache-2.0"
] | 196 | 164bff80486e9ae6a095a97667b365c46ceabd86 | https://github.com/ModelTC/EOD/tree/164bff80486e9ae6a095a97667b365c46ceabd86 |
Decoder4 | import torch
import torch.nn as nn
class Decoder4(nn.Module):
def __init__(self, model=None, fixed=False):
super(Decoder4, self).__init__()
self.fixed = fixed
self.conv41 = nn.Conv2d(512, 256, 3, 1, 0)
self.conv34 = nn.Conv2d(256, 256, 3, 1, 0)
self.conv33 = nn.Conv2d(256,... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | Decoder4 | false | 14,065 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
IOU | import torch
def _iou(pred, target, size_average=True):
b = pred.shape[0]
IoU = 0.0
for i in range(0, b):
Iand1 = torch.sum(target[i, :, :, :] * pred[i, :, :, :])
Ior1 = torch.sum(target[i, :, :, :]) + torch.sum(pred[i, :, :, :]
) - Iand1
IoU1 = Iand1 / Ior1
IoU... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | Morales97/BASNet | IOU | false | 14,066 | [
"MIT"
] | 977 | 4c2074f769ec0a3f61b2de60b56666ebe67da858 | https://github.com/Morales97/BASNet/tree/4c2074f769ec0a3f61b2de60b56666ebe67da858 |
PSNR | import torch
import torch as th
class PSNR(th.nn.Module):
def __init__(self):
super(PSNR, self).__init__()
self.mse = th.nn.MSELoss()
def forward(self, out, ref):
mse = self.mse(out, ref)
return -10 * th.log10(mse)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), tor... | 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 as th
assert_si... | MohamadHMousavi/demosaicnet | PSNR | false | 14,067 | [
"MIT"
] | 140 | 43f013c79395ee5bccaa0f3525cc61007808845b | https://github.com/MohamadHMousavi/demosaicnet/tree/43f013c79395ee5bccaa0f3525cc61007808845b |
GMoF | import torch
import torch.nn as nn
class GMoF(nn.Module):
def __init__(self, rho=1):
super(GMoF, self).__init__()
self.rho = rho
def extra_repr(self):
return 'rho = {}'.format(self.rho)
def forward(self, residual):
squared_res = residual ** 2
dist = torch.div(squ... | 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... | MoyGcc/hpcwild | GMoF | false | 14,068 | [
"MIT"
] | 47 | 8ed35c3f188284af2a4dd0d68b09fbceb105c2ba | https://github.com/MoyGcc/hpcwild/tree/8ed35c3f188284af2a4dd0d68b09fbceb105c2ba |
Generator | import torch
import torch.nn as nn
import torch.nn.functional as F
class Generator(nn.Module):
"""Define standard linear + softmax generation step."""
def __init__(self, d_model, vocab):
super(Generator, self).__init__()
self.proj = nn.Linear(d_model, vocab)
def forward(self, x):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MolecularAI/deep-molecular-optimization | Generator | false | 14,069 | [
"Apache-2.0"
] | 52 | 815fecabd210662db1a89c4a2ab13d5e0ff9c037 | https://github.com/MolecularAI/deep-molecular-optimization/tree/815fecabd210662db1a89c4a2ab13d5e0ff9c037 |
Elu | import torch
import torch.fx
class Elu(torch.nn.Module):
def __init__(self):
super(Elu, self).__init__()
self.elu = torch.nn.ELU()
def forward(self, x):
return self.elu(x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.fx
assert_size_stride = torch._C._dynamo.guards.assert_size_stride... | NVIDIA/Torch-TensorRT | Elu | false | 14,070 | [
"BSD-3-Clause"
] | 430 | 1a22204fecec690bc3c2a318dab4f57b98c57f05 | https://github.com/NVIDIA/Torch-TensorRT/tree/1a22204fecec690bc3c2a318dab4f57b98c57f05 |
SPPblock | import torch
from torch import nn
import torch.nn.functional as F
import torch.nn.parallel
class SPPblock(nn.Module):
def __init__(self, in_channels):
super(SPPblock, self).__init__()
self.pool1 = nn.MaxPool2d(kernel_size=[2, 2], stride=2)
self.pool2 = nn.MaxPool2d(kernel_size=[3, 3], 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 import nn
import t... | Minerva-J/Pytorch-Segmentation-multi-models | SPPblock | false | 14,071 | [
"Apache-2.0"
] | 84 | 0845b54d4fbc8d38c70f158054b7ab1be2b3ceb9 | https://github.com/Minerva-J/Pytorch-Segmentation-multi-models/tree/0845b54d4fbc8d38c70f158054b7ab1be2b3ceb9 |
SmallDecoder5_16x | import torch
import torch.nn as nn
class SmallDecoder5_16x(nn.Module):
def __init__(self, model=None, fixed=False):
super(SmallDecoder5_16x, self).__init__()
self.fixed = fixed
self.conv51 = nn.Conv2d(128, 128, 3, 1, 0)
self.conv44 = nn.Conv2d(128, 128, 3, 1, 0)
self.conv4... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MingSun-Tse/Collaborative-Distillation | SmallDecoder5_16x | false | 14,072 | [
"MIT"
] | 172 | 915712674af82ff91d926d922c14988cce0430f3 | https://github.com/MingSun-Tse/Collaborative-Distillation/tree/915712674af82ff91d926d922c14988cce0430f3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.