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 |
|---|---|---|---|---|---|---|---|---|---|---|
CoxPHLossSorted | import torch
from torch import Tensor
from torch import nn as nn
def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07
) ->Tensor:
"""Requires the input to be sorted by descending duration time.
See DatasetDurationSorted.
We calculate the negative log of $(rac{h_i}{\\sum_{j \\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 math as tl_math
from torch import Tens... | abhishek1015/MT-TS-Net | CoxPHLossSorted | false | 6,060 | [
"MIT"
] | 1 | f927f64cddd790ce1ddf07cbbd93ada332f96ba3 | https://github.com/abhishek1015/MT-TS-Net/tree/f927f64cddd790ce1ddf07cbbd93ada332f96ba3 |
BranchNet | import torch
import torch.nn as nn
class BranchNet(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(in_channels=3, out_channels=96, kernel_size=
7, stride=3)
self.relu1 = nn.ReLU()
self.maxpool1 = nn.MaxPool2d(kernel_size=2)
self.conv2 ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | aalto-intelligent-robotics/sivl | BranchNet | false | 6,061 | [
"MIT"
] | 1 | a5de0e0dd4fc6b15c9b15cb4ffa8b6f9de12a96d | https://github.com/aalto-intelligent-robotics/sivl/tree/a5de0e0dd4fc6b15c9b15cb4ffa8b6f9de12a96d |
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... | abhinavarora/text | RobertaClassificationHead | false | 6,062 | [
"BSD-3-Clause"
] | 1 | 69f67f3a775f3d3c6f85cfaa4ac3819500b90696 | https://github.com/abhinavarora/text/tree/69f67f3a775f3d3c6f85cfaa4ac3819500b90696 |
AELossPurePie | import torch
import torch.nn as nn
import torch.cuda
def _ae_loss(tag0, tag1, mask):
num = mask.sum(dim=1, keepdim=True).float()
tag0 = tag0.squeeze()
tag1 = tag1.squeeze()
tag_mean = (tag0 + tag1) / 2
tag0 = torch.pow(tag0 - tag_mean, 2) / (num + 0.0001)
tag0 = tag0[mask].sum()
tag1 = tor... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.cuda
assert_size_stride = torch._C._dynamo.guards.asse... | abhithosar/chartocr_cv | AELossPurePie | false | 6,063 | [
"BSD-3-Clause"
] | 1 | 388b95710a02ded0532b021f64c58d8d3e1cc639 | https://github.com/abhithosar/chartocr_cv/tree/388b95710a02ded0532b021f64c58d8d3e1cc639 |
Temporal_Attention_layer | import torch
from torch import nn
import torch.nn.functional as F
class Temporal_Attention_layer(nn.Module):
def __init__(self, DEVICE, in_channels, num_of_vertices, num_of_timesteps):
super(Temporal_Attention_layer, self).__init__()
self.U1 = nn.Parameter(torch.FloatTensor(num_of_vertices))
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | abcdefg-dev-dd/asxdcvfg | Temporal_Attention_layer | false | 6,065 | [
"Apache-2.0"
] | 1 | 83421d4a133810968d6e04b256a9312895452941 | https://github.com/abcdefg-dev-dd/asxdcvfg/tree/83421d4a133810968d6e04b256a9312895452941 |
Embedder | from torch.nn import Module
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import functional
class Embedder(Module):
def __init__(self, input_size, kernel_sizes):
super().__init__()
self.conv1 = nn.Conv2d(3, 64, kernel_size=kernel_sizes[0])
self.pool1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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
i... | Zonglin-Li6565/FaceKoob | Embedder | false | 6,066 | [
"MIT"
] | 1 | d72da10330ec313308a16116b7d2abd8ecfcdbcf | https://github.com/Zonglin-Li6565/FaceKoob/tree/d72da10330ec313308a16116b7d2abd8ecfcdbcf |
MaxPoolStride1 | import torch
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import torch.nn.functional as F
import torch._utils
class MaxPoolStride1(nn.Module):
def __init__(self, kernel_size):
super(MaxPoolStride1, self).__init__()
self.kernel_size = kernel_size
self.p... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.utils.data
import torch.utils.data.distributed
import ... | accountcwd/pose-estimation-lite | MaxPoolStride1 | false | 6,067 | [
"MIT"
] | 1 | 36b6fa534c04a909d5722ace90a199c9590bb2eb | https://github.com/accountcwd/pose-estimation-lite/tree/36b6fa534c04a909d5722ace90a199c9590bb2eb |
GEGLU | import torch
from torch import nn
import torch.nn.functional as F
class GEGLU(nn.Module):
def forward(self, x):
x, gate = x.chunk(2, dim=-1)
return F.gelu(gate) * x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | activeloopai/gpt-neox | GEGLU | false | 6,068 | [
"MIT"
] | 1 | 89749e0b76938fa1ff84a3dd1cbcbe64521d861b | https://github.com/activeloopai/gpt-neox/tree/89749e0b76938fa1ff84a3dd1cbcbe64521d861b |
CoxPHLoss | import torch
from torch import Tensor
from torch import nn as nn
def cox_ph_loss_sorted(log_h: 'Tensor', events: 'Tensor', eps: 'float'=1e-07
) ->Tensor:
"""Requires the input to be sorted by descending duration time.
See DatasetDurationSorted.
We calculate the negative log of $(rac{h_i}{\\sum_{j \\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 import Tensor
from torch import nn as nn
assert_size_stride = torch._C._dynamo... | abhishek1015/MT-TS-Net | CoxPHLoss | false | 6,069 | [
"MIT"
] | 1 | f927f64cddd790ce1ddf07cbbd93ada332f96ba3 | https://github.com/abhishek1015/MT-TS-Net/tree/f927f64cddd790ce1ddf07cbbd93ada332f96ba3 |
AELossPureCls | import torch
import torch.nn as nn
import torch.cuda
def _ae_loss(tag0, tag1, mask):
num = mask.sum(dim=1, keepdim=True).float()
tag0 = tag0.squeeze()
tag1 = tag1.squeeze()
tag_mean = (tag0 + tag1) / 2
tag0 = torch.pow(tag0 - tag_mean, 2) / (num + 0.0001)
tag0 = tag0[mask].sum()
tag1 = tor... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import torch.cuda
assert_size_stride = torch._C._dynamo.guards.asse... | abhithosar/chartocr_cv | AELossPureCls | false | 6,070 | [
"BSD-3-Clause"
] | 1 | 388b95710a02ded0532b021f64c58d8d3e1cc639 | https://github.com/abhithosar/chartocr_cv/tree/388b95710a02ded0532b021f64c58d8d3e1cc639 |
MLM | import math
import torch
from torch import nn
import torch.nn.functional as F
def get_mask_subset_with_prob(mask, prob):
batch, seq_len, device = *mask.shape, mask.device
max_masked = math.ceil(prob * seq_len)
num_tokens = mask.sum(dim=-1, keepdim=True)
mask_excess = mask.cumsum(dim=-1) > (num_tokens ... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | aced125/alphafold2 | MLM | false | 6,071 | [
"MIT"
] | 1 | c85682ece37d37c608773cef3ec342b9ddc7fca0 | https://github.com/aced125/alphafold2/tree/c85682ece37d37c608773cef3ec342b9ddc7fca0 |
Dense_net_transition | import torch
import torch.nn as nn
import torch.nn.functional as F
class Dense_net_transition(nn.Module):
def __init__(self, nChannels, outChannels):
super(Dense_net_transition, self).__init__()
self.conv = nn.Conv2d(nChannels, outChannels, kernel_size=1, bias=False
)
def forward... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_... | aditya140/NoveltyDetectionResearch | Dense_net_transition | false | 6,072 | [
"MIT"
] | 1 | f9b27e6e8d9c23f85d4d91241ee5d050ecd6b6ef | https://github.com/aditya140/NoveltyDetectionResearch/tree/f9b27e6e8d9c23f85d4d91241ee5d050ecd6b6ef |
PLCCLoss | import torch
import torch.nn as nn
import torch.utils
class PLCCLoss(nn.Module):
def __init__(self):
super(PLCCLoss, self).__init__()
def forward(self, input, target):
input0 = input - torch.mean(input)
target0 = target - torch.mean(target)
self.loss = torch.sum(input0 * targ... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
import... | adynmiles/DARTS-FQA | PLCCLoss | false | 6,074 | [
"MIT"
] | 1 | a088a0efeb1160d0cdbf2b2a3e30f132c16eb53f | https://github.com/adynmiles/DARTS-FQA/tree/a088a0efeb1160d0cdbf2b2a3e30f132c16eb53f |
PostPreplayer | import torch
from torch import nn
import torch.nn.functional as F
class PostPreplayer(nn.Module):
def __init__(self, dim, out_dim, num_nodes, seq_l, dropout):
super().__init__()
self.norm1 = torch.nn.LayerNorm((dim, num_nodes, seq_l))
self.end_conv_1 = nn.Conv2d(in_channels=dim, out_chann... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | abcdefg-dev-dd/asxdcvfg | PostPreplayer | false | 6,075 | [
"Apache-2.0"
] | 1 | 83421d4a133810968d6e04b256a9312895452941 | https://github.com/abcdefg-dev-dd/asxdcvfg/tree/83421d4a133810968d6e04b256a9312895452941 |
Block | import math
import torch
import torch.nn.functional as F
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
class DenseSAGEConv(torch.nn.Module):
"""See :class:`torch_geometric... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | acrididcheng/pytorch_geometric | Block | false | 6,076 | [
"MIT"
] | 1 | 50dad4a6b6dc958ad68b9a3c2bc3decfa3516737 | https://github.com/acrididcheng/pytorch_geometric/tree/50dad4a6b6dc958ad68b9a3c2bc3decfa3516737 |
MultiHeadAttn | import torch
import torch.nn as nn
import torch.nn.functional as F
class MultiHeadAttn(nn.Module):
def __init__(self, n_head, d_model, d_head, dropout, dropatt=0,
pre_lnorm=False):
super(MultiHeadAttn, self).__init__()
self.n_head = n_head
self.d_model = d_model
self.d_hea... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | aalto-speech/FinnishXL | MultiHeadAttn | false | 6,077 | [
"Apache-2.0"
] | 1 | 42afe376162dd08d5eaa0639aed4221fa3db4cc2 | https://github.com/aalto-speech/FinnishXL/tree/42afe376162dd08d5eaa0639aed4221fa3db4cc2 |
interaction | import torch
import torch.nn as nn
class interaction(nn.Module):
def __init__(self, conf):
super().__init__()
def forward(self, p, h):
p = p.unsqueeze(2)
h = h.unsqueeze(1)
return p * h
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def ... | 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... | aditya140/NoveltyDetectionResearch | interaction | false | 6,078 | [
"MIT"
] | 1 | f9b27e6e8d9c23f85d4d91241ee5d050ecd6b6ef | https://github.com/aditya140/NoveltyDetectionResearch/tree/f9b27e6e8d9c23f85d4d91241ee5d050ecd6b6ef |
FNetEncoder | import torch
from torch import nn
class FeedForward(nn.Module):
def __init__(self, dhidden, dropout_rate, **kwargs):
super(FeedForward, self).__init__(**kwargs)
self.dhidden = dhidden
self.dropout_rate = dropout_rate
self.dense_1 = nn.Linear(dhidden, 4 * dhidden)
self.dens... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | abdelghanibelgaid/FNet-TensorFlow-PyTorch | FNetEncoder | false | 6,079 | [
"MIT"
] | 1 | e8eef4366b98d78b79917b6eadd168515de26a3f | https://github.com/abdelghanibelgaid/FNet-TensorFlow-PyTorch/tree/e8eef4366b98d78b79917b6eadd168515de26a3f |
AdapterModule | import torch
import torch.nn.functional as F
class AdapterModule(torch.nn.Module):
def __init__(self, d_in, adapter_size):
super().__init__()
self.project_down = torch.nn.Linear(d_in, adapter_size)
self.project_up = torch.nn.Linear(adapter_size, d_in)
def forward(self, x):
i1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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... | adamviola/piazza-qa | AdapterModule | false | 6,081 | [
"MIT"
] | 1 | 1fd65cfeb7bae753fc74d7ab837ab408f7c06507 | https://github.com/adamviola/piazza-qa/tree/1fd65cfeb7bae753fc74d7ab837ab408f7c06507 |
TransitionUpB | import torch
import torch.nn as nn
def center_crop(layer, max_height, max_width):
_, _, h, w = layer.size()
xy1 = (w - max_width) // 2
xy2 = (h - max_height) // 2
return layer[:, :, xy2:xy2 + max_height, xy1:xy1 + max_width]
class TransitionUpB(nn.Module):
"""
Like TransitionUp but with bili... | 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... | adriancampos/road-extraction | TransitionUpB | false | 6,082 | [
"MIT"
] | 1 | 3eaf4ed010d71475276d99d4841d67990a967a1b | https://github.com/adriancampos/road-extraction/tree/3eaf4ed010d71475276d99d4841d67990a967a1b |
TriangleMultiplicativeModule | import torch
from torch import nn
from torch import einsum
from inspect import isfunction
def exists(val):
return val is not None
def default(val, d):
if exists(val):
return val
return d() if isfunction(d) else d
class TriangleMultiplicativeModule(nn.Module):
def __init__(self, *, dim, hi... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | aced125/alphafold2 | TriangleMultiplicativeModule | false | 6,083 | [
"MIT"
] | 1 | c85682ece37d37c608773cef3ec342b9ddc7fca0 | https://github.com/aced125/alphafold2/tree/c85682ece37d37c608773cef3ec342b9ddc7fca0 |
TransitionUp | import torch
import torch.nn as nn
def center_crop(layer, max_height, max_width):
_, _, h, w = layer.size()
xy1 = (w - max_width) // 2
xy2 = (h - max_height) // 2
return layer[:, :, xy2:xy2 + max_height, xy1:xy1 + max_width]
class TransitionUp(nn.Module):
def __init__(self, in_channels, out_cha... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | adriancampos/road-extraction | TransitionUp | false | 6,084 | [
"MIT"
] | 1 | 3eaf4ed010d71475276d99d4841d67990a967a1b | https://github.com/adriancampos/road-extraction/tree/3eaf4ed010d71475276d99d4841d67990a967a1b |
ISub | import torch
class ISub(torch.nn.Module):
def __init__(self):
super(ISub, self).__init__()
def forward(self, x, y):
x -= y
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_sub_0(in_ptr0, in_ptr1, out_ptr1, xnumel,... | ahangchen/torch2trt | ISub | false | 6,085 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
DenseSAGEConv | import math
import torch
import torch.nn.functional as F
from torch.nn import Parameter
import torch.utils.data
def uniform(size, tensor):
bound = 1.0 / math.sqrt(size)
if tensor is not None:
tensor.data.uniform_(-bound, bound)
class DenseSAGEConv(torch.nn.Module):
"""See :class:`torch_geometric... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | acrididcheng/pytorch_geometric | DenseSAGEConv | false | 6,086 | [
"MIT"
] | 1 | 50dad4a6b6dc958ad68b9a3c2bc3decfa3516737 | https://github.com/acrididcheng/pytorch_geometric/tree/50dad4a6b6dc958ad68b9a3c2bc3decfa3516737 |
IDiv | import torch
class IDiv(torch.nn.Module):
def __init__(self):
super(IDiv, self).__init__()
def forward(self, x, y):
x /= y
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_div_0(in_ptr0, in_ptr1, out_ptr1, xnumel,... | ahangchen/torch2trt | IDiv | false | 6,087 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
FocalLoss | import torch
from torch import nn
class FocalLoss(nn.Module):
def __init__(self, gamma=2, eps=1e-07):
super(FocalLoss, self).__init__()
self.gamma = gamma
self.eps = eps
self.ce = nn.CrossEntropyLoss()
def forward(self, input, target):
logp = self.ce(input, target)
... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.triton_helpers import math as tl_math
from torch import nn
a... | agikarasugi/Face-Mask-Invariant-End-to-End-Face-Recognition | FocalLoss | false | 6,088 | [
"MIT"
] | 1 | eb274ff98246c1bb8748bd8c8351d3494a87dfce | https://github.com/agikarasugi/Face-Mask-Invariant-End-to-End-Face-Recognition/tree/eb274ff98246c1bb8748bd8c8351d3494a87dfce |
SineLayer | import torch
import numpy as np
from torch import nn
class SineLayer(nn.Module):
def __init__(self, in_features, out_features, bias=True, is_first=False,
omega_0=30.0):
super().__init__()
self.omega_0 = omega_0
self.is_first = is_first
self.in_features = in_features
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import numpy ... | afiaka87/text_to_img | SineLayer | false | 6,089 | [
"MIT"
] | 1 | 59c28a9de57d88910f6dfe8ea9a9d40d37b2279a | https://github.com/afiaka87/text_to_img/tree/59c28a9de57d88910f6dfe8ea9a9d40d37b2279a |
LT | import torch
class LT(torch.nn.Module):
def __init__(self):
super(LT, self).__init__()
def forward(self, x, y):
return x < y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | LT | false | 6,090 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
FocusLiteNNMinMax | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
class FocusLiteNNMinMax(nn.Module):
def __init__(self, num_channel=1):
super(FocusLiteNNMinMax, self).__init__()
self.num_channel = num_channel
self.conv = nn.Conv2d(3, self.num_channel, 7, 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 math
import torch.nn as nn
import torch.utils
assert_size_stride = torch.... | adynmiles/DARTS-FQA | FocusLiteNNMinMax | false | 6,091 | [
"MIT"
] | 1 | a088a0efeb1160d0cdbf2b2a3e30f132c16eb53f | https://github.com/adynmiles/DARTS-FQA/tree/a088a0efeb1160d0cdbf2b2a3e30f132c16eb53f |
Pow | import torch
class Pow(torch.nn.Module):
def __init__(self):
super(Pow, self).__init__()
def forward(self, x, y):
return x ** y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | ahangchen/torch2trt | Pow | false | 6,092 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
Gdn | from torch.autograd import Function
import torch
import torch.nn as nn
import torch.utils
class GdnFunction(Function):
@staticmethod
def forward(ctx, x, gamma, beta):
ctx.save_for_backward(x, gamma, beta)
n, c, h, w = list(x.size())
tx = x.permute(0, 2, 3, 1).contiguous()
tx =... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language 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... | adynmiles/DARTS-FQA | Gdn | false | 6,093 | [
"MIT"
] | 1 | a088a0efeb1160d0cdbf2b2a3e30f132c16eb53f | https://github.com/adynmiles/DARTS-FQA/tree/a088a0efeb1160d0cdbf2b2a3e30f132c16eb53f |
RMulFloat | import torch
class RMulFloat(torch.nn.Module):
def __init__(self):
super(RMulFloat, self).__init__()
def forward(self, x):
return 10.0 * 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | RMulFloat | false | 6,094 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
GT | import torch
class GT(torch.nn.Module):
def __init__(self):
super(GT, self).__init__()
def forward(self, x, y):
return x > y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | GT | false | 6,095 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
RMulInt | import torch
class RMulInt(torch.nn.Module):
def __init__(self):
super(RMulInt, self).__init__()
def forward(self, x):
return 10 * 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | RMulInt | false | 6,096 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
RAddFloat | import torch
class RAddFloat(torch.nn.Module):
def __init__(self):
super(RAddFloat, self).__init__()
def forward(self, x):
return 1.0 + 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | RAddFloat | false | 6,097 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
EQ | import torch
class EQ(torch.nn.Module):
def __init__(self):
super(EQ, self).__init__()
def forward(self, x, y):
return x == y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | EQ | false | 6,098 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
IMul | import torch
class IMul(torch.nn.Module):
def __init__(self):
super(IMul, self).__init__()
def forward(self, x, y):
x *= y
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_mul_0(in_ptr0, in_ptr1, out_ptr1, xnumel,... | ahangchen/torch2trt | IMul | false | 6,099 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
RDivFloat | import torch
class RDivFloat(torch.nn.Module):
def __init__(self):
super(RDivFloat, self).__init__()
def forward(self, x):
return 100.0 / 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | RDivFloat | false | 6,100 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
IAdd | import torch
class IAdd(torch.nn.Module):
def __init__(self):
super(IAdd, self).__init__()
def forward(self, x, y):
x += y
return x
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
@triton.jit
def triton_poi_fused_add_0(in_ptr0, in_ptr1, out_ptr1, xnumel,... | ahangchen/torch2trt | IAdd | false | 6,101 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
Mul | import torch
class Mul(torch.nn.Module):
def __init__(self):
super(Mul, self).__init__()
def forward(self, x, y):
return x * y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | Mul | false | 6,102 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
RSubFloat | import torch
class RSubFloat(torch.nn.Module):
def __init__(self):
super(RSubFloat, self).__init__()
def forward(self, x):
return 1.0 - 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | RSubFloat | false | 6,103 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
RDivInt | import torch
class RDivInt(torch.nn.Module):
def __init__(self):
super(RDivInt, self).__init__()
def forward(self, x):
return 100 / 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | RDivInt | false | 6,104 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
RpowFloat | import torch
class RpowFloat(torch.nn.Module):
def __init__(self):
super(RpowFloat, self).__init__()
def forward(self, x):
return 2.0 ** x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | ahangchen/torch2trt | RpowFloat | false | 6,105 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
RpowInt | import torch
class RpowInt(torch.nn.Module):
def __init__(self):
super(RpowInt, self).__init__()
def forward(self, x):
return 2 ** x
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | ahangchen/torch2trt | RpowInt | false | 6,106 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
TensorClampMin | import torch
class TensorClampMin(torch.nn.Module):
def forward(self, x):
return x.clamp_min(-0.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._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | ahangchen/torch2trt | TensorClampMin | false | 6,107 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
TorchMul | import torch
class TorchMul(torch.nn.Module):
def __init__(self):
super(TorchMul, self).__init__()
def forward(self, x, y):
return torch.mul(x, y)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | TorchMul | false | 6,108 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
RSubInt | import torch
class RSubInt(torch.nn.Module):
def __init__(self):
super(RSubInt, self).__init__()
def forward(self, x):
return 1 - 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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | RSubInt | false | 6,109 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
TensorClampMax | import torch
class TensorClampMax(torch.nn.Module):
def forward(self, x):
return x.clamp_max(0.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._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | ahangchen/torch2trt | TensorClampMax | false | 6,110 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
Sub | import torch
class Sub(torch.nn.Module):
def __init__(self):
super(Sub, self).__init__()
def forward(self, x, y):
return x - y
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | Sub | false | 6,111 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
TensorClamp | import torch
class TensorClamp(torch.nn.Module):
def forward(self, x):
return x.clamp(-0.1, 0.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._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | ahangchen/torch2trt | TensorClamp | false | 6,112 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
TorchAdd | import torch
class TorchAdd(torch.nn.Module):
def __init__(self):
super(TorchAdd, self).__init__()
def forward(self, x, y):
return torch.add(x, y)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | TorchAdd | false | 6,113 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
TensorClampOptionMin | import torch
class TensorClampOptionMin(torch.nn.Module):
def forward(self, x):
return x.clamp(min=-0.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._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | ahangchen/torch2trt | TensorClampOptionMin | false | 6,114 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
MSELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
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... | ahmad4633/mmfashion | MSELoss | false | 6,115 | [
"Apache-2.0"
] | 1 | ad2c911bf71bb95dce340a963e7f83c477a84824 | https://github.com/ahmad4633/mmfashion/tree/ad2c911bf71bb95dce340a963e7f83c477a84824 |
TensorClampOptionMax | import torch
class TensorClampOptionMax(torch.nn.Module):
def forward(self, x):
return x.clamp(max=0.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._inductor.runtime import triton_helpers
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torc... | ahangchen/torch2trt | TensorClampOptionMax | false | 6,116 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
Swish | import torch
import torch.nn as nn
class Swish(nn.Module):
def __init__(self):
super(Swish, self).__init__()
self.beta = nn.Parameter(torch.tensor(1.0))
def forward(self, x):
return x * torch.sigmoid(self.beta * x)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | ahmedfgad/high-fidelity-generative-compression | Swish | false | 6,117 | [
"Apache-2.0"
] | 1 | f3c6aa3472e3c629cbc35eefb0957119c913054a | https://github.com/ahmedfgad/high-fidelity-generative-compression/tree/f3c6aa3472e3c629cbc35eefb0957119c913054a |
ChannelNorm2D | import torch
import torch.nn as nn
class ChannelNorm2D(nn.Module):
"""
Similar to default Torch instanceNorm2D but calculates
moments over channel dimension instead of spatial dims.
Expects input_dim in format (B,C,H,W)
"""
def __init__(self, input_channels, momentum=0.1, eps=0.001, affine=T... | import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | ahmedfgad/high-fidelity-generative-compression | ChannelNorm2D | false | 6,118 | [
"Apache-2.0"
] | 1 | f3c6aa3472e3c629cbc35eefb0957119c913054a | https://github.com/ahmedfgad/high-fidelity-generative-compression/tree/f3c6aa3472e3c629cbc35eefb0957119c913054a |
TorchSub | import torch
class TorchSub(torch.nn.Module):
def __init__(self):
super(TorchSub, self).__init__()
def forward(self, x, y):
return torch.sub(x, y)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | TorchSub | false | 6,119 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
TorchDiv | import torch
class TorchDiv(torch.nn.Module):
def __init__(self):
super(TorchDiv, self).__init__()
def forward(self, x, y):
return torch.div(x, y)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
@triton.j... | ahangchen/torch2trt | TorchDiv | false | 6,121 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
TorchPow | import torch
class TorchPow(torch.nn.Module):
def __init__(self):
super(TorchPow, self).__init__()
def forward(self, x, y):
return torch.pow(x, y)
def get_inputs():
return [torch.rand([4, 4, 4, 4]), torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_c... | ahangchen/torch2trt | TorchPow | false | 6,122 | [
"MIT"
] | 1 | 53c663f0e0570ef7ffd6771354ae3478f63bd328 | https://github.com/ahangchen/torch2trt/tree/53c663f0e0570ef7ffd6771354ae3478f63bd328 |
SeparableConv2d | import torch
from torch import nn
class SeparableConv2d(nn.Module):
"""Implements a depthwise separable 2D convolution as described
in MobileNet (https://arxiv.org/abs/1704.04861)
See: [SeparableConv2D in Keras](https://www.tensorflow.org/api_docs/python/tf/keras/layers/SeparableConv2D)
Impl... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import 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... | aidan-fitz/SolarTracer | SeparableConv2d | false | 6,123 | [
"Apache-2.0"
] | 1 | 31cc77ca974640be277d00c6ca23d82292f178c1 | https://github.com/aidan-fitz/SolarTracer/tree/31cc77ca974640be277d00c6ca23d82292f178c1 |
multi_pool | import torch
import torch.nn as nn
class multi_pool(nn.Module):
def __init__(self):
super(multi_pool, self).__init__()
self.pool2 = nn.MaxPool2d(2, stride=2)
self.pool4 = nn.MaxPool2d(4, stride=2, padding=1)
self.pool8 = nn.MaxPool2d(8, stride=2, padding=3)
def forward(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... | ahhaa/crowdcount-stackpool | multi_pool | false | 6,124 | [
"MIT"
] | 1 | b849b72e88d5e53a9f6b5dbc93014668aee43fb4 | https://github.com/ahhaa/crowdcount-stackpool/tree/b849b72e88d5e53a9f6b5dbc93014668aee43fb4 |
Net | import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 3, 2, 1)
self.conv2 = nn.Conv2d(32, 64, 3, 2, 1)
self.conv3 = nn.Conv2d(64, 128, 3, 2, 1)
self.conv4 = 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
import torch.nn as nn
assert_... | VincentWang001/HairNet | Net | false | 6,125 | [
"MIT"
] | 1 | 396a61dc63f09a6812cf14bd09ae52c9fd76565a | https://github.com/VincentWang001/HairNet/tree/396a61dc63f09a6812cf14bd09ae52c9fd76565a |
ConvSample | import torch
class ConvSample(torch.nn.Module):
def __init__(self):
super().__init__()
self.conv1 = torch.nn.Conv2d(in_channels=1, out_channels=5,
kernel_size=5, stride=2, padding=2)
self.conv2 = torch.nn.Conv2d(in_channels=5, out_channels=5,
kernel_size=3, stride=... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
assert_size_stride = torch._C... | ahgamut/torchrecord | ConvSample | false | 6,126 | [
"MIT"
] | 1 | 6ab623776d12e0ae6497c34e93d16407e0a9c9c2 | https://github.com/ahgamut/torchrecord/tree/6ab623776d12e0ae6497c34e93d16407e0a9c9c2 |
NoisyLinear | import math
import torch
import torch.nn as nn
import torch.nn
import torch.optim
class NoisyLinear(nn.Linear):
def __init__(self, in_dimension, out_dimension, std_dev_init=0.4) ->None:
"""
Noisy Networks for Exploration: https://arxiv.org/abs/1706.10295
Standard linear layer: y = wx + b
... | 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 libd... | ailzy/Horizon | NoisyLinear | false | 6,127 | [
"BSD-3-Clause"
] | 1 | 377786d6c0306c3ecec1b18b6029f72949a4fdea | https://github.com/ailzy/Horizon/tree/377786d6c0306c3ecec1b18b6029f72949a4fdea |
CELoss | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.parallel
import torch.optim
import torch.utils.data
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
... | ahmad4633/mmfashion | CELoss | false | 6,128 | [
"Apache-2.0"
] | 1 | ad2c911bf71bb95dce340a963e7f83c477a84824 | https://github.com/ahmad4633/mmfashion/tree/ad2c911bf71bb95dce340a963e7f83c477a84824 |
DiscriminatorLoss | import torch
from torch import nn
class DiscriminatorLoss(nn.Module):
def __init__(self):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
def forward(self, fake_pred, real_pred):
fake_target = torch.zeros_like(fake_pred)
real_target = torch.ones_like(real_pred)
... | 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 ... | akanametov/CycleGAN | DiscriminatorLoss | false | 6,129 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 |
GeneratorLoss | import torch
from torch import nn
class GeneratorLoss(nn.Module):
def __init__(self, alpha=1, beta=10, gamma=10):
super().__init__()
self.bce = nn.BCEWithLogitsLoss()
self.l1 = nn.L1Loss()
self.alpha = alpha
self.beta = beta
self.gamma = gamma
def forward(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
from torch ... | akanametov/CycleGAN | GeneratorLoss | false | 6,130 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 |
NavACLNetwork | import torch
import torch.nn as nn
class NavACLNetwork(nn.Module):
def __init__(self, task_param_dim, hidden_dim, init_w=0.0005):
super(NavACLNetwork, self).__init__()
self.layer_1 = nn.Linear(task_param_dim, hidden_dim)
self.layer_2 = nn.Linear(hidden_dim, hidden_dim)
self.layer_... | import torch
from torch._inductor.select_algorithm import extern_kernels
import 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... | ai-lab-science/Deep-Reinforcement-Learning-for-mapless-navigation-in-intralogistics | NavACLNetwork | false | 6,131 | [
"MIT"
] | 1 | ac29a691317c69bc397809b222c0f3cf3f1916bc | https://github.com/ai-lab-science/Deep-Reinforcement-Learning-for-mapless-navigation-in-intralogistics/tree/ac29a691317c69bc397809b222c0f3cf3f1916bc |
PointerHead | import torch
import torch.quantization
from torch import nn
class PointerHead(nn.Module):
"""Head for pointer ordering task."""
def __init__(self, embed_dim, bias=True):
super().__init__()
self.embed_dim = embed_dim
self.scaling = self.embed_dim ** -0.5
self.k_proj = nn.Linear... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.quantization
from torch import nn
assert_size_stride = torch._C._dy... | airKlizz/passage-ordering | PointerHead | false | 6,132 | [
"MIT"
] | 1 | f63b993dfd5b7e6475e7fb8950c23c3f22951979 | https://github.com/airKlizz/passage-ordering/tree/f63b993dfd5b7e6475e7fb8950c23c3f22951979 |
stack_pool | import torch
import torch.nn as nn
class stack_pool(nn.Module):
def __init__(self):
super(stack_pool, self).__init__()
self.pool2 = nn.MaxPool2d(2, stride=2)
self.pool2s1 = nn.MaxPool2d(2, stride=1)
self.pool3s1 = nn.MaxPool2d(3, stride=1, padding=1)
self.padding = nn.Repl... | 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... | ahhaa/crowdcount-stackpool | stack_pool | false | 6,133 | [
"MIT"
] | 1 | b849b72e88d5e53a9f6b5dbc93014668aee43fb4 | https://github.com/ahhaa/crowdcount-stackpool/tree/b849b72e88d5e53a9f6b5dbc93014668aee43fb4 |
BasicBlock | import torch
from torch import nn
class BasicBlock(nn.Module):
"""Basic block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True):
super().__init__()
self.conv = nn.Conv2d(inplanes, outplanes, kernel_size, stride, padding
)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | akanametov/CycleGAN | BasicBlock | false | 6,134 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 |
PixLoss | import torch
import torch.nn as nn
class PixLoss(nn.Module):
"""Pixel-wise MSE loss for images"""
def __init__(self, alpha=20):
super().__init__()
self.alpha = alpha
def forward(self, fake, real):
return self.alpha * torch.mean((fake - real) ** 2)
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
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
emp... | akanametov/SuperResolution | PixLoss | false | 6,135 | [
"MIT"
] | 1 | 45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | https://github.com/akanametov/SuperResolution/tree/45313d1309ddb5cdef821aaf5ac7b5ad574b5287 |
DecoderBlock | import torch
from torch import nn
class DecoderBlock(nn.Module):
"""Decoder block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, dropout=False):
super().__init__()
self.relu = nn.ReLU(inplace=True)
self.deconv = nn.ConvTranspose2d(inplanes, outp... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | akanametov/CycleGAN | DecoderBlock | false | 6,136 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 |
EncoderBlock | import torch
from torch import nn
class EncoderBlock(nn.Module):
"""Encoder block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True, padding_mode='zeros'):
super().__init__()
self.lrelu = nn.LeakyReLU(0.2, inplace=True)
self.conv = nn.Con... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice
from torch import n... | akanametov/CycleGAN | EncoderBlock | false | 6,137 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 |
UpdateCell | import torch
from torch import nn
import torch as th
class UpdateCell(nn.Module):
def __init__(self, input_dim, output_dim):
super().__init__()
self.x2i = nn.Linear(input_dim, 2 * output_dim, bias=True)
self.h2h = nn.Linear(output_dim, 2 * output_dim, bias=False)
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.triton_helpers import libdevice
from torch import n... | alarca94/recbole-extension | UpdateCell | false | 6,138 | [
"MIT"
] | 1 | 171d4e58c83d35838307503d85e6c006701b3003 | https://github.com/alarca94/recbole-extension/tree/171d4e58c83d35838307503d85e6c006701b3003 |
AdvLoss | import torch
import torch.nn as nn
class AdvLoss(nn.Module):
"""BCE for True and False reals"""
def __init__(self, alpha=1):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
self.alpha = alpha
def forward(self, pred, target):
return self.alpha * self.loss_fn(pred,... | 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... | akanametov/SuperResolution | AdvLoss | false | 6,139 | [
"MIT"
] | 1 | 45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | https://github.com/akanametov/SuperResolution/tree/45313d1309ddb5cdef821aaf5ac7b5ad574b5287 |
DiscriminatorLoss | import torch
import torch.nn as nn
class AdvLoss(nn.Module):
"""BCE for True and False reals"""
def __init__(self, alpha=1):
super().__init__()
self.loss_fn = nn.BCEWithLogitsLoss()
self.alpha = alpha
def forward(self, pred, target):
return self.alpha * self.loss_fn(pred,... | 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... | akanametov/SuperResolution | DiscriminatorLoss | false | 6,140 | [
"MIT"
] | 1 | 45313d1309ddb5cdef821aaf5ac7b5ad574b5287 | https://github.com/akanametov/SuperResolution/tree/45313d1309ddb5cdef821aaf5ac7b5ad574b5287 |
Cos | import torch
import torch.nn as nn
class Cos(nn.Module):
def __init__(self):
super().__init__()
def forward(self, X: 'torch.Tensor'):
return torch.cos(X)
def get_inputs():
return [torch.rand([4, 4, 4, 4])]
def get_init_inputs():
return [[], {}]
| import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import math as tl_math
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert... | alartum/sngp-pytorch | Cos | false | 6,141 | [
"Apache-2.0"
] | 1 | 8d1f6c22d7ae635feeff0c0912624589e31e2e62 | https://github.com/alartum/sngp-pytorch/tree/8d1f6c22d7ae635feeff0c0912624589e31e2e62 |
GeneratorLoss | import torch
from torch import nn
class GeneratorLoss(nn.Module):
def __init__(self, alpha=100):
super().__init__()
self.alpha = alpha
self.bce = nn.BCEWithLogitsLoss()
self.l1 = nn.L1Loss()
def forward(self, fake, real, fake_pred):
fake_target = torch.ones_like(fake_... | 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 ... | akanametov/Pix2Pix-new | GeneratorLoss | false | 6,142 | [
"MIT"
] | 1 | 46aaefc506655dbf918ffdbd1c79174d76a748d0 | https://github.com/akanametov/Pix2Pix-new/tree/46aaefc506655dbf918ffdbd1c79174d76a748d0 |
TotalVariationLoss | import torch
import torch.nn as nn
class TotalVariationLoss(nn.Module):
def __init__(self, loss_weight: 'int'=1) ->None:
super(TotalVariationLoss, self).__init__()
self.loss_weight = loss_weight
@staticmethod
def tensor_size(t: 'torch.Tensor') ->torch.Tensor:
return t.size()[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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | aksh-ai/image-super-resolution | TotalVariationLoss | false | 6,143 | [
"MIT"
] | 1 | b3f2e48707db702dcd57733a8bcbf97ba87bb8a9 | https://github.com/aksh-ai/image-super-resolution/tree/b3f2e48707db702dcd57733a8bcbf97ba87bb8a9 |
HyperpriorSynthesisDLMM | import torch
import torch.nn as nn
import torch.nn.functional as F
def get_num_DLMM_channels(C, K=4, params=['mu', 'scale', 'mix']):
"""
C: Channels of latent representation (L3C uses 5).
K: Number of mixture coefficients.
"""
return C * K * len(params)
class HyperpriorSynthesisDLMM(nn.Module)... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ahmedfgad/high-fidelity-generative-compression | HyperpriorSynthesisDLMM | false | 6,144 | [
"Apache-2.0"
] | 1 | f3c6aa3472e3c629cbc35eefb0957119c913054a | https://github.com/ahmedfgad/high-fidelity-generative-compression/tree/f3c6aa3472e3c629cbc35eefb0957119c913054a |
BasicBlock | import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
class BasicBlock(nn.Module):
expansion = 1
def __init__(self, inplanes, planes, st... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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_... | akux2021/Learning-to-Grasp-by-Digging | BasicBlock | false | 6,145 | [
"Apache-2.0"
] | 1 | af7a32cb3e860df2d233a26174c7a27eb798b08d | https://github.com/akux2021/Learning-to-Grasp-by-Digging/tree/af7a32cb3e860df2d233a26174c7a27eb798b08d |
Discriminator | import torch
from torch import nn
class BasicBlock(nn.Module):
"""Basic block"""
def __init__(self, inplanes, outplanes, kernel_size=4, stride=2,
padding=1, norm=True):
super().__init__()
self.conv = nn.Conv2d(inplanes, outplanes, kernel_size, stride, padding
)
sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | akanametov/CycleGAN | Discriminator | false | 6,146 | [
"MIT"
] | 1 | a61e76134cfdda43306e326e3dbba38d8cb21163 | https://github.com/akanametov/CycleGAN/tree/a61e76134cfdda43306e326e3dbba38d8cb21163 |
ImageProcessor | import torch
import torch.nn as nn
class ImageProcessor(nn.Module):
def __init__(self, init_image_embedding_size, embedding_size):
super().__init__()
self.conv = nn.Conv2d(init_image_embedding_size, embedding_size,
kernel_size=1)
def forward(self, image_encoding):
x = sel... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | alasin/vqa_pytorch | ImageProcessor | false | 6,147 | [
"MIT"
] | 1 | 8a311226d8eea56ef79f6be3c864ec05768e2895 | https://github.com/alasin/vqa_pytorch/tree/8a311226d8eea56ef79f6be3c864ec05768e2895 |
HyperpriorSynthesis | import torch
import torch.nn as nn
import torch.nn.functional as F
class HyperpriorSynthesis(nn.Module):
"""
Hyperprior 'synthesis model' as proposed in [1]. Outputs
distribution parameters of input latents.
[1] Ballé et. al., "Variational image compression with a scale hyperprior",
arXiv:1... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
import torch.nn as nn
import ... | ahmedfgad/high-fidelity-generative-compression | HyperpriorSynthesis | false | 6,148 | [
"Apache-2.0"
] | 1 | f3c6aa3472e3c629cbc35eefb0957119c913054a | https://github.com/ahmedfgad/high-fidelity-generative-compression/tree/f3c6aa3472e3c629cbc35eefb0957119c913054a |
BesselBasisLayer | import torch
import numpy as np
import torch.nn as nn
class Envelope(nn.Module):
def __init__(self, exponent):
super(Envelope, self).__init__()
self.exponent = exponent
self.p = exponent + 1
self.a = -(self.p + 1) * (self.p + 2) / 2
self.b = self.p * (self.p + 2)
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.triton_helpers import math as tl_math
import numpy as np
import torch.nn as nn
assert_size_stride = torch._C._d... | akirasosa/pre-training-mol | BesselBasisLayer | false | 6,149 | [
"MIT"
] | 1 | 2fd65a959eee50e2eea260719633042ae37bb92c | https://github.com/akirasosa/pre-training-mol/tree/2fd65a959eee50e2eea260719633042ae37bb92c |
AdMSoftmaxLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class AdMSoftmaxLoss(nn.Module):
def __init__(self, in_features, out_features, s=30.0, m=0.4):
"""
AM Softmax Loss
"""
super(AdMSoftmaxLoss, self).__init__()
self.s = s
self.m = m
self.in_fe... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | albertvillanova/s3prl | AdMSoftmaxLoss | false | 6,150 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
AP | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super(AttentivePooling, self).__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | albertvillanova/s3prl | AP | false | 6,151 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
AMSoftmaxLoss | import torch
import torch.nn as nn
import torch.nn.functional as F
class AMSoftmaxLoss(nn.Module):
def __init__(self, hidden_dim, speaker_num, s=30.0, m=0.4, **kwargs):
"""
AM Softmax Loss
"""
super(AMSoftmaxLoss, self).__init__()
self.s = s
self.m = m
self... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | albertvillanova/s3prl | AMSoftmaxLoss | false | 6,152 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
L2Norm | import torch
import torch.nn as nn
class L2Norm(nn.Module):
def __init__(self):
super(L2Norm, self).__init__()
self.eps = 1e-10
def forward(self, x):
norm = torch.sqrt(torch.sum(x * x, dim=1) + self.eps)
x = x / norm.unsqueeze(-1).expand_as(x)
return x
def get_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.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | albutko/vlb | L2Norm | false | 6,153 | [
"BSD-2-Clause"
] | 1 | 437245c0991948eeb36a277937a7e67d389041e4 | https://github.com/albutko/vlb/tree/437245c0991948eeb36a277937a7e67d389041e4 |
PrecomputedNorm | import torch
import torch.nn as nn
class PrecomputedNorm(nn.Module):
"""Normalization using Pre-computed Mean/Std.
Args:
stats: Precomputed (mean, std).
axis: Axis setting used to calculate mean/variance.
"""
def __init__(self, stats, axis=[1, 2]):
super().__init__()
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
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_st... | albertvillanova/s3prl | PrecomputedNorm | false | 6,154 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
ASP | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super(AttentivePooling, self).__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | albertvillanova/s3prl | ASP | false | 6,155 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
AttentivePooling | import torch
import torch.nn as nn
class AttentivePooling(nn.Module):
"""
Implementation of Attentive Pooling
"""
def __init__(self, input_dim, **kwargs):
super(AttentivePooling, self).__init__()
self.W_a = nn.Linear(input_dim, input_dim)
self.W = nn.Linear(input_dim, 1)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | albertvillanova/s3prl | AttentivePooling | false | 6,156 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
Model | import torch
import torch.nn as nn
class Model(nn.Module):
def __init__(self, input_dim, output_class_num, **kwargs):
super(Model, self).__init__()
self.linear = nn.Linear(input_dim, output_class_num)
def forward(self, features):
pooled = features.mean(dim=1)
predicted = 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
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_s... | albertvillanova/s3prl | Model | false | 6,157 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
ChannelNorm | import torch
import torch.nn as nn
class ChannelNorm(nn.Module):
def __init__(self, numFeatures, epsilon=1e-05, affine=True):
super(ChannelNorm, self).__init__()
if affine:
self.weight = nn.parameter.Parameter(torch.Tensor(1,
numFeatures, 1))
self.bias = 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
from torch._inductor.runtime.triton_helpers import libdevice
import torch.nn as nn
assert_size_stride = torch._C._dynamo.guards.assert_size_... | albertvillanova/s3prl | ChannelNorm | false | 6,158 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
AlternateAttention | import torch
import torch.nn as nn
class AlternateAttention(nn.Module):
def __init__(self, embedding_size, hidden_size):
super().__init__()
self.hidden_size = hidden_size
self.embedding_size = embedding_size
self.x_linear = nn.Linear(self.embedding_size, self.hidden_size)
... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
im... | alasin/vqa_pytorch | AlternateAttention | false | 6,160 | [
"MIT"
] | 1 | 8a311226d8eea56ef79f6be3c864ec05768e2895 | https://github.com/alasin/vqa_pytorch/tree/8a311226d8eea56ef79f6be3c864ec05768e2895 |
CrossEntropyLoss | import torch
import torch.nn.functional as F
import torch.nn as nn
def _is_long(x):
return isinstance(x, torch.LongTensor) or isinstance(x, torch.LongTensor)
def onehot(indexes, N=None, ignore_index=None):
"""
Creates a one-representation of indexes with N possible entries
if N is not specified, it ... | 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.functi... | aldakata/ClassConditionalC2D | CrossEntropyLoss | false | 6,161 | [
"MIT"
] | 1 | dd73e1d4d5f0f82438340211e3c479dbd16b8ffc | https://github.com/aldakata/ClassConditionalC2D/tree/dd73e1d4d5f0f82438340211e3c479dbd16b8ffc |
SelfAttentionPooling | import torch
import torch.nn as nn
class SelfAttentionPooling(nn.Module):
"""
Implementation of SelfAttentionPooling
Original Paper: Self-Attention Encoding and Pooling for Speaker Recognition
https://arxiv.org/pdf/2008.01077v1.pdf
"""
def __init__(self, input_dim):
super(SelfAttenti... | import torch
from torch._inductor.select_algorithm import extern_kernels
import triton
import triton.language as tl
from 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.... | albertvillanova/s3prl | SelfAttentionPooling | false | 6,162 | [
"MIT"
] | 1 | b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 | https://github.com/albertvillanova/s3prl/tree/b127ade4ed2f80a1027901bbd2f204b4fb1aaf03 |
HyperpriorAnalysis | import torch
import torch.nn as nn
import torch.nn.functional as F
class HyperpriorAnalysis(nn.Module):
"""
Hyperprior 'analysis model' as proposed in [1].
[1] Ballé et. al., "Variational image compression with a scale hyperprior",
arXiv:1802.01436 (2018).
C: Number of 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
from torch._inductor.runtime import triton_helpers
from torch._inductor.runtime.... | ahmedfgad/high-fidelity-generative-compression | HyperpriorAnalysis | false | 6,163 | [
"Apache-2.0"
] | 1 | f3c6aa3472e3c629cbc35eefb0957119c913054a | https://github.com/ahmedfgad/high-fidelity-generative-compression/tree/f3c6aa3472e3c629cbc35eefb0957119c913054a |
FeatureMatchingLoss | import torch
import torch.utils.data
import torch
from torch import nn
class FeatureMatchingLoss(nn.Module):
def __init__(self, n_layers_D, num_D):
super(FeatureMatchingLoss, self).__init__()
self.criterion = nn.L1Loss()
self.n_layers_D = n_layers_D
self.num_D = num_D
def for... | 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.utils.data
import torch
from torch import nn
assert_size_str... | alexander-telepov/RGB2MSI | FeatureMatchingLoss | false | 6,164 | [
"BSD-3-Clause"
] | 1 | 99f81f5547d40d0c92cfde39994a8c53629bd0f7 | https://github.com/alexander-telepov/RGB2MSI/tree/99f81f5547d40d0c92cfde39994a8c53629bd0f7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.