{ "cells": [ { "cell_type": "code", "execution_count": 3, "id": "55639ddf-442f-4da9-be1d-75543a2e0c70", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2024-03-12 20:49:33.250521: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n", "2024-03-12 20:49:33.298077: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered\n", "2024-03-12 20:49:33.298108: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered\n", "2024-03-12 20:49:33.299348: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered\n", "2024-03-12 20:49:33.307159: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n", "To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n", "2024-03-12 20:49:34.869437: I itex/core/wrapper/itex_cpu_wrapper.cc:60] Intel Extension for Tensorflow* AVX512 CPU backend is loaded.\n", "2024-03-12 20:49:34.962813: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355\n", "2024-03-12 20:49:34.993825: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355\n", "2024-03-12 20:49:34.997527: I external/local_xla/xla/stream_executor/cuda/cuda_executor.cc:901] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355\n" ] } ], "source": [ "import tensorflow as tf\n", "from tensorflow import keras" ] }, { "cell_type": "code", "execution_count": 7, "id": "f0852765-7e18-41df-aecf-10bbc9649010", "metadata": {}, "outputs": [], "source": [ "model = tf.keras.models.load_model('samplemodel01.keras')" ] }, { "cell_type": "code", "execution_count": 8, "id": "a958a761-107d-4dbd-8055-ba4085b80de6", "metadata": {}, "outputs": [], "source": [ "y_pred = tf.convert_to_tensor([[11000]])" ] }, { "cell_type": "code", "execution_count": 9, "id": "4aa44234-0cfc-4e3b-9b44-e741f6521a0c", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2024-03-12 20:52:50.931243: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:117] Plugin optimizer for device_type CPU is enabled.\n", "2024-03-12 20:52:51.026576: I external/local_xla/xla/service/service.cc:168] XLA service 0x55d7aadc8c40 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:\n", "2024-03-12 20:52:51.026653: I external/local_xla/xla/service/service.cc:176] StreamExecutor device (0): Quadro RTX 4000, Compute Capability 7.5\n", "2024-03-12 20:52:51.041029: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:269] disabling MLIR crash reproducer, set env var `MLIR_CRASH_REPRODUCER_DIRECTORY` to enable.\n", "2024-03-12 20:52:51.101126: I external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:454] Loaded cuDNN version 8907\n", "2024-03-12 20:52:51.104547: I external/local_tsl/tsl/platform/default/subprocess.cc:304] Start cannot spawn child process: No such file or directory\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 303ms/step\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\n", "I0000 00:00:1710276771.219566 85038 device_compiler.h:186] Compiled cluster using XLA! This line is logged at most once for the lifetime of the process.\n" ] } ], "source": [ "pred = model.predict(y_pred)" ] }, { "cell_type": "code", "execution_count": 10, "id": "214f3a54-95f4-4c5e-b211-608e62d26cc2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[22005.293]], dtype=float32)" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pred" ] }, { "cell_type": "code", "execution_count": 12, "id": "8b719dcf-155d-40d1-a111-56181030968d", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[22005.293]\n" ] } ], "source": [ "print (str(pred[0]))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }