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 |
|---|---|---|---|---|---|---|---|---|---|---|
PredictFC | import torch
import torch.nn as nn
class PredictFC(nn.Module):
def __init__(self, num_params, num_states, in_channels):
super(PredictFC, self).__init__()
self.num_params = num_params
self.fc_param = nn.Conv2d(in_channels, num_params, kernel_size=1,
stride=1, padding=0, bias=Tr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | DistinctVision/conditional-lane-detection | PredictFC | false | 11,350 | [
"Apache-2.0"
] | 0 | b118a40738188facf63ec7cd0bb0422fdf562b77 | https://github.com/DistinctVision/conditional-lane-detection/tree/b118a40738188facf63ec7cd0bb0422fdf562b77 |
ModulatedConv2d | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
def make_kernel(k):
k = torch.tensor(k, dtype=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch.autograd... | DeepVoodooFX/pixel2style2pixel | ModulatedConv2d | false | 11,351 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | 0 | 0254c32400d55f7e400ead15b02ad6a992ba1e21 | https://github.com/DeepVoodooFX/pixel2style2pixel/tree/0254c32400d55f7e400ead15b02ad6a992ba1e21 |
Actor | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DiegelD/Deep-Reinforcement-Learning-ND | Actor | false | 11,352 | [
"MIT"
] | 0 | 15a91da352414718bb83fdc538d73ac576472cb8 | https://github.com/DiegelD/Deep-Reinforcement-Learning-ND/tree/15a91da352414718bb83fdc538d73ac576472cb8 |
PositionwiseFeedforward | import torch
import torch.nn as nn
import torch.nn.functional as F
class PositionwiseFeedforward(nn.Module):
def __init__(self, hid_dim, pf_dim, dropout):
super().__init__()
self.hid_dim = hid_dim
self.pf_dim = pf_dim
self.fc_1 = nn.Conv1d(hid_dim, pf_dim, 1)
self.fc_2 = n... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | DingXiangYuanZhiXing/transformerCPI | PositionwiseFeedforward | false | 11,353 | [
"Apache-2.0"
] | 0 | 1fba6b29f6ddba64bdfb264887307c24fdf5c607 | https://github.com/DingXiangYuanZhiXing/transformerCPI/tree/1fba6b29f6ddba64bdfb264887307c24fdf5c607 |
SigmoidRange | import torch
import torch.nn as nn
from typing import *
def sigmoid_range(x, low, high):
"""Sigmoid function with range `(low, high)`"""
return torch.sigmoid(x) * (high - low) + low
class SigmoidRange(nn.Module):
"""Sigmoid module with range `(low, high)`"""
def __init__(self, low, high):
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
from typing import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dy... | DineshChauhan/fastai_docs | SigmoidRange | false | 11,354 | [
"Apache-2.0"
] | 0 | cf4d88073fb6f3ef7331b5360618b8dd95eb9345 | https://github.com/DineshChauhan/fastai_docs/tree/cf4d88073fb6f3ef7331b5360618b8dd95eb9345 |
GatedConvTranspose | import torch
import torch.nn as nn
import torch.utils.data
class GatedConvTranspose(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, output_padding=0, groups=1):
super(GatedConvTranspose, self).__init__()
self.layer_f = nn.ConvTranspose2d(in_chan... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | GatedConvTranspose | false | 11,355 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
Critic | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import numpy as np
import tor... | DiegelD/Deep-Reinforcement-Learning-ND | Critic | false | 11,356 | [
"MIT"
] | 0 | 15a91da352414718bb83fdc538d73ac576472cb8 | https://github.com/DiegelD/Deep-Reinforcement-Learning-ND/tree/15a91da352414718bb83fdc538d73ac576472cb8 |
BlendLinear | import torch
import torch.nn as nn
import torch.utils.data
class BlendLinear(nn.Module):
def __init__(self, dim_in, dim_out, layer_type=nn.Linear, **unused_kwargs):
super(BlendLinear, self).__init__()
self._layer0 = layer_type(dim_in, dim_out)
self._layer1 = layer_type(dim_in, dim_out)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | BlendLinear | false | 11,357 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
MultiHeadAttention | import math
import torch
import numpy as np
from torch import nn
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, input_dim, embed_dim, val_dim=None, key_dim
=None):
super(MultiHeadAttention, self).__init__()
if val_dim is None:
val_dim = embed_dim // n_heads
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | DaehanKim/attention-learn-to-route | MultiHeadAttention | false | 11,358 | [
"MIT"
] | 0 | 9ce4fa9a3a136768f92adf3d1e7d62620442f1b7 | https://github.com/DaehanKim/attention-learn-to-route/tree/9ce4fa9a3a136768f92adf3d1e7d62620442f1b7 |
ConcatSquashLinear | import torch
import torch.nn as nn
import torch.utils.data
class ConcatSquashLinear(nn.Module):
def __init__(self, dim_in, dim_out):
super(ConcatSquashLinear, self).__init__()
self._layer = nn.Linear(dim_in, dim_out)
self._hyper_bias = nn.Linear(1, dim_out, bias=False)
self._hyper... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | ConcatSquashLinear | false | 11,359 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
GatedLinear | import torch
import torch.nn as nn
import torch.utils.data
class GatedLinear(nn.Module):
def __init__(self, in_features, out_features):
super(GatedLinear, self).__init__()
self.layer_f = nn.Linear(in_features, out_features)
self.layer_g = nn.Linear(in_features, out_features)
def forw... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | GatedLinear | false | 11,360 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
ConcatSquashConv2d | import torch
import torch.nn as nn
import torch.utils.data
class ConcatSquashConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False):
super(ConcatSquashConv2d, self).__init__()
module = nn.ConvTranspose2d if tr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | ConcatSquashConv2d | false | 11,361 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
GatedConv | import torch
import torch.nn as nn
import torch.utils.data
class GatedConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride=1,
padding=0, groups=1):
super(GatedConv, self).__init__()
self.layer_f = nn.Conv2d(in_channels, out_channels, kernel_size,
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | GatedConv | false | 11,362 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
AttentionUnit | import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import init
class AttentionUnit(nn.Module):
def __init__(self, sDim, xDim, attDim):
super(AttentionUnit, self).__init__()
self.sDim = sDim
self.xDim = xDim
self.attDim = attDim
self.sEmbed = nn... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DimplesL/aster.pytorch | AttentionUnit | false | 11,363 | [
"MIT"
] | 0 | c28f3438e0e398958fa54a804db83c819fb3d9b3 | https://github.com/DimplesL/aster.pytorch/tree/c28f3438e0e398958fa54a804db83c819fb3d9b3 |
ConcatConv2d | import torch
import torch.nn as nn
import torch.utils.data
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 = nn.ConvTranspose2d if transpose else... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | ConcatConv2d | false | 11,364 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
ToRGB | from torch.autograd import Function
import math
import torch
from torch import nn
from torch.nn import functional as F
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
return FusedLeakyReLUFunction.apply(input, bias, negative_slope, scale)
def make_kernel(k):
k = torch.tensor(k, dtype=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch.autograd import Function
import math
from torch import nn
from torch.... | DeepVoodooFX/pixel2style2pixel | ToRGB | false | 11,365 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT"
] | 0 | 0254c32400d55f7e400ead15b02ad6a992ba1e21 | https://github.com/DeepVoodooFX/pixel2style2pixel/tree/0254c32400d55f7e400ead15b02ad6a992ba1e21 |
BiaffineScorer | import torch
import torch.nn as nn
class BiaffineScorer(nn.Module):
def __init__(self, input1_size, input2_size, output_size):
super().__init__()
self.W_bilin = nn.Bilinear(input1_size + 1, input2_size + 1,
output_size)
self.W_bilin.weight.data.zero_()
self.W_bilin.bia... | 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... | CopticScriptorium/stanza | BiaffineScorer | false | 11,366 | [
"Apache-2.0"
] | 0 | a16b152fce3d2cc325b7d67e03952bd00c878fe3 | https://github.com/CopticScriptorium/stanza/tree/a16b152fce3d2cc325b7d67e03952bd00c878fe3 |
BasicBlock | import torch
import torch.nn as nn
import torch.utils.data
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, dim):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv2d(dim, dim, kernel_size=3, padding=1, bias=False)
self.bn1 = nn.GroupNorm(2, dim, eps=0.0001)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | D-hash-code/ffjord | BasicBlock | false | 11,367 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
ConvertPointsToHomogeneous | import torch
import torch.nn as nn
def convert_points_to_homogeneous(points):
"""Function that converts points from Euclidean to homogeneous space.
See :class:`~torchgeometry.ConvertPointsToHomogeneous` for details.
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> output = tgm.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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | DoJing/frankmocap | ConvertPointsToHomogeneous | false | 11,368 | [
"BSD-3-Clause"
] | 0 | ac2ddc5a75a885ede5068a25049ca2bfe9330576 | https://github.com/DoJing/frankmocap/tree/ac2ddc5a75a885ede5068a25049ca2bfe9330576 |
ConvertPointsFromHomogeneous | import torch
import torch.nn as nn
def convert_points_from_homogeneous(points):
"""Function that converts points from homogeneous to Euclidean space.
See :class:`~torchgeometry.ConvertPointsFromHomogeneous` for details.
Examples::
>>> input = torch.rand(2, 4, 3) # BxNx3
>>> output = tg... | 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... | DoJing/frankmocap | ConvertPointsFromHomogeneous | false | 11,369 | [
"BSD-3-Clause"
] | 0 | ac2ddc5a75a885ede5068a25049ca2bfe9330576 | https://github.com/DoJing/frankmocap/tree/ac2ddc5a75a885ede5068a25049ca2bfe9330576 |
SigmaL1SmoothLoss | import torch
import torch.nn as nn
from typing import *
class SigmaL1SmoothLoss(nn.Module):
def forward(self, output, target):
reg_diff = torch.abs(target - output)
reg_loss = torch.where(torch.le(reg_diff, 1 / 9), 4.5 * torch.pow(
reg_diff, 2), reg_diff - 1 / 18)
return reg_l... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | DineshChauhan/fastai_docs | SigmaL1SmoothLoss | false | 11,370 | [
"Apache-2.0"
] | 0 | cf4d88073fb6f3ef7331b5360618b8dd95eb9345 | https://github.com/DineshChauhan/fastai_docs/tree/cf4d88073fb6f3ef7331b5360618b8dd95eb9345 |
HyperConv2d | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Linear') != -1 or classname.find('Conv') != -1:
nn.init.constant_(m.weight, 0)
nn.init.normal_(m.bias, 0, 0.01)
class HyperConv2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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
import torch.utils.data
as... | D-hash-code/ffjord | HyperConv2d | false | 11,371 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
UpsampleConvLayer | import torch
import torch.nn.parallel
import torch.utils.data
import torch.onnx
import torch.optim
import torch.utils.data.distributed
class UpsampleConvLayer(torch.nn.Module):
"""UpsampleConvLayer
Upsamples the input and then does a convolution. This method gives better results
compared to ConvTranspose2... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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.... | Arjuna197/examples | UpsampleConvLayer | false | 11,372 | [
"BSD-3-Clause"
] | 0 | f504ea2aafc8a8baa5effb659fc1c20a70aabdda | https://github.com/Arjuna197/examples/tree/f504ea2aafc8a8baa5effb659fc1c20a70aabdda |
Foo | import torch
import torch.nn.functional
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data.distributed
class Foo(torch.nn.Module):
def __init__(self, size):
super(Foo, self).__init__()
self.n = torch.nn.Parameter(torch.ones(size))
self.m = torch.nn... | 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.functional
import torch.nn.parallel
import torch.utils.data
import torch.optim
import torch.utils.data.distributed
assert_si... | DominickZhang/Distillation-Swin-Transformer | Foo | false | 11,373 | [
"MIT"
] | 0 | 6fc7b25bd558edb14e6f15715f53612c37e5166f | https://github.com/DominickZhang/Distillation-Swin-Transformer/tree/6fc7b25bd558edb14e6f15715f53612c37e5166f |
GatedConv2d | import torch
import torch.nn as nn
import torch.utils.data
class GatedConv2d(nn.Module):
def __init__(self, input_channels, output_channels, kernel_size, stride,
padding, dilation=1, activation=None):
super(GatedConv2d, self).__init__()
self.activation = activation
self.sigmoid = ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | GatedConv2d | false | 11,374 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
BlendConv2d | import torch
import torch.nn as nn
import torch.utils.data
class BlendConv2d(nn.Module):
def __init__(self, dim_in, dim_out, ksize=3, stride=1, padding=0,
dilation=1, groups=1, bias=True, transpose=False, **unused_kwargs):
super(BlendConv2d, self).__init__()
module = nn.ConvTranspose2d if... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.utils.data
assert_size_stride = torch._C._dyn... | D-hash-code/ffjord | BlendConv2d | false | 11,375 | [
"MIT"
] | 0 | 3647ab35537a8bac3b4dc1e45a593819ac8e2c18 | https://github.com/D-hash-code/ffjord/tree/3647ab35537a8bac3b4dc1e45a593819ac8e2c18 |
Policy | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
import torch.onnx
import torch.optim
import torch.utils.data.distributed
class Policy(nn.Module):
def __init__(self):
super(Policy, self).__init__()
self.affine1 = nn.Linear(4, 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.... | Arjuna197/examples | Policy | false | 11,376 | [
"BSD-3-Clause"
] | 0 | f504ea2aafc8a8baa5effb659fc1c20a70aabdda | https://github.com/Arjuna197/examples/tree/f504ea2aafc8a8baa5effb659fc1c20a70aabdda |
ScaledDotProductAttention | import torch
import numpy as np
import torch.utils.data
import torch.nn as nn
class ScaledDotProductAttention(nn.Module):
""" Scaled Dot-Product Attention """
def __init__(self, temperature, attn_dropout=0.1):
super().__init__()
self.temperature = temperature
self.dropout = nn.Dropout... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Doomski99/MarcCoru2019CropType | ScaledDotProductAttention | false | 11,377 | [
"MIT"
] | 0 | 17db294ef51bdd39fd884e0052141d8092b98b86 | https://github.com/Doomski99/MarcCoru2019CropType/tree/17db294ef51bdd39fd884e0052141d8092b98b86 |
AddReadout | import torch
import torch.nn as nn
class AddReadout(nn.Module):
def __init__(self, start_index=1):
super(AddReadout, self).__init__()
self.start_index = start_index
def forward(self, x):
if self.start_index == 2:
readout = (x[:, 0] + x[:, 1]) / 2
else:
... | 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... | DazhiZhong/MiDaS | AddReadout | false | 11,378 | [
"MIT"
] | 0 | e8bafa9c0cf6d2a9d940d2dc36f0ea28a75e5809 | https://github.com/DazhiZhong/MiDaS/tree/e8bafa9c0cf6d2a9d940d2dc36f0ea28a75e5809 |
Critic | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Critic(nn.Module):
"""Critic (Value) Model."""
def __init__(self, state_size, action_size, seed, ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._dynamo.g... | DougTrajano/ds_drl_continuous_control | Critic | false | 11,379 | [
"MIT"
] | 0 | a160b53f68f9fc30c917038af406367dcaa44dc7 | https://github.com/DougTrajano/ds_drl_continuous_control/tree/a160b53f68f9fc30c917038af406367dcaa44dc7 |
SoftAttention | import torch
import torch.utils.data
import torch.nn as nn
class SoftAttention(torch.nn.Module):
"""
v = tanh(hW + b)
w = softmax(v*u)
out = sum wh
see eqs 5-7 in https://www.sciencedirect.com/science/article/abs/pii/S0924271619300115
"""
def __init__(self, hidden_dim):
super(Sof... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Doomski99/MarcCoru2019CropType | SoftAttention | false | 11,380 | [
"MIT"
] | 0 | 17db294ef51bdd39fd884e0052141d8092b98b86 | https://github.com/Doomski99/MarcCoru2019CropType/tree/17db294ef51bdd39fd884e0052141d8092b98b86 |
VAE | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
import torch.onnx
import torch.optim
import torch.utils.data.distributed
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Linear(784, 400)
... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from... | Arjuna197/examples | VAE | false | 11,381 | [
"BSD-3-Clause"
] | 0 | f504ea2aafc8a8baa5effb659fc1c20a70aabdda | https://github.com/Arjuna197/examples/tree/f504ea2aafc8a8baa5effb659fc1c20a70aabdda |
MLP | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
class MLP(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(28 * 28 * 1, 300)
self.fc2 = nn.Linear(300, 100)
self.fc3 = nn.Linear(100, 10)
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
import ... | EY4L/MNIST-MLP-SVM | MLP | false | 11,382 | [
"MIT"
] | 0 | e2f078e3cb3e6992d78e3165de0a6a164b26caff | https://github.com/EY4L/MNIST-MLP-SVM/tree/e2f078e3cb3e6992d78e3165de0a6a164b26caff |
FeatNet | import torch
import torch.nn as nn
class FeatNet(nn.Module):
def __init__(self):
super(FeatNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=
(3, 7), stride=1, padding=(1, 3), bias=False)
self.tanh1 = nn.Tanh()
self.Pool1 = nn.Avg... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as ... | DongChengdongHangZhou/adversarial-attack-iris | FeatNet | false | 11,383 | [
"Apache-2.0"
] | 0 | ae7e408c47c332fc876d572acd4701e4b8970487 | https://github.com/DongChengdongHangZhou/adversarial-attack-iris/tree/ae7e408c47c332fc876d572acd4701e4b8970487 |
modrelu | import torch
from torch import nn
class modrelu(nn.Module):
""" This code comes is extracted from https://github.com/Lezcano/expRNN, we just repeat it as it is needed by our experiment"""
def __init__(self, features):
super(modrelu, self).__init__()
self.features = features
self.b = n... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | EMassart/OrthCDforRNNs | modrelu | false | 11,384 | [
"MIT"
] | 0 | 487102a4e249ccfbca3062a613011e6cec09ba3a | https://github.com/EMassart/OrthCDforRNNs/tree/487102a4e249ccfbca3062a613011e6cec09ba3a |
Actor | import torch
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
def hidden_init(layer):
fan_in = layer.weight.data.size()[0]
lim = 1.0 / np.sqrt(fan_in)
return -lim, lim
class Actor(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, f... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | DougTrajano/ds_drl_continuous_control | Actor | false | 11,385 | [
"MIT"
] | 0 | a160b53f68f9fc30c917038af406367dcaa44dc7 | https://github.com/DougTrajano/ds_drl_continuous_control/tree/a160b53f68f9fc30c917038af406367dcaa44dc7 |
PositionwiseFeedForward | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
class PositionwiseFeedForward(nn.Module):
""" A two-feed-forward-layer module """
def __init__(self, d_in, d_hid, dropout=0.1):
super().__init__()
self.w_1 = nn.Conv1d(d_in, d_hid, 1)
self.w_2 =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Doomski99/MarcCoru2019CropType | PositionwiseFeedForward | false | 11,386 | [
"MIT"
] | 0 | 17db294ef51bdd39fd884e0052141d8092b98b86 | https://github.com/Doomski99/MarcCoru2019CropType/tree/17db294ef51bdd39fd884e0052141d8092b98b86 |
ResidualBlock | import torch
import torch.nn.parallel
import torch.utils.data
import torch.onnx
import torch.optim
import torch.utils.data.distributed
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kerne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Arjuna197/examples | ResidualBlock | false | 11,387 | [
"BSD-3-Clause"
] | 0 | f504ea2aafc8a8baa5effb659fc1c20a70aabdda | https://github.com/Arjuna197/examples/tree/f504ea2aafc8a8baa5effb659fc1c20a70aabdda |
Decoder | import torch
import torch.nn as nn
class Decoder(nn.Module):
def __init__(self, latent_size, out_size):
super().__init__()
self.linear1 = nn.Linear(latent_size, int(out_size / 4))
self.linear2 = nn.Linear(int(out_size / 4), int(out_size / 2))
self.linear3 = nn.Linear(int(out_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_... | DuneeshaFernando/usad | Decoder | false | 11,388 | [
"BSD-3-Clause"
] | 0 | 22653a96deefe57013b1df57bb6dc316ef423c95 | https://github.com/DuneeshaFernando/usad/tree/22653a96deefe57013b1df57bb6dc316ef423c95 |
TanH | import torch
import torch.nn as nn
class TanH(torch.nn.Module):
def __init__(self, a=1, max=10):
super().__init__()
self.a = a
self.max = max
def forward(self, v):
tanh = nn.Tanh()
act = tanh(self.a * v) * self.max
return act
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.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | ElliotHYLee/MyPyTorchAPI | TanH | false | 11,389 | [
"MIT"
] | 0 | edb25b724372367e96e3bd2f420c023c4efbfcd7 | https://github.com/ElliotHYLee/MyPyTorchAPI/tree/edb25b724372367e96e3bd2f420c023c4efbfcd7 |
L2 | import torch
import torch.nn as nn
class L2(nn.Module):
def __init__(self):
super(L2, self).__init__()
def forward(self, output, target):
lossvalue = torch.norm(output - target, p=2, dim=1).mean()
return lossvalue
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | Egazaga/flownet2-pytorch | L2 | false | 11,390 | [
"Apache-2.0"
] | 0 | a9bdaf41a1d4b46a4b079bde4de97fe829edf93d | https://github.com/Egazaga/flownet2-pytorch/tree/a9bdaf41a1d4b46a4b079bde4de97fe829edf93d |
BatchScalar33MatMul | import torch
import torch.nn as nn
class BatchScalar33MatMul(nn.Module):
def __init__(self):
super().__init__()
def forward(self, scalar, mat):
s = scalar.unsqueeze(2)
s = s.expand_as(mat)
return s * mat
def get_inputs():
return [torch.rand([4, 4]), torch.rand([4, 4, 4]... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ElliotHYLee/MyPyTorchAPI | BatchScalar33MatMul | false | 11,391 | [
"MIT"
] | 0 | edb25b724372367e96e3bd2f420c023c4efbfcd7 | https://github.com/ElliotHYLee/MyPyTorchAPI/tree/edb25b724372367e96e3bd2f420c023c4efbfcd7 |
MyCustom | import torch
import torch.nn as nn
class Sigmoid(torch.nn.Module):
def __init__(self, a=1, max=10):
super().__init__()
self.a = a
self.max = max
def forward(self, v):
sig = nn.Sigmoid()
act = sig(self.a * v) * self.max
return act
class TanH(torch.nn.Module):... | 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_... | ElliotHYLee/MyPyTorchAPI | MyCustom | false | 11,392 | [
"MIT"
] | 0 | edb25b724372367e96e3bd2f420c023c4efbfcd7 | https://github.com/ElliotHYLee/MyPyTorchAPI/tree/edb25b724372367e96e3bd2f420c023c4efbfcd7 |
BCE_loss | import torch
import torch.nn as nn
class BCE_loss(nn.Module):
def __init__(self):
super(BCE_loss, self).__init__()
def forward(self, pred, gt):
bce_loss = nn.BCELoss(size_average=True)
bce_out = bce_loss(pred, gt)
return bce_out
def get_inputs():
return [torch.rand([4, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torc... | EmmanuelleB985/Head-and-Neck-Tumour-Segmentation-and-Prediction-of-Patient-Survival | BCE_loss | false | 11,393 | [
"MIT"
] | 0 | 347883eb6dd5daebba091119ede7a9f5b78076d1 | https://github.com/EmmanuelleB985/Head-and-Neck-Tumour-Segmentation-and-Prediction-of-Patient-Survival/tree/347883eb6dd5daebba091119ede7a9f5b78076d1 |
ResidualConvUnit | import torch
import torch.nn as nn
class ResidualConvUnit(nn.Module):
"""Residual convolution module.
"""
def __init__(self, features):
"""Init.
Args:
features (int): number of features
"""
super().__init__()
self.conv1 = nn.Conv2d(features, 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_... | DazhiZhong/MiDaS | ResidualConvUnit | false | 11,394 | [
"MIT"
] | 0 | e8bafa9c0cf6d2a9d940d2dc36f0ea28a75e5809 | https://github.com/DazhiZhong/MiDaS/tree/e8bafa9c0cf6d2a9d940d2dc36f0ea28a75e5809 |
Sigmoid | import torch
import torch.nn as nn
class Sigmoid(torch.nn.Module):
def __init__(self, a=1, max=10):
super().__init__()
self.a = a
self.max = max
def forward(self, v):
sig = nn.Sigmoid()
act = sig(self.a * v) * self.max
return act
def get_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... | ElliotHYLee/MyPyTorchAPI | Sigmoid | false | 11,395 | [
"MIT"
] | 0 | edb25b724372367e96e3bd2f420c023c4efbfcd7 | https://github.com/ElliotHYLee/MyPyTorchAPI/tree/edb25b724372367e96e3bd2f420c023c4efbfcd7 |
Encoder | import torch
import torch.nn as nn
class Encoder(nn.Module):
def __init__(self, in_size, latent_size):
super().__init__()
self.linear1 = nn.Linear(in_size, int(in_size / 2))
self.linear2 = nn.Linear(int(in_size / 2), int(in_size / 4))
self.linear3 = nn.Linear(int(in_size / 4), lat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | DuneeshaFernando/usad | Encoder | false | 11,396 | [
"BSD-3-Clause"
] | 0 | 22653a96deefe57013b1df57bb6dc316ef423c95 | https://github.com/DuneeshaFernando/usad/tree/22653a96deefe57013b1df57bb6dc316ef423c95 |
ContinuousLoss_L2 | import torch
import torch.nn as nn
class ContinuousLoss_L2(nn.Module):
""" Class to measure loss between continuous emotion dimension predictions and labels. Using l2 loss as base. """
def __init__(self, margin=1):
super(ContinuousLoss_L2, self).__init__()
self.margin = margin
def forwar... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
... | Emilien-mipt/emotic | ContinuousLoss_L2 | false | 11,397 | [
"MIT"
] | 0 | c27c0a4f4c8e7ef81edcd527f9f4aa4747ab72af | https://github.com/Emilien-mipt/emotic/tree/c27c0a4f4c8e7ef81edcd527f9f4aa4747ab72af |
VAE | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.onnx
import torch.optim
import torch.utils.data.distributed
import torch.nn.functional as F
import torch.autograd
class VAE(nn.Module):
def __init__(self):
super(VAE, self).__init__()
self.fc1 = nn.Li... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Delaunay/examples | VAE | false | 11,398 | [
"BSD-3-Clause"
] | 0 | ba3b7b954c47c1bd2441448890680a3ceb98c490 | https://github.com/Delaunay/examples/tree/ba3b7b954c47c1bd2441448890680a3ceb98c490 |
Batch33MatVec3Mul | import torch
import torch.nn as nn
class Batch33MatVec3Mul(nn.Module):
def __init(self):
super().__init__()
def forward(self, mat, vec):
vec = vec.unsqueeze(2)
result = torch.matmul(mat, vec)
return result.squeeze(2)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | ElliotHYLee/MyPyTorchAPI | Batch33MatVec3Mul | false | 11,399 | [
"MIT"
] | 0 | edb25b724372367e96e3bd2f420c023c4efbfcd7 | https://github.com/ElliotHYLee/MyPyTorchAPI/tree/edb25b724372367e96e3bd2f420c023c4efbfcd7 |
LocationLayer | import torch
import torch.utils.data
from torch import nn
class LinearNorm(torch.nn.Module):
def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
super(LinearNorm, self).__init__()
self.linear_layer = torch.nn.Linear(in_dim, out_dim, bias=bias)
torch.nn.init.xavier_unifor... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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._dyna... | Engineering-Course/tacotron2 | LocationLayer | false | 11,400 | [
"BSD-3-Clause"
] | 0 | 7e3968670cdec9817d219fd36bb2fc631c25d350 | https://github.com/Engineering-Course/tacotron2/tree/7e3968670cdec9817d219fd36bb2fc631c25d350 |
ChannelSELayer3D | import torch
import torch.nn as nn
class ChannelSELayer3D(nn.Module):
"""
3D extension of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
*Zhu et al., AnatomyNet, arXiv:arXiv:1808.05238*
"""
def __init__(self, num_channels... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | EmmanuelleB985/Head-and-Neck-Tumour-Segmentation-and-Prediction-of-Patient-Survival | ChannelSELayer3D | false | 11,401 | [
"MIT"
] | 0 | 347883eb6dd5daebba091119ede7a9f5b78076d1 | https://github.com/EmmanuelleB985/Head-and-Neck-Tumour-Segmentation-and-Prediction-of-Patient-Survival/tree/347883eb6dd5daebba091119ede7a9f5b78076d1 |
Net | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv = nn.Conv2d(1, 1, 3)
def forward(self, x):
return self.conv(x)
def get_inputs():
return [torch.rand([4, 1, 64, 64])]
def get_init_inputs():
return [[], {}]
| import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | EricGustin/SmartRedis | Net | false | 11,402 | [
"BSD-2-Clause"
] | 0 | 42c42fb4312c0822a58e3c869f60b7e51d4bdd05 | https://github.com/EricGustin/SmartRedis/tree/42c42fb4312c0822a58e3c869f60b7e51d4bdd05 |
FeatureCorrelation | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class FeatureCorrelation(nn.Module):
def __init__(self):
super(FeatureCorrelation, self).__init__()
def forward(self, feat_a, feat_b):
bs, c, h, w = feat_a.size()
feat_a = feat_a.tr... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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.optim
import torch.u... | Dogacel/mmfashion | FeatureCorrelation | false | 11,403 | [
"Apache-2.0"
] | 0 | e49613245c8501042edd7aeeaa8fb93e5ea13238 | https://github.com/Dogacel/mmfashion/tree/e49613245c8501042edd7aeeaa8fb93e5ea13238 |
L1NormLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class L1NormLoss(nn.Module):
def __init__(self, loss_weight=0.0005, average=True):
super(L1NormLoss, self).__init__()
self.loss_weight = loss_weight
self.average = average
def forwa... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
assert_size_stride = torch._C._dynamo.guards.asser... | Dogacel/mmfashion | L1NormLoss | false | 11,404 | [
"Apache-2.0"
] | 0 | e49613245c8501042edd7aeeaa8fb93e5ea13238 | https://github.com/Dogacel/mmfashion/tree/e49613245c8501042edd7aeeaa8fb93e5ea13238 |
Net | import torch
import torch.utils.data
import torch.nn as nn
import torch.nn.functional as F
import torch.optim
import torch.backends.cudnn
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... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | ConstantSun/ResNeXt | Net | false | 11,405 | [
"MIT"
] | 0 | 43a23cf776bfd8438796e4978a0b6ead49c893e5 | https://github.com/ConstantSun/ResNeXt/tree/43a23cf776bfd8438796e4978a0b6ead49c893e5 |
ChannelSpatialSELayer3D | import torch
import torch.nn as nn
import torch.nn.functional as F
class ChannelSELayer3D(nn.Module):
"""
3D extension of Squeeze-and-Excitation (SE) block described in:
*Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
*Zhu et al., AnatomyNet, arXiv:arXiv:1808.05238*
"""
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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 ... | EmmanuelleB985/Head-and-Neck-Tumour-Segmentation-and-Prediction-of-Patient-Survival | ChannelSpatialSELayer3D | false | 11,407 | [
"MIT"
] | 0 | 347883eb6dd5daebba091119ede7a9f5b78076d1 | https://github.com/EmmanuelleB985/Head-and-Neck-Tumour-Segmentation-and-Prediction-of-Patient-Survival/tree/347883eb6dd5daebba091119ede7a9f5b78076d1 |
CustomizedNet | import torch
import torch.nn as nn
import torch.utils.data.distributed
class CustomizedNet(nn.Module):
def __init__(self, dropout, input_size, input_feature_num, hidden_dim,
output_size):
"""
Simply use linear layers for multi-variate single-step forecasting.
"""
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
import torch.nn as nn
import ... | EvelynQiang/analytics-zoo | CustomizedNet | false | 11,408 | [
"Apache-2.0"
] | 0 | be5dd08abe9b14ac085817decd017862a273985a | https://github.com/EvelynQiang/analytics-zoo/tree/be5dd08abe9b14ac085817decd017862a273985a |
L1Loss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class L1Loss(nn.Module):
def __init__(self, size_average=None, reduce=None, reduction='mean'):
super(L1Loss, self).__init__()
self.size_average = size_average
... | 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
... | Dogacel/mmfashion | L1Loss | false | 11,409 | [
"Apache-2.0"
] | 0 | e49613245c8501042edd7aeeaa8fb93e5ea13238 | https://github.com/Dogacel/mmfashion/tree/e49613245c8501042edd7aeeaa8fb93e5ea13238 |
FeatureNorm | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class FeatureNorm(nn.Module):
def __init__(self, eps=1e-06):
super(FeatureNorm, self).__init__()
self.eps = eps
def forward(self, feature):
norm_feat = torch.sum(torch.pow(feature, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.... | Dogacel/mmfashion | FeatureNorm | false | 11,410 | [
"Apache-2.0"
] | 0 | e49613245c8501042edd7aeeaa8fb93e5ea13238 | https://github.com/Dogacel/mmfashion/tree/e49613245c8501042edd7aeeaa8fb93e5ea13238 |
SelectiveMarginLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
class SelectiveMarginLoss(nn.Module):
def __init__(self, loss_weight=5e-05, margin=0.2):
super(SelectiveMarginLoss, self).__init__()
self.margin = margin
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
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data... | Dogacel/mmfashion | SelectiveMarginLoss | false | 11,411 | [
"Apache-2.0"
] | 0 | e49613245c8501042edd7aeeaa8fb93e5ea13238 | https://github.com/Dogacel/mmfashion/tree/e49613245c8501042edd7aeeaa8fb93e5ea13238 |
MarginRankingLoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class MarginRankingLoss(nn.Module):
def __init__(self, margin=0.2, loss_weight=5e-05, size_average=None,
reduce=None, reduction='mean'):
super(MarginRankingLoss, ... | 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.nn.parallel
import torch.optim
import torch.utils.data... | Dogacel/mmfashion | MarginRankingLoss | false | 11,412 | [
"Apache-2.0"
] | 0 | e49613245c8501042edd7aeeaa8fb93e5ea13238 | https://github.com/Dogacel/mmfashion/tree/e49613245c8501042edd7aeeaa8fb93e5ea13238 |
MSELoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class MSELoss(nn.Module):
def __init__(self, ratio=1, size_average=None, reduce=None, reduction=
'mean'):
super(MSELoss, self).__init__()
self.ratio = rat... | 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.nn.parallel
import torch.optim
import torch.utils.data... | Dogacel/mmfashion | MSELoss | false | 11,413 | [
"Apache-2.0"
] | 0 | e49613245c8501042edd7aeeaa8fb93e5ea13238 | https://github.com/Dogacel/mmfashion/tree/e49613245c8501042edd7aeeaa8fb93e5ea13238 |
CEL | import torch
from torch import nn
class CEL(nn.Module):
def __init__(self):
super(CEL, self).__init__()
None
self.eps = 1e-06
def forward(self, pred, target):
pred = pred.sigmoid()
intersection = pred * target
numerator = (pred - intersection).sum() + (target ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empt... | Farzanehkaji/https-github.com-lartpang-MINet | CEL | false | 11,414 | [
"MIT"
] | 0 | db7f5e64be4d28df2bfc68409b56c3f97d6388f1 | https://github.com/Farzanehkaji/https-github.com-lartpang-MINet/tree/db7f5e64be4d28df2bfc68409b56c3f97d6388f1 |
MaskNet | import torch
import torch.nn as nn
class MaskNet(nn.Module):
def __init__(self):
super(MaskNet, self).__init__()
self.conv1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=
5, stride=1, padding=2)
self.relu1 = nn.ReLU()
self.Pool1 = nn.MaxPool2d(kernel_size=(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
assert_... | DongChengdongHangZhou/adversarial-attack-iris | MaskNet | false | 11,415 | [
"Apache-2.0"
] | 0 | ae7e408c47c332fc876d572acd4701e4b8970487 | https://github.com/DongChengdongHangZhou/adversarial-attack-iris/tree/ae7e408c47c332fc876d572acd4701e4b8970487 |
outputCNN | import torch
import torch.cuda
import torch
import torch.nn as nn
import torch.nn.functional as F
class outputCNN(nn.Module):
def __init__(self, input_dim):
super(outputCNN, self).__init__()
self.conv1 = nn.Conv2d(in_channels=input_dim, out_channels=128,
kernel_size=(5, 5), padding=(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.cuda
import torc... | EricPengShuai/CoLive | outputCNN | false | 11,416 | [
"MIT"
] | 0 | 6e49c3bf204307167a8b7cc1495c6270c7375444 | https://github.com/EricPengShuai/CoLive/tree/6e49c3bf204307167a8b7cc1495c6270c7375444 |
CELoss | import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.nn.functional as F
class CELoss(nn.Module):
def __init__(self, ratio=1, weight=None, size_average=None,
ignore_index=-100, reduce=None, reduction='mean'):
super(CELoss, 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 math as tl_math
import torch.nn as nn
... | Dogacel/mmfashion | CELoss | false | 11,417 | [
"Apache-2.0"
] | 0 | e49613245c8501042edd7aeeaa8fb93e5ea13238 | https://github.com/Dogacel/mmfashion/tree/e49613245c8501042edd7aeeaa8fb93e5ea13238 |
FocalLoss | import torch
import torch.nn as nn
class FocalLoss(nn.Module):
def __init__(self, gamma=0):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.ce = torch.nn.CrossEntropyLoss()
def forward(self, input, target):
logp = self.ce(input, target)
p = torch.exp(-logp)
... | 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
... | EnochMHforever/CCF-BDCI2019-Multi-person-Face-Recognition-Competition-Baseline-master | FocalLoss | false | 11,418 | [
"MIT"
] | 0 | 5a1ac28dbfe1099f62e61975b0c1d7c43980e067 | https://github.com/EnochMHforever/CCF-BDCI2019-Multi-person-Face-Recognition-Competition-Baseline-master/tree/5a1ac28dbfe1099f62e61975b0c1d7c43980e067 |
FlowHead | import torch
import torch.nn as nn
class FlowHead(nn.Module):
def __init__(self, input_dim=128, hidden_dim=256):
super(FlowHead, self).__init__()
self.conv1 = nn.Conv2d(input_dim, hidden_dim, 3, padding=1)
self.conv2 = nn.Conv2d(hidden_dim, 2, 3, padding=1)
self.relu = nn.ReLU(inp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | Etienne-Meunier/FGVC | FlowHead | false | 11,419 | [
"MIT"
] | 0 | a7c6d4b6583ad3a380b0359fde9223dccc8e9c66 | https://github.com/Etienne-Meunier/FGVC/tree/a7c6d4b6583ad3a380b0359fde9223dccc8e9c66 |
FlexibleRNN | import torch
import numpy as np
from torch import nn
def create_diag_(A, diag):
""" This code comes is extracted from https://github.com/Lezcano/expRNN, we just repeat it as it is needed by our experiment"""
n = A.size(0)
diag_z = torch.zeros(n - 1)
diag_z[::2] = diag
A_init = torch.diag(diag_z, 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.... | EMassart/OrthCDforRNNs | FlexibleRNN | false | 11,420 | [
"MIT"
] | 0 | 487102a4e249ccfbca3062a613011e6cec09ba3a | https://github.com/EMassart/OrthCDforRNNs/tree/487102a4e249ccfbca3062a613011e6cec09ba3a |
BetaVAE | import torch
import torch.nn as nn
import torch.utils.data
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
def forward(self, x):
return x * torch.sigmoid(x)
class BetaVAE(nn.Module):
activations = {'relu': nn.ReLU, 'sigmoid': nn.Sigmoid, 'swish': Swish,
... | import torch
from torch import device
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math... | EdwardYGLi/Mnist_b_vae | BetaVAE | false | 11,421 | [
"MIT"
] | 0 | 5c568798bcaa5ec8154aaee8eff2906cf651e958 | https://github.com/EdwardYGLi/Mnist_b_vae/tree/5c568798bcaa5ec8154aaee8eff2906cf651e958 |
PinballLoss | import torch
import torch.nn as nn
class PinballLoss(nn.Module):
""" Pinball Loss
Computes the pinball loss between y and y_hat.
Parameters
----------
y: tensor
actual values in torch tensor.
y_hat: tensor (same shape as y)
predicted values in torch tensor.
tau: float, between 0 and 1
t... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | FedericoGarza/esrnn_torch | PinballLoss | false | 11,422 | [
"MIT"
] | 0 | 9f28f38e27dc0ba12cc965e60f7e08e635c8b19d | https://github.com/FedericoGarza/esrnn_torch/tree/9f28f38e27dc0ba12cc965e60f7e08e635c8b19d |
DisaggregatedPinballLoss | import torch
import torch.nn as nn
class DisaggregatedPinballLoss(nn.Module):
""" Pinball Loss
Computes the pinball loss between y and y_hat.
Parameters
----------
y: tensor
actual values in torch tensor.
y_hat: tensor (same shape as y)
predicted values in torch tensor.
tau: float, between ... | 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... | FedericoGarza/esrnn_torch | DisaggregatedPinballLoss | false | 11,423 | [
"MIT"
] | 0 | 9f28f38e27dc0ba12cc965e60f7e08e635c8b19d | https://github.com/FedericoGarza/esrnn_torch/tree/9f28f38e27dc0ba12cc965e60f7e08e635c8b19d |
ParameterOutput | import torch
import torch.nn as nn
import torch.nn.functional as F
class ParameterOutput(nn.Module):
def __init__(self, in_features, out_features, low=-1, high=1):
super(ParameterOutput, self).__init__()
self.low = low
self.high = high
self.linear = nn.Linear(in_features, out_feat... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | FilipaRamos/Rl-Pusher | ParameterOutput | false | 11,424 | [
"MIT"
] | 0 | 40aa123695f7f2c96dbc11be9d92abefdf2d12c4 | https://github.com/FilipaRamos/Rl-Pusher/tree/40aa123695f7f2c96dbc11be9d92abefdf2d12c4 |
AttnScore | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def sequence_mask(lengths, max_len=None):
"""
Creates a boolean mask from sequence lengths.
"""
batch_size = lengths.numel()
max_len = max_len or lengths.max()
return torch.arange(0, max_len).type_a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Fengyee/ASER | AttnScore | false | 11,425 | [
"MIT"
] | 0 | c284b507ee268a8275456a969b944895cacc54b8 | https://github.com/Fengyee/ASER/tree/c284b507ee268a8275456a969b944895cacc54b8 |
Baseblock | import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.nn import init
class Baseblock(nn.Module):
def __init__(self, in_channels):
super(Baseblock, self).__init__()
self.p_size = [1, 1, 1, 1]
self.pool1 = nn.MaxPool2d(kernel_size=self.p_size[0], stride=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
from to... | FENGShuanglang/PyTorch_Feat_Vision | Baseblock | false | 11,426 | [
"MIT"
] | 0 | c45dd001c3354e430e9772ddca6f4ba779656761 | https://github.com/FENGShuanglang/PyTorch_Feat_Vision/tree/c45dd001c3354e430e9772ddca6f4ba779656761 |
ConvLayer | import torch
import torch.nn as nn
class ConvLayer(nn.Module):
def __init__(self, in_channels=10, out_channels=10, kernel_size=5,
pooling_size=3, padding='valid') ->None:
super().__init__()
self.conv1d = nn.Conv1d(in_channels=in_channels, out_channels=
out_channels, kernel_siz... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | FabienRoger/Apnea-Detector-Interpretation | ConvLayer | false | 11,427 | [
"MIT"
] | 0 | 96b95ea5e037d328386256feda53496d28609e81 | https://github.com/FabienRoger/Apnea-Detector-Interpretation/tree/96b95ea5e037d328386256feda53496d28609e81 |
LevelVariabilityLoss | import torch
import torch.nn as nn
class LevelVariabilityLoss(nn.Module):
""" Level Variability Loss
Computes the variability penalty for the level.
Parameters
----------
levels: tensor with shape (batch, n_time)
levels obtained from exponential smoothing component of ESRNN
level_variability_penalt... | 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... | FedericoGarza/esrnn_torch | LevelVariabilityLoss | false | 11,428 | [
"MIT"
] | 0 | 9f28f38e27dc0ba12cc965e60f7e08e635c8b19d | https://github.com/FedericoGarza/esrnn_torch/tree/9f28f38e27dc0ba12cc965e60f7e08e635c8b19d |
AsymmetricLossOptimized | import torch
import torch.nn as nn
class AsymmetricLossOptimized(nn.Module):
""" Notice - optimized version, minimizes memory allocation and gpu uploading,
favors inplace operations"""
def __init__(self, gamma_neg=4, gamma_pos=1, clip=0.05, eps=1e-08,
disable_torch_grad_focal_loss=False):
... | 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... | FrankFundel/BAT | AsymmetricLossOptimized | false | 11,429 | [
"MIT"
] | 0 | 70c422d9af093a5c5e4d7486f7a206bc87478a9e | https://github.com/FrankFundel/BAT/tree/70c422d9af093a5c5e4d7486f7a206bc87478a9e |
Dummy | import torch
from torch import nn
class Dummy(nn.Module):
def forward(self, input):
x = input
return x + 1
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_str... | FynnBe/tiktorch | Dummy | false | 11,430 | [
"MIT"
] | 0 | 60c6fa9700e7ff73e44338e8755c56c6e8846f2f | https://github.com/FynnBe/tiktorch/tree/60c6fa9700e7ff73e44338e8755c56c6e8846f2f |
Attention | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.init as init
def sequence_mask(lengths, max_len=None):
"""
Creates a boolean mask from sequence lengths.
"""
batch_size = lengths.numel()
max_len = max_len or lengths.max()
return torch.arange(0, max_len).type_a... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Fengyee/ASER | Attention | false | 11,431 | [
"MIT"
] | 0 | c284b507ee268a8275456a969b944895cacc54b8 | https://github.com/Fengyee/ASER/tree/c284b507ee268a8275456a969b944895cacc54b8 |
TinyConvNet2d | import torch
class TinyConvNet2d(torch.nn.Module):
def __init__(self, in_channels=1, out_channels=1):
super().__init__()
self.conv1 = torch.nn.Conv2d(in_channels, 16, 1)
self.nlin1 = torch.nn.ReLU()
self.conv2 = torch.nn.Conv2d(16, 64, 1)
self.nlin2 = torch.nn.ReLU()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | FynnBe/tiktorch | TinyConvNet2d | false | 11,432 | [
"MIT"
] | 0 | 60c6fa9700e7ff73e44338e8755c56c6e8846f2f | https://github.com/FynnBe/tiktorch/tree/60c6fa9700e7ff73e44338e8755c56c6e8846f2f |
PositionwiseFeedForward | import torch
import torch.nn as nn
class LayerNorm(nn.Module):
"""
Layer Normalization class
"""
def __init__(self, features, eps=1e-06):
super(LayerNorm, self).__init__()
self.a_2 = nn.Parameter(torch.ones(features))
self.b_2 = nn.Parameter(torch.zeros(features))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | Fengyee/ASER | PositionwiseFeedForward | false | 11,433 | [
"MIT"
] | 0 | c284b507ee268a8275456a969b944895cacc54b8 | https://github.com/Fengyee/ASER/tree/c284b507ee268a8275456a969b944895cacc54b8 |
Confucius | import torch
import torch.nn as nn
class Confucius(nn.Module):
def __init__(self, output_dim, expose_dim, hidden):
super(Confucius, self).__init__()
self.output_fc = nn.Linear(output_dim, hidden)
self.fc_expose = nn.Linear(expose_dim, hidden)
self.fc_final = nn.Linear(hidden, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | Fuchai/FixMatch-pytorch | Confucius | false | 11,434 | [
"MIT"
] | 0 | 105f40678414182d194945b77d24d658b1e84850 | https://github.com/Fuchai/FixMatch-pytorch/tree/105f40678414182d194945b77d24d658b1e84850 |
NegativeSamplingLoss | import torch
from torch import nn
from torch import tensor
class NegativeSamplingLoss(nn.Module):
"""
loss function of negative-sampling.
"""
def forward(self, input_vectors: 'tensor', output_vectors: 'tensor',
noise_vectors: 'tensor'):
batch_size, embed_size = input_vectors.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.triton_helpers import math as tl_math
from torch im... | FrederichRiver/taurus | NegativeSamplingLoss | false | 11,435 | [
"BSD-3-Clause"
] | 0 | 1da240b7723bdc99883d7afe0253608cfdababb5 | https://github.com/FrederichRiver/taurus/tree/1da240b7723bdc99883d7afe0253608cfdababb5 |
MaxPool2dDynamicSamePadding | import math
import torch
import torch.nn.functional as F
import torch.nn as nn
class MaxPool2dDynamicSamePadding(nn.MaxPool2d):
"""2D MaxPooling like TensorFlow's 'SAME' mode, with a dynamic image size.
The padding is operated in forward function by calculating dynamically.
"""
def __init__(self, ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | GavinHU66/DebugEntity | MaxPool2dDynamicSamePadding | false | 11,436 | [
"MIT"
] | 0 | 21f38f01bdfbbc363a73f640331c6f04a121cf82 | https://github.com/GavinHU66/DebugEntity/tree/21f38f01bdfbbc363a73f640331c6f04a121cf82 |
AutoEncoder | import torch
import torch.nn as nn
import torch.utils.data
import torch
class AutoEncoder(nn.Module):
def __init__(self, num_question, k=100):
""" Initialize a class AutoEncoder.
:param num_question: int
:param k: int
"""
super(AutoEncoder, self).__init__()
self.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
import torch.nn as nn
import torch.utils.data
import torch
assert_size_stride = ... | Gabiedcc/CSC-311 | AutoEncoder | false | 11,437 | [
"MIT"
] | 0 | e0ae7598ad9e9057ef41c6e634a47a15fc4b3321 | https://github.com/Gabiedcc/CSC-311/tree/e0ae7598ad9e9057ef41c6e634a47a15fc4b3321 |
MLP | import torch
from torch import nn
import torch.utils.data
class MLP(nn.Module):
def __init__(self, input_size, output_size, hidden_size=None, dropout=0.1):
super().__init__()
if hidden_size is None:
hidden_size = input_size * 4
self.w_1 = nn.Linear(input_size * 2, hidden_size)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch import nn
import t... | DreamerDeo/tensor2struct-public | MLP | false | 11,438 | [
"MIT"
] | 0 | 48e41b7faf041189c17dff8445d9e2b4d709e753 | https://github.com/DreamerDeo/tensor2struct-public/tree/48e41b7faf041189c17dff8445d9e2b4d709e753 |
LanguageModelCriterion | import torch
from torch import nn
from torch.autograd import *
class LanguageModelCriterion(nn.Module):
def __init__(self):
super(LanguageModelCriterion, self).__init__()
def forward(self, input, target, mask, reduction='mean'):
if target.ndim == 3:
target = target.reshape(-1, ta... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch import nn
from torch.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch... | GeorgeKostenkov/ImageCaptioning.pytorch | LanguageModelCriterion | false | 11,439 | [
"MIT"
] | 0 | 8f17433fdaba2f89774e45ad5a3a88b880932ee6 | https://github.com/GeorgeKostenkov/ImageCaptioning.pytorch/tree/8f17433fdaba2f89774e45ad5a3a88b880932ee6 |
TinyConvNet3d | import torch
class TinyConvNet3d(torch.nn.Module):
def __init__(self, in_channels=1, out_channels=1):
super().__init__()
self.conv1 = torch.nn.Conv3d(in_channels, 16, 1)
self.nlin1 = torch.nn.ReLU()
self.conv2 = torch.nn.Conv3d(16, 64, 1)
self.nlin2 = torch.nn.ReLU()
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | FynnBe/tiktorch | TinyConvNet3d | false | 11,440 | [
"MIT"
] | 0 | 60c6fa9700e7ff73e44338e8755c56c6e8846f2f | https://github.com/FynnBe/tiktorch/tree/60c6fa9700e7ff73e44338e8755c56c6e8846f2f |
Highway | import torch
from torch import nn
from torch.nn import functional as F
class Highway(nn.Module):
"""The Highway update layer from [srivastava2015]_.
.. [srivastava2015] Srivastava, R. K., *et al.* (2015).
`Highway Networks <http://arxiv.org/abs/1505.00387>`_.
*arXiv*, 1505.00387.
"""
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 import nn
assert_s... | GavEdwards/chemicalx | Highway | false | 11,441 | [
"Apache-2.0"
] | 0 | 400a983ae6ba88ae0b632d021627dbdadd47b0d0 | https://github.com/GavEdwards/chemicalx/tree/400a983ae6ba88ae0b632d021627dbdadd47b0d0 |
RewardCriterion | import torch
from torch import nn
from torch.autograd import *
class RewardCriterion(nn.Module):
def __init__(self):
super(RewardCriterion, self).__init__()
def forward(self, input, seq, reward, reduction='mean'):
N, L = input.shape[:2]
input = input.gather(2, seq.unsqueeze(2)).squee... | 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.autograd import *
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch... | GeorgeKostenkov/ImageCaptioning.pytorch | RewardCriterion | false | 11,442 | [
"MIT"
] | 0 | 8f17433fdaba2f89774e45ad5a3a88b880932ee6 | https://github.com/GeorgeKostenkov/ImageCaptioning.pytorch/tree/8f17433fdaba2f89774e45ad5a3a88b880932ee6 |
Generator | import torch
import torch.nn.functional as F
from torch import nn
from torch.autograd import *
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)
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.... | GeorgeKostenkov/ImageCaptioning.pytorch | Generator | false | 11,443 | [
"MIT"
] | 0 | 8f17433fdaba2f89774e45ad5a3a88b880932ee6 | https://github.com/GeorgeKostenkov/ImageCaptioning.pytorch/tree/8f17433fdaba2f89774e45ad5a3a88b880932ee6 |
JointsMSELoss | 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
class JointsMSELoss(nn.Module):
def __init__(self, use_target_weight):
super(JointsMSELoss, self).__init__()
self.criterion = nn.MSELoss(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
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.n... | Gerrystev/efficientnet-simple-baseline | JointsMSELoss | false | 11,444 | [
"MIT"
] | 0 | 03ae4da4e91825f73d5185d0d195dd141bd7c4f1 | https://github.com/Gerrystev/efficientnet-simple-baseline/tree/03ae4da4e91825f73d5185d0d195dd141bd7c4f1 |
InceptionB | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicConv2d(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
super(BasicConv2d, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, bias=True, **kwargs)
def forward(self, x):
x ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Galaxies99/inception-cuda | InceptionB | false | 11,445 | [
"MIT"
] | 0 | ed8fdbe3caef415e60b52e671273be90e9423e44 | https://github.com/Galaxies99/inception-cuda/tree/ed8fdbe3caef415e60b52e671273be90e9423e44 |
InceptionC | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicConv2d(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
super(BasicConv2d, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, bias=True, **kwargs)
def forward(self, x):
x ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Galaxies99/inception-cuda | InceptionC | false | 11,446 | [
"MIT"
] | 0 | ed8fdbe3caef415e60b52e671273be90e9423e44 | https://github.com/Galaxies99/inception-cuda/tree/ed8fdbe3caef415e60b52e671273be90e9423e44 |
InceptionD | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicConv2d(nn.Module):
def __init__(self, in_channels, out_channels, **kwargs):
super(BasicConv2d, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, bias=True, **kwargs)
def forward(self, x):
x ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | Galaxies99/inception-cuda | InceptionD | false | 11,447 | [
"MIT"
] | 0 | ed8fdbe3caef415e60b52e671273be90e9423e44 | https://github.com/Galaxies99/inception-cuda/tree/ed8fdbe3caef415e60b52e671273be90e9423e44 |
AbsModel | from torch.nn import Module
import torch
from torch import Tensor
from torch.nn import Identity
from torch.nn.modules import Module
import torch.optim.lr_scheduler
class AbsLayer(Module):
def forward(self, x: 'Tensor') ->Tensor:
return torch.abs(x).reshape((-1, 1))
class AbsModel(Module):
"""Fake 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.triton_helpers import math as tl_math
from torch.nn import Module
from torch import Tensor
from torch.nn import... | Ektagavas/avalanche | AbsModel | false | 11,448 | [
"MIT"
] | 0 | 6671dc748078532709aad07b9e28ad6c903ab12b | https://github.com/Ektagavas/avalanche/tree/6671dc748078532709aad07b9e28ad6c903ab12b |
TransformerNet | import torch
import torch.nn.parallel
import torch.utils.data
import torch.onnx
import torch.optim
import torch.utils.data.distributed
class ConvLayer(torch.nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, stride):
super(ConvLayer, self).__init__()
reflection_padding = kerne... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | Arjuna197/examples | TransformerNet | false | 11,449 | [
"BSD-3-Clause"
] | 0 | f504ea2aafc8a8baa5effb659fc1c20a70aabdda | https://github.com/Arjuna197/examples/tree/f504ea2aafc8a8baa5effb659fc1c20a70aabdda |
CrossEntropy | import torch
import torch.nn as nn
class CrossEntropy(nn.Module):
def __init__(self):
super().__init__()
def forward(self, props, tgt):
tgt_props = props.gather(2, tgt.unsqueeze(2)).squeeze()
mask = (tgt > 0).float()
return -(tgt_props * mask).sum() / mask.sum()
def get_inp... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | Gromy1211/torch-light | CrossEntropy | false | 11,450 | [
"MIT"
] | 0 | c7d7a9bc5ab1eab03d800a27d9325859516f01e6 | https://github.com/Gromy1211/torch-light/tree/c7d7a9bc5ab1eab03d800a27d9325859516f01e6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.