Skip to content

Commit

Permalink
chore: renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurent Valdes committed Dec 30, 2024
1 parent 0e4dfe2 commit e974e5e
Showing 1 changed file with 147 additions and 38 deletions.
185 changes: 147 additions & 38 deletions Untitled.ipynb → tf_sheet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,74 @@
"cell_type": "code",
"execution_count": 1,
"id": "02d39a02-17f2-4307-8d41-6903c289e9d2",
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T19:26:44.051696Z",
"start_time": "2024-12-29T19:26:42.404515Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Eager Execution Enabled: True\n",
"Available Devices:\n",
"PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')\n",
"PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')\n"
]
}
],
"source": [
"import tensorflow as tf\n",
"\n",
"from tensorflow.python.framework.ops import EagerTensor\n",
"print(\"Eager Execution Enabled:\", tf.executing_eagerly())\n",
"print(\"Available Devices:\")\n",
"for device in tf.config.list_physical_devices():\n",
" print(device)\n",
"\n",
"tf.debugging.set_log_device_placement(False)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "5a948f66-bc82-4e98-bb2c-d4e6a5d6c353",
"metadata": {},
"outputs": [],
"source": [
"import tensorflow as tf"
"%load_ext tensorboard\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "793e06aa-0230-433f-a92a-6c32846bc444",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T19:27:50.307150Z",
"start_time": "2024-12-29T19:27:50.304200Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"()\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-12-29 23:09:19.737726: I metal_plugin/src/device/metal_device.cc:1154] Metal device set to: Apple M2\n",
"2024-12-29 23:09:19.737750: I metal_plugin/src/device/metal_device.cc:296] systemMemory: 16.00 GB\n",
"2024-12-29 23:09:19.737756: I metal_plugin/src/device/metal_device.cc:313] maxCacheSize: 5.33 GB\n",
"2024-12-29 23:09:19.737769: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support.\n",
"2024-12-29 23:09:19.737778: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: <undefined>)\n"
]
}
],
"source": [
Expand All @@ -31,9 +81,14 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"id": "4ea11dda-ab38-4e21-97e4-c318c0790ec7",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T19:27:53.630687Z",
"start_time": "2024-12-29T19:27:53.627165Z"
}
},
"outputs": [
{
"name": "stdout",
Expand All @@ -50,9 +105,14 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"id": "a3394f67-a3fc-4c26-887e-70c315703d65",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T19:27:55.934553Z",
"start_time": "2024-12-29T19:27:55.925292Z"
}
},
"outputs": [
{
"name": "stdout",
Expand All @@ -77,9 +137,14 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 6,
"id": "e3b108ce-d5ec-421f-a655-5b9c6ecc299d",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T19:27:58.162658Z",
"start_time": "2024-12-29T19:27:58.158969Z"
}
},
"outputs": [
{
"name": "stdout",
Expand All @@ -96,9 +161,14 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 7,
"id": "d33d85e8-43e8-4a20-aa31-6303b774d0da",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T19:28:00.310769Z",
"start_time": "2024-12-29T19:28:00.307345Z"
}
},
"outputs": [],
"source": [
"import tensorflow as tf\n",
Expand All @@ -113,9 +183,14 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 8,
"id": "6ed0c75b-a964-48df-a9dd-b6e0a8dcbafa",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T19:28:02.677382Z",
"start_time": "2024-12-29T19:28:02.673991Z"
}
},
"outputs": [
{
"name": "stdout",
Expand All @@ -131,9 +206,14 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 9,
"id": "45bdd81b-c86d-4abc-804f-3d43a60382be",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T19:29:26.646642Z",
"start_time": "2024-12-29T19:29:26.635782Z"
}
},
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -176,15 +256,15 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 10,
"id": "0ac17c30-2312-40a2-9df9-66d088e1a6b5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[[-0.24501422 -0.5116961 -0.44979703]]\n",
"[[ 1.1468321 -1.8221927 1.7510278]]\n",
"[[4 5]]\n"
]
}
Expand Down Expand Up @@ -215,7 +295,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 11,
"id": "b3c566e4-6643-4af4-a13f-ed69c6ac259f",
"metadata": {},
"outputs": [],
Expand All @@ -229,15 +309,15 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 12,
"id": "28ad88bb-f378-47b0-aaf9-87c43b1260f1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-1.6479137\n"
"-1.2997332\n"
]
}
],
Expand Down Expand Up @@ -274,18 +354,10 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 13,
"id": "0841827f-1770-4b6c-97e7-01c1aedde23b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:Trace already enabled\n"
]
}
],
"outputs": [],
"source": [
"logdir = \"logs/graph_demo\"\n",
"writer = tf.summary.create_file_writer(logdir)\n",
Expand All @@ -298,14 +370,14 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 14,
"id": "bb359e92-3724-4e0b-a247-1138000553c6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Reusing TensorBoard on port 6006 (pid 36911), started 0:00:18 ago. (Use '!kill 36911' to kill it.)"
"Reusing TensorBoard on port 6006 (pid 85848), started 2:35:02 ago. (Use '!kill 85848' to kill it.)"
]
},
"metadata": {},
Expand All @@ -315,11 +387,11 @@
"data": {
"text/html": [
"\n",
" <iframe id=\"tensorboard-frame-794b75c9ae2164bd\" width=\"100%\" height=\"800\" frameborder=\"0\">\n",
" <iframe id=\"tensorboard-frame-e7c10ccffd3661a5\" width=\"100%\" height=\"800\" frameborder=\"0\">\n",
" </iframe>\n",
" <script>\n",
" (function() {\n",
" const frame = document.getElementById(\"tensorboard-frame-794b75c9ae2164bd\");\n",
" const frame = document.getElementById(\"tensorboard-frame-e7c10ccffd3661a5\");\n",
" const url = new URL(\"/\", window.location);\n",
" const port = 6006;\n",
" if (port) {\n",
Expand All @@ -342,20 +414,57 @@
"%tensorboard --logdir logs/graph_demo\n"
]
},
{
"cell_type": "code",
"id": "2a6b9053-c6fb-436b-9d57-9a8a0ce56459",
"metadata": {
"ExecuteTime": {
"end_time": "2024-12-29T23:59:13.685350Z",
"start_time": "2024-12-29T23:59:13.534620Z"
}
},
"source": [
"with tf.device('/GPU:0'): # Explicitly use Metal GPU\n",
" a = tf.constant([[1.0, 2.0], [3.0, 4.0]])\n",
" b = tf.constant([[1.0, 1.0], [0.0, 1.0]])\n",
" c = tf.matmul(a, b)\n",
" print(c)"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"tf.Tensor(\n",
"[[1. 3.]\n",
" [3. 7.]], shape=(2, 2), dtype=float32)\n"
]
}
],
"execution_count": 25
},
{
"cell_type": "code",
"execution_count": null,
"id": "2425d80b-c1c4-4cb3-86ea-3ca72e7b1fa7",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "6c253276-6b56-4cff-a81b-c863939a035c",
"id": "f0215ac3-e4cb-46c5-88bd-4b44a4f79917",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python (gym-env-py3.10)",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "gym-env-py3.10"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -367,7 +476,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.16"
"version": "3.11.11"
}
},
"nbformat": 4,
Expand Down

0 comments on commit e974e5e

Please sign in to comment.