FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
tutorials/tensorflowTUT/tensorflow10_def_add_layer.py at master · Snowdrop99/tutorials · GitHub
Snowdrop99
/
tutorials
Public
forked from
MorvanZhou/tutorials
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
tutorials
/
tensorflowTUT
/
tensorflow10_def_add_layer.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
21 lines (17 loc) · 780 Bytes
Breadcrumbs
tutorials
/
tensorflowTUT
/
tensorflow10_def_add_layer.py
Copy path
File metadata and controls
21 lines (17 loc) · 780 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.
"""
from
__future__
import
print_function
import
tensorflow
as
tf
def
add_layer
(
inputs
,
in_size
,
out_size
,
activation_function
=
None
):
Weights
=
tf
.
Variable
(
tf
.
random_normal
([
in_size
,
out_size
]))
biases
=
tf
.
Variable
(
tf
.
zeros
([
1
,
out_size
])
+
0.1
)
Wx_plus_b
=
tf
.
matmul
(
inputs
,
Weights
)
+
biases
if
activation_function
is
None
:
outputs
=
Wx_plus_b
else
:
outputs
=
activation_function
(
Wx_plus_b
)
return
outputs
Back
|
FazBrowse Home
|
New Git URL