# Path: snntoolbox/parsing/model_libs/keras_input_lib.py
# class ModelParser(AbstractModelParser):
#     def get_layer_iterable(self):
#     def get_type(self, layer):
#     def get_batchnorm_parameters(self, layer):
#     def get_inbound_layers(self, layer):
#     def layers_to_skip(self):
#     def has_weights(self, layer):
#     def initialize_attributes(self, layer=None):
#     def get_input_shape(self):
#     def get_output_shape(self, layer):
#     def parse_sparse(self, layer, attributes):
#     def parse_dense(self, layer, attributes):
#     def parse_sparse_convolution(self, layer, attributes):
#     def parse_convolution(self, layer, attributes):
#     def parse_sparse_depthwiseconvolution(self, layer, attributes):
#     def parse_depthwiseconvolution(self, layer, attributes):
#     def parse_transpose_convolution(self, layer, attributes):
#     def parse_pooling(self, layer, attributes):
#     def get_activation(self, layer):
#     def get_outbound_layers(self, layer):
#     def parse_concatenate(self, layer, attributes):
#     def input_layer_name(self):
# def load(path, filename, **kwargs):
# def evaluate(val_fn, batch_size, num_to_test, x_test=None, y_test=None,
#              dataflow=None):
# 
# Path: snntoolbox/utils/utils.py
# def import_script(path, filename):
#     """Import python script independently from python version.
# 
#     Parameters
#     ----------
# 
#     path: string
#         Path to directory where to load script from.
# 
#     filename: string
#         Name of script file.
#     """
# 
#     filepath = os.path.join(path, filename + '.py')
# 
#     v = sys.version_info
#     if v >= (3, 5):
#         import importlib.util
#         spec = importlib.util.spec_from_file_location(filename, filepath)
#         mod = importlib.util.module_from_spec(spec)
#         spec.loader.exec_module(mod)
#     elif v >= (3, 3):
#         # noinspection PyCompatibility,PyUnresolvedReferences
#         from importlib.machinery import SourceFileLoader
#         mod = SourceFileLoader(filename, filepath).load_module()
#     else:
#         # noinspection PyDeprecation
#         import imp
#         # noinspection PyDeprecation
#         mod = imp.load_source(filename, filepath)
#     return mod


import os
import numpy as np
import torch
import onnx
import onnxruntime
from tensorflow.keras import backend, models, metrics
from snntoolbox.parsing.model_libs import keras_input_lib
from snntoolbox.utils.utils import import_script
    from onnx2keras import onnx_to_keras
# -*- coding: utf-8 -*-
"""PyTorch model parser.

@author: rbodo
"""





def to_numpy(tensor):
    return tensor.detach().cpu().numpy() if tensor.requires_grad \
        else tensor.cpu().numpy()



# Path: snntoolbox/parsing/model_libs/keras_input_lib.py
# class ModelParser(AbstractModelParser):
#     def get_layer_iterable(self):
#     def get_type(self, layer):
#     def get_batchnorm_parameters(self, layer):
#     def get_inbound_layers(self, layer):
#     def layers_to_skip(self):
#     def has_weights(self, layer):
#     def initialize_attributes(self, layer=None):
#     def get_input_shape(self):
#     def get_output_shape(self, layer):
#     def parse_sparse(self, layer, attributes):
#     def parse_dense(self, layer, attributes):
#     def parse_sparse_convolution(self, layer, attributes):
#     def parse_convolution(self, layer, attributes):
#     def parse_sparse_depthwiseconvolution(self, layer, attributes):
#     def parse_depthwiseconvolution(self, layer, attributes):
#     def parse_transpose_convolution(self, layer, attributes):
#     def parse_pooling(self, layer, attributes):
#     def get_activation(self, layer):
#     def get_outbound_layers(self, layer):
#     def parse_concatenate(self, layer, attributes):
#     def input_layer_name(self):
# def load(path, filename, **kwargs):
# def evaluate(val_fn, batch_size, num_to_test, x_test=None, y_test=None,
#              dataflow=None):
# 
# Path: snntoolbox/utils/utils.py
# def import_script(path, filename):
#     """Import python script independently from python version.
# 
#     Parameters
#     ----------
# 
#     path: string
#         Path to directory where to load script from.
# 
#     filename: string
#         Name of script file.
#     """
# 
#     filepath = os.path.join(path, filename + '.py')
# 
#     v = sys.version_info
#     if v >= (3, 5):
#         import importlib.util
#         spec = importlib.util.spec_from_file_location(filename, filepath)
#         mod = importlib.util.module_from_spec(spec)
#         spec.loader.exec_module(mod)
#     elif v >= (3, 3):
#         # noinspection PyCompatibility,PyUnresolvedReferences
#         from importlib.machinery import SourceFileLoader
#         mod = SourceFileLoader(filename, filepath).load_module()
#     else:
#         # noinspection PyDeprecation
#         import imp
#         # noinspection PyDeprecation
#         mod = imp.load_source(filename, filepath)
#     return mod


# Path: snntoolbox/parsing/model_libs/pytorch_input_lib.py
import os
import numpy as np
import torch
import onnx
import onnxruntime
from tensorflow.keras import backend, models, metrics
from snntoolbox.parsing.model_libs import keras_input_lib
from snntoolbox.utils.utils import import_script
    from onnx2keras import onnx_to_keras

# -*- coding: utf-8 -*-
"""PyTorch model parser.

@author: rbodo
"""





def to_numpy(tensor):
    return tensor.detach().cpu().numpy() if tensor.requires_grad \
        else tensor.cpu().numpy()



class ModelParser(keras_input_lib.ModelParser):