Skip to content

Commit dde31b9

Browse files
committed
Tensorflow
1 parent f988d28 commit dde31b9

File tree

2 files changed

+346
-4
lines changed

2 files changed

+346
-4
lines changed
Lines changed: 173 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,177 @@
11
{
2-
"cells": [],
3-
"metadata": {},
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stderr",
10+
"output_type": "stream",
11+
"text": [
12+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
13+
" _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n",
14+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
15+
" _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n",
16+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
17+
" _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n",
18+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
19+
" _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n",
20+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
21+
" _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n",
22+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
23+
" np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n",
24+
"/usr/lib/python3/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
25+
" from ._conv import register_converters as _register_converters\n",
26+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
27+
" _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n",
28+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
29+
" _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n",
30+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
31+
" _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n",
32+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
33+
" _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n",
34+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
35+
" _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n",
36+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
37+
" np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n"
38+
]
39+
}
40+
],
41+
"source": [
42+
"import tensorflow as tf"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": 2,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"x1 = tf.constant([1,2,3,4])"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": 3,
57+
"metadata": {},
58+
"outputs": [
59+
{
60+
"data": {
61+
"text/plain": [
62+
"<tf.Tensor 'Const:0' shape=(4,) dtype=int32>"
63+
]
64+
},
65+
"execution_count": 3,
66+
"metadata": {},
67+
"output_type": "execute_result"
68+
}
69+
],
70+
"source": [
71+
"x1"
72+
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": 4,
77+
"metadata": {},
78+
"outputs": [
79+
{
80+
"name": "stdout",
81+
"output_type": "stream",
82+
"text": [
83+
"Tensor(\"Const:0\", shape=(4,), dtype=int32)\n"
84+
]
85+
}
86+
],
87+
"source": [
88+
"print(x1)"
89+
]
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": 5,
94+
"metadata": {},
95+
"outputs": [],
96+
"source": [
97+
"x2 = tf.constant([5,6,7,8])"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": 6,
103+
"metadata": {},
104+
"outputs": [
105+
{
106+
"data": {
107+
"text/plain": [
108+
"<tf.Tensor 'mul:0' shape=(4,) dtype=int32>"
109+
]
110+
},
111+
"execution_count": 6,
112+
"metadata": {},
113+
"output_type": "execute_result"
114+
}
115+
],
116+
"source": [
117+
"x1*x2"
118+
]
119+
},
120+
{
121+
"cell_type": "code",
122+
"execution_count": 7,
123+
"metadata": {},
124+
"outputs": [],
125+
"source": [
126+
"sess = tf.Session()"
127+
]
128+
},
129+
{
130+
"cell_type": "code",
131+
"execution_count": 8,
132+
"metadata": {},
133+
"outputs": [
134+
{
135+
"name": "stdout",
136+
"output_type": "stream",
137+
"text": [
138+
"[ 5 12 21 32]\n"
139+
]
140+
}
141+
],
142+
"source": [
143+
"print(sess.run(x1*x2))"
144+
]
145+
},
146+
{
147+
"cell_type": "code",
148+
"execution_count": 9,
149+
"metadata": {},
150+
"outputs": [],
151+
"source": [
152+
"sess.close()"
153+
]
154+
}
155+
],
156+
"metadata": {
157+
"kernelspec": {
158+
"display_name": "Python 3",
159+
"language": "python",
160+
"name": "python3"
161+
},
162+
"language_info": {
163+
"codemirror_mode": {
164+
"name": "ipython",
165+
"version": 3
166+
},
167+
"file_extension": ".py",
168+
"mimetype": "text/x-python",
169+
"name": "python",
170+
"nbconvert_exporter": "python",
171+
"pygments_lexer": "ipython3",
172+
"version": "3.6.8"
173+
}
174+
},
4175
"nbformat": 4,
5176
"nbformat_minor": 2
6177
}

23.Tensorflow Basics.ipynb

Lines changed: 173 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,177 @@
11
{
2-
"cells": [],
3-
"metadata": {},
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stderr",
10+
"output_type": "stream",
11+
"text": [
12+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
13+
" _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n",
14+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
15+
" _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n",
16+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
17+
" _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n",
18+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
19+
" _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n",
20+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
21+
" _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n",
22+
"/home/angicia/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
23+
" np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n",
24+
"/usr/lib/python3/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
25+
" from ._conv import register_converters as _register_converters\n",
26+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
27+
" _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n",
28+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
29+
" _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n",
30+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
31+
" _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n",
32+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
33+
" _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n",
34+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
35+
" _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n",
36+
"/usr/local/lib/python3.6/dist-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
37+
" np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n"
38+
]
39+
}
40+
],
41+
"source": [
42+
"import tensorflow as tf"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": 2,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"x1 = tf.constant([1,2,3,4])"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": 3,
57+
"metadata": {},
58+
"outputs": [
59+
{
60+
"data": {
61+
"text/plain": [
62+
"<tf.Tensor 'Const:0' shape=(4,) dtype=int32>"
63+
]
64+
},
65+
"execution_count": 3,
66+
"metadata": {},
67+
"output_type": "execute_result"
68+
}
69+
],
70+
"source": [
71+
"x1"
72+
]
73+
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": 4,
77+
"metadata": {},
78+
"outputs": [
79+
{
80+
"name": "stdout",
81+
"output_type": "stream",
82+
"text": [
83+
"Tensor(\"Const:0\", shape=(4,), dtype=int32)\n"
84+
]
85+
}
86+
],
87+
"source": [
88+
"print(x1)"
89+
]
90+
},
91+
{
92+
"cell_type": "code",
93+
"execution_count": 5,
94+
"metadata": {},
95+
"outputs": [],
96+
"source": [
97+
"x2 = tf.constant([5,6,7,8])"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": 6,
103+
"metadata": {},
104+
"outputs": [
105+
{
106+
"data": {
107+
"text/plain": [
108+
"<tf.Tensor 'mul:0' shape=(4,) dtype=int32>"
109+
]
110+
},
111+
"execution_count": 6,
112+
"metadata": {},
113+
"output_type": "execute_result"
114+
}
115+
],
116+
"source": [
117+
"x1*x2"
118+
]
119+
},
120+
{
121+
"cell_type": "code",
122+
"execution_count": 7,
123+
"metadata": {},
124+
"outputs": [],
125+
"source": [
126+
"sess = tf.Session()"
127+
]
128+
},
129+
{
130+
"cell_type": "code",
131+
"execution_count": 8,
132+
"metadata": {},
133+
"outputs": [
134+
{
135+
"name": "stdout",
136+
"output_type": "stream",
137+
"text": [
138+
"[ 5 12 21 32]\n"
139+
]
140+
}
141+
],
142+
"source": [
143+
"print(sess.run(x1*x2))"
144+
]
145+
},
146+
{
147+
"cell_type": "code",
148+
"execution_count": 9,
149+
"metadata": {},
150+
"outputs": [],
151+
"source": [
152+
"sess.close()"
153+
]
154+
}
155+
],
156+
"metadata": {
157+
"kernelspec": {
158+
"display_name": "Python 3",
159+
"language": "python",
160+
"name": "python3"
161+
},
162+
"language_info": {
163+
"codemirror_mode": {
164+
"name": "ipython",
165+
"version": 3
166+
},
167+
"file_extension": ".py",
168+
"mimetype": "text/x-python",
169+
"name": "python",
170+
"nbconvert_exporter": "python",
171+
"pygments_lexer": "ipython3",
172+
"version": "3.6.8"
173+
}
174+
},
4175
"nbformat": 4,
5176
"nbformat_minor": 2
6177
}

0 commit comments

Comments
 (0)