Spaces:
Sleeping
Sleeping
File size: 1,143 Bytes
77da9e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# ------------------------------------------------------------------------
# RF-DETR
# Copyright (c) 2025 Roboflow. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see LICENSE for details]
# ------------------------------------------------------------------------
# Modified from LW-DETR (https://github.com/Atten4Vis/LW-DETR)
# Copyright (c) 2024 Baidu. All Rights Reserved.
# ------------------------------------------------------------------------
"""
CustomOpSymbolicRegistry class
"""
from copy import deepcopy
import onnx
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.onnx import register_custom_op_symbolic
from torch.onnx.symbolic_helper import parse_args
from torch.onnx.symbolic_helper import _get_tensor_dim_size, _get_tensor_sizes
from torch.autograd import Function
class CustomOpSymbolicRegistry:
# _SYMBOLICS = {}
_OPTIMIZER = []
@classmethod
def optimizer(cls, fn):
cls._OPTIMIZER.append(fn)
def register_optimizer():
def optimizer_wrapper(fn):
CustomOpSymbolicRegistry.optimizer(fn)
return fn
return optimizer_wrapper |