1# Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================== 15"""Provides a list of renames between TensorFlow 1.* and 2.0.""" 16from __future__ import absolute_import 17from __future__ import division 18from __future__ import print_function 19 20from tensorflow.tools.compatibility import renames_v2 21 22# pylint: disable=line-too-long 23 24# Add additional renames not in renames_v2.py here. 25# IMPORTANT: For the renames in here, if you also need to add to 26# function_reorders or function_keyword_renames in tf_upgrade_v2.py, 27# use the OLD function name. 28# These renames happen after the arguments have been processed. 29manual_symbol_renames = { 30 "tf.batch_to_space_nd": 31 "tf.batch_to_space", 32 "tf.batch_gather": 33 "tf.compat.v1.batch_gather", 34 "tf.space_to_batch_nd": 35 "tf.space_to_batch", 36 "tf.nn.space_to_batch": 37 "tf.space_to_batch", 38 "tf.estimator.inputs": 39 "tf.compat.v1.estimator.inputs", 40 "tf.extract_image_patches": 41 "tf.image.extract_patches", 42 "tf.image.extract_image_patches": 43 "tf.image.extract_patches", 44 "tf.gfile.Copy": 45 "tf.io.gfile.copy", 46 "tf.gfile.DeleteRecursively": 47 "tf.io.gfile.rmtree", 48 "tf.gfile.Exists": 49 "tf.io.gfile.exists", 50 "tf.gfile.Glob": 51 "tf.io.gfile.glob", 52 "tf.gfile.GFile": 53 "tf.io.gfile.GFile", 54 "tf.gfile.IsDirectory": 55 "tf.io.gfile.isdir", 56 "tf.gfile.ListDirectory": 57 "tf.io.gfile.listdir", 58 "tf.gfile.MakeDirs": 59 "tf.io.gfile.makedirs", 60 "tf.gfile.MkDir": 61 "tf.io.gfile.mkdir", 62 "tf.gfile.Open": 63 "tf.io.gfile.GFile", 64 "tf.gfile.Remove": 65 "tf.io.gfile.remove", 66 "tf.gfile.Rename": 67 "tf.io.gfile.rename", 68 "tf.gfile.Stat": 69 "tf.io.gfile.stat", 70 "tf.gfile.Walk": 71 "tf.io.gfile.walk", 72 "tf.contrib.cluster_resolver.ClusterResolver": 73 "tf.distribute.cluster_resolver.ClusterResolver", 74 "tf.contrib.cluster_resolver.GceClusterResolver": 75 "tf.distribute.cluster_resolver.GCEClusterResolver", 76 "tf.contrib.cluster_resolver.KubernetesClusterResolver": 77 "tf.distribute.cluster_resolver.KubernetesClusterResolver", 78 "tf.contrib.cluster_resolver.SimpleClusterResolver": 79 "tf.distribute.cluster_resolver.SimpleClusterResolver", 80 "tf.contrib.cluster_resolver.SlurmClusterResolver": 81 "tf.distribute.cluster_resolver.SlurmClusterResolver", 82 "tf.contrib.cluster_resolver.TFConfigClusterResolver": 83 "tf.distribute.cluster_resolver.TFConfigClusterResolver", 84 "tf.contrib.cluster_resolver.TPUClusterResolver": 85 "tf.distribute.cluster_resolver.TPUClusterResolver", 86 "tf.contrib.cluster_resolver.UnionClusterResolver": 87 "tf.distribute.cluster_resolver.UnionClusterResolver", 88 "tf.contrib.data.AUTOTUNE": 89 "tf.data.experimental.AUTOTUNE", 90 "tf.contrib.data.Counter": 91 "tf.data.experimental.Counter", 92 "tf.contrib.data.CheckpointInputPipelineHook": 93 "tf.data.experimental.CheckpointInputPipelineHook", 94 "tf.contrib.data.CsvDataset": 95 "tf.data.experimental.CsvDataset", 96 "tf.contrib.data.Optional": 97 "tf.data.experimental.Optional", 98 "tf.contrib.data.RandomDataset": 99 "tf.data.experimental.RandomDataset", 100 "tf.contrib.data.Reducer": 101 "tf.data.experimental.Reducer", 102 "tf.contrib.data.SqlDataset": 103 "tf.data.experimental.SqlDataset", 104 "tf.contrib.data.StatsAggregator": 105 "tf.data.experimental.StatsAggregator", 106 "tf.contrib.data.TFRecordWriter": 107 "tf.data.experimental.TFRecordWriter", 108 "tf.contrib.data.assert_element_shape": 109 "tf.data.experimental.assert_element_shape", 110 "tf.contrib.data.bucket_by_sequence_length": 111 "tf.data.experimental.bucket_by_sequence_length", 112 "tf.contrib.data.choose_from_datasets": 113 "tf.data.experimental.choose_from_datasets", 114 "tf.contrib.data.copy_to_device": 115 "tf.data.experimental.copy_to_device", 116 "tf.contrib.data.dense_to_sparse_batch": 117 "tf.data.experimental.dense_to_sparse_batch", 118 "tf.contrib.data.enumerate_dataset": 119 "tf.data.experimental.enumerate_dataset", 120 "tf.contrib.data.get_next_as_optional": 121 "tf.data.experimental.get_next_as_optional", 122 "tf.contrib.data.get_single_element": 123 "tf.data.experimental.get_single_element", 124 "tf.contrib.data.group_by_reducer": 125 "tf.data.experimental.group_by_reducer", 126 "tf.contrib.data.group_by_window": 127 "tf.data.experimental.group_by_window", 128 "tf.contrib.data.ignore_errors": 129 "tf.data.experimental.ignore_errors", 130 "tf.contrib.data.latency_stats": 131 "tf.data.experimental.latency_stats", 132 "tf.contrib.data.make_batched_features_dataset": 133 "tf.data.experimental.make_batched_features_dataset", 134 "tf.contrib.data.make_csv_dataset": 135 "tf.data.experimental.make_csv_dataset", 136 "tf.contrib.data.make_saveable_from_iterator": 137 "tf.data.experimental.make_saveable_from_iterator", 138 "tf.contrib.data.map_and_batch": 139 "tf.data.experimental.map_and_batch", 140 "tf.contrib.data.parallel_interleave": 141 "tf.data.experimental.parallel_interleave", 142 "tf.contrib.data.parse_example_dataset": 143 "tf.data.experimental.parse_example_dataset", 144 "tf.contrib.data.prefetch_to_device": 145 "tf.data.experimental.prefetch_to_device", 146 "tf.contrib.data.rejection_resample": 147 "tf.data.experimental.rejection_resample", 148 "tf.contrib.data.sample_from_datasets": 149 "tf.data.experimental.sample_from_datasets", 150 "tf.contrib.data.scan": 151 "tf.data.experimental.scan", 152 "tf.contrib.data.set_stats_aggregator": 153 "tf.data.experimental.set_stats_aggregator", 154 "tf.contrib.data.shuffle_and_repeat": 155 "tf.data.experimental.shuffle_and_repeat", 156 "tf.contrib.data.unbatch": 157 "tf.data.experimental.unbatch", 158 "tf.contrib.data.unique": 159 "tf.data.experimental.unique", 160 "tf.contrib.distribute.CrossDeviceOps": 161 "tf.distribute.CrossDeviceOps", 162 "tf.contrib.distribute.ReductionToOneDeviceCrossDeviceOps": 163 "tf.distribute.ReductionToOneDevice", 164 "tf.contrib.estimator.make_early_stopping_hook": 165 "tf.estimator.experimental.make_early_stopping_hook", 166 "tf.contrib.estimator.stop_if_higher_hook": 167 "tf.estimator.experimental.stop_if_higher_hook", 168 "tf.contrib.estimator.stop_if_lower_hook": 169 "tf.estimator.experimental.stop_if_lower_hook", 170 "tf.contrib.estimator.stop_if_no_decrease_hook": 171 "tf.estimator.experimental.stop_if_no_decrease_hook", 172 "tf.contrib.estimator.stop_if_no_increase_hook": 173 "tf.estimator.experimental.stop_if_no_increase_hook", 174 "tf.contrib.framework.CriticalSection": 175 "tf.CriticalSection", 176 "tf.contrib.framework.is_tensor": 177 "tf.is_tensor", 178 "tf.contrib.framework.load_variable": 179 "tf.train.load_variable", 180 "tf.contrib.framework.nest.assert_same_structure": 181 "tf.nest.assert_same_structure", 182 "tf.contrib.framework.nest.flatten": 183 "tf.nest.flatten", 184 "tf.contrib.framework.nest.is_sequence": 185 "tf.nest.is_nested", 186 "tf.contrib.framework.nest.map_structure": 187 "tf.nest.map_structure", 188 "tf.contrib.framework.nest.pack_sequence_as": 189 "tf.nest.pack_sequence_as", 190 "tf.contrib.batching.batch_function": 191 "tf.nondifferentiable_batch_function", 192 "tf.contrib.util.constant_value": 193 "tf.get_static_value", 194 "tf.contrib.saved_model.load_keras_model": 195 "tf.compat.v1.keras.experimental.load_from_saved_model", 196 "tf.contrib.saved_model.save_keras_model": 197 "tf.compat.v1.keras.experimental.export_saved_model", 198 "tf.contrib.rnn.RNNCell": 199 "tf.compat.v1.nn.rnn_cell.RNNCell", 200 "tf.contrib.rnn.LSTMStateTuple": 201 "tf.nn.rnn_cell.LSTMStateTuple", 202 "tf.contrib.rnn.BasicLSTMCell": 203 "tf.compat.v1.nn.rnn_cell.BasicLSTMCell", 204 "tf.contrib.rnn.BasicRNNCell": 205 "tf.compat.v1.nn.rnn_cell.BasicRNNCell", 206 "tf.contrib.rnn.GRUCell": 207 "tf.compat.v1.nn.rnn_cell.GRUCell", 208 "tf.contrib.rnn.LSTMCell": 209 "tf.compat.v1.nn.rnn_cell.LSTMCell", 210 "tf.contrib.rnn.MultiRNNCell": 211 "tf.compat.v1.nn.rnn_cell.MultiRNNCell", 212 "tf.contrib.rnn.static_rnn": 213 "tf.compat.v1.nn.static_rnn", 214 "tf.contrib.rnn.static_state_saving_rnn": 215 "tf.compat.v1.nn.static_state_saving_rnn", 216 "tf.contrib.rnn.static_bidirectional_rnn": 217 "tf.compat.v1.nn.static_bidirectional_rnn", 218 "tf.contrib.framework.sort": 219 "tf.sort", 220 "tf.contrib.framework.argsort": 221 "tf.argsort", 222 "tf.contrib.summary.all_summary_ops": 223 "tf.compat.v1.summary.all_v2_summary_ops", 224 "tf.contrib.summary.always_record_summaries": 225 "tf.compat.v2.summary.record_if", 226 "tf.contrib.summary.audio": 227 "tf.compat.v2.summary.audio", 228 "tf.contrib.summary.create_file_writer": 229 "tf.compat.v2.summary.create_file_writer", 230 "tf.contrib.summary.flush": 231 "tf.compat.v2.summary.flush", 232 "tf.contrib.summary.generic": 233 "tf.compat.v2.summary.write", 234 "tf.contrib.summary.histogram": 235 "tf.compat.v2.summary.histogram", 236 "tf.contrib.summary.image": 237 "tf.compat.v2.summary.image", 238 "tf.contrib.summary.initialize": 239 "tf.compat.v1.summary.initialize", 240 "tf.contrib.summary.never_record_summaries": 241 "tf.compat.v2.summary.record_if", 242 "tf.contrib.summary.scalar": 243 "tf.compat.v2.summary.scalar", 244 "tf.contrib.tpu.CrossShardOptimizer": 245 "tf.compat.v1.tpu.CrossShardOptimizer", 246 "tf.contrib.tpu.InputPipelineConfig": 247 "tf.compat.v1.estimator.tpu.InputPipelineConfig", 248 "tf.contrib.tpu.RunConfig": 249 "tf.compat.v1.estimator.tpu.RunConfig", 250 "tf.contrib.tpu.TPUConfig": 251 "tf.compat.v1.estimator.tpu.TPUConfig", 252 "tf.contrib.tpu.TPUEstimator": 253 "tf.compat.v1.estimator.tpu.TPUEstimator", 254 "tf.contrib.tpu.TPUEstimatorSpec": 255 "tf.compat.v1.estimator.tpu.TPUEstimatorSpec", 256 "tf.contrib.tpu.batch_parallel": 257 "tf.compat.v1.tpu.batch_parallel", 258 "tf.contrib.tpu.bfloat16_scope": 259 "tf.compat.v1.tpu.bfloat16_scope", 260 "tf.contrib.tpu.core": 261 "tf.compat.v1.tpu.core", 262 "tf.contrib.tpu.cross_replica_sum": 263 "tf.compat.v1.tpu.cross_replica_sum", 264 "tf.contrib.tpu.initialize_system": 265 "tf.compat.v1.tpu.initialize_system", 266 "tf.contrib.tpu.outside_compilation": 267 "tf.compat.v1.tpu.outside_compilation", 268 "tf.contrib.tpu.replicate": 269 "tf.compat.v1.tpu.replicate", 270 "tf.contrib.tpu.rewrite": 271 "tf.compat.v1.tpu.rewrite", 272 "tf.contrib.tpu.shard": 273 "tf.compat.v1.tpu.shard", 274 "tf.contrib.tpu.shutdown_system": 275 "tf.compat.v1.tpu.shutdown_system", 276 "tf.contrib.training.checkpoints_iterator": 277 "tf.train.checkpoints_iterator", 278 "tf.contrib.layers.recompute_grad": 279 "tf.recompute_grad", 280 "tf.count_nonzero": 281 "tf.math.count_nonzero", 282 "tf.decode_raw": 283 "tf.io.decode_raw", 284 "tf.manip.batch_to_space_nd": 285 "tf.batch_to_space", 286 "tf.quantize_v2": 287 "tf.quantization.quantize", 288 "tf.sparse_add": 289 "tf.sparse.add", 290 "tf.sparse_concat": 291 "tf.sparse.concat", 292 "tf.sparse_split": 293 "tf.sparse.split", 294 "tf.sparse_matmul": 295 "tf.linalg.matmul", 296 "tf.sparse_reduce_sum": 297 "tf.sparse.reduce_sum", 298 "tf.sparse_reduce_max": 299 "tf.sparse.reduce_max", 300 "tf.random.stateless_multinomial": 301 "tf.random.stateless_categorical", 302 "tf.substr": 303 "tf.strings.substr", 304 # TODO(b/129398290) 305 "tf.string_split": 306 "tf.compat.v1.string_split", 307 "tf.string_to_hash_bucket": 308 "tf.strings.to_hash_bucket", 309 "tf.string_to_number": 310 "tf.strings.to_number", 311 "tf.multinomial": 312 "tf.random.categorical", 313 "tf.random.multinomial": 314 "tf.random.categorical", 315 "tf.reduce_join": 316 "tf.strings.reduce_join", 317 "tf.load_file_system_library": 318 "tf.load_library", 319 "tf.bincount": 320 "tf.math.bincount", 321 "tf.confusion_matrix": 322 "tf.math.confusion_matrix", 323 "tf.train.confusion_matrix": 324 "tf.math.confusion_matrix", 325 "tf.train.sdca_fprint": 326 "tf.raw_ops.SdcaFprint", 327 "tf.train.sdca_optimizer": 328 "tf.raw_ops.SdcaOptimizer", 329 "tf.train.sdca_shrink_l1": 330 "tf.raw_ops.SdcaShrinkL1", 331 "tf.decode_csv": 332 "tf.io.decode_csv", 333 "tf.data.Iterator": 334 "tf.compat.v1.data.Iterator", 335 "tf.data.experimental.DatasetStructure": 336 "tf.data.DatasetSpec", 337 "tf.data.experimental.OptionalStructure": 338 "tf.OptionalSpec", 339 "tf.data.experimental.RaggedTensorStructure": 340 "tf.RaggedTensorSpec", 341 "tf.data.experimental.SparseTensorStructure": 342 "tf.SparseTensorSpec", 343 "tf.data.experimental.Structure": 344 "tf.TypeSpec", 345 "tf.data.experimental.TensorArrayStructure": 346 "tf.TensorArraySpec", 347 "tf.data.experimental.TensorStructure": 348 "tf.TensorSpec", 349 "tf.parse_example": 350 "tf.io.parse_example", 351 "tf.parse_single_example": 352 "tf.io.parse_single_example", 353 "tf.nn.fused_batch_norm": 354 "tf.compat.v1.nn.fused_batch_norm", 355 "tf.nn.softmax_cross_entropy_with_logits_v2": 356 "tf.nn.softmax_cross_entropy_with_logits", 357 "tf.losses.Reduction.MEAN": 358 "tf.compat.v1.losses.Reduction.MEAN", 359 "tf.losses.Reduction.SUM_BY_NONZERO_WEIGHTS": 360 "tf.compat.v1.losses.Reduction.SUM_BY_NONZERO_WEIGHTS", 361 "tf.losses.Reduction.SUM_OVER_NONZERO_WEIGHTS": 362 "tf.compat.v1.losses.Reduction.SUM_OVER_NONZERO_WEIGHTS", 363 "tf.lite.constants.FLOAT": 364 "tf.float32", 365 "tf.lite.constants.INT32": 366 "tf.int32", 367 "tf.lite.constants.INT64": 368 "tf.int64", 369 "tf.lite.constants.STRING": 370 "tf.string", 371 "tf.lite.constants.QUANTIZED_UINT8": 372 "tf.uint8", 373 "tf.arg_max": 374 "tf.argmax", 375 "tf.arg_min": 376 "tf.argmin", 377 # tf.nn.ctc_loss is still available in 2.0 but behavior 378 # changed significantly. 379 "tf.nn.ctc_loss": 380 "tf.compat.v1.nn.ctc_loss", 381 # tf.saved_model.load in 1.x has no equivalent in 2.x, but there is a 382 # symbol with the same name. 383 "tf.saved_model.load": 384 "tf.compat.v1.saved_model.load", 385 "tf.saved_model.load_v2": 386 "tf.compat.v2.saved_model.load", 387 "tf.image.resize_images": 388 "tf.image.resize", 389 "tf.random_poisson": 390 "tf.random.poisson", 391 "tf.debugging.assert_greater": 392 "tf.compat.v1.debugging.assert_greater", 393 "tf.debugging.assert_greater_equal": 394 "tf.compat.v1.debugging.assert_greater_equal", 395 "tf.debugging.assert_integer": 396 "tf.compat.v1.debugging.assert_integer", 397 "tf.debugging.assert_less": 398 "tf.compat.v1.debugging.assert_less", 399 "tf.debugging.assert_less_equal": 400 "tf.compat.v1.debugging.assert_less_equal", 401 "tf.debugging.assert_near": 402 "tf.compat.v1.debugging.assert_near", 403 "tf.debugging.assert_negative": 404 "tf.compat.v1.debugging.assert_negative", 405 "tf.debugging.assert_non_negative": 406 "tf.compat.v1.debugging.assert_non_negative", 407 "tf.debugging.assert_non_positive": 408 "tf.compat.v1.debugging.assert_non_positive", 409 "tf.debugging.assert_none_equal": 410 "tf.compat.v1.debugging.assert_none_equal", 411 "tf.debugging.assert_type": 412 "tf.compat.v1.debugging.assert_type", 413 "tf.debugging.assert_positive": 414 "tf.compat.v1.debugging.assert_positive", 415 "tf.debugging.assert_equal": 416 "tf.compat.v1.debugging.assert_equal", 417 "tf.debugging.assert_scalar": 418 "tf.compat.v1.debugging.assert_scalar", 419 "tf.assert_equal": 420 "tf.compat.v1.assert_equal", 421 "tf.assert_less": 422 "tf.compat.v1.assert_less", 423 "tf.assert_greater": 424 "tf.compat.v1.assert_greater", 425 "tf.debugging.assert_rank": 426 "tf.compat.v1.debugging.assert_rank", 427 "tf.debugging.assert_rank_at_least": 428 "tf.compat.v1.debugging.assert_rank_at_least", 429 "tf.debugging.assert_rank_in": 430 "tf.compat.v1.debugging.assert_rank_in", 431 "tf.errors.exception_type_from_error_code": 432 "tf.compat.v1.errors.exception_type_from_error_code", 433 "tf.errors.error_code_from_exception_type": 434 "tf.compat.v1.errors.error_code_from_exception_type", 435 "tf.errors.raise_exception_on_not_ok_status": 436 "tf.compat.v1.errors.raise_exception_on_not_ok_status", 437 "tf.assert_rank": 438 "tf.compat.v1.assert_rank", 439 "tf.nn.max_pool": 440 "tf.nn.max_pool2d", 441 "tf.nn.avg_pool": 442 "tf.nn.avg_pool2d", 443 "tf.keras.initializers.zeros": 444 "tf.compat.v1.keras.initializers.zeros", 445 "tf.keras.initializers.Zeros": 446 "tf.compat.v1.keras.initializers.Zeros", 447 "tf.keras.initializers.ones": 448 "tf.compat.v1.keras.initializers.ones", 449 "tf.keras.initializers.Ones": 450 "tf.compat.v1.keras.initializers.Ones", 451 "tf.keras.initializers.constant": 452 "tf.compat.v1.keras.initializers.constant", 453 "tf.keras.initializers.Constant": 454 "tf.compat.v1.keras.initializers.Constant", 455 "tf.keras.initializers.VarianceScaling": 456 "tf.compat.v1.keras.initializers.VarianceScaling", 457 "tf.keras.initializers.Orthogonal": 458 "tf.compat.v1.keras.initializers.Orthogonal", 459 "tf.keras.initializers.orthogonal": 460 "tf.compat.v1.keras.initializers.orthogonal", 461 "tf.keras.initializers.Identity": 462 "tf.compat.v1.keras.initializers.Identity", 463 "tf.keras.initializers.identity": 464 "tf.compat.v1.keras.initializers.identity", 465 "tf.keras.initializers.glorot_uniform": 466 "tf.compat.v1.keras.initializers.glorot_uniform", 467 "tf.keras.initializers.glorot_normal": 468 "tf.compat.v1.keras.initializers.glorot_normal", 469 "tf.keras.initializers.lecun_normal": 470 "tf.compat.v1.keras.initializers.lecun_normal", 471 "tf.keras.initializers.lecun_uniform": 472 "tf.compat.v1.keras.initializers.lecun_uniform", 473 "tf.keras.initializers.he_normal": 474 "tf.compat.v1.keras.initializers.he_normal", 475 "tf.keras.initializers.he_uniform": 476 "tf.compat.v1.keras.initializers.he_uniform", 477 "tf.keras.initializers.TruncatedNormal": 478 "tf.compat.v1.keras.initializers.TruncatedNormal", 479 "tf.keras.initializers.truncated_normal": 480 "tf.compat.v1.keras.initializers.truncated_normal", 481 "tf.keras.initializers.RandomUniform": 482 "tf.compat.v1.keras.initializers.RandomUniform", 483 "tf.keras.initializers.uniform": 484 "tf.compat.v1.keras.initializers.uniform", 485 "tf.keras.initializers.random_uniform": 486 "tf.compat.v1.keras.initializers.random_uniform", 487 "tf.keras.initializers.RandomNormal": 488 "tf.compat.v1.keras.initializers.RandomNormal", 489 "tf.keras.initializers.normal": 490 "tf.compat.v1.keras.initializers.normal", 491 "tf.keras.initializers.random_normal": 492 "tf.compat.v1.keras.initializers.random_normal", 493 "tf.zeros_initializer": 494 "tf.compat.v1.zeros_initializer", 495 "tf.initializers.zeros": 496 "tf.compat.v1.initializers.zeros", 497 "tf.ones_initializer": 498 "tf.compat.v1.ones_initializer", 499 "tf.initializers.ones": 500 "tf.compat.v1.initializers.ones", 501 "tf.constant_initializer": 502 "tf.compat.v1.constant_initializer", 503 "tf.initializers.constant": 504 "tf.compat.v1.initializers.constant", 505 "tf.random_uniform_initializer": 506 "tf.compat.v1.random_uniform_initializer", 507 "tf.initializers.random_uniform": 508 "tf.compat.v1.initializers.random_uniform", 509 "tf.random_normal_initializer": 510 "tf.compat.v1.random_normal_initializer", 511 "tf.initializers.random_normal": 512 "tf.compat.v1.initializers.random_normal", 513 "tf.truncated_normal_initializer": 514 "tf.compat.v1.truncated_normal_initializer", 515 "tf.initializers.truncated_normal": 516 "tf.compat.v1.initializers.truncated_normal", 517 "tf.variance_scaling_initializer": 518 "tf.compat.v1.variance_scaling_initializer", 519 "tf.initializers.variance_scaling": 520 "tf.compat.v1.initializers.variance_scaling", 521 "tf.orthogonal_initializer": 522 "tf.compat.v1.orthogonal_initializer", 523 "tf.initializers.orthogonal": 524 "tf.compat.v1.initializers.orthogonal", 525 "tf.glorot_uniform_initializer": 526 "tf.compat.v1.glorot_uniform_initializer", 527 "tf.initializers.glorot_uniform": 528 "tf.compat.v1.initializers.glorot_uniform", 529 "tf.glorot_normal_initializer": 530 "tf.compat.v1.glorot_normal_initializer", 531 "tf.initializers.glorot_normal": 532 "tf.compat.v1.initializers.glorot_normal", 533 "tf.initializers.identity": 534 "tf.compat.v1.initializers.identity", 535 "tf.initializers.lecun_normal": 536 "tf.compat.v1.initializers.lecun_normal", 537 "tf.initializers.lecun_uniform": 538 "tf.compat.v1.initializers.lecun_uniform", 539 "tf.initializers.he_normal": 540 "tf.compat.v1.initializers.he_normal", 541 "tf.initializers.he_uniform": 542 "tf.compat.v1.initializers.he_uniform", 543 "tf.data.experimental.map_and_batch_with_legacy_function": 544 "tf.compat.v1.data.experimental.map_and_batch_with_legacy_function", 545 "tf.nn.conv2d_backprop_input": 546 "tf.nn.conv2d_transpose", 547 "tf.test.compute_gradient": 548 "tf.compat.v1.test.compute_gradient", 549 "tf.floor_div": 550 "tf.math.floordiv", 551 "tf.where": 552 "tf.compat.v1.where", 553 "tf.where_v2": 554 "tf.compat.v2.where", 555 "tf.app.flags": "tf.compat.v1.app.flags", 556} 557# pylint: enable=line-too-long 558 559 560def add_contrib_direct_import_support(symbol_dict): 561 """Add support for `tf.contrib.*` alias `contrib_*.` Updates dict in place.""" 562 for symbol_name in list(symbol_dict.keys()): 563 symbol_alias = symbol_name.replace("tf.contrib.", "contrib_") 564 symbol_dict[symbol_alias] = symbol_dict[symbol_name] 565 566add_contrib_direct_import_support(manual_symbol_renames) 567 568symbol_renames = renames_v2.renames 569symbol_renames.update(manual_symbol_renames) 570 571addons_symbol_mappings = { 572 "tf.contrib.layers.poincare_normalize": 573 "tfa.layers.PoincareNormalize", 574 "tf.contrib.layers.maxout": 575 "tfa.layers.Maxout", 576 "tf.contrib.layers.group_norm": 577 "tfa.layers.GroupNormalization", 578 "tf.contrib.layers.instance_norm": 579 "tfa.layers.InstanceNormalization", 580 "tf.contrib.sparsemax.sparsemax": 581 "tfa.activations.sparsemax", 582 "tf.contrib.losses.metric_learning.contrastive_loss": 583 "tfa.losses.ContrastiveLoss", 584 "tf.contrib.losses.metric_learning.lifted_struct_loss": 585 "tfa.losses.LiftedStructLoss", 586 "tf.contrib.sparsemax.sparsemax_loss": 587 "tfa.losses.SparsemaxLoss", 588 "tf.contrib.losses.metric_learning.triplet_semihard_loss": 589 "tfa.losses.TripletSemiHardLoss", 590 "tf.contrib.opt.LazyAdamOptimizer": 591 "tfa.optimizers.LazyAdam", 592 "tf.contrib.opt.MovingAverageOptimizer": 593 "tfa.optimizers.MovingAverage", 594 "tf.contrib.opt.MomentumWOptimizer": 595 "tfa.optimizers.SGDW", 596 "tf.contrib.opt.AdamWOptimizer": 597 "tfa.optimizers.AdamW", 598 "tf.contrib.opt.extend_with_decoupled_weight_decay": 599 "tfa.optimizers.extend_with_decoupled_weight_decay", 600 "tf.contrib.text.skip_gram_sample": 601 "tfa.text.skip_gram_sample", 602 "tf.contrib.text.skip_gram_sample_with_text_vocab": 603 "tfa.text.skip_gram_sample_with_text_vocab", 604 "tf.contrib.image.dense_image_warp": 605 "tfa.image.dense_image_warp", 606 "tf.contrib.image.adjust_hsv_in_yiq": 607 "tfa.image.adjust_hsv_in_yiq", 608 "tf.contrib.image.compose_transforms": 609 "tfa.image.compose_transforms", 610 "tf.contrib.image.random_hsv_in_yiq": 611 "tfa.image.random_hsv_in_yiq", 612 "tf.contrib.image.angles_to_projective_transforms": 613 "tfa.image.angles_to_projective_transforms", 614 "tf.contrib.image.matrices_to_flat_transforms": 615 "tfa.image.matrices_to_flat_transforms", 616 "tf.contrib.image.rotate": 617 "tfa.image.rotate", 618 "tf.contrib.image.transform": 619 "tfa.image.transform", 620 "tf.contrib.rnn.NASCell": 621 "tfa.rnn.NASCell", 622 "tf.contrib.rnn.LayerNormBasicLSTMCell": 623 "tfa.rnn.LayerNormLSTMCell" 624} 625 626add_contrib_direct_import_support(addons_symbol_mappings) 627