Skip to content

Commit

Permalink
chore(tensorflow-cpu): add test with tf lib and move to stable py pac…
Browse files Browse the repository at this point in the history
…kage

Signed-off-by: Massimiliano Giovagnoli <massimiliano.giovagnoli@chainguard.dev>
  • Loading branch information
maxgio92 committed Dec 20, 2024
1 parent 062a755 commit 563c7a8
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tensorflow-cpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pipeline:
--no-cache-dir \
--root ${{targets.contextdir}} \
--prefix ${{vars.prefix}} \
tf-nightly
${{vars.pypi-package}}
- name: Install jupyter requirements
runs: |
Expand All @@ -68,6 +68,11 @@ pipeline:
runs: |
mkdir -p ${{targets.contextdir}}/tf/tensorflow-tutorials
cp jupyter.readme.md ${{targets.contextdir}}/tf/tensorflow-tutorials/README.md
- name: Cleanup pycache
runs: |
find . -name '__pycache__' -exec rm -rf {} +
test:
environment:
contents:
Expand All @@ -80,6 +85,27 @@ test:
- name: Test import of Tensorflow
- runs: |
python -c 'import tensorflow as tf'
- name: Test Tensorflow library
runs: |
cat <<"EOF" >test.py
import tensorflow as tf
# Check TensorFlow version
print("TensorFlow version:", tf.__version__)
# Check if TensorFlow can access the CPU
print("Is built with CUDA:", tf.test.is_built_with_cuda())
print("Available devices:")
for device in tf.config.list_physical_devices():
print(device)
# Perform a simple computation
a = tf.constant([1.0, 2.0, 3.0])
b = tf.constant([4.0, 5.0, 6.0])
c = tf.add(a, b)
print("Result of addition:", c.numpy())
EOF
python test.py
- name: Test Juputer notebook run
runs: |
jupyter notebook --notebook-dir=/tf --ip 0.0.0.0 --no-browser --allow-root >/dev/null 2>&1 &
Expand Down

0 comments on commit 563c7a8

Please sign in to comment.