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 |
|---|---|---|---|---|---|---|---|---|---|---|
Fp32GroupNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
import torch.distributed
class Fp32GroupNorm(nn.GroupNorm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
impor... | DCMMC/chineseocr | Fp32GroupNorm | false | 9,219 | [
"MIT"
] | 0 | 0b8772615239ea7f212b1ab5bc75183e7e9f16b0 | https://github.com/DCMMC/chineseocr/tree/0b8772615239ea7f212b1ab5bc75183e7e9f16b0 |
DiceLoss | import torch
from torch import nn
class DiceLoss(nn.Module):
""" Loss function based on Dice-Sorensen Coefficient (L = 1 - Dice)
Input arguments:
soft : boolean, default = True
Select whether to use soft labelling or not. If true, dice calculated
directly on sigmoid output without conv... | 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... | Jiongqi/RectAngle | DiceLoss | false | 9,220 | [
"MIT"
] | 0 | 558fa036d1b21b5ae0a556271ab674cd8ffe88b6 | https://github.com/Jiongqi/RectAngle/tree/558fa036d1b21b5ae0a556271ab674cd8ffe88b6 |
MsgNorm | import torch
import torch.nn.functional as F
class MsgNorm(torch.nn.Module):
def __init__(self, learn_msg_scale=False):
super(MsgNorm, self).__init__()
self.msg_scale = torch.nn.Parameter(torch.Tensor([1.0]),
requires_grad=learn_msg_scale)
def forward(self, x, msg, p=2):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._... | LMZimmer/nasbench301 | MsgNorm | false | 9,221 | [
"Apache-2.0"
] | 0 | 3329d24a41765e87ac7ebf91fbf38269beeda822 | https://github.com/LMZimmer/nasbench301/tree/3329d24a41765e87ac7ebf91fbf38269beeda822 |
Modified | import torch
from torch import nn
import torch.nn.functional as F
class Modified(nn.Module):
def __init__(self):
super(Modified, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 3)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 10, 3)
self.conv3 = nn.Conv2d(10, 16, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Karin-S/USYD-ELEC5307 | Modified | false | 9,222 | [
"Apache-2.0"
] | 0 | 83cb40adf0c15ee703a880fc7aba5c69b82a5434 | https://github.com/Karin-S/USYD-ELEC5307/tree/83cb40adf0c15ee703a880fc7aba5c69b82a5434 |
BartClassificationHead | import torch
import torch.utils.data
from torch import nn
class BartClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, input_dim, inner_dim, num_classes, pooler_dropout):
super().__init__()
self.dense = nn.Linear(input_dim, inner_dim)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.... | JuruoMP/gap-exp | BartClassificationHead | false | 9,223 | [
"Apache-2.0"
] | 0 | 2d7af8a1da2f0ff8f9d3a2c6e15cc6383c716c05 | https://github.com/JuruoMP/gap-exp/tree/2d7af8a1da2f0ff8f9d3a2c6e15cc6383c716c05 |
Discriminator | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.weight_norm as weightNorm
class TReLU(nn.Module):
def __init__(self):
super(TReLU, self).__init__()
self.alpha = nn.Parameter(torch.FloatTensor(1), requires_grad=True)
self.alpha.data.fill_(0)
de... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | HenryOsborne/LearningToPaint | Discriminator | false | 9,224 | [
"MIT"
] | 0 | d8fdf41c8d193b91c78f73b7a092897e846e19eb | https://github.com/HenryOsborne/LearningToPaint/tree/d8fdf41c8d193b91c78f73b7a092897e846e19eb |
Baseline | import torch
from torch import nn
import torch.nn.functional as F
class Baseline(nn.Module):
def __init__(self):
super(Baseline, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 3)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 3)
self.conv3 = nn.Conv2d(16, 32, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Karin-S/USYD-ELEC5307 | Baseline | false | 9,225 | [
"Apache-2.0"
] | 0 | 83cb40adf0c15ee703a880fc7aba5c69b82a5434 | https://github.com/Karin-S/USYD-ELEC5307/tree/83cb40adf0c15ee703a880fc7aba5c69b82a5434 |
ColorJitterLayer | from torch.autograd import Function
import math
import numbers
import torch
import numpy as np
import torch.nn as nn
def hsv2rgb(hsv):
"""Convert a 4-d HSV tensor to the RGB counterpart.
>>> %timeit hsv2rgb_lookup(hsv)
2.37 ms ± 13.4 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
>>> %timeit... | 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.... | Jinoh-Cho/Visual-Genome-Image-Inpainting | ColorJitterLayer | false | 9,226 | [
"MIT"
] | 0 | f8c43bf2e4a9139d4c35903d0c323b9d8eb54859 | https://github.com/Jinoh-Cho/Visual-Genome-Image-Inpainting/tree/f8c43bf2e4a9139d4c35903d0c323b9d8eb54859 |
ScaledDotProductAttention | import torch
from torch import nn
class ScaledDotProductAttention(nn.Module):
"""
Attention mechansims usually scale values based on relationships between
keys and queries.
Attention(Q,K,V) = A(Q,K)*V where A() is a normalization function.
A common choice for the normalization function is 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.... | KalleBylin/tft_webapp | ScaledDotProductAttention | false | 9,227 | [
"Apache-2.0"
] | 0 | 008f109e77f8bada417655dab482f340adb8cb6b | https://github.com/KalleBylin/tft_webapp/tree/008f109e77f8bada417655dab482f340adb8cb6b |
LearnedPositionalEmbedding | import torch
import torch.utils.data
from torch import nn
def create_position_ids_from_input_ids(input_ids, padding_idx):
""" Replace non-padding symbols with their position numbers. Position numbers begin at
padding_idx+1. Padding symbols are ignored. This is modified from fairseq's
`utils.make_positions... | 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.utils.data
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._... | JuruoMP/gap-exp | LearnedPositionalEmbedding | false | 9,228 | [
"Apache-2.0"
] | 0 | 2d7af8a1da2f0ff8f9d3a2c6e15cc6383c716c05 | https://github.com/JuruoMP/gap-exp/tree/2d7af8a1da2f0ff8f9d3a2c6e15cc6383c716c05 |
Gaussian_Kernel_Function | import torch
import torch.nn as nn
class Gaussian_Kernel_Function(nn.Module):
def __init__(self, std):
super(Gaussian_Kernel_Function, self).__init__()
self.sigma = std ** 2
def forward(self, fa, fb):
asize = fa.size()
bsize = fb.size()
fa1 = fa.view(-1, 1, asize[1])
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.gu... | LOUEY233/Toward-Mutual-Information | Gaussian_Kernel_Function | false | 9,229 | [
"MIT"
] | 0 | cde9ce5c9920bbc9c6e39dafb61ff1dd0c97772f | https://github.com/LOUEY233/Toward-Mutual-Information/tree/cde9ce5c9920bbc9c6e39dafb61ff1dd0c97772f |
Gaussian_Distance | import torch
import torch.nn as nn
class Gaussian_Distance(nn.Module):
def __init__(self, kern=1):
super(Gaussian_Distance, self).__init__()
self.kern = kern
self.avgpool = nn.AvgPool2d(kernel_size=kern, stride=kern)
def forward(self, mu_a, logvar_a, mu_b, logvar_b):
mu_a = 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | LOUEY233/Toward-Mutual-Information | Gaussian_Distance | false | 9,230 | [
"MIT"
] | 0 | cde9ce5c9920bbc9c6e39dafb61ff1dd0c97772f | https://github.com/LOUEY233/Toward-Mutual-Information/tree/cde9ce5c9920bbc9c6e39dafb61ff1dd0c97772f |
Gram_StyleLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
def gram_matrix(input):
a, b, c, d = input.size()
features = input.view(a * b, c * d)
G = torch.mm(features, features.t())
return G / (a * b * c * d)
class Gram_StyleLoss(nn.Module):
def __init__(self):
super(Gram_StyleL... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Holmes-Alan/TxST | Gram_StyleLoss | false | 9,231 | [
"MIT"
] | 0 | c5b59a12bbb9e62244c3b608581d5cb9606525e0 | https://github.com/Holmes-Alan/TxST/tree/c5b59a12bbb9e62244c3b608581d5cb9606525e0 |
GLU | import torch
from torch import nn
class GLU(nn.Module):
"""
The Gated Linear Unit GLU(a,b) = mult(a,sigmoid(b)) is common in NLP
architectures like the Gated CNN. Here sigmoid(b) corresponds to a gate
that controls what information from a is passed to the following layer.
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 import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_st... | KalleBylin/tft_webapp | GLU | false | 9,232 | [
"Apache-2.0"
] | 0 | 008f109e77f8bada417655dab482f340adb8cb6b | https://github.com/KalleBylin/tft_webapp/tree/008f109e77f8bada417655dab482f340adb8cb6b |
QuickGELU | import torch
import torch.nn as nn
class QuickGELU(nn.Module):
def forward(self, x: 'torch.Tensor'):
return x * torch.sigmoid(1.702 * 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Holmes-Alan/TxST | QuickGELU | false | 9,233 | [
"MIT"
] | 0 | c5b59a12bbb9e62244c3b608581d5cb9606525e0 | https://github.com/Holmes-Alan/TxST/tree/c5b59a12bbb9e62244c3b608581d5cb9606525e0 |
ScalarMix | import torch
import torch.nn as nn
class ScalarMix(nn.Module):
"""
Computes a parameterised scalar mixture of :math:`N` tensors, :math:`mixture = \\gamma * \\sum_{k}(s_k * tensor_k)`
where :math:`s = \\mathrm{softmax}(w)`, with :math:`w` and :math:`\\gamma` scalar parameters.
Args:
n_layers (... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | KoichiYasuoka/diaparser | ScalarMix | false | 9,234 | [
"MIT"
] | 0 | ca11e65ef890cee2fbb23f42ae9c711c89767158 | https://github.com/KoichiYasuoka/diaparser/tree/ca11e65ef890cee2fbb23f42ae9c711c89767158 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 32, 5)
self.conv2 = nn.Conv2d(32, 64, 5)
self.conv3 = nn.Conv2d(64, 128, 5)
x = torch.randn(50, 50).view(-1, 1, 50, 50)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JSONLewis/TOHM | Net | false | 9,235 | [
"MIT"
] | 0 | ba40fdfe0a1c515aca7f57de030bdc02a7d0951e | https://github.com/JSONLewis/TOHM/tree/ba40fdfe0a1c515aca7f57de030bdc02a7d0951e |
UnfoldTemporalWindows | import torch
import torch.nn as nn
class UnfoldTemporalWindows(nn.Module):
def __init__(self, window_size, window_stride, window_dilation=1):
super().__init__()
self.window_size = window_size
self.window_stride = window_stride
self.window_dilation = window_dilation
self.pa... | 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... | IW276/IW276SS20P7 | UnfoldTemporalWindows | false | 9,236 | [
"MIT"
] | 0 | ed388c04eb8d5ea1d13b5ed4119e722552794a62 | https://github.com/IW276/IW276SS20P7/tree/ed388c04eb8d5ea1d13b5ed4119e722552794a62 |
CrossAttN_v8 | import torch
import torch.nn as nn
import torch.nn.functional as Func
class CrossAttN_v8(nn.Module):
def __init__(self, in_planes, clip_dim):
super(CrossAttN_v8, self).__init__()
self.f = nn.Conv2d(in_planes, in_planes, 1, 1, 0)
self.g = nn.Conv2d(in_planes, in_planes, 1, 1, 0)
se... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Holmes-Alan/TxST | CrossAttN_v8 | false | 9,237 | [
"MIT"
] | 0 | c5b59a12bbb9e62244c3b608581d5cb9606525e0 | https://github.com/Holmes-Alan/TxST/tree/c5b59a12bbb9e62244c3b608581d5cb9606525e0 |
MultConst | import torch
import torch.nn as nn
class MultConst(nn.Module):
def forward(self, input):
return 255 * 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | JonghunBok/PyTorch-Multi-Style-Transfer | MultConst | false | 9,238 | [
"MIT"
] | 0 | 0e6744eb7d9c746ba828fc406e59d619f2e60094 | https://github.com/JonghunBok/PyTorch-Multi-Style-Transfer/tree/0e6744eb7d9c746ba828fc406e59d619f2e60094 |
AttentionHead | import torch
import torch.nn as nn
class AttentionHead(nn.Module):
def __init__(self, h_size, hidden_dim=512):
super().__init__()
self.W = nn.Linear(h_size, hidden_dim)
self.V = nn.Linear(hidden_dim, 1)
def forward(self, features):
att = torch.tanh(self.W(features))
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.... | Leo1998-Lu/CommonLit-Readability-Prize-Silver-Medal-Solution | AttentionHead | false | 9,239 | [
"MIT"
] | 0 | 1df3282a77b5f8f45c4eef9831061cb390a63fc5 | https://github.com/Leo1998-Lu/CommonLit-Readability-Prize-Silver-Medal-Solution/tree/1df3282a77b5f8f45c4eef9831061cb390a63fc5 |
Biaffine | import torch
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
self.weight = nn.Parameter(torc... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | KoichiYasuoka/diaparser | Biaffine | false | 9,240 | [
"MIT"
] | 0 | ca11e65ef890cee2fbb23f42ae9c711c89767158 | https://github.com/KoichiYasuoka/diaparser/tree/ca11e65ef890cee2fbb23f42ae9c711c89767158 |
Fp32LayerNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torch.onnx.operators
import torch.optim
import torch.optim.lr_scheduler
import torch.distributed
class Fp32LayerNorm(nn.LayerNorm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data
import torch.onnx.operators
impor... | DCMMC/chineseocr | Fp32LayerNorm | false | 9,241 | [
"MIT"
] | 0 | 0b8772615239ea7f212b1ab5bc75183e7e9f16b0 | https://github.com/DCMMC/chineseocr/tree/0b8772615239ea7f212b1ab5bc75183e7e9f16b0 |
AttentionPool2d | import torch
import torch.nn as nn
import torch.nn.functional as F
class AttentionPool2d(nn.Module):
def __init__(self, spacial_dim: 'int', embed_dim: 'int', num_heads:
'int', output_dim: 'int'=None):
super().__init__()
self.positional_embedding = nn.Parameter(torch.randn(spacial_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
from torch._inductor.runtime.... | Holmes-Alan/TxST | AttentionPool2d | false | 9,242 | [
"MIT"
] | 0 | c5b59a12bbb9e62244c3b608581d5cb9606525e0 | https://github.com/Holmes-Alan/TxST/tree/c5b59a12bbb9e62244c3b608581d5cb9606525e0 |
CmapPafHeadAttention | import torch
import torch.utils.data
import torch.nn
import torch.optim
class UpsampleCBR(torch.nn.Sequential):
def __init__(self, input_channels, output_channels, count=1, num_flat=0):
layers = []
for i in range(count):
if i == 0:
inch = input_channels
els... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | KeithStoke/POSE_Test | CmapPafHeadAttention | false | 9,243 | [
"MIT"
] | 0 | 581aaf6f3d4fd50e56aa16c43913292af7d36879 | https://github.com/KeithStoke/POSE_Test/tree/581aaf6f3d4fd50e56aa16c43913292af7d36879 |
UNet | import torch
import torch.nn as nn
import torch.nn.functional as F
class DoubleConv(nn.Module):
"""
Double 3x3 conv + relu
"""
def __init__(self, in_channels, out_channels):
super(DoubleConv, self).__init__()
self.conv_1 = nn.Conv2d(in_channels, out_channels, 3)
self.conv_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
import ... | Aoi-hosizora/UNet-pytorch | UNet | false | 9,244 | [
"MIT"
] | 0 | 96951d5d1fdc6c6266a11e1bd97fbf72010bc87d | https://github.com/Aoi-hosizora/UNet-pytorch/tree/96951d5d1fdc6c6266a11e1bd97fbf72010bc87d |
FirstOctaveConv | import torch
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
from torch.nn import init as init
class FirstOctaveConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, alpha=0.5,
stride=1, padding=1, dilation=1, groups=1, bias=False):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from math import sqrt as sqrt
from itertools import produc... | IlikeBB/Object-Detection-for-M-NBI | FirstOctaveConv | false | 9,245 | [
"MIT"
] | 0 | 650fa1ca7b8860785f0a838dab0301a9cba121d6 | https://github.com/IlikeBB/Object-Detection-for-M-NBI/tree/650fa1ca7b8860785f0a838dab0301a9cba121d6 |
SurfaceLoss | import torch
import torch.nn as nn
class SurfaceLoss(nn.Module):
def __init__(self, epsilon=1e-05, softmax=True):
super(SurfaceLoss, self).__init__()
self.weight_map = []
def forward(self, x, distmap):
x = torch.softmax(x, dim=1)
self.weight_map = distmap
score = x.fl... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | KamranBinaee/RGnet | SurfaceLoss | false | 9,246 | [
"MIT"
] | 0 | 85861ab47a94018c8f8fa01fb7e64d8eec7fdc43 | https://github.com/KamranBinaee/RGnet/tree/85861ab47a94018c8f8fa01fb7e64d8eec7fdc43 |
MLP | import torch
import torch.nn as nn
class SharedDropout(nn.Module):
"""
SharedDropout differs from the vanilla dropout strategy in that
the dropout mask is shared across one dimension.
Args:
p (float):
The probability of an element to be zeroed. Default: 0.5.
batch_first (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
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | KoichiYasuoka/diaparser | MLP | false | 9,247 | [
"MIT"
] | 0 | ca11e65ef890cee2fbb23f42ae9c711c89767158 | https://github.com/KoichiYasuoka/diaparser/tree/ca11e65ef890cee2fbb23f42ae9c711c89767158 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
def __init__(self, ignore_target=-1):
super().__init__()
self.ignore_target = ignore_target
def forward(self, input, target):
"""
:param input: (N), logit
:param target: (N), {0, 1}
:return:
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | LorenzLamm/Pointnet2.PyTorch | DiceLoss | false | 9,248 | [
"MIT"
] | 0 | d15862b282c93cedbc08ea14622793f66429af21 | https://github.com/LorenzLamm/Pointnet2.PyTorch/tree/d15862b282c93cedbc08ea14622793f66429af21 |
ChamferLoss | import torch
import torch.nn as nn
class ChamferLoss(nn.Module):
"""
Torch implementation of chamferLoss for n-dimensional geometries
"""
def __init__(self):
self.init__ = super(ChamferLoss, self).__init__()
self.use_cuda = torch.cuda.is_available()
def batch_pairwise_dist(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
import torch.nn as nn
assert_... | GitMarco27/GitMarco | ChamferLoss | false | 9,249 | [
"MIT"
] | 0 | 2d9dd93a73a6d7b68d63222512a646cdd988909e | https://github.com/GitMarco27/GitMarco/tree/2d9dd93a73a6d7b68d63222512a646cdd988909e |
ResidualBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class ResidualBlock(nn.Module):
def __init__(self, input_channel, output_channel, upsample=True):
super(ResidualBlock, self).__init__()
self.conv1 = nn.Conv2d(input_channel, output_channel, kernel_size=3,
padding=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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Holmes-Alan/TxST | ResidualBlock | false | 9,250 | [
"MIT"
] | 0 | c5b59a12bbb9e62244c3b608581d5cb9606525e0 | https://github.com/Holmes-Alan/TxST/tree/c5b59a12bbb9e62244c3b608581d5cb9606525e0 |
BertNonFusedLayerNorm | import torch
from torch import nn
class BertNonFusedLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-12):
"""Construct a layernorm module in the TF style (epsilon inside the square root).
"""
super(BertNonFusedLayerNorm, self).__init__()
self.gamma = nn.Parameter(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... | LiyuanLucasLiu/FasterTransformer | BertNonFusedLayerNorm | false | 9,251 | [
"Apache-2.0"
] | 0 | c28149096030286e87491c7648f5a020aed22cc9 | https://github.com/LiyuanLucasLiu/FasterTransformer/tree/c28149096030286e87491c7648f5a020aed22cc9 |
GumbelSoftmax | import torch
import torch.utils.data
from torch import nn
from torch.nn import functional as F
class GumbelSoftmax(nn.Module):
def __init__(self, f_dim, c_dim):
super(GumbelSoftmax, self).__init__()
self.logits = nn.Linear(f_dim, c_dim)
self.f_dim = f_dim
self.c_dim = c_dim
d... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Kaya176/GMVAE | GumbelSoftmax | false | 9,252 | [
"MIT"
] | 0 | 6369be52dbac796e2f836f51b16aaa5c61247350 | https://github.com/Kaya176/GMVAE/tree/6369be52dbac796e2f836f51b16aaa5c61247350 |
CodeLoss | import torch
from torch import nn
class CodeLoss(nn.Module):
def __init__(self):
super().__init__()
self.loss = nn.MSELoss()
def forward(self, origin_code, trans_code, origin_feature,
trans_feature, weight=0.001):
code_similar = torch.mean(torch.sum((origin_code != trans_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 import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | KMU-AELAB/DeepHashing | CodeLoss | false | 9,253 | [
"MIT"
] | 0 | c60069884778246c5a6e11161b78af69e5c8c176 | https://github.com/KMU-AELAB/DeepHashing/tree/c60069884778246c5a6e11161b78af69e5c8c176 |
VertexDirectEmbedder | import torch
import torch.utils.data
from torch import nn
def normalize_embeddings(embeddings: 'torch.Tensor', epsilon: 'float'=1e-06
) ->torch.Tensor:
"""
Normalize N D-dimensional embedding vectors arranged in a tensor [N, D]
Args:
embeddings (tensor [N, D]): N D-dimensional embedding vecto... | 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
from... | Lele-Zhou/detectron2-based | VertexDirectEmbedder | false | 9,254 | [
"Apache-2.0"
] | 0 | a6f65174c6f11918c8e7600746f9f87baa89ecc0 | https://github.com/Lele-Zhou/detectron2-based/tree/a6f65174c6f11918c8e7600746f9f87baa89ecc0 |
Rot180 | import torch
import torch.nn as nn
def rot180(input: 'torch.Tensor') ->torch.Tensor:
"""Rotate a tensor image or a batch of tensor images
180 degrees. Input must be a tensor of shape (C, H, W)
or a batch of tensors :math:`(*, C, H, W)`.
Args:
input (torch.Tensor): input tensor
Returns:
... | 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... | IEM-Computer-Vision/kornia | Rot180 | false | 9,255 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
ResidualAttentionBlock | import torch
import torch.nn as nn
from collections import OrderedDict
class LayerNorm(nn.LayerNorm):
"""Subclass torch's LayerNorm to handle fp16."""
def forward(self, x: 'torch.Tensor'):
orig_type = x.dtype
ret = super().forward(x.type(torch.float32))
return ret.type(orig_type)
cl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Holmes-Alan/TxST | ResidualAttentionBlock | false | 9,256 | [
"MIT"
] | 0 | c5b59a12bbb9e62244c3b608581d5cb9606525e0 | https://github.com/Holmes-Alan/TxST/tree/c5b59a12bbb9e62244c3b608581d5cb9606525e0 |
L2Norm | import torch
import torch.nn as nn
from math import sqrt as sqrt
from itertools import product as product
import torch.nn.init as init
class L2Norm(nn.Module):
def __init__(self, n_channels, scale):
super(L2Norm, self).__init__()
self.n_channels = n_channels
self.gamma = scale or None
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from math import sqrt as sqrt
from itertools import produ... | LucasVandroux/ssd.pytorch | L2Norm | false | 9,257 | [
"MIT"
] | 0 | d4471f6cfe2aa003ba5d7d9d9ab4d78936bb3f02 | https://github.com/LucasVandroux/ssd.pytorch/tree/d4471f6cfe2aa003ba5d7d9d9ab4d78936bb3f02 |
Hflip | import torch
import torch.nn as nn
def hflip(input: 'torch.Tensor') ->torch.Tensor:
"""Horizontally flip a tensor image or a batch of tensor images. Input must
be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.
Args:
input (torch.Tensor): input tensor
Returns:
... | 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... | IEM-Computer-Vision/kornia | Hflip | false | 9,258 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
RgbaToBgr | import torch
import torch.nn as nn
def bgr_to_rgb(image: 'torch.Tensor') ->torch.Tensor:
"""Convert a BGR image to RGB.
See :class:`~kornia.color.BgrToRgb` for details.
Args:
image (torch.Tensor): BGR Image to be converted to RGB.
Returns:
torch.Tensor: RGB version of the image.
... | 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... | IEM-Computer-Vision/kornia | RgbaToBgr | false | 9,259 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
InvDepth | import torch
import torch.nn as nn
class InvDepth(nn.Module):
def __init__(self, height, width, min_depth=0.5, max_depth=25.0):
super(InvDepth, self).__init__()
self._min_range = 1.0 / max_depth
self._max_range = 1.0 / min_depth
self.w = nn.Parameter(self._init_weights(height, wid... | 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... | IEM-Computer-Vision/kornia | InvDepth | false | 9,260 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
PSNRLoss | import torch
import torch.nn as nn
from torch.nn.functional import mse_loss
def psnr_loss(input: 'torch.Tensor', target: 'torch.Tensor', max_val: 'float'
) ->torch.Tensor:
"""Function that computes PSNR
See :class:`~kornia.losses.PSNR` for details.
"""
if not torch.is_tensor(input) or not torch.i... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
from t... | IEM-Computer-Vision/kornia | PSNRLoss | false | 9,261 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
TotalVariation | import torch
import torch.nn as nn
def total_variation(img: 'torch.Tensor') ->torch.Tensor:
"""Function that computes Total Variation.
See :class:`~kornia.losses.TotalVariation` for details.
"""
if not torch.is_tensor(img):
raise TypeError(f'Input type is not a torch.Tensor. Got {type(img)}')... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | IEM-Computer-Vision/kornia | TotalVariation | false | 9,262 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
DenseNet2D_up_block_concat | import torch
import torch.nn as nn
class DenseNet2D_up_block_concat(nn.Module):
def __init__(self, skip_channels, input_channels, output_channels,
up_stride, dropout=False, prob=0):
super(DenseNet2D_up_block_concat, self).__init__()
self.conv11 = nn.Conv2d(skip_channels + input_channels,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | KamranBinaee/RGnet | DenseNet2D_up_block_concat | false | 9,263 | [
"MIT"
] | 0 | 85861ab47a94018c8f8fa01fb7e64d8eec7fdc43 | https://github.com/KamranBinaee/RGnet/tree/85861ab47a94018c8f8fa01fb7e64d8eec7fdc43 |
Vflip | import torch
import torch.nn as nn
def vflip(input: 'torch.Tensor') ->torch.Tensor:
"""Vertically flip a tensor image or a batch of tensor images. Input must
be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.
Args:
input (torch.Tensor): input tensor
Returns:
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... | IEM-Computer-Vision/kornia | Vflip | false | 9,264 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
ToLongTensor | import torch
from torch import Tensor
from typing import List
import torch.nn as nn
class ToLongTensor(nn.Module):
"""Convert a list of integers to long tensor
"""
def __init__(self):
super(ToLongTensor, self).__init__()
def forward(self, tokens: 'List[List[int]]') ->Tensor:
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... | LaudateCorpus1/text-1 | ToLongTensor | false | 9,265 | [
"BSD-3-Clause"
] | 0 | 8808e7eee5a2df79b9566a4a348889dc2722fcfb | https://github.com/LaudateCorpus1/text-1/tree/8808e7eee5a2df79b9566a4a348889dc2722fcfb |
ResidualBlockNoBN | import torch
from torch import nn
class ResidualBlockNoBN(nn.Module):
"""
ResNet without Batch Normalisation
"""
def __init__(self, in_channels, out_channels, stride=1):
super(ResidualBlockNoBN, self).__init__()
self.conv1 = nn.Conv2d(in_channels=in_channels, out_channels=
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_s... | LasseWolter/laughter-detection | ResidualBlockNoBN | false | 9,266 | [
"MIT"
] | 0 | f0a37f8e991fc57e8bbc846695fc4dea84d60af5 | https://github.com/LasseWolter/laughter-detection/tree/f0a37f8e991fc57e8bbc846695fc4dea84d60af5 |
RobertaClassificationHead | import torch
import torch.nn as nn
from typing import Optional
class RobertaClassificationHead(nn.Module):
def __init__(self, num_classes, input_dim, inner_dim: 'Optional[int]'=
None, dropout: 'float'=0.1, activation=nn.ReLU):
super().__init__()
if not inner_dim:
inner_dim = 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 import triton_helpers
import torch.nn as nn
from ty... | LaudateCorpus1/text-1 | RobertaClassificationHead | false | 9,267 | [
"BSD-3-Clause"
] | 0 | 8808e7eee5a2df79b9566a4a348889dc2722fcfb | https://github.com/LaudateCorpus1/text-1/tree/8808e7eee5a2df79b9566a4a348889dc2722fcfb |
RgbaToRgb | import torch
import torch.nn as nn
def rgba_to_rgb(image: 'torch.Tensor') ->torch.Tensor:
"""Convert image from RGBA to RGB.
See :class:`~kornia.color.RgbaToRgb` for details.
Args:
image (torch.Tensor): RGBA Image to be converted to RGB.
Returns:
torch.Tensor: RGB version of the ima... | 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... | IEM-Computer-Vision/kornia | RgbaToRgb | false | 9,268 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
"""
Scale shall be learnable according to original paper
scale: initial scale number
chan_num: L2Norm channel number (norm over all channels)
"""
def __init__(self, scale=20, chan_num=512):
super(L2Norm, self).__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
import torch.nn as nn
assert... | KarthikGanesan88/stonne | L2Norm | false | 9,269 | [
"MIT"
] | 0 | f228ade67120b9dafac8ea99d201e269b2ad7099 | https://github.com/KarthikGanesan88/stonne/tree/f228ade67120b9dafac8ea99d201e269b2ad7099 |
Net | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 1, (5, 5), groups=1)
self.relu1 = nn.ReLU(inplace=True)
self.fc1 = nn.Linear(36, 5)
self.relu2 = nn.ReLU(inplace=True)
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
import torch.nn as nn
assert_... | KarthikGanesan88/stonne | Net | false | 9,270 | [
"MIT"
] | 0 | f228ade67120b9dafac8ea99d201e269b2ad7099 | https://github.com/KarthikGanesan88/stonne/tree/f228ade67120b9dafac8ea99d201e269b2ad7099 |
BuildingsModel | import torch
from torch import Tensor
from typing import List
from typing import Tuple
from typing import Union
import torch.nn as nn
class DownSamplingBlock(nn.Module):
def __init__(self, in_channels: 'int', channel_up_factor: 'int'=2,
max_pooling: 'bool'=True, dropout: 'Tuple'=(0, 0)):
super().... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | JosefDoun/Ikonos-2-Building-Segmentation-U-Net | BuildingsModel | false | 9,271 | [
"MIT"
] | 0 | fecb9874dbf74886fd30d00b8561dfc66886be8c | https://github.com/JosefDoun/Ikonos-2-Building-Segmentation-U-Net/tree/fecb9874dbf74886fd30d00b8561dfc66886be8c |
DuelingQNetwork | import torch
import torch.nn.functional as F
import torch.nn as nn
class DuelingQNetwork(nn.Module):
def __init__(self, state_size, action_size, hidsize1=128, hidsize2=128):
super(DuelingQNetwork, self).__init__()
self.fc1_val = nn.Linear(state_size, hidsize1)
self.fc2_val = nn.Linear(hid... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | LuckUVeryX/flatland-kit | DuelingQNetwork | false | 9,272 | [
"MIT"
] | 0 | 3127c072b2f26fa0a0f4b45888672c11b80acfd3 | https://github.com/LuckUVeryX/flatland-kit/tree/3127c072b2f26fa0a0f4b45888672c11b80acfd3 |
EmbedNoise | import torch
import torch.nn as nn
def _sn_to_specnorm(sn: 'int'):
if sn > 0:
def specnorm(module):
return nn.utils.spectral_norm(module, n_power_iterations=sn)
else:
def specnorm(module, **kw):
return module
return specnorm
class EmbedNoise(nn.Module):
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | KirillShmilovich/coarse2fine_VAE | EmbedNoise | false | 9,273 | [
"MIT"
] | 0 | e4c1022f9570934a2be59ea0989c80102dc46ad4 | https://github.com/KirillShmilovich/coarse2fine_VAE/tree/e4c1022f9570934a2be59ea0989c80102dc46ad4 |
LayerNorm | import torch
import torch.nn as nn
import torch.optim
class LayerNorm(nn.Module):
"""Construct a layernorm module in the OpenAI style (epsilon inside the square root)."""
def __init__(self, n_state, e=1e-05):
super(LayerNorm, self).__init__()
self.g = nn.Parameter(torch.ones(n_state))
... | 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
assert_size_stride = torch._C._dynamo.... | LouisCastricato/comet-commonsense | LayerNorm | false | 9,274 | [
"Apache-2.0"
] | 0 | dd27c0f1f4a5cc75a11329611721a21a0f5a049f | https://github.com/LouisCastricato/comet-commonsense/tree/dd27c0f1f4a5cc75a11329611721a21a0f5a049f |
GCT | import sys
import torch
import torch.nn as nn
import torch.utils.data.distributed
class GCT(nn.Module):
def __init__(self, num_channels, epsilon=1e-05, mode='l2', after_relu=False
):
super(GCT, self).__init__()
self.alpha = nn.Parameter(torch.ones(1, num_channels, 1, 1))
self.gamm... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.utils.data.distributed
assert_size_stride = ... | Erfun76/insightface | GCT | false | 9,275 | [
"MIT"
] | 0 | 148cef36a43a055f68d2b6a475f4aa38625ad8b4 | https://github.com/Erfun76/insightface/tree/148cef36a43a055f68d2b6a475f4aa38625ad8b4 |
RingLoss | import torch
import torch.utils.data
from torch import nn
class RingLoss(nn.Module):
"""Ring loss.
Reference:
Zheng et al. Ring loss: Convex Feature Normalization for Face Recognition. CVPR 2018.
"""
def __init__(self, weight_ring=1.0):
super(RingLoss, self).__init__()
self.r... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.utils.data
from torch import nn
assert_size_stride = torch._C._dyn... | Luxios22/Dual_Norm | RingLoss | false | 9,276 | [
"MIT"
] | 0 | b404a03b15fc05749e0c648d9e46ffe70f6b2a80 | https://github.com/Luxios22/Dual_Norm/tree/b404a03b15fc05749e0c648d9e46ffe70f6b2a80 |
InterpolationBlock | import torch
import torch.nn as nn
from torch.nn import functional as F
import torch.utils.data.distributed
class InterpolationBlock(nn.Module):
"""
Interpolation upsampling block.
Parameters:
----------
scale_factor : float
Multiplier for spatial size.
mode : str, default 'bilinear'
... | 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.distributed
assert_size_stride = torch._C._... | Erfun76/insightface | InterpolationBlock | false | 9,277 | [
"MIT"
] | 0 | 148cef36a43a055f68d2b6a475f4aa38625ad8b4 | https://github.com/Erfun76/insightface/tree/148cef36a43a055f68d2b6a475f4aa38625ad8b4 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net_basic(nn.Module):
"""基础网络,仅包含保存、加载模型的功能"""
def __init__(self):
super(Net_basic, self).__init__()
def load(self, path):
"""加载指定模型"""
self.load_state_dict(torch.load(path))
def save(self, path):
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | IewNixIl/graduation_project_under | Net | false | 9,278 | [
"MIT"
] | 0 | 67d0345208511bb06c35c3453227b2fa4ebef4a3 | https://github.com/IewNixIl/graduation_project_under/tree/67d0345208511bb06c35c3453227b2fa4ebef4a3 |
SqueezeExcite | import torch
import torch.nn as nn
from torch.nn import functional as F
import torch.utils.data.distributed
def _make_divisible(v, divisor, min_value=None):
"""
This function is taken from the original tf repo.
It ensures that all layers have a channel number that is divisible by 8
It can be seen here... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | Erfun76/insightface | SqueezeExcite | false | 9,279 | [
"MIT"
] | 0 | 148cef36a43a055f68d2b6a475f4aa38625ad8b4 | https://github.com/Erfun76/insightface/tree/148cef36a43a055f68d2b6a475f4aa38625ad8b4 |
ConvRelu | import torch
from torch import nn
import torch.backends.cudnn
def conv3x3(in_, out):
return nn.Conv2d(in_, out, 3, padding=1)
class ConvRelu(nn.Module):
def __init__(self, in_: 'int', out: 'int'):
super(ConvRelu, self).__init__()
self.conv = conv3x3(in_, out)
self.activation = nn.Re... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | ImmortalTurtle/robot-surgery-segmentation | ConvRelu | false | 9,280 | [
"MIT"
] | 0 | dd86cec33d800c1104e9f89296ef8b1d38e968e2 | https://github.com/ImmortalTurtle/robot-surgery-segmentation/tree/dd86cec33d800c1104e9f89296ef8b1d38e968e2 |
ECA_Layer | import math
import torch
import torch.nn as nn
import torch.utils.data.distributed
class ECA_Layer(nn.Module):
def __init__(self, channels, gamma=2, b=1):
super(ECA_Layer, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
t = int(abs((math.log(channels, 2) + b) / gamma))
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
import math
import torch.nn as nn
import torch.utils.data.distributed
assert_siz... | Erfun76/insightface | ECA_Layer | false | 9,281 | [
"MIT"
] | 0 | 148cef36a43a055f68d2b6a475f4aa38625ad8b4 | https://github.com/Erfun76/insightface/tree/148cef36a43a055f68d2b6a475f4aa38625ad8b4 |
SplitCrossEntropyLoss | import torch
import torch.nn as nn
def logsumexp(x, dim=None, keepdim=False):
if dim is None:
x, dim = x.view(-1), 0
xm, _ = torch.max(x, dim, keepdim=True)
x = torch.where((xm == float('inf')) | (xm == float('-inf')), xm, xm +
torch.log(torch.sum(torch.exp(x - xm), dim, keepdim=True)))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | MatthieuLabeau/power-divergences-LM | SplitCrossEntropyLoss | false | 9,282 | [
"BSD-3-Clause"
] | 0 | cdc9ff417650a3f1b7968e86ca6359533cabdf1e | https://github.com/MatthieuLabeau/power-divergences-LM/tree/cdc9ff417650a3f1b7968e86ca6359533cabdf1e |
FrmScrLoss | import torch
import torch.nn as nn
class FrmScrLoss(nn.Module):
def __init__(self, propotion):
super().__init__()
self.s = propotion
def forward(self, frm_scrs, label):
_n, t, _c = frm_scrs.size()
max_frm_values, _ = torch.topk(frm_scrs, max(int(t // self.s), 1), 1)
m... | 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
... | LeonHLJ/MMSD | FrmScrLoss | false | 9,283 | [
"MIT"
] | 0 | e39838e4e38524a670c08cc696a65da8ae01f648 | https://github.com/LeonHLJ/MMSD/tree/e39838e4e38524a670c08cc696a65da8ae01f648 |
ConfidencePenalty | import torch
import torch.utils.data
from torch import nn
class ConfidencePenalty(nn.Module):
"""Cross entropy loss with label smoothing regularizer.
Reference:
Szegedy et al. Rethinking the Inception Architecture for Computer Vision. CVPR 2016.
Equation: y = (1 - epsilon) * y + epsilon / K.
Arg... | 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.utils.dat... | Luxios22/Dual_Norm | ConfidencePenalty | false | 9,284 | [
"MIT"
] | 0 | b404a03b15fc05749e0c648d9e46ffe70f6b2a80 | https://github.com/Luxios22/Dual_Norm/tree/b404a03b15fc05749e0c648d9e46ffe70f6b2a80 |
MaxPPVPool1d | from torch.nn import Module
import torch
import torch.multiprocessing
import torch
class MaxPPVPool1d(Module):
"""Drop-in replacement for AdaptiveConcatPool1d - multiplies nf by 2"""
def forward(self, x):
_max = x.max(dim=-1).values
_ppv = torch.gt(x, 0).sum(dim=-1).float() / x.shape[-1]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch.nn import Module
import torch.multiprocessing
import torch
assert_size_stride ... | MOREDataset/tsai | MaxPPVPool1d | false | 9,285 | [
"Apache-2.0"
] | 0 | 54987a579365ca7722475fff2fc4a24dc054e82c | https://github.com/MOREDataset/tsai/tree/54987a579365ca7722475fff2fc4a24dc054e82c |
RPN_Up | import torch
import torch.nn as nn
import torch.nn.functional as F
class RPN_Up(nn.Module):
"""
For SiamRPN
"""
def __init__(self, anchor_nums=5, inchannels=256, outchannels=256,
cls_type='thicker'):
super(RPN_Up, self).__init__()
self.anchor_nums = anchor_nums
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
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch... | FMsunyh/SiamDW | RPN_Up | false | 9,286 | [
"MIT"
] | 0 | ef7a97ee6bdf732edbb7dc2943daf15b92535019 | https://github.com/FMsunyh/SiamDW/tree/ef7a97ee6bdf732edbb7dc2943daf15b92535019 |
Hsigmoid | import torch
import torch.nn as nn
from torch.quantization import QuantStub
from torch.quantization import DeQuantStub
class Hsigmoid(nn.Module):
def __init__(self, inplace=True, add_stub=False):
super().__init__()
self.float_op = nn.quantized.FloatFunctional()
self.relu6 = nn.ReLU6(inpla... | 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
from torch.quantization import QuantStub
from torch.quantization im... | Leslie-Fang/incubator-tvm | Hsigmoid | false | 9,287 | [
"Apache-2.0"
] | 0 | aa035f4650926f5e714b02cbab6d974f0a17352f | https://github.com/Leslie-Fang/incubator-tvm/tree/aa035f4650926f5e714b02cbab6d974f0a17352f |
QNet | import torch
class QNet(torch.nn.Module):
def __init__(self, n_features):
super(QNet, self).__init__()
self.fc1 = torch.nn.Linear(n_features, 20)
self.fc1_activate = torch.nn.ReLU()
self.fc2 = torch.nn.Linear(20, 1)
def forward(self, x):
x = self.fc1(x)
x = 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
assert_size_stride = torch._C... | Lovestarni/Reinforcement-learning-with-tensorflow | QNet | false | 9,288 | [
"MIT"
] | 0 | 822a4ae812b044687c11138ef9c9db1e1190f98c | https://github.com/Lovestarni/Reinforcement-learning-with-tensorflow/tree/822a4ae812b044687c11138ef9c9db1e1190f98c |
PGNet | import torch
class PGNet(torch.nn.Module):
def __init__(self, n_features, n_actions):
super(PGNet, self).__init__()
self.fc1 = torch.nn.Linear(n_features, 20)
self.fc1_activate = torch.nn.ReLU()
self.fc2 = torch.nn.Linear(20, n_actions)
self.out_activate = torch.nn.Softmax... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Lovestarni/Reinforcement-learning-with-tensorflow | PGNet | false | 9,289 | [
"MIT"
] | 0 | 822a4ae812b044687c11138ef9c9db1e1190f98c | https://github.com/Lovestarni/Reinforcement-learning-with-tensorflow/tree/822a4ae812b044687c11138ef9c9db1e1190f98c |
MulScalarNegative | import torch
import torch.nn as 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 = ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
from torch.quantization import QuantStub
from torch.quantization import DeQuantStub
assert_size_stride = torch._C._dyn... | Leslie-Fang/incubator-tvm | MulScalarNegative | false | 9,290 | [
"Apache-2.0"
] | 0 | aa035f4650926f5e714b02cbab6d974f0a17352f | https://github.com/Leslie-Fang/incubator-tvm/tree/aa035f4650926f5e714b02cbab6d974f0a17352f |
Hswish | import torch
import torch.nn as nn
from torch.quantization import QuantStub
from torch.quantization import DeQuantStub
class Hsigmoid(nn.Module):
def __init__(self, inplace=True, add_stub=False):
super().__init__()
self.float_op = nn.quantized.FloatFunctional()
self.relu6 = nn.ReLU6(inpla... | 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
from torch.quantization import QuantStub
from torch.quantization im... | Leslie-Fang/incubator-tvm | Hswish | false | 9,291 | [
"Apache-2.0"
] | 0 | aa035f4650926f5e714b02cbab6d974f0a17352f | https://github.com/Leslie-Fang/incubator-tvm/tree/aa035f4650926f5e714b02cbab6d974f0a17352f |
MADDPGCritic | import torch
from torch import nn
class MADDPGCritic(nn.Module):
"""
Critic which takes observation-action pairs of all agents and returns specific q values for each
"""
def __init__(self, n_agents: 'int', act_dim: 'int', obs_dim: 'int',
history: 'int'=0, hidden_dim: 'int'=32):
super(MADDP... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | LuggiStruggi/MADDPG | MADDPGCritic | false | 9,292 | [
"MIT"
] | 0 | 20cbef7cf531f7573fa9cdf8742733becef1f827 | https://github.com/LuggiStruggi/MADDPG/tree/20cbef7cf531f7573fa9cdf8742733becef1f827 |
TokenEmbedding | import torch
import torch.nn as nn
class TokenEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(TokenEmbedding, self).__init__()
padding = 1 if torch.__version__ >= '1.5.0' else 2
self.tokenConv = nn.Conv1d(in_channels=c_in, out_channels=d_model,
kernel_size=3, pa... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | LeoYoung1996/Experiment | TokenEmbedding | false | 9,293 | [
"Apache-2.0"
] | 0 | e3e875e0fd9b0367b761c51d9862b9da5e448576 | https://github.com/LeoYoung1996/Experiment/tree/e3e875e0fd9b0367b761c51d9862b9da5e448576 |
GAT | import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLayer, self).__init__(... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Kkuntal990/pyGAT | GAT | false | 9,294 | [
"MIT"
] | 0 | ab9d1f35dfc60c1ce2070164c23ed363101aebfb | https://github.com/Kkuntal990/pyGAT/tree/ab9d1f35dfc60c1ce2070164c23ed363101aebfb |
L2loss | import torch
import torch.nn as nn
class L2loss(nn.Module):
"""
Euclidean loss also known as L2 loss. Compute the sum of the squared difference between the two images.
"""
def __init__(self):
super(L2loss, self).__init__()
def forward(self, input, target):
return torch.sum((input... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | Elameri/ivadomed | L2loss | false | 9,295 | [
"MIT"
] | 0 | 76b5cea46f90f938aafd5ec26e072d559c764b43 | https://github.com/Elameri/ivadomed/tree/76b5cea46f90f938aafd5ec26e072d559c764b43 |
CausalConv2d | import torch
import torch.utils.data
import torch
from torch import nn
class WNConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True, activation=None):
super().__init__()
self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_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.triton_helpers import libdevice
import torch.utils.... | KouheiFurukawa/vq-vae-2-pytorch | CausalConv2d | false | 9,296 | [
"MIT"
] | 0 | ad8a4d8409c2e99e1db790a0e215b346b56b1e1f | https://github.com/KouheiFurukawa/vq-vae-2-pytorch/tree/ad8a4d8409c2e99e1db790a0e215b346b56b1e1f |
InverseDepthSmoothnessLoss | import torch
import torch.nn as nn
def _gradient_x(img: 'torch.Tensor') ->torch.Tensor:
assert len(img.shape) == 4, img.shape
return img[:, :, :, :-1] - img[:, :, :, 1:]
def _gradient_y(img: 'torch.Tensor') ->torch.Tensor:
assert len(img.shape) == 4, img.shape
return img[:, :, :-1, :] - img[:, :, 1:... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | IEM-Computer-Vision/kornia | InverseDepthSmoothnessLoss | false | 9,297 | [
"ECL-2.0",
"Apache-2.0"
] | 0 | f98bd9a2158a6e59cda076d55d476acf13f4e0af | https://github.com/IEM-Computer-Vision/kornia/tree/f98bd9a2158a6e59cda076d55d476acf13f4e0af |
MADDPGCritic3 | import torch
from torch import nn
class MADDPGCritic3(nn.Module):
"""
Critic which takes observation-action pairs of all agents and returns one q value for all
"""
def __init__(self, n_agents: 'int', act_dim: 'int', obs_dim: 'int',
history: 'int'=0, hidden_dim: 'int'=32):
super(MADDPGCritic... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | LuggiStruggi/MADDPG | MADDPGCritic3 | false | 9,298 | [
"MIT"
] | 0 | 20cbef7cf531f7573fa9cdf8742733becef1f827 | https://github.com/LuggiStruggi/MADDPG/tree/20cbef7cf531f7573fa9cdf8742733becef1f827 |
SurfaceClassifier | import torch
import torch.nn as nn
import torch.nn.functional as F
class SurfaceClassifier(nn.Module):
def __init__(self, filter_channels, num_views=1, no_residual=True,
last_op=None):
super(SurfaceClassifier, self).__init__()
self.filters = []
self.num_views = num_views
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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | KORguy/PIFu_Part | SurfaceClassifier | false | 9,299 | [
"MIT"
] | 0 | bd199d439a94f8bc8b4036898b0f1ec01e56ab9e | https://github.com/KORguy/PIFu_Part/tree/bd199d439a94f8bc8b4036898b0f1ec01e56ab9e |
WNConv2d | import torch
import torch.utils.data
import torch
from torch import nn
class WNConv2d(nn.Module):
def __init__(self, in_channel, out_channel, kernel_size, stride=1,
padding=0, bias=True, activation=None):
super().__init__()
self.conv = nn.utils.weight_norm(nn.Conv2d(in_channel, out_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.triton_helpers import libdevice
import torch.utils.... | KouheiFurukawa/vq-vae-2-pytorch | WNConv2d | false | 9,300 | [
"MIT"
] | 0 | ad8a4d8409c2e99e1db790a0e215b346b56b1e1f | https://github.com/KouheiFurukawa/vq-vae-2-pytorch/tree/ad8a4d8409c2e99e1db790a0e215b346b56b1e1f |
FocalTverskyLoss | import torch
import torch.nn as nn
class TverskyLoss(nn.Module):
"""Tversky Loss.
.. seealso::
Salehi, Seyed Sadegh Mohseni, Deniz Erdogmus, and Ali Gholipour. "Tversky loss function for image segmentation
using 3D fully convolutional deep networks." International Workshop on Machine Learning... | 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_... | Elameri/ivadomed | FocalTverskyLoss | false | 9,301 | [
"MIT"
] | 0 | 76b5cea46f90f938aafd5ec26e072d559c764b43 | https://github.com/Elameri/ivadomed/tree/76b5cea46f90f938aafd5ec26e072d559c764b43 |
BinaryCrossEntropyLoss | import torch
import torch.nn as nn
class BinaryCrossEntropyLoss(nn.Module):
"""(`BinaryCrossEntropyLoss <https://pytorch.org/docs/master/generated/torch.nn.BCELoss.html#bceloss>`__).
Attributes:
loss_fct (BCELoss): Binary cross entropy loss function from torch library.
"""
def __init__(self)... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | Elameri/ivadomed | BinaryCrossEntropyLoss | false | 9,302 | [
"MIT"
] | 0 | 76b5cea46f90f938aafd5ec26e072d559c764b43 | https://github.com/Elameri/ivadomed/tree/76b5cea46f90f938aafd5ec26e072d559c764b43 |
UpsamplingBilinear | import torch
import torch.nn as nn
from torch.quantization import QuantStub
from torch.quantization import DeQuantStub
class UpsamplingBilinear(nn.Module):
def __init__(self):
super().__init__()
self.quant = QuantStub()
self.dequant = DeQuantStub()
def forward(self, x):
x = 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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
from torch.quantization import QuantStub
from torch.quantization im... | Leslie-Fang/incubator-tvm | UpsamplingBilinear | false | 9,303 | [
"Apache-2.0"
] | 0 | aa035f4650926f5e714b02cbab6d974f0a17352f | https://github.com/Leslie-Fang/incubator-tvm/tree/aa035f4650926f5e714b02cbab6d974f0a17352f |
FocalDiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
"""DiceLoss.
.. seealso::
Milletari, Fausto, Nassir Navab, and Seyed-Ahmad Ahmadi. "V-net: Fully convolutional neural networks for
volumetric medical image segmentation." 2016 fourth international conference on 3D vision (3DV). IEE... | 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
... | Elameri/ivadomed | FocalDiceLoss | false | 9,304 | [
"MIT"
] | 0 | 76b5cea46f90f938aafd5ec26e072d559c764b43 | https://github.com/Elameri/ivadomed/tree/76b5cea46f90f938aafd5ec26e072d559c764b43 |
FocalLoss | import torch
import torch.nn as nn
class FocalLoss(nn.Module):
"""FocalLoss.
.. seealso::
Lin, Tsung-Yi, et al. "Focal loss for dense object detection."
Proceedings of the IEEE international conference on computer vision. 2017.
Args:
gamma (float): Value from 0 to 5, Control betw... | 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
... | Elameri/ivadomed | FocalLoss | false | 9,305 | [
"MIT"
] | 0 | 76b5cea46f90f938aafd5ec26e072d559c764b43 | https://github.com/Elameri/ivadomed/tree/76b5cea46f90f938aafd5ec26e072d559c764b43 |
MultiClassDiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
"""DiceLoss.
.. seealso::
Milletari, Fausto, Nassir Navab, and Seyed-Ahmad Ahmadi. "V-net: Fully convolutional neural networks for
volumetric medical image segmentation." 2016 fourth international conference on 3D vision (3DV). IEE... | 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... | Elameri/ivadomed | MultiClassDiceLoss | false | 9,306 | [
"MIT"
] | 0 | 76b5cea46f90f938aafd5ec26e072d559c764b43 | https://github.com/Elameri/ivadomed/tree/76b5cea46f90f938aafd5ec26e072d559c764b43 |
TemporalEmbedding | import math
import torch
import torch.nn as nn
class FixedEmbedding(nn.Module):
def __init__(self, c_in, d_model):
super(FixedEmbedding, self).__init__()
w = torch.zeros(c_in, d_model).float()
w.require_grad = False
position = torch.arange(0, c_in).float().unsqueeze(1)
div... | 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 math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guar... | LeoYoung1996/Experiment | TemporalEmbedding | false | 9,307 | [
"Apache-2.0"
] | 0 | e3e875e0fd9b0367b761c51d9862b9da5e448576 | https://github.com/LeoYoung1996/Experiment/tree/e3e875e0fd9b0367b761c51d9862b9da5e448576 |
Conv_ReLU | import torch
import torch.nn as nn
class Conv_ReLU(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=None, groups=1, bias=True):
super(Conv_ReLU, self).__init__()
if padding is None:
if stride == 1:
padding = (kernel_size ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | Liyong8490/DP_HSISR | Conv_ReLU | false | 9,308 | [
"Apache-2.0"
] | 0 | e46298ce3432757ae225b73b3752dceda95909eb | https://github.com/Liyong8490/DP_HSISR/tree/e46298ce3432757ae225b73b3752dceda95909eb |
TverskyLoss | import torch
import torch.nn as nn
class TverskyLoss(nn.Module):
"""Tversky Loss.
.. seealso::
Salehi, Seyed Sadegh Mohseni, Deniz Erdogmus, and Ali Gholipour. "Tversky loss function for image segmentation
using 3D fully convolutional deep networks." International Workshop on Machine Learning... | 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... | Elameri/ivadomed | TverskyLoss | false | 9,309 | [
"MIT"
] | 0 | 76b5cea46f90f938aafd5ec26e072d559c764b43 | https://github.com/Elameri/ivadomed/tree/76b5cea46f90f938aafd5ec26e072d559c764b43 |
DiceLoss | import torch
import torch.nn as nn
class DiceLoss(nn.Module):
"""DiceLoss.
.. seealso::
Milletari, Fausto, Nassir Navab, and Seyed-Ahmad Ahmadi. "V-net: Fully convolutional neural networks for
volumetric medical image segmentation." 2016 fourth international conference on 3D vision (3DV). IEE... | 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... | Elameri/ivadomed | DiceLoss | false | 9,310 | [
"MIT"
] | 0 | 76b5cea46f90f938aafd5ec26e072d559c764b43 | https://github.com/Elameri/ivadomed/tree/76b5cea46f90f938aafd5ec26e072d559c764b43 |
RankingLoss | import torch
from abc import abstractmethod
import torch.utils.data.dataloader
import torch.nn.functional as F
from torch import nn
import torch.nn
class SimilarityLoss(nn.Module):
def __init__(self):
super(SimilarityLoss, self).__init__()
@abstractmethod
def forward(self, inputs, targets):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from abc import abstractmethod
import torch.utils.data.dataloader
from torch import nn
im... | MaxDall/flair | RankingLoss | false | 9,311 | [
"MIT"
] | 0 | fe33be4a63134595c21891edbe00ef9bd6014641 | https://github.com/MaxDall/flair/tree/fe33be4a63134595c21891edbe00ef9bd6014641 |
PairwiseBCELoss | import torch
from abc import abstractmethod
import torch.utils.data.dataloader
import torch.nn.functional as F
from torch import nn
import torch.nn
class SimilarityLoss(nn.Module):
def __init__(self):
super(SimilarityLoss, self).__init__()
@abstractmethod
def forward(self, inputs, targets):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from abc im... | MaxDall/flair | PairwiseBCELoss | false | 9,312 | [
"MIT"
] | 0 | fe33be4a63134595c21891edbe00ef9bd6014641 | https://github.com/MaxDall/flair/tree/fe33be4a63134595c21891edbe00ef9bd6014641 |
MLP_PART | import torch
import torch.nn as nn
import torch.nn.functional as F
class MLP_PART(nn.Module):
def __init__(self, filter_channels, merge_layer=0, res_layers=[], norm=
'group', num_parts=2, last_op=None):
super(MLP_PART, self).__init__()
self.num_parts = num_parts
self.fc_parts_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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | KORguy/PIFu_Part | MLP_PART | false | 9,313 | [
"MIT"
] | 0 | bd199d439a94f8bc8b4036898b0f1ec01e56ab9e | https://github.com/KORguy/PIFu_Part/tree/bd199d439a94f8bc8b4036898b0f1ec01e56ab9e |
SimpleBody | import torch
import torch.nn as nn
from torch.nn import functional as F
class SimpleBody(nn.Module):
def __init__(self, num_channels):
super(SimpleBody, self).__init__()
self.out_feats = 32
self.fc1 = nn.Linear(num_channels, self.out_feats)
def forward(self, x):
x = F.relu(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 torch.nn as nn
assert_... | Michaelrising/sac-discrete.pytorch | SimpleBody | false | 9,314 | [
"MIT"
] | 0 | 93ae779f5980726db0302c3471fd143c7d1d35ed | https://github.com/Michaelrising/sac-discrete.pytorch/tree/93ae779f5980726db0302c3471fd143c7d1d35ed |
OutputLayer | import torch
import torch.nn as nn
import torch.utils.dlpack
class OutputLayer(nn.Module):
def __init__(self, voxel_size=1.0):
super(OutputLayer, self).__init__()
def forward(self, features_list, index_map_list):
out = []
for feat, index_map in zip(features_list, index_map_list):
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.dlpack
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._... | Jaein94/Open3D-ML | OutputLayer | false | 9,315 | [
"MIT"
] | 0 | 815c111229322d562e11ea3148ad6568ccf13d1d | https://github.com/Jaein94/Open3D-ML/tree/815c111229322d562e11ea3148ad6568ccf13d1d |
IOUloss | import torch
import torch.nn as nn
class IOUloss(nn.Module):
def __init__(self, reduction='none', loss_type='iou'):
super(IOUloss, self).__init__()
self.reduction = reduction
self.loss_type = loss_type
def forward(self, pred, target):
assert pred.shape[0] == target.shape[0]
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | JJLimmm/YOLOx | IOUloss | false | 9,316 | [
"Apache-2.0"
] | 0 | 85fdb819be84dfec3a8306cb74872a1c0ef28e3e | https://github.com/JJLimmm/YOLOx/tree/85fdb819be84dfec3a8306cb74872a1c0ef28e3e |
MLP | import torch
class MLP(torch.nn.Module):
def __init__(self, input_size, ouput_size=1) ->None:
super(MLP, self).__init__()
self.layer_1 = torch.nn.Linear(input_size, 2 * input_size)
self.layer_2 = torch.nn.Linear(2 * input_size, 2 * input_size)
self.layer_3 = torch.nn.Linear(2 * 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cu... | MohammadAminAlamalhoda/EEG-Classification | MLP | false | 9,317 | [
"MIT"
] | 0 | dcaf452ba48bc5fcf9a777f73f81bdec9b21592e | https://github.com/MohammadAminAlamalhoda/EEG-Classification/tree/dcaf452ba48bc5fcf9a777f73f81bdec9b21592e |
DAInsHead | import torch
import torch.utils.data
from torchvision.transforms import functional as F
from torch import nn
import torch.nn.functional as F
class DAInsHead(nn.Module):
"""
Adds a simple Instance-level Domain Classifier head
"""
def __init__(self, in_channels):
"""
Arguments:
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
from ... | FengJunJian/Domain-Adaptive-Faster-RCNN-PyTorch | DAInsHead | false | 9,318 | [
"MIT"
] | 0 | 35aa8d208fec22af8c502f8d6d2f562e857d4175 | https://github.com/FengJunJian/Domain-Adaptive-Faster-RCNN-PyTorch/tree/35aa8d208fec22af8c502f8d6d2f562e857d4175 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.