From 92df35e879102f0cd7dd0d97bb2a2c0fcf0d4147 Mon Sep 17 00:00:00 2001 From: Michael Reneer Date: Thu, 26 Sep 2024 08:25:58 -0700 Subject: [PATCH] Replace `tff.types.tensorflow_to_type` with `tff.tensorflow.to_type`. This is a no-op change. PiperOrigin-RevId: 679158905 --- .../building_your_own_federated_learning_algorithm.ipynb | 2 +- docs/tutorials/composing_learning_algorithms.ipynb | 2 +- docs/tutorials/custom_federated_algorithms_2.ipynb | 4 ++-- examples/simple_fedavg/simple_fedavg_tff.py | 4 ++-- examples/stateful_clients/stateful_fedavg_tff.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/tutorials/building_your_own_federated_learning_algorithm.ipynb b/docs/tutorials/building_your_own_federated_learning_algorithm.ipynb index 75c3aea140..cd093cac92 100644 --- a/docs/tutorials/building_your_own_federated_learning_algorithm.ipynb +++ b/docs/tutorials/building_your_own_federated_learning_algorithm.ipynb @@ -894,7 +894,7 @@ "outputs": [], "source": [ "tf_dataset_type = tff.SequenceType(\n", - " tff.types.tensorflow_to_type(tff_model.input_spec)\n", + " tff.tensorflow.to_type(tff_model.input_spec)\n", ")" ] }, diff --git a/docs/tutorials/composing_learning_algorithms.ipynb b/docs/tutorials/composing_learning_algorithms.ipynb index 9095b4b659..30460037b4 100644 --- a/docs/tutorials/composing_learning_algorithms.ipynb +++ b/docs/tutorials/composing_learning_algorithms.ipynb @@ -289,7 +289,7 @@ " optimizer: tff.learning.optimizers.Optimizer,\n", ") -\u003e tff.learning.templates.ClientWorkProcess:\n", " \"\"\"Creates a client work process that uses gradient clipping.\"\"\"\n", - " data_type = tff.SequenceType(tff.types.tensorflow_to_type(model.input_spec))\n", + " data_type = tff.SequenceType(tff.tensorflow.to_type(model.input_spec))\n", " model_weights_type = tff.types.to_type(\n", " tf.nest.map_structure(\n", " lambda arr: tff.types.TensorType(shape=arr.shape, dtype=arr.dtype),\n", diff --git a/docs/tutorials/custom_federated_algorithms_2.ipynb b/docs/tutorials/custom_federated_algorithms_2.ipynb index 15f66dae45..bc49fb1e3f 100644 --- a/docs/tutorials/custom_federated_algorithms_2.ipynb +++ b/docs/tutorials/custom_federated_algorithms_2.ipynb @@ -399,7 +399,7 @@ "BATCH_SPEC = collections.OrderedDict(\n", " x=tf.TensorSpec(shape=[None, 784], dtype=tf.float32),\n", " y=tf.TensorSpec(shape=[None], dtype=tf.int32))\n", - "BATCH_TYPE = tff.types.tensorflow_to_type(BATCH_SPEC)\n", + "BATCH_TYPE = tff.tensorflow.to_type(BATCH_SPEC)\n", "\n", "str(BATCH_TYPE)" ] @@ -447,7 +447,7 @@ "MODEL_SPEC = collections.OrderedDict(\n", " weights=tf.TensorSpec(shape=[784, 10], dtype=tf.float32),\n", " bias=tf.TensorSpec(shape=[10], dtype=tf.float32))\n", - "MODEL_TYPE = tff.types.tensorflow_to_type(MODEL_SPEC)\n", + "MODEL_TYPE = tff.tensorflow.to_type(MODEL_SPEC)\n", "print(MODEL_TYPE)" ] }, diff --git a/examples/simple_fedavg/simple_fedavg_tff.py b/examples/simple_fedavg/simple_fedavg_tff.py index 485779f66d..d801b8f895 100644 --- a/examples/simple_fedavg/simple_fedavg_tff.py +++ b/examples/simple_fedavg/simple_fedavg_tff.py @@ -76,7 +76,7 @@ def client_update_fn(server_message, tf_dataset): # function, using tff.sequenece_reduce. client_update_type_spec = client_update_fn.type_signature.result - batch_type = tff.types.tensorflow_to_type(model_fn().input_spec) + batch_type = tff.tensorflow.to_type(model_fn().input_spec) @tff.tensorflow.computation(client_update_type_spec, batch_type) def client_update_batch_fn(client_data, batch): @@ -163,7 +163,7 @@ def server_message_fn(server_state): return build_server_broadcast_message(server_state) server_message_type = server_message_fn.type_signature.result - element_type = tff.types.tensorflow_to_type(whimsy_model.input_spec) + element_type = tff.tensorflow.to_type(whimsy_model.input_spec) tf_dataset_type = tff.SequenceType(element_type) federated_server_state_type = tff.FederatedType(server_state_type, tff.SERVER) diff --git a/examples/stateful_clients/stateful_fedavg_tff.py b/examples/stateful_clients/stateful_fedavg_tff.py index 98bb3304cf..c9a60a5629 100644 --- a/examples/stateful_clients/stateful_fedavg_tff.py +++ b/examples/stateful_clients/stateful_fedavg_tff.py @@ -112,7 +112,7 @@ def server_message_fn(server_state): return stateful_fedavg_tf.build_server_broadcast_message(server_state) server_message_type = server_message_fn.type_signature.result - element_type = tff.types.tensorflow_to_type(whimsy_model.input_spec) + element_type = tff.tensorflow.to_type(whimsy_model.input_spec) tf_dataset_type = tff.SequenceType(element_type) @tff.tensorflow.computation(