Open
Description
Problem
Currently, the test_tensorboard()
method in various test notebooks (e.g., jupyter/rocm/tensorflow/ubi9-python-3.12/test/test_notebook.ipynb
) trains a model with TensorBoard callbacks but does not verify that the logging functionality actually worked or that log files were created.
Background
This issue was identified during review of PR #1259 (#1259 (comment)) where the TensorBoard test lacks proper verification of its core functionality.
Acceptance Criteria
- Update
test_tensorboard()
methods across all test notebooks to verify log file creation - Use temporary directories for log storage during testing to avoid filesystem pollution
- Add assertions to check that log files exist and contain expected content
- Ensure tests clean up temporary files after completion
- Verify the solution works across all affected notebook images (TensorFlow, PyTorch, etc.)
Implementation Guidance
-
Search for all affected files:
find . -name "test_notebook.ipynb" -exec grep -l "test_tensorboard" {} \;
-
For each affected file, update the test method to:
- Import
os
andtempfile
modules - Use
tempfile.TemporaryDirectory()
for log storage - Add verification that log files are created
- Include proper error messages in assertions
- Import
-
Example implementation pattern:
def test_tensorboard(self): import os import tempfile # Create model and prepare data... with tempfile.TemporaryDirectory() as log_dir: tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir) # Train model... # Verify log files were created log_files = os.listdir(log_dir) self.assertTrue(len(log_files) > 0, "TensorBoard should create log files")
Related
- Original discussion: RHOAIENG-27434: Create Rocm Tensorflow Python 3.12 Image #1259 (comment)
- Requested by: @jiridanek
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status