repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_unique.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# unique paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
data_type = "float32"
def unique(name: str, x, **op_args):
paddle.enable_static()
with paddle.static.program_gua... | 79 | 2,457 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_mul.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from save_model import saveModel
import sys
def paddle_matmul(name, x1, x2, x_transpose=False, y_transpose=False):
import paddle
paddle.enable_static()
with paddle.static.program_guard(paddle.static.Progr... | 56 | 2,196 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_flip.py | .py | #
# flip paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
def flip(name: str, x, axis, is_dynamic=False):
paddle.enable_static()
with paddle.static.program_guard(paddle.static.Program(), paddle.static.Program()):
if is_dynamic:
data = p... | 74 | 1,984 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_eye.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# fill_const paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
def eye(name : str, rows, cols = None, dtype = None):
paddle.enable_static()
with paddle.static.program_guard(... | 42 | 1,406 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_log.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# log paddle model generator
#
import numpy as np
from save_model import saveModel
import paddle
import sys
def log(name: str, x, data_type='float32'):
paddle.enable_static()
with paddle.static.program_guard(paddle.static.Pr... | 46 | 1,214 |
openvino | src/frontends/paddle/tests/test_models/gen_scripts/generate_logical_not.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# logical_not paddle model generator
#
import numpy as np
from save_model import saveModel
import sys
def equal_logical_not(name : str, x, y):
import paddle
paddle.enable_static()
with paddle.static.program_guard(paddle.... | 49 | 1,396 |
openvino | src/frontends/tensorflow/docs/check_supported_ops.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import re
import sys
not_supported_ops_with_translators = ["WriteFile"]
def run_in_ci():
if "CI" in os.environ and os.environ["CI"].lower() == "true":
return True
if "TF_BUILD" in os.environ and len(os.envir... | 81 | 2,698 |
openvino | src/frontends/tensorflow/tests/test_models/gen_wrapper.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import shutil
import subprocess
import sys
# do not print messages from TensorFlow
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
if len(sys.argv) < 4:
print("Script[model in pbtxt format], output folder and mark file must be s... | 35 | 1,013 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_model_with_assert.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# model with Assert node generator
#
import os
import sys
import numpy as np
import tensorflow as tf
def main():
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
... | 39 | 1,135 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_metagraph_variables.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# Create the graph and model
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
x_value = [[1.,2.,3.],[3.,2.,1.]]
z_value = [[2.,2.,1.],[1.,1.,2.]]
tf_x = tf... | 37 | 1,689 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_program-only.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# Create the graph and model
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
x_value = [[1.,2.,3.],[3.,2.,1.]]
tf_x = tf.constant(x_value)
tf_y = tf.compa... | 17 | 578 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/split_in_function.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow.compat.v1 as tf
import numpy as np
def main():
tf.compat.v1.reset_default_graph()
@tf.function
def second_func(x):
x1, x2, x3 = tf.split(x, 3)
return x1 + x2 + x3
... | 31 | 691 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_nonexistent_add.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# unsupported add tensorflow model generator
#
import numpy as np
import os
import sys
import tensorflow as tf
def main():
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as s... | 41 | 1,129 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_variables.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# Create the graph and model
class AddVariable(tf.Module):
def __init__(self):
super(AddVariable, self).__init__()
self.var1 = tf.Variable(123.0)
@tf.function(input_signature=[tf... | 20 | 527 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_malicious_overflow.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import struct
import sys
def encode_varint(value):
"""Encode an integer as a protobuf varint."""
result = bytearray()
while value > 0x7F:
result.append((value & 0x7F) | 0x80)
value >>= 7
result... | 220 | 8,190 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_2in_2out.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import numpy as np
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
input1 = tf.compat.v1.placeholder(tf.float32, [1, 3, 3, 1], 'inpu... | 39 | 1,322 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_unitialized_variablev2.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
placeholder = tf.raw_ops.Placeholder(dtype=tf.float32, shape=[3, 2], name='x')
va... | 20 | 768 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_control_dependency.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import numpy as np
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
input1 = tf.compat.v1.placeholder(tf.float32, [2, 3], 'input1')
... | 25 | 713 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_multi-graph.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
export_dir = os.path.join(sys.argv[1], "saved_model_multi-graph")
#Slash replacing required because otherwise fails on Windows
builder = tf.compat.v1.saved_model.Builder(export_dir if os.na... | 49 | 1,951 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_partitioned_call_with_conv.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import numpy as np
import tensorflow.compat.v1 as tf
def main():
'''
This test model aims to test that the conversion for the body graphs is performed with set input shapes
that allows to get more opti... | 39 | 1,304 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/__init__.py | .py | # do not print messages from TensorFlow
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' | 3 | 90 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_empty_tensor_list.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
tensor = tf.compat.v1.placeholder(tf.float32, [2, 3, 5], name='data')
element_sh... | 26 | 1,093 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_parameter_result.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# This test model aims to cover conversion of SavedModel with multiple tensor names for output
# among which TF FE needs to remain only user specific names and exclude internal tensor names... | 26 | 877 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_ragged_tensor_to_sparse.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow.compat.v1 as tf
def main():
tf.compat.v1.reset_default_graph()
@tf.function
def second_func(strings, row_splits):
sparse_indices, sparse_values, sparse_dense_shape = tf.raw_o... | 36 | 1,307 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_dynamic_type_model.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# dynamic type is below FW node for unsupported operation
#
import os
import sys
import tensorflow as tf
def main():
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
... | 39 | 1,057 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_partitioned_call_with_unique.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow.compat.v1 as tf
def main():
tf.compat.v1.reset_default_graph()
@tf.function
def second_func(x):
relu = tf.raw_ops.Relu(features=x)
y, idx = tf.raw_ops.Unique(x=relu)
... | 34 | 896 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_conv_with_dynamic_input_channel.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# Create the graph and model
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
filter = tf.constant(value=0, shape=[3, 3, 6, 6], dtype=tf.float32)
input = tf.co... | 20 | 781 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_broadcast_issue.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
import numpy as np
# Create the graph and model
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
tf_x = tf.constant(np.array([[1, 2]], dtype=np.dtype('i8')))
t... | 19 | 746 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_with_gather.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# This test model aims to cover conversion of SavedModel with integer input types
class ModelWithGather(tf.Module):
def __init__(self):
super(ModelWithGather, self).__init__()
... | 24 | 743 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_nms_named_outputs.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow.compat.v1 as tf
def main():
tf.compat.v1.reset_default_graph()
@tf.function
def second_func(boxes, scores):
# the second function is used to obtain the body graph with NonMax... | 46 | 2,044 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_gather_with_string_table.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
params = tf.constant(["First sentence", "Second sentence sentence", "Third"], dtype=t... | 19 | 717 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_oob_index.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# What: Generates 7 malicious TF SavedModel directories that trigger security guards in
# VariablesIndex::map_assignvariable() (variables_index.cpp).
# No TF runtime needed — all protobuf and SSTable structures are built by h... | 776 | 34,667 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_unsupported_relu.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# unsupported relu tensorflow model generator
#
import numpy as np
import os
import sys
import tensorflow as tf
def main():
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as ... | 39 | 1,010 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_unsupported_op_itergetnext.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import os
import sys
import tensorflow as tf
def main():
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
iteratorv2 = tf.raw_ops.IteratorV2(shared_name="iterator", container="... | 39 | 1,407 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_tf1_if_with_nonexistent_op.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import numpy as np
import tensorflow as tf
from tensorflow.python.framework.convert_to_constants import convert_variables_to_constants_v2
# generate a model with TF1 If operation that contains unsupported operatio... | 60 | 2,187 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_resource_gather_model.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import numpy as np
import tensorflow as tf
def main():
# this test model imitates a sub-graph of one model with ResourceGather from our model scope
tf.compat.v1.reset_default_graph()
with tf.compat.v1... | 54 | 2,349 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_intermediate_output.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# Create the graph and model
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
input1 = tf.compat.v1.placeholder(dtype=tf.float32, shape=[2], name='input1')
inp... | 19 | 793 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_saved_model_with_numerical_names.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
# Create the graph and model
tf.compat.v1.reset_default_graph()
with tf.compat.v1.Session() as sess:
tf_x = tf.compat.v1.placeholder(dtype=tf.float32, shape=[1], name='0')
tf_y = tf.... | 19 | 751 |
openvino | src/frontends/tensorflow/tests/test_models/gen_scripts/generate_string_lower.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import tensorflow as tf
tf.compat.v1.reset_default_graph()
# Create the graph and model
with tf.compat.v1.Session() as sess:
sentences = tf.compat.v1.placeholder(tf.string, [2], name='sentences')
tf.raw_ops... | 17 | 544 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/model_tf1_while.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
tf.reset_default_graph()
# Note: run this script in TensorFlow 1 environment to generate model_tf1_while.pbtxt
# The model with Switch, NextIteration and other TF1 While stuff cannot be generated in TF... | 20 | 673 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/concat_with_non_constant_axis.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
tf.reset_default_graph()
with tf.Session() as sess:
x = tf.placeholder(dtype=tf.float32, shape=[4, 3], name='x')
y = tf.placeholder(dtype=tf.float32, shape=[2, 3], name='y')
z = tf.placeho... | 20 | 665 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/forward_edge_model.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
tf.reset_default_graph()
with tf.Session() as sess:
const2 = tf.constant(2.0, dtype=tf.float32)
x = tf.placeholder(dtype=tf.float32, shape=[2, 3], name='x')
relu = tf.nn.relu(x)
add = ... | 20 | 584 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/partitioned_call2.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
@tf.function
def second_func(x):
x = tf.raw_ops.TopKV2(input=x, k=tf.constant(3, tf.int32))[1]
x = tf.add(x, tf.constant(10, tf.int32))
return x
@tf.function
def first_func(x, y):
ret... | 22 | 623 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/model_with_if.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
from tensorflow.python.framework import function
tf.reset_default_graph()
@function.Defun(tf.int32, tf.int32)
def then_branch_func(x, y):
return x + y
@function.Defun(tf.int32, tf.int32)
def els... | 31 | 861 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/undefined_input_shape.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
tf.reset_default_graph()
with tf.Session() as sess:
x = tf.placeholder(dtype=tf.float32, shape=None, name='x')
y = tf.placeholder(dtype=tf.float32, shape=[2, 3], name='y')
z = tf.placehold... | 18 | 545 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/forward_edge_model2.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
tf.reset_default_graph()
with tf.Session() as sess:
const2 = tf.constant(2.0, dtype=tf.float32)
x = tf.placeholder(dtype=tf.float32, shape=[2, 3], name='x')
relu = tf.nn.relu(x)
mul = ... | 20 | 585 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/injected_body_and_if.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
from tensorflow.python.framework import function
tf.reset_default_graph()
@function.Defun(tf.int32)
def aux_func(x):
return x ** 2
@function.Defun(tf.int32, tf.int32)
def then_branch_func(x, y):... | 36 | 941 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/partitioned_call.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
@tf.function
def second_func(x):
return x ** 2
@tf.function
def first_func(x, y):
return second_func(x - y)
graph_def = first_func.get_concrete_function(tf.constant([6, 3]), tf.constant([7]... | 19 | 418 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/model_with_output_shapes_attr.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
tf.reset_default_graph()
with tf.Session() as sess:
x = tf.placeholder(dtype=tf.float32, shape=[2,3], name='x')
tf.nn.relu(x, name="relu")
tf.global_variables_initializer()
sess.graph... | 16 | 443 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/model_switch_merge_several_cond_flows.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# Documents how model_switch_merge_several_cond_flows.pbtxt was produced.
# Two Switch nodes: `Switch` feeds real data (AddV2/Sub -> Merge); `Switch_1` is consumed only
# through control dependencies, so the frontend prunes and frees it ... | 36 | 1,489 |
openvino | src/frontends/tensorflow/tests/test_models/models_pbtxt/string_tensors_model.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tensorflow.compat.v1 as tf
tf.reset_default_graph()
# Create the graph and model
with tf.Session() as sess:
x = tf.placeholder(tf.float32, [2, 3], 'x')
y = tf.placeholder(tf.float32, [2, 3], 'y')
cond = tf.constant(Tr... | 20 | 805 |
openvino | src/frontends/onnx/docs/check_supported_ops.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import re
import sys
from pathlib import Path
def run_in_ci():
if "CI" in os.environ and os.environ["CI"].lower() == "true":
return True
if "TF_BUILD" in os.environ and len(os.environ["TF_BUILD"]):
ret... | 153 | 6,066 |
openvino | src/frontends/onnx/tests/onnx_prototxt_converter.py | .py | #!/usr/bin/env python
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Converts protobuf files from binary message format into prototxt format and vice-versa.
Supports files with only '.onnx' or '.prototxt' extensions. Application may accept only single
argument denoting input fil... | 93 | 3,067 |
openvino | src/frontends/onnx/tests/runtime.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Provide a layer of abstraction for an OpenVINO runtime environment."""
import logging
from typing import Union
import numpy as np
from openvino import Core, Type
from openvino.exceptions import UserInputErr... | 193 | 9,133 |
openvino | src/frontends/onnx/tests/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
# test.BACKEND_NAME is a configuration variable determining which
# OV backend tests will use. It's set during pytest configuration time.
# See `pytest_configure` hook in `conftest.py` for more deta... | 221 | 15,914 |
openvino | src/frontends/onnx/tests/conftest.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import pytest
import tests
import logging
from pathlib import Path
def _get_default_model_zoo_dir():
return Path(os.getenv("ONNX_HOME", Path.home() / ".onnx/model_zoo"))
def pytest_a... | 118 | 4,269 |
openvino | src/frontends/onnx/tests/tests_python/test_frontend_onnx.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import io
import os
import onnx
import numpy as np
from onnx.helper import make_graph, make_model, make_tensor_value_info
import pytest
from pathlib import Path
from itertools import chain
import tempfile
import s... | 890 | 30,320 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_unary.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from onnx.helper import make_graph, make_model, make_node, make_tensor_value_info
from openvino.exceptions import OVTypeError
from tests.runtime import get_runtime
fro... | 513 | 18,722 |
openvino | src/frontends/onnx/tests/tests_python/test_frontend_onnx_editor.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import numpy as np
import onnx
import pytest
from onnx.helper import make_graph, make_model, make_tensor_value_info
from openvino.frontend import FrontEndManager, GeneralFailure
from openvino import Di... | 1,934 | 72,020 |
openvino | src/frontends/onnx/tests/tests_python/test_backend.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import platform
import logging
import onnx.backend.test
from tests import (
BACKEND_NAME,
skip_rng_tests,
xfail_issue_33488,
xfail_issue_33596,
xfail_issue_33606,
xfail_issue_33651,
xf... | 887 | 47,552 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_nonlinear.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from tests.tests_python.utils import run_node
def import_and_compute(op_type, input_data, **node_attrs):
data_inputs = [np.array(input_data)]
node = onnx.hel... | 109 | 4,335 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_batchnorm.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
from tests.tests_python.utils import run_node
def make_batch_norm_node(**node_attributes):
return onnx.helper.make_node(
"BatchNormalization", inputs=["X", "scale", "B... | 86 | 3,305 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_logical.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from tests.tests_python.utils import run_node
@pytest.mark.parametrize(
("onnx_op", "numpy_func", "data_type"),
[
pytest.param("And", np.logical_and,... | 46 | 1,727 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_matmul.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
from onnx.helper import make_graph, make_model, make_node, make_tensor_value_info
import pytest
from tests.runtime import get_runtime
from tests.tests_python.utils import import_onn... | 162 | 6,450 |
openvino | src/frontends/onnx/tests/tests_python/test_onnx_external_data.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import numpy as np
from openvino import Core
import shutil
import pytest
from tests.runtime import get_runtime
external_data_model_current_folder_path = "external_data.onnx"
external_data_model_full_p... | 46 | 1,561 |
openvino | src/frontends/onnx/tests/tests_python/test_zoo_models.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import tests
import logging
import pprint
from operator import itemgetter
from pathlib import Path
from typing import Any
from collections.abc import Sequence
import numpy as np
from tests.tests_python.utils import OpenVinoOnnxBackend
f... | 228 | 10,886 |
openvino | src/frontends/onnx/tests/tests_python/test_frontend_extension.py | .py | # -*- coding: utf-8 -*- noqa: E999
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import os
from openvino.frontend import FrontEndManager
TENSORFLOW_FRONTEND_NAME = "tf"
PADDLE_FRONTEND_NAME = "paddle"
imported_frontends = []
try:
from pybind_mock_frontend impor... | 105 | 3,521 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_random.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
from tests.tests_python.utils import run_node
def test_random_uniform():
low = 90.0
high = 100.0
node = onnx.helper.make_node(
"RandomUniform",
inputs... | 54 | 1,173 |
openvino | src/frontends/onnx/tests/tests_python/test_frontend_lib_close.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import onnx
import pytest
from onnx.helper import make_graph, make_model, make_tensor_value_info
from openvino.frontend import FrontEndManager
def make_onnx_model(model_name: str) -> None:
"""Make ... | 82 | 2,428 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_reduction.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from tests import xfail_issue_99962
from tests.runtime import get_runtime
from tests.tests_python.utils import (
run_node,
import_onnx_model,
)
reduce_data = ... | 360 | 15,535 |
openvino | src/frontends/onnx/tests/tests_python/test_onnx_import.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import numpy as np
import onnx
from onnx.helper import make_graph, make_model, make_node, make_tensor_value_info
from openvino import Core
from tests.runtime import get_runtime
from tests.tests_python.... | 67 | 2,120 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_reshape.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from onnx.helper import make_graph, make_model, make_node, make_tensor_value_info
from tests.runtime import get_runtime
from tests.tests_python.utils import (
all_... | 453 | 17,276 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_binary.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from onnx.helper import make_graph, make_model, make_tensor_value_info
from tests.tests_python.utils import run_model
def import_and_compute(op_type, input_data_left... | 135 | 5,437 |
openvino | src/frontends/onnx/tests/tests_python/test_frontendmanager.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pickle
import os
from pathlib import Path
from openvino import PartialShape
from openvino.frontend import FrontEndManager, InitializationFailure, TelemetryExtension
from openvino.utils.types import get_ele... | 718 | 21,979 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_convpool.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import pytest
from onnx.helper import make_graph, make_model, make_node, make_tensor_value_info
from onnx.onnx_cpp2py_export.checker import ValidationError
from tests.runtime import... | 400 | 15,422 |
openvino | src/frontends/onnx/tests/tests_python/test_ops_variadic.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from functools import reduce
import numpy as np
import onnx
import pytest
from tests.tests_python.utils import run_node
@pytest.mark.parametrize(
("onnx_op", "numpy_func"), [("Sum", np.add), ("Min", np.min... | 45 | 1,245 |
openvino | src/frontends/onnx/tests/tests_python/utils/onnx_backend.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""ONNX Backend implementation.
See ONNX documentation for details:
https://github.com/onnx/onnx/blob/master/docs/Implementing%20an%20ONNX%20backend.md
"""
from typing import Any, Optional, Text
from collections... | 137 | 4,723 |
openvino | src/frontends/onnx/tests/tests_python/utils/onnx_helpers.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
from openvino import Core, Tensor, Model
def import_onnx_model(model: onnx.ModelProto) -> Model:
onnx.checker.check_model(model)
model_byte_string = model.SerializeToStrin... | 18 | 447 |
openvino | src/frontends/onnx/tests/tests_python/utils/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from string import ascii_uppercase
from collections.abc import Iterable
from typing import Any, Optional, Text
import numpy as np
import onnx
from onnx.helper import make_graph, make_model, make_node, make_tensor... | 87 | 3,660 |
openvino | src/frontends/onnx/tests/tests_python/utils/model_importer.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import onnx
import onnx.backend.test
import unittest
import dataclasses
from collections import defaultdict
from collections.abc import Callable, Sequence
from onnx import numpy_helper, NodePro... | 180 | 7,215 |
openvino | src/bindings/python/docs/examples/openvino/mymodule/myclass.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
class MyClass():
"""MyClass created as part of tutorial."""
def __init__(self):
pass
def say_hello(self):
"""Say hello to the world!"""
print("Hello! Let's work on OV together... | 14 | 324 |
openvino | src/bindings/python/docs/examples/custom_module/custom_helpers.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
def top1_index(results: list) -> int:
return results.index(max(results))
| 7 | 184 |
openvino | src/bindings/python/tests/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
skip_devtest = pytest.mark.skip(reason="Test might depend on machine, should be run by developers"
"or advanced users for debug/testing purposes.")
skip_need_... | 11 | 418 |
openvino | src/bindings/python/tests/test_package_versions.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import openvino.preprocess as ov_pre
import openvino as ov
import openvino.frontend as ov_front
import openvino._offline_transformations as ov_off_transf
import openvino._pyopenvino as ov_py
def test_get_version... | 30 | 728 |
openvino | src/bindings/python/tests/conftest.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import pytest
def pytest_configure(config):
# register additional markers
config.addinivalue_line("markers", "skip_on_cpu: Skip test on CPU")
config.addinivalue_line("markers", "skip_on_gp... | 24 | 886 |
openvino | src/bindings/python/tests/test_transformations/test_pattern_ops.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
import pytest
from openvino import PartialShape, Symbol, Dimension
from openvino import opset13 as ops
from openvino.passes import Matcher, WrapType, Or, AnyInput, Optional
from openvino.passes ... | 433 | 17,911 |
openvino | src/bindings/python/tests/test_transformations/test_compression.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.op import Parameter, Constant
from openvino.opset13 import add, multiply
import openvino as ov
from tests.utils.helpers import create_filenames_for_ir
def make_constant(values, ... | 114 | 4,745 |
openvino | src/bindings/python/tests/test_transformations/test_compression_4bit.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino import opset13 as opset
import openvino as ov
import pytest
@pytest.mark.parametrize(
("ov_type", "numpy_dtype"),
[
(ov.Type.f32, np.float32),
(ov.Type.... | 102 | 2,774 |
openvino | src/bindings/python/tests/test_transformations/test_manager.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.passes import Manager, GraphRewrite, BackwardGraphRewrite, Serialize
from tests.test_transformations.utils.utils import MyModelPass, PatternReplacement, expect_exception
def test_registration_and_p... | 42 | 1,523 |
openvino | src/bindings/python/tests/test_transformations/test_public_transformations.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import pytest
import numpy as np
from openvino import Model, PartialShape, Shape, Core
from openvino import opset13 as ops
from openvino.passes import (
Manager,
ConstantFolding,
MakeStateful... | 167 | 5,083 |
openvino | src/bindings/python/tests/test_transformations/test_offline_api.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import pytest
import numpy as np
from openvino._offline_transformations import (
apply_moc_transformations,
apply_low_latency_transformation,
apply_pruning_transformation,
apply_make_stat... | 432 | 15,797 |
openvino | src/bindings/python/tests/test_transformations/test_matcher_pass.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino import opset8
from openvino.passes import Manager, Matcher, MatcherPass, WrapType
from openvino.utils import replace_node
from tests.test_transformations.utils.utils import count_ops, get_relu_model,... | 58 | 1,841 |
openvino | src/bindings/python/tests/test_transformations/test_model_pass.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.passes import Manager
from tests.test_transformations.utils.utils import get_relu_model, MyModelPass
def test_model_pass():
manager = Manager()
model_pass = manager.register_pass(MyModelPas... | 22 | 555 |
openvino | src/bindings/python/tests/test_transformations/test_graph_rewrite.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino import opset8
from openvino.passes import Manager, GraphRewrite, MatcherPass, WrapType, Matcher
from tests.test_transformations.utils.utils import count_ops, get_relu_model, PatternReplacement
def ... | 75 | 2,299 |
openvino | src/bindings/python/tests/test_transformations/test_replacement_api.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino import Model, PartialShape
from openvino import opset13 as ops
from openvino.utils import replace_node, replace_output_update_name
def get_relu_model():
# Parameter->Relu->Result
param = op... | 66 | 2,226 |
openvino | src/bindings/python/tests/test_transformations/utils/utils.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino import Model, PartialShape
from openvino import opset13 as ops
from openvino.passes import ModelPass, Matcher, MatcherPass, WrapType
def get_relu_model():
# Parameter->Relu->Result
param = ... | 79 | 2,237 |
openvino | src/bindings/python/tests/test_runtime/test_core.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import sys
import numpy as np
import os
from pathlib import Path
from openvino import (
Model,
Core,
Tensor,
PartialShape,
CompiledModel,
tensor_from_file,
compile_model,... | 537 | 17,871 |
openvino | src/bindings/python/tests/test_runtime/test_type.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
import numpy as np
from openvino import Type
@pytest.mark.parametrize(("dtype_string", "dtype", "ovtype"), [
("float16", np.float16, Type.f16),
("float32", np.float32, Type.f32),
("flo... | 136 | 5,257 |
openvino | src/bindings/python/tests/test_runtime/test_remote_api.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import pytest
import numpy as np
import openvino as ov
from tests.utils.helpers import get_relu_model
@pytest.mark.skipif(
"CPU" not in os.environ.get("TEST_DEVICE", ""),
reason="Test can be... | 270 | 9,400 |
openvino | src/bindings/python/tests/test_runtime/test_tensor.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from copy import deepcopy, copy
import os
import subprocess
import sys
import numpy as np
import openvino as ov
import openvino.opset13 as ops
from openvino.helpers import pack_data, unpack_data
import pytest
... | 779 | 25,919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.