Skip to content

Conversation

FelixBenning
Copy link

@FelixBenning FelixBenning commented Jun 14, 2021

An attempt to upgrade deepOBS tensorflow to 2.0

  • run tf_upgrade_v2 script on deepobs (cf. https://www.tensorflow.org/guide/upgrade), commit 5550bea

  • try to fix errors in reports.txt with replacements from tfa and apparent aliases from tf (e.g. tf.keras.layers.Flatten()(x) for tf.contrib.layers.flatten(x)) (commits dec400b ed0b72a cc5e9d8)

  • inspect warnings

  • run tf_upgrade_v2 script on tests - no issues (commit 3082d1f)

    output (0 issues that require attention)
    INFO line 33:4: Renamed 'tf.reset_default_graph' to 'tf.compat.v1.reset_default_graph'
    INFO line 48:9: Renamed 'tf.Session' to 'tf.compat.v1.Session'
    INFO line 25:4: Renamed 'tf.reset_default_graph' to 'tf.compat.v1.reset_default_graph'
    INFO line 40:9: Renamed 'tf.Session' to 'tf.compat.v1.Session'
    INFO line 69:8: Renamed 'tf.reset_default_graph' to 'tf.compat.v1.reset_default_graph'
    INFO line 96:21: Renamed 'tf.ConfigProto' to 'tf.compat.v1.ConfigProto'
    INFO line 98:21: Renamed 'tf.ConfigProto' to 'tf.compat.v1.ConfigProto'
    INFO line 100:18: Added keywords to args of function 'tf.reduce_mean'
    INFO line 101:13: Renamed 'tf.Session' to 'tf.compat.v1.Session'
    INFO line 102:21: Renamed 'tf.global_variables_initializer' to 'tf.compat.v1.global_variables_initializer'
    INFO line 153:63: Renamed 'tf.trainable_variables' to 'tf.compat.v1.trainable_variables'
    TensorFlow 2.0 Upgrade Script
    -----------------------------
    Converted 9 files
    Detected 0 issues that require attention
    --------------------------------------------------------------------------------
    
    
    Make sure to read the detailed log 'report_tests.txt'
    
    logfile
    TensorFlow 2.0 Upgrade Script
    -----------------------------
    Converted 9 files
    Detected 0 issues that require attention
    --------------------------------------------------------------------------------
    ================================================================================
    Detailed log follows:
    
    ================================================================================
    ================================================================================
    Input tree: 'tests'
    ================================================================================
    --------------------------------------------------------------------------------
    Processing file 'tests\\check_image_datasets.py'
     outputting to 'tests\\check_image_datasets.py'
    --------------------------------------------------------------------------------
    
    
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    Processing file 'tests\\check_image_datasets_old.py'
     outputting to 'tests\\check_image_datasets_old.py'
    --------------------------------------------------------------------------------
    
    33:4: INFO: Renamed 'tf.reset_default_graph' to 'tf.compat.v1.reset_default_graph'
    48:9: INFO: Renamed 'tf.Session' to 'tf.compat.v1.Session'
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    Processing file 'tests\\check_text_datasets.py'
     outputting to 'tests\\check_text_datasets.py'
    --------------------------------------------------------------------------------
    
    25:4: INFO: Renamed 'tf.reset_default_graph' to 'tf.compat.v1.reset_default_graph'
    40:9: INFO: Renamed 'tf.Session' to 'tf.compat.v1.Session'
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    Processing file 'tests\\test_testproblems.py'
     outputting to 'tests\\test_testproblems.py'
    --------------------------------------------------------------------------------
    
    69:8: INFO: Renamed 'tf.reset_default_graph' to 'tf.compat.v1.reset_default_graph'
    96:21: INFO: Renamed 'tf.ConfigProto' to 'tf.compat.v1.ConfigProto'
    98:21: INFO: Renamed 'tf.ConfigProto' to 'tf.compat.v1.ConfigProto'
    100:18: INFO: Added keywords to args of function 'tf.reduce_mean'
    101:13: INFO: Renamed 'tf.Session' to 'tf.compat.v1.Session'
    102:21: INFO: Renamed 'tf.global_variables_initializer' to 'tf.compat.v1.global_variables_initializer'
    153:63: INFO: Renamed 'tf.trainable_variables' to 'tf.compat.v1.trainable_variables'
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    Processing file 'tests\\__init__.py'
     outputting to 'tests\\__init__.py'
    --------------------------------------------------------------------------------
    
    
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    Processing file 'tests\\pytorch\\testproblems\\test_quadratic_deep.py'
     outputting to 'tests\\pytorch\\testproblems\\test_quadratic_deep.py'
    --------------------------------------------------------------------------------
    
    
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    Processing file 'tests\\utils\\utils_number_of_parameters.py'
     outputting to 'tests\\utils\\utils_number_of_parameters.py'
    --------------------------------------------------------------------------------
    
    
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    Processing file 'tests\\utils\\utils_tests.py'
     outputting to 'tests\\utils\\utils_tests.py'
    --------------------------------------------------------------------------------
    
    
    --------------------------------------------------------------------------------
    
    --------------------------------------------------------------------------------
    Processing file 'tests\\utils\\__init__.py'
     outputting to 'tests\\utils\\__init__.py'
    --------------------------------------------------------------------------------
    
    
    --------------------------------------------------------------------------------
    
    
  • run unit tests

tf.compat.v1.data.get_output_types(self._train_dataset),
tf.compat.v1.data.get_output_shapes(self._train_dataset),
)
self.batch = self._iterator.get_next()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws the error

 GetNext() failed because the iterator has not been initialized. Ensure that you have run the initializer operation for this iterator before getting the next element. [Op:IteratorGetNext]

It appears that self.dataset.batch is accessed in set_up of (at least one - cifar100_3c3d) TestProblem after initialization. The question is which initialization to choose then I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant