{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Tensorflow_Eager_Exec-1.x.-2.0ipynb",
"version": "0.3.2",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
},
"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.7.3"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
""
]
},
{
"metadata": {
"id": "EM7xU9c7Qo8Z",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"# টেন্সর-ফ্লো ১.x ভার্সন \n",
"# Tensorflow Eager mode নেই "
]
},
{
"metadata": {
"id": "917g8FH5Qo8a",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
"import numpy as np\n",
"import tensorflow as tf"
],
"execution_count": 0,
"outputs": []
},
{
"metadata": {
"id": "F_KhZi5BTZpY",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"# এখন কি আছে?"
]
},
{
"metadata": {
"id": "Jg2No-evRzKe",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
},
"outputId": "5ffe72d3-cc60-4a32-d03a-3f281744e92a"
},
"cell_type": "code",
"source": [
"print(tf.__version__)"
],
"execution_count": 7,
"outputs": [
{
"output_type": "stream",
"text": [
"1.13.1\n"
],
"name": "stdout"
}
]
},
{
"metadata": {
"id": "DbKe0HiHQo8e",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"## Eager Enabled নেই (Default হিসেবে)"
]
},
{
"metadata": {
"id": "LaUN8hSzQo8f",
"colab_type": "code",
"outputId": "575c3274-b98a-494f-a726-fe2a79937033",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"cell_type": "code",
"source": [
"tf.executing_eagerly()"
],
"execution_count": 8,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"False"
]
},
"metadata": {
"tags": []
},
"execution_count": 8
}
]
},
{
"metadata": {
"id": "umwa9KWjSjwi",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"# tf.matmul: Multiply Two Matricies Using TensorFlow MatMul"
]
},
{
"metadata": {
"scrolled": true,
"id": "ZdkL5GI6Qo8i",
"colab_type": "code",
"outputId": "98abf679-cd55-4854-d746-e6c2d57fe2ce",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"cell_type": "code",
"source": [
"x = [[2., 2.],\n",
" [1., 0.]]\n",
"\n",
"m = tf.matmul(x, x)\n",
"\n",
"m"
],
"execution_count": 9,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 9
}
]
},
{
"metadata": {
"id": "PpdhriR2T1bY",
"colab_type": "text"
},
"cell_type": "markdown",
"source": [
"# টেন্সর-ফ্লো ২.০ ইনস্টলেশন \n",
"\n",
"কিছু জিনিস ঠিকমতো কাজ না করতে পারে, টেস্ট করতে থাকুন "
]
},
{
"metadata": {
"id": "1H1iDGiDTpdr",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 616
},
"outputId": "1de8cd03-d374-4dba-9147-a6a672f65013"
},
"cell_type": "code",
"source": [
"!pip install --upgrade tensorflow-gpu==2.0.0-alpha0"
],
"execution_count": 10,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting tensorflow-gpu==2.0.0-alpha0\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/1a/66/32cffad095253219d53f6b6c2a436637bbe45ac4e7be0244557210dc3918/tensorflow_gpu-2.0.0a0-cp36-cp36m-manylinux1_x86_64.whl (332.1MB)\n",
"\u001b[K |████████████████████████████████| 332.1MB 62kB/s \n",
"\u001b[?25hRequirement already satisfied, skipping upgrade: gast>=0.2.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (0.2.2)\n",
"Requirement already satisfied, skipping upgrade: six>=1.10.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (1.12.0)\n",
"Requirement already satisfied, skipping upgrade: keras-applications>=1.0.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (1.0.7)\n",
"Collecting tf-estimator-nightly<1.14.0.dev2019030116,>=1.14.0.dev2019030115 (from tensorflow-gpu==2.0.0-alpha0)\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/13/82/f16063b4eed210dc2ab057930ac1da4fbe1e91b7b051a6c8370b401e6ae7/tf_estimator_nightly-1.14.0.dev2019030115-py2.py3-none-any.whl (411kB)\n",
"\u001b[K |████████████████████████████████| 419kB 40.7MB/s \n",
"\u001b[?25hRequirement already satisfied, skipping upgrade: protobuf>=3.6.1 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (3.7.1)\n",
"Requirement already satisfied, skipping upgrade: absl-py>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (0.7.1)\n",
"Requirement already satisfied, skipping upgrade: termcolor>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (1.1.0)\n",
"Requirement already satisfied, skipping upgrade: astor>=0.6.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (0.7.1)\n",
"Requirement already satisfied, skipping upgrade: wheel>=0.26 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (0.33.1)\n",
"Collecting tb-nightly<1.14.0a20190302,>=1.14.0a20190301 (from tensorflow-gpu==2.0.0-alpha0)\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/a9/51/aa1d756644bf4624c03844115e4ac4058eff77acd786b26315f051a4b195/tb_nightly-1.14.0a20190301-py3-none-any.whl (3.0MB)\n",
"\u001b[K |████████████████████████████████| 3.0MB 31.4MB/s \n",
"\u001b[?25hRequirement already satisfied, skipping upgrade: numpy<2.0,>=1.14.5 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (1.16.3)\n",
"Requirement already satisfied, skipping upgrade: grpcio>=1.8.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (1.15.0)\n",
"Requirement already satisfied, skipping upgrade: keras-preprocessing>=1.0.5 in /usr/local/lib/python3.6/dist-packages (from tensorflow-gpu==2.0.0-alpha0) (1.0.9)\n",
"Collecting google-pasta>=0.1.2 (from tensorflow-gpu==2.0.0-alpha0)\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/64/bb/f1bbc131d6294baa6085a222d29abadd012696b73dcbf8cf1bf56b9f082a/google_pasta-0.1.5-py3-none-any.whl (51kB)\n",
"\u001b[K |████████████████████████████████| 61kB 21.6MB/s \n",
"\u001b[?25hRequirement already satisfied, skipping upgrade: h5py in /usr/local/lib/python3.6/dist-packages (from keras-applications>=1.0.6->tensorflow-gpu==2.0.0-alpha0) (2.8.0)\n",
"Requirement already satisfied, skipping upgrade: setuptools in /usr/local/lib/python3.6/dist-packages (from protobuf>=3.6.1->tensorflow-gpu==2.0.0-alpha0) (41.0.1)\n",
"Requirement already satisfied, skipping upgrade: werkzeug>=0.11.15 in /usr/local/lib/python3.6/dist-packages (from tb-nightly<1.14.0a20190302,>=1.14.0a20190301->tensorflow-gpu==2.0.0-alpha0) (0.15.2)\n",
"Requirement already satisfied, skipping upgrade: markdown>=2.6.8 in /usr/local/lib/python3.6/dist-packages (from tb-nightly<1.14.0a20190302,>=1.14.0a20190301->tensorflow-gpu==2.0.0-alpha0) (3.1)\n",
"Installing collected packages: tf-estimator-nightly, tb-nightly, google-pasta, tensorflow-gpu\n",
"Successfully installed google-pasta-0.1.5 tb-nightly-1.14.0a20190301 tensorflow-gpu-2.0.0a0 tf-estimator-nightly-1.14.0.dev2019030115\n"
],
"name": "stdout"
},
{
"output_type": "display_data",
"data": {
"application/vnd.colab-display-data+json": {
"pip_warning": {
"packages": [
"tensorflow",
"tensorflow_estimator"
]
}
}
},
"metadata": {
"tags": []
}
}
]
},
{
"metadata": {
"id": "sqqaXABD53ND",
"colab_type": "code",
"colab": {}
},
"cell_type": "code",
"source": [
"import numpy as np\n",
"import tensorflow as tf"
],
"execution_count": 0,
"outputs": []
},
{
"metadata": {
"id": "m1V3nWne55Aa",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "42af5bc0-7f5d-47e6-bbc2-ecdd98c6aee2"
},
"cell_type": "code",
"source": [
"tf.executing_eagerly()"
],
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"True"
]
},
"metadata": {
"tags": []
},
"execution_count": 3
}
]
},
{
"metadata": {
"id": "nelIcfzlT9Hj",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"outputId": "ace48694-d669-4f6a-d883-edd2741183bc"
},
"cell_type": "code",
"source": [
"tf.__version__"
],
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'2.0.0-alpha0'"
]
},
"metadata": {
"tags": []
},
"execution_count": 4
}
]
},
{
"metadata": {
"id": "pmGNj0YNUGVz",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 68
},
"outputId": "00ae5cc7-83bd-4e03-f527-3188fc33fad8"
},
"cell_type": "code",
"source": [
"x = [[2., 2.],\n",
" [1., 0.]]\n",
"\n",
"m = tf.matmul(x, x)\n",
"\n",
"m"
],
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
]
},
"metadata": {
"tags": []
},
"execution_count": 5
}
]
},
{
"metadata": {
"id": "XNWuHyXwQo8l",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 51
},
"outputId": "9ee0696a-cfc2-4a21-f879-90ca04f2a78c"
},
"cell_type": "code",
"source": [
"m.numpy()"
],
"execution_count": 6,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array([[6., 4.],\n",
" [2., 2.]], dtype=float32)"
]
},
"metadata": {
"tags": []
},
"execution_count": 6
}
]
}
]
}