repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_densenet_2.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import keras_segmentation from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import run_image img_path = os.path.join(os.path.dirname(__file__), '../dat...
1,258
29.707317
107
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_open_face.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras, is_tf_keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import r...
15,525
55.871795
129
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_semantic_segmentation.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np import math from onnxconverter_common.onnx_ex import get_maximum_opset_supported from mock_keras2onnx.proto import keras from keras.initializers import RandomNormal from os.path import dirname, abspath ...
82,051
36.552403
149
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_acgan.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import ru...
5,263
34.093333
168
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_cogan.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import ru...
4,356
30.572464
107
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/run_all_v2.py
# SPDX-License-Identifier: Apache-2.0 import os os.environ["PYTHONPATH"] = \ os.environ.get("PYTHONPATH", "") + os.pathsep + "../../keras2onnx_unit_tests" + os.pathsep + "../../../" os.environ["TF2ONNX_CATCH_ERRORS"] = "FALSE" files = ['test_keras_applications_v2.py', 'test_transformers.py', 'test_chatbot.py', 't...
652
27.391304
108
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_srgan.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import onnx import numpy as np from mock_keras2onnx.proto import keras from keras.applications import VGG19 from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onn...
6,736
33.372449
192
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_series_net.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from keras.regularizers import l2 from keras.initializers import TruncatedNormal from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(absp...
4,217
34.445378
120
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_wgan_gp.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import ru...
5,803
32.94152
107
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_transformers.py
# SPDX-License-Identifier: Apache-2.0 import os from os.path import dirname, abspath import unittest import sys sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) import json import urllib.request import pickle import numpy as np import tensorflow as tf from onnxconverter_common....
24,209
51.516269
135
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_efn.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest from os.path import dirname, abspath from mock_keras2onnx.proto import keras, is_tensorflow_older_than sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import run_image img_path = os.path...
1,491
32.155556
95
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_chatbot.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from mock_keras2onnx.proto.tfcompat import is_tf2 from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2on...
4,426
40.764151
130
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_unet_plus_plus.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import numpy as np import onnxruntime from os.path import dirname, abspath from mock_keras2onnx.proto import keras, is_keras_older_than from keras.applications.vgg16 import VGG16 from onnxconverter_common.onnx_ex import get_maximum_opset_suppor...
5,964
35.820988
113
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_ccgan.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import keras_contrib import numpy as np from mock_keras2onnx import set_converter from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '....
5,232
33.202614
131
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_nbeats.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import run_keras_and_...
10,673
38.680297
116
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_resnext.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from mock_keras2onnx.proto.tfcompat import is_tf2 if is_tf2: def l2(weight_decay): # old keras layer expects a tuple but tf keras wants a single value...
16,488
41.497423
112
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_lipnet.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import run_keras_and_...
3,930
37.920792
136
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_deeplab_v3.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from onnxconverter_common.onnx_ex import get_maximum_opset_supported from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__...
16,644
42.233766
117
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_nasnet_mobile.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import run_keras_and_...
16,919
44.12
118
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_autoencoder.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import run_keras_and_...
4,717
33.948148
123
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_keras_applications.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from onnxconverter_common.onnx_ex import get_maximum_opset_supported from mock_keras2onnx.proto import keras, is_keras_older_than from os.path import dirname, abspath sys.path.insert(0, os.path.join(di...
16,893
42.096939
144
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_resume_parser.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import run_keras_and_...
6,421
37.22619
123
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_deepface.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import run_onnx_runti...
3,815
37.16
108
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_semantic_embeddings.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras from keras import regularizers from keras.engine import Layer, InputSpec from keras.utils import layer_utils, conv_utils from os.path import dirname, abspath sys....
17,495
37.537445
120
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_applications/nightly_build/test_dualgan.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import unittest import mock_keras2onnx import onnx import numpy as np from mock_keras2onnx.proto import keras from os.path import dirname, abspath sys.path.insert(0, os.path.join(dirname(abspath(__file__)), '../../keras2onnx_tests/')) from test_utils import ru...
4,281
30.485294
168
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/test_layers.py
# SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np from mock_keras2onnx.proto.tfcompat import is_tf2, tensorflow as tf from mock_keras2onnx.proto import (keras, is_tf_keras, is_tensorflow_older_than, is_tensorflow_later_than, is_...
115,744
41.289003
229
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/conftest.py
# SPDX-License-Identifier: Apache-2.0 import os import pytest import numpy as np import tensorflow as tf from mock_keras2onnx.proto import keras, is_tf_keras from test_utils import run_onnx_runtime from mock_keras2onnx.proto.tfcompat import is_tf2 K = keras.backend @pytest.fixture(scope='function') def runner(): ...
880
22.184211
74
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/test_subclassing.py
# SPDX-License-Identifier: Apache-2.0 import pytest import mock_keras2onnx import numpy as np import tensorflow as tf from test_utils import convert_keras_for_test as convert_keras from mock_keras2onnx.proto import is_tensorflow_older_than if (not mock_keras2onnx.proto.is_tf_keras) or (not mock_keras2onnx.proto.tfcom...
8,436
34.599156
102
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/test_cgan.py
# SPDX-License-Identifier: Apache-2.0 import pytest import tensorflow as tf import mock_keras2onnx import numpy as np from mock_keras2onnx.proto import keras, is_tf_keras, is_tensorflow_older_than from tf2onnx.keras2onnx_api import convert_keras from packaging.version import Version Activation = keras.layers.Activati...
4,662
34.325758
111
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/test_utils.py
# SPDX-License-Identifier: Apache-2.0 import os import sys import onnx from onnx import helper import numpy as np import mock_keras2onnx from mock_keras2onnx.proto import keras, is_keras_older_than from mock_keras2onnx.proto.tfcompat import is_tf2 from packaging.version import Version from tf2onnx.keras2onnx_api impor...
13,088
37.497059
122
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/mock_keras2onnx/__init__.py
from tf2onnx.keras2onnx_api import convert_keras def set_converter(*args, **kwargs): pass
96
15.166667
48
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/mock_keras2onnx/proto/tfcompat.py
# SPDX-License-Identifier: Apache-2.0 import os import tensorflow as _tf from packaging.version import Version is_tf2 = Version(_tf.__version__.split('-')[0]) >= Version("2.0.0") def normalize_tensor_shape(tensor_shape): if is_tf2: return [d for d in tensor_shape] else: return [d.value for ...
1,292
27.733333
83
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/mock_keras2onnx/proto/__init__.py
# SPDX-License-Identifier: Apache-2.0 import os import tensorflow from packaging.version import Version # Rather than using ONNX protobuf definition throughout our codebase, we import ONNX protobuf definition here so that # we can conduct quick fixes by overwriting ONNX functions without changing any lines elsewhere....
2,109
29.57971
117
py
tensorflow-onnx
tensorflow-onnx-main/tests/keras2onnx_unit_tests/mock_keras2onnx/ke2onnx/batch_norm.py
convert_keras_batch_normalization = None
40
40
40
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_resnet_v2_152.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/imagenet/resnet_v2_152/classification/5?tf-hub-format=compressed" dest = "tf-resnet_v2_152" name = "resnet_v2_152" onnx_name = os.path.j...
509
24.5
101
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_resnet_v2_101.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/imagenet/resnet_v2_101/feature_vector/5?tf-hub-format=compressed" dest = "tf-resnet_v2_101" name = "resnet_v2_101" onnx_name = os.path.j...
519
25
101
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_talkheads_ggelu_bert_en_large.py
# SPDX-License-Identifier: Apache-2.0 import os from collections import OrderedDict import numpy import numpy.random as rnd from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/tensorflow/talkheads_ggelu_bert_en_large/2?tf-hub-format=compressed" dest = "tf-talkhead...
979
36.692308
123
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_yamnet_tf.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark, benchmark_tflite def main(opset=13): url = "https://tfhub.dev/google/yamnet/1?tf-hub-format=compressed" dest = "tf-yamnet-tf" name = "yamnet" onnx_name = os.path.join(dest, "%s-%d.onnx" %...
702
28.291667
81
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_yamnet_tflite.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark_tflite def main(opset=13): url = "https://tfhub.dev/google/lite-model/yamnet/classification/tflite/1?lite-format=tflite" dest = "tf-yamnet-tflite" name = "yamnet" onnx_name = os.path.join(...
745
30.083333
97
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_mobile_food_segmenter_V1.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark import tf2onnx import onnxruntime as ort def main(opset=13): url = "https://tfhub.dev/google/seefood/segmenter/mobile_food_segmenter_V1/1?tf-hub-format=compressed" dest = "tf-mobile_food_segmenter...
1,400
30.840909
106
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_mobilenet_v3_small_075_224.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/imagenet/mobilenet_v3_small_075_224/feature_vector/5?tf-hub-format=compressed" dest = "tf-mobilenet-v3-small-075-224" name = "mobilenet-v3-s...
558
26.95
114
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_enformer.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from numpy.testing import assert_almost_equal from onnxruntime import InferenceSession from _tools import generate_random_images, benchmark, measure_time from tensorflow import convert_to_tensor import tensorflow as tf import tensorflow_hub as hub import tf2o...
1,952
31.016393
80
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_thunder.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/movenet/singlepose/thunder/3?tf-hub-format=compressed" dest = "tf-thunder" name = "thunder" onnx_name = os.path.join(dest, "%s-%d.onnx" ...
548
25.142857
90
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_lambert_en_uncased_L-24_H-1024_A-16.py
# SPDX-License-Identifier: Apache-2.0 import os from collections import OrderedDict import numpy import numpy.random as rnd from _tools import generate_text_inputs, benchmark def main(opset=13): if False: import tensorflow as tf import tensorflow_text import tensorflow_hub as hub ...
1,706
39.642857
123
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_spam_detection.py
# SPDX-License-Identifier: Apache-2.0 import os import random import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/tensorflow/tutorials/spam-detection/1?tf-hub-format=compressed" dest = "tf-spam-detection" name = "spam-detection" onnx_name = os...
520
23.809524
92
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_blazeposedetector.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/mediapipe/tfjs-model/blazeposedetector/1/default/1?tfjs-format=compressed" dest = "tf-blazeposedetector" name = "blazeposedetector" onnx_name =...
529
25.5
103
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_resnet_v1_101_keras.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy import onnxruntime as ort import tensorflow as tf import tensorflow_hub as hub import tf2onnx from _tools import generate_random_images, check_discrepencies imgs = generate_random_images(shape=(1, 224, 224, 3), scale=1.) model = tf.keras.Sequential([ hu...
1,201
29.820513
86
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_albert_en_xlarge.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy import numpy.random as rnd from collections import OrderedDict from _tools import generate_text_inputs, benchmark def main(opset=13): url = "https://tfhub.dev/tensorflow/albert_en_xlarge/3?tf-hub-format=compressed" dest = "tf-albert-en-xlarge" n...
1,057
35.482759
123
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_yamnet_coral.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark_tflite def main(opset=13): url = "https://tfhub.dev/google/coral-model/yamnet/classification/coral/1?coral-format=tflite" dest = "tf-yamnet-coral" name = "yamnet" onnx_name = os.path.join(...
1,123
45.833333
166
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_resnet_v1_101.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/imagenet/resnet_v1_101/feature_vector/5?tf-hub-format=compressed" dest = "tf-resnet_v1_101" name = "resnet_v1_101" onnx_name = os.path.j...
519
25
101
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_bert_en_wwm_uncased.py
# SPDX-License-Identifier: Apache-2.0 import os from collections import OrderedDict import numpy import numpy.random as rnd from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/tensorflow/bert_en_wwm_uncased_L-24_H-1024_A-16/4?tf-hub-format=compressed" dest = "tf-b...
997
37.384615
122
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_inception_v3.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/inaturalist/inception_v3/feature_vector/5?tf-hub-format=compressed" dest = "tf-inception_v3" name = "inception_v3" onnx_name = os.path.j...
509
24.5
103
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_albert_en_xlarge_keras.py
# Adapted the sample code on https://tfhub.dev/tensorflow/albert_en_xlarge/3 import tensorflow_text as text import tensorflow as tf import tensorflow_hub as hub # Using hub.load instead of KerasLayer lets us easily intercept the results of the # preprocessor before passing it to the encoder preprocessor = hub.load("ht...
2,127
37.690909
98
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_resnet_v2_101_classification.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/imagenet/resnet_v1_101/classification/5?tf-hub-format=compressed" dest = "tf-resnet_v2_101_classification" name = "resnet_v2_101_classificat...
549
26.5
101
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_humpback_whale.py
# SPDX-License-Identifier: Apache-2.0 import os os.environ["CUDA_VISIBLE_DEVICES"] = "-1" import pickle import numpy from onnxruntime import InferenceSession from _tools import generate_random_images, benchmark, measure_time import tensorflow as tf import tensorflow_hub as hub def main(opset=13): url = "https://t...
2,230
40.314815
87
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_nasnet_large.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/imagenet/nasnet_large/feature_vector/5?tf-hub-format=compressed" dest = "tf-nasnet-large" name = "nasnet-large" onnx_name = os.path.join...
506
24.35
100
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_mobilenet_v3_large_075_224.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/google/imagenet/mobilenet_v3_large_075_224/classification/5?tf-hub-format=compressed" dest = "tf-mobilenet-v3-large-075-224" name = "mobilenet-v3-l...
558
26.95
114
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_esrgan.py
# SPDX-License-Identifier: Apache-2.0 import os import numpy from _tools import generate_random_images, benchmark def main(opset=13): url = "https://tfhub.dev/captain-pool/esrgan-tf2/1?tf-hub-format=compressed" dest = "tf-esrgan-tf2" name = "esrgan-tf2" onnx_name = os.path.join(dest, "%s-%d.onnx" % (n...
460
22.05
80
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/_tools.py
# SPDX-License-Identifier: Apache-2.0 """ The following code compares the speed of tensorflow against onnxruntime with a model downloaded from Tensorflow Hub. """ import os import sys import time import tarfile import zipfile import subprocess import datetime from collections import OrderedDict import numpy from tqdm ...
17,888
36.980892
110
py
tensorflow-onnx
tensorflow-onnx-main/tests/tfhub/tfhub_mobilebert_en_uncased.py
# SPDX-License-Identifier: Apache-2.0 import os from collections import OrderedDict import numpy import numpy.random as rnd from _tools import generate_text_inputs, benchmark def main(opset=13): if False: import tensorflow as tf import tensorflow_text import tensorflow_hub as hub ...
1,308
35.361111
118
py
open-prompts
open-prompts-main/update_presets.py
import glob import json presets = [] for preset_category_idx, preset_category_path in enumerate( glob.glob('presets/*')): preset_category_name = preset_category_path.split('/')[1] preset_category_data = { 'idx': preset_category_idx, 'name': preset_category_name, 'subcategories'...
1,436
33.214286
77
py
open-prompts
open-prompts-main/update_modifiers.py
import glob import json modifiers = [] for modifier_category_idx, modifier_category_path in enumerate( glob.glob('modifiers/*')): modifier_category_name = modifier_category_path.split('/')[1] modifier_category_data = { 'id': modifier_category_idx, 'name': modifier_category_name, ...
1,535
33.909091
79
py
MKIDPipeline
MKIDPipeline-master/setup.py
from __future__ import print_function import setuptools from setuptools.command.install import install from setuptools.command.develop import develop import subprocess import numpy from setuptools.extension import Extension from Cython.Build import cythonize #pip install -e git+http://github.com/mazinlab/mkidpipeline....
2,069
29.895522
99
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/definitions.py
import hashlib import os from collections import defaultdict from datetime import datetime from typing import Set import ruamel.yaml import astropy.units import numpy as np from astropy import units as u from astropy.coordinates import SkyCoord import mkidcore.config import mkidcore.utils import mkidpipeline.config as...
68,731
41.115196
121
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/samples.py
import pkg_resources from collections import defaultdict import mkidpipeline.definitions as d import mkidpipeline.config as config _i = defaultdict(lambda: 0) def _namer(name='Thing'): ret = f"{name}{_i[name]}" _i[name] = _i[name] + 1 return ret SAMPLEDATA = {'default': ( d.MKIDObservation(name=_n...
9,041
63.585714
116
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/jsondefs.py
MKIDReductionJobJSON = { 'frameid': 'a subaru frame id', # or None/null string 'data': [0, 0], # start and stop timestamps bracketing the relevant logging records 'kind': 'image', # 'image', 'dither', or 'wavecal' 'instrument_config': 'path_to_dashboard.yaml', #loadable with mkidcore.config.load ...
773
47.375
104
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/photontable.py
import os import time import multiprocessing as mp import functools import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline from ruamel.yaml.comments import CommentedSeq import mkidcore.metadata from mkidcore.binfile.mkidbin import PhotonCType, PhotonNumpyType from mkidcore.corelog import getLogg...
45,801
39.931189
120
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/config.py
import os import multiprocessing as mp import pathlib from io import StringIO import mkidcore.config from mkidcore.corelog import getLogger from mkidcore.objects import Beammap from mkidcore.instruments import InstrumentInfo from mkidcore.metadata import DEFAULT_CARDSET # Ensure that the beammap gets registered with ...
10,318
37.793233
118
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/__init__.py
0
0
0
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/pipeline.py
from importlib import import_module import pkgutil import multiprocessing as mp import functools import mkidcore.config from mkidcore.pixelflags import FlagSet, BEAMMAP_FLAGS from mkidcore.config import getLogger import mkidpipeline.config as config import mkidpipeline.steps PIPELINE_STEPS = {'attachmeta': None} for...
3,883
32.196581
117
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/tests/benchmark.py
import os os.environ['NUMEXPR_MAX_THREADS'] = '32' os.environ['NUMEXPR_NUM_THREADS'] = '16' os.environ["TMPDIR"] = '/scratch/tmp/' import tables.index tables.index.profile = True from photontable import Photontable #@profile def tsectest(f): of = Photontable(f) # p=LineProfiler(of.photonTable._where) #...
2,148
36.051724
125
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/tests/test_config.py
import mkidpipeline.definitions as definitions import mkidpipeline.samples import mkidpipeline.config as config import mkidpipeline.pipeline as pipe import mkidcore.corelog import pkg_resources as pkg mkidcore.corelog.getLogger('mkidcore', setup=True, configfile=pkg.resource_filename('mkidpi...
917
28.612903
101
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/tests/output_validation.py
import mkidpipeline.definitions as definitions import mkidpipeline.config as config from astropy.io import fits import logging import pkg_resources as pkg import csv import astropy.units as u pipe_cfg ='/work/steiger/new_pipeline_testing/pipe.yaml' out_cfg='/work/steiger/new_pipeline_testing/out.yaml' data_cfg='/work/...
4,689
35.356589
119
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/tests/test_metadata.py
from mkidpipeline.config import * import mkidpipeline as pipe from io import StringIO df = '/scratch/baileyji/mec/data.yml' pf = '/scratch/baileyji/mec/pipe.yml' of = '/scratch/baileyji/mec/out.yml' h5 = '/scratch/baileyji/mec/h5raw.h5' pipe.logtoconsole() df='/scratch/steiger/MEC/HD1160/data_HD1160.yml' pcfg = pi...
758
26.107143
65
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/tests/test_wavecal.py
#!/bin/env python3 import mkidpipeline.definitions as definitions import mkidpipeline.config as config import mkidpipeline.pipeline as pipe import pkg_resources as pkg import mkidcore.corelog mkidcore.corelog.getLogger('mkidcore', setup=True, configfile=pkg.resource_filename('mkidpipeline', ...
913
40.545455
104
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/tests/h5speed.py
import os #Dark has 16 cores, 2 threads/core os.environ['NUMEXPR_MAX_THREADS'] = '64' os.environ['NUMEXPR_NUM_THREADS'] = '16' import numexpr import numpy as np import tables import time, timeit, copy, pickle, hashlib, re, collections, ast from pkg_resources import resource_filename import matplotlib.pyplot as plt impo...
33,663
47.507205
267
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/flatcal.py
import os import multiprocessing as mp import time import matplotlib.pyplot as plt import numpy as np from matplotlib import gridspec from mpl_toolkits.axes_grid1 import make_axes_locatable import mkidpipeline.definitions as definitions from mkidpipeline.steps import wavecal from mkidpipeline.photontable import Photon...
32,890
48.834848
121
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/speccal.py
""" The speccal takes in an MKID wavelength cube in arbitrary 'counts' units and converts it to a wavelength cube with the same dimensions but in units of ergs/s/cm^2/angstroms. The speccal first loads a standard spectrum which can be specified by a two column text file in the data.yaml, or it is pulled directly from ...
35,029
48.199438
142
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/sample.py
import mkidpipeline.config from mkidcore.pixelflags import FlagSet class StepConfig(mkidpipeline.config.BaseStepConfig): yaml_tag = u'!samplestep_cfg' REQUIRED_KEYS = (('parameter1', 2, 'comment about parameter1, list allowed values here'), ('parameter2', 'string val', 'comment about para...
1,978
42.021739
121
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/drizzler.py
""" Classes DrizzleParams : Calculates and stores the relevant info for Drizzler Canvas : Called by the "Drizzler" classes. Generates the canvas that is drizzled onto Drizzler : Generates a spatially dithered 4-cube (xytw) DrizzledData : Saves the drizzled data as FITS Functions ...
38,371
51.492476
125
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/wavecal.py
import os import queue import warnings from logging import getLogger import numpy as np import multiprocessing as mp import time from distutils.spawn import find_executable import progressbar as pb import scipy import astropy.constants import matplotlib from matplotlib import gridspec from matplotlib.widgets import Bu...
137,676
49.21043
123
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/buildhdf.py
import os import tables import time import numpy as np import multiprocessing as mp from mkidcore.corelog import getLogger from mkidcore.config import yaml import mkidcore.utils from mkidcore.objects import Beammap from mkidcore.instruments import InstrumentInfo from mkidpipeline.photontable import Photontable import...
13,199
44.993031
127
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/cosmiccal.py
""" Author: Clarissa Rizzo, Isabel Lipartito, Noah Swimmer Cosmic Cleaner is a class that will find the cosmic correction and will create a file that has the associated ObsFile name (beginning timestamp) as well as a list of the timestamps to be removed plus some metadata, such as the cutout times before and after the ...
11,793
49.836207
131
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/lincal.py
""" To preserve the phase response of each pixel to an incident photon, a dead time is enforced on each pixel immediately following a photon event. This prevents a subsequent photon from falling on the decay tail of the previous one, but also causes a non-linear response at high count rates. The lincal corrects for th...
5,352
46.371681
120
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/output.py
from importlib import import_module import pkgutil import multiprocessing as mp import time from collections import defaultdict import functools import os import mkidpipeline.definitions as definitions import mkidcore.pixelflags from mkidcore.config import getLogger import mkidpipeline.config as config from mkidpipeli...
3,721
42.788235
133
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/pixcal.py
""" The pixcal applies the pixcal.hot, pixcal.cold and pixcal.dead flags to hot, cold, and dead pixels respectively so that they can be removed from future calibration and analysis if desired. hot, cold, and dead pixels are defined differently depending on the pixel calibration `method` specified in the pipe.yaml. `th...
20,329
48.828431
120
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/wcscal.py
import mkidpipeline.config import numpy as np import matplotlib.pyplot as plt from mkidpipeline.utils.smoothing import astropy_convolve from mkidpipeline.utils.photometry import fit_sources from astropy.coordinates import SkyCoord import astropy.units as u from mkidpipeline.photontable import Photontable from mkidcore....
20,405
44.549107
120
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/steps/movies.py
import os import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as manimation from astropy.wcs import WCS import astropy.units as u import skimage.restoration as restoration from astropy.io import fits from astropy.visualization import ImageNormalize, AsinhStretch, LinearStretch, \ LogStret...
13,865
43.159236
121
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/conex2pixels.py
#!/usr/bin/env python3 import os import numpy as np import skimage.transform as tf import matplotlib.pyplot as plt from matplotlib.patches import Rectangle from photutils import DAOStarFinder, centroids, centroid_2dg from scipy.stats import chisquare from astropy import stats from mkidpipeline.definitions import MKIDD...
4,290
45.139785
133
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/wavecal_models.py
import os import copy import astropy import warnings import numpy as np import lmfit as lm from cycler import cycler import scipy.optimize as opt from scipy.signal import find_peaks from inspect import signature from matplotlib import pyplot as plt from scipy.special import erfc, erfcx import mkidcore.corelog as pipel...
48,281
41.841171
122
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/plotting.py
import numpy as np import numpy.ma as ma import matplotlib import matplotlib.cbook as cbook import matplotlib.pyplot as plt from matplotlib.colors import Normalize import matplotlib as mpl """ Plotting tools for quick array viewing Adapted from tutorials from python4astronomers. Credit to authors: Tom Aldcroft, Tom Rob...
15,567
35.890995
156
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/snr.py
from mkidpipeline.utils.photometry import * import numpy as np import matplotlib.pyplot as plt def signal_to_noise(image, num_apertures, center, dist, pa, radius, save_path=None, aper_idx=None, trim=0): """ function to calculate the signal to noise of a target using aperture photometry. This code takes a seri...
4,368
39.082569
118
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/memory.py
import multiprocessing as mp import os import threading from collections import defaultdict from contextlib import AbstractContextManager import psutil import time from logging import getLogger allocated = mp.Value('d', 0.0) CHECK_INTERVAL = .5 PIPELINE_MAX_RAM = min(192 * 1024**3, psutil.virtual_memory().total) PIPE...
6,832
36.338798
121
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/pdfs.py
""" Author: Seth Meeker Date: Feb 11, 2017 Define some probability density functions for fitting speckle histograms """ import matplotlib.pyplot as plt import numpy as np from mpmath import hyp1f1 from scipy import special from scipy.optimize.minpack import curve_fit from scipy.special import factorial from s...
5,043
33.312925
110
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/output_validation.py
import mkidpipeline.definitions as definitions import mkidpipeline.config as config from astropy.io import fits from mkidcore.corelog import getLogger import pkg_resources as pkg import csv def validate(outputs): for o in outputs: open_close(o) fits_keys(o) dimensions(o) calibratio...
3,556
31.336364
114
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/resampling.py
import numpy as np import scipy def rebin_2d(a, ysize, xsize): """ Rebin an array to a SMALLER array. Rescales the values such that each element in the output array is the mean of the elememts which it encloses in the input array (i.e., not the total). Similar to the IDL rebin function. Dimensions ...
2,242
39.053571
135
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/photometry.py
""" Author: Sarah Steiger Date: 11/24/2020 Photometry utility functions """ import numpy as np from astropy.table import Table from photutils.detection import IRAFStarFinder from photutils.psf import IntegratedGaussianPRF, DAOGroup from photutils.background import MMMBackground, MADStdBackgroundRMS fro...
17,829
47.583106
142
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/fitting.py
import numpy as np from scipy.optimize.minpack import curve_fit import math from mkidpipeline.utils.resampling import rebin_2d def fit_blackbody(wvls, flux, fraction=1.0, new_wvls=None, temp_guess=8600): """ Seth 11/13/14 Simple blackbody fitting function that returns BB temperature and fluxes if requested...
3,584
37.967391
117
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/__init__.py
0
0
0
py
MKIDPipeline
MKIDPipeline-master/mkidpipeline/utils/binparse.py
""" binparse.py Author: Kristina Davis Oct 2018 This code is somewhat based on darkBinViewer.py from Seth+group. It is meant to be a sightweight module to parse individual or a series of .bin files and construct imaging or spectral datacubes, where image cubes are sequenced in time (pix value is total # counts per tim...
10,454
38.011194
119
py