diff --git a/e2e/integration_tests/convert_predict.py b/e2e/integration_tests/convert_predict.py index f72fab9536..a44b96aaaa 100644 --- a/e2e/integration_tests/convert_predict.py +++ b/e2e/integration_tests/convert_predict.py @@ -42,7 +42,7 @@ from tensorflow.python.framework import dtypes from tensorflow.python.framework import tensor_spec from tensorflow.python.ops import variables -from tensorflow.python.training.tracking import tracking +from tensorflow.python.trackable import autotrackable from tensorflow.python.saved_model.save import save import tensorflow_hub as hub import tensorflowjs as tfjs @@ -182,7 +182,7 @@ def _create_saved_model_v2(save_dir): save_dir: directory name of where the saved model will be stored. """ input_data = constant_op.constant(1., shape=[1]) - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3.) root.v2 = variables.Variable(2.) root.f = def_function.function(lambda x: root.v1 * root.v2 * x) @@ -211,7 +211,7 @@ def square_if_positive(v): v = v + 1 return v - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.f = square_if_positive to_save = root.f.get_concrete_function( tensor_spec.TensorSpec([], dtypes.float32)) @@ -290,7 +290,7 @@ def _create_saved_model_v2_complex64(save_dir): save_dir: directory name of where the saved model will be stored. """ input_data = constant_op.constant(1., shape=[1]) - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3 + 1j, dtype=tf.complex64) root.f = def_function.function(lambda x: tf.complex(x, x) + root.v1) to_save = root.f.get_concrete_function(input_data) diff --git a/e2e/integration_tests/metadata.py b/e2e/integration_tests/metadata.py index ffab7ce26a..31a5770240 100644 --- a/e2e/integration_tests/metadata.py +++ b/e2e/integration_tests/metadata.py @@ -42,7 +42,7 @@ from tensorflow.python.framework import dtypes from tensorflow.python.framework import tensor_spec from tensorflow.python.ops import variables -from tensorflow.python.training.tracking import tracking +from tensorflow.python.trackable import autotrackable from tensorflow.python.saved_model.save import save import tensorflow_hub as hub import tensorflowjs as tfjs @@ -79,7 +79,7 @@ def _create_model_with_metadata(): def _create_saved_model(save_dir): input_data = constant_op.constant(1., shape=[1]) - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3.) root.v2 = variables.Variable(2.) root.f = def_function.function(lambda x: root.v1 * root.v2 * x) diff --git a/e2e/karma.conf.js b/e2e/karma.conf.js index de65babfbd..3324cab277 100644 --- a/e2e/karma.conf.js +++ b/e2e/karma.conf.js @@ -144,6 +144,10 @@ module.exports = function(config) { config.set({ ...extraConfig, + reporters: [ + 'spec', + 'jasmine-order', + ], browsers: ['Chrome'], browserStack: { username: process.env.BROWSERSTACK_USERNAME, @@ -182,9 +186,9 @@ module.exports = function(config) { }, bs_ios_12: { base: 'BrowserStack', - device: 'iPhone X', - os: 'iOS', - os_version: '11.0', + device: 'iPhone XS', + os: 'ios', + os_version: '12.3', real_mobile: true }, bs_android_10: { diff --git a/e2e/package.json b/e2e/package.json index bfd54ee5a1..eab1b88f73 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -30,6 +30,7 @@ "karma-browserstack-launcher": "~1.6.0", "karma-chrome-launcher": "~3.1.1", "karma-jasmine": "~1.1.0", + "karma-jasmine-order-reporter": "^1.1.0", "karma-spec-reporter": "~0.0.32", "karma-typescript": "~5.5.1", "karma-typescript-es6-transform": "^5.1.0", diff --git a/e2e/yarn.lock b/e2e/yarn.lock index 64610090d6..d7f3dd60e8 100644 --- a/e2e/yarn.lock +++ b/e2e/yarn.lock @@ -2855,10 +2855,15 @@ karma-chrome-launcher@~3.1.1: dependencies: which "^1.2.1" +karma-jasmine-order-reporter@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/karma-jasmine-order-reporter/-/karma-jasmine-order-reporter-1.1.0.tgz#3bd4cfd9e5ae53cc0d972905b811a479c127d0a8" + integrity sha512-mzC6WfOg7y5kCf7K4W+nB5NHea1ogcDjRpepFLLRjbi4lx08wQG+6EY2zd+mC2ANIvb6+ux2d9mFVtZ3MIwTYg== + karma-jasmine@~1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-1.1.2.tgz#394f2b25ffb4a644b9ada6f22d443e2fd08886c3" - integrity sha1-OU8rJf+0pkS5rabyLUQ+L9CIhsM= + integrity sha512-SENGE9DhlIIFTSZWiNq4eGeXL8G6z9cqHIOdkx9jh1qhhQqwEy3tAoLRyER0vOcHqdOlKmGpOuXk+HOipIy7sg== karma-spec-reporter@~0.0.32: version "0.0.33" diff --git a/tfjs-converter/python/tensorflowjs/converters/fuse_prelu_test.py b/tfjs-converter/python/tensorflowjs/converters/fuse_prelu_test.py index 8e44c29793..ffceb14d1b 100644 --- a/tfjs-converter/python/tensorflowjs/converters/fuse_prelu_test.py +++ b/tfjs-converter/python/tensorflowjs/converters/fuse_prelu_test.py @@ -24,7 +24,7 @@ from tensorflow.python.eager import def_function from tensorflow.python.framework import constant_op from tensorflow.python.ops import variables -from tensorflow.python.training.tracking import tracking +from tensorflow.python.trackable import autotrackable from tensorflowjs.converters import fuse_depthwise_conv2d from tensorflowjs.converters import fuse_prelu @@ -242,7 +242,7 @@ def execute_model(tensor): def testNonPreluPattern(self): """Test a basic model with functions to make sure functions are inlined.""" input_data = constant_op.constant(1., shape=[1]) - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3.) root.v2 = variables.Variable(2.) diff --git a/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2_test.py b/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2_test.py index 08ba5f1541..8eb000d3d6 100644 --- a/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2_test.py +++ b/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2_test.py @@ -30,7 +30,7 @@ from tensorflow.python.framework import dtypes from tensorflow.python.framework import tensor_spec from tensorflow.python.ops import variables -from tensorflow.python.training.tracking import tracking +from tensorflow.python.trackable import autotrackable from tensorflow.python.tools import freeze_graph from tensorflow.python.saved_model.save import save import tensorflow_hub as hub @@ -190,7 +190,7 @@ def conv2d_addV2_depthwise_addV2(x): input=res, filter=filter, strides=[1, 1, 1, 1], padding="VALID") res = tf.raw_ops.AddV2(x=res, y=bias) return res - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.f = conv2d_addV2_depthwise_addV2 to_save = root.f.get_concrete_function( tensor_spec.TensorSpec([1, 1, 1, 1], dtypes.float32)) @@ -207,7 +207,7 @@ def addV2_conv2d(x): res = tf.raw_ops.Conv2D( input=res, filter=filter, strides=[1, 1, 1, 1], padding="VALID") return res - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.f = addV2_conv2d to_save = root.f.get_concrete_function( tensor_spec.TensorSpec([1, 1, 1, 1], dtypes.float32)) @@ -247,7 +247,7 @@ def _create_saved_model_with_unfusable_prelu(self): def _create_saved_model(self): """Test a basic model with functions to make sure functions are inlined.""" input_data = constant_op.constant(1., shape=[1]) - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3.) root.v2 = variables.Variable(2.) root.f = def_function.function(lambda x: root.v1 * root.v2 * x) @@ -260,7 +260,7 @@ def _create_saved_model_with_fusable_matmul(self): """Test a fusable matmul model.""" input_data = constant_op.constant(1., shape=[1, 1]) bias_data = constant_op.constant(1., shape=[1]) - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.v2 = variables.Variable([[2.]]) root.f = def_function.function( lambda x: tf.nn.relu(tf.nn.bias_add(tf.matmul(x, root.v2), @@ -278,7 +278,7 @@ def find_next_odd(v): while tf.equal(v1 % 2, 0): v1 = v1 + 1 return v1 - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.f = find_next_odd to_save = root.f.get_concrete_function( tensor_spec.TensorSpec([], dtypes.int32)) @@ -303,7 +303,7 @@ def _create_saved_model_with_tfdf(self): model.save(save_dir) def _create_unsupported_saved_model(self): - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.w = variables.Variable(tf.random.uniform([2, 2])) @def_function.function @@ -322,7 +322,7 @@ def exported_function(x): save(root, save_dir, to_save) def _create_saved_model_with_debug_ops(self): - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.w = variables.Variable(tf.random.uniform([2, 2])) @def_function.function diff --git a/tfjs-converter/python/tensorflowjs/converters/wizard_test.py b/tfjs-converter/python/tensorflowjs/converters/wizard_test.py index 024b659eb3..dce9592307 100644 --- a/tfjs-converter/python/tensorflowjs/converters/wizard_test.py +++ b/tfjs-converter/python/tensorflowjs/converters/wizard_test.py @@ -24,7 +24,7 @@ import tensorflow.compat.v2 as tf from tensorflow.python.eager import def_function from tensorflow.python.ops import variables -from tensorflow.python.training.tracking import tracking +from tensorflow.python.trackable import autotrackable from tensorflow.python.saved_model import save from tensorflowjs.converters import wizard @@ -74,7 +74,7 @@ def _create_keras_saved_model(self): def _create_saved_model(self): """Test a basic model with functions to make sure functions are inlined.""" input_data = tf.constant(1., shape=[1]) - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3.) root.v2 = variables.Variable(2.) root.f = def_function.function(lambda x: root.v1 * root.v2 * x) diff --git a/tfjs-converter/python/test_pip_package.py b/tfjs-converter/python/test_pip_package.py index b113e6f857..313323ab2c 100644 --- a/tfjs-converter/python/test_pip_package.py +++ b/tfjs-converter/python/test_pip_package.py @@ -33,7 +33,7 @@ from tensorflow.python.framework import constant_op from tensorflow.python.ops import variables from tensorflow.python.tools import freeze_graph -from tensorflow.python.training.tracking import tracking +from tensorflow.python.trackable import autotrackable from tensorflow.python.saved_model.save import save import tensorflow_hub as hub @@ -115,7 +115,7 @@ def _createTensorFlowSavedModel(save_path): """ input_data = constant_op.constant(1., shape=[1]) - root = tracking.AutoTrackable() + root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3.) root.v2 = variables.Variable(2.) root.f = def_function.function(lambda x: root.v1 * root.v2 * x) diff --git a/tfjs-node/python/int64_model.py b/tfjs-node/python/int64_model.py index 827f88a0aa..f9a50a02fa 100644 --- a/tfjs-node/python/int64_model.py +++ b/tfjs-node/python/int64_model.py @@ -21,12 +21,12 @@ from tensorflow.python.framework import constant_op from tensorflow.python.framework import dtypes from tensorflow.python.ops import variables -from tensorflow.python.training.tracking import tracking +from tensorflow.python.trackable import autotrackable from tensorflow.python.saved_model.save import save """Test a basic model with functions to make sure functions are inlined.""" input_data = constant_op.constant(1, shape=[2], dtype=tf.int64) -root = tracking.AutoTrackable() +root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3, dtype=tf.int64) root.v2 = variables.Variable(2, dtype=tf.int64) root.f = def_function.function(lambda x: root.v1 * root.v2 * x) diff --git a/tfjs-node/python/unint8_model.py b/tfjs-node/python/unint8_model.py index 733e68fc25..9d7ebd5b93 100644 --- a/tfjs-node/python/unint8_model.py +++ b/tfjs-node/python/unint8_model.py @@ -20,12 +20,12 @@ from tensorflow.python.eager import def_function from tensorflow.python.framework import constant_op from tensorflow.python.ops import variables -from tensorflow.python.training.tracking import tracking +from tensorflow.python.trackable import autotrackable from tensorflow.python.saved_model.save import save """Test a basic model with functions to make sure functions are inlined.""" input_data = constant_op.constant(1, shape=[1], dtype=tf.uint8) -root = tracking.AutoTrackable() +root = autotrackable.AutoTrackable() root.v1 = variables.Variable(3) root.v2 = variables.Variable(2) root.f = def_function.function(lambda x: root.v1 * root.v2 * tf.cast(x, tf.int32))