国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

腳本之家,腳本語言編程技術及教程分享平臺!
分類導航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務器之家 - 腳本之家 - Python - Python 中 function(#) (X)格式 和 (#)在Python3.*中的注意事項

Python 中 function(#) (X)格式 和 (#)在Python3.*中的注意事項

2021-04-24 00:18沈子恒 Python

這篇文章主要介紹了Python 中 function(#) (X)格式 和 (#)在Python3.*中的注意事項,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下

python 的語法定義和C++、matlab、java 還是很有區別的。

1. 括號與函數調用

?
1
2
def devided_3(x):
   return x/3.

print(a)    #不帶括號調用的結果:<function a at 0x139c756a8>
print(a(3)) #帶括號調用的結果:1

不帶括號時,調用的是函數在內存在的首地址; 帶括號時,調用的是函數在內存區的代碼塊,輸入參數后執行函數體。

2. 括號與類調用

?
1
2
3
4
5
6
7
8
9
class test():
  y = 'this is out of __init__()'
  def __init__(self):
    self.y = 'this is in the __init__()'
 
x = test  # x是類位置的首地址
print(x.y) # 輸出類的內容:this is out of __init__()
x = test() # 類的實例化
print(x.y) # 輸出類的屬性:this is in the __init__() ;

3. function(#) (input)

?
1
2
3
4
5
6
7
8
9
10
11
12
def With_func_rtn(a):
  print("this is func with another func as return")
  print(a)
  def func(b):
    print("this is another function")
    print(b)
  return func
func(2018)(11)
>>> this is func with another func as return
  2018
  this is another function
  11

其實,這種情況最常用在卷積神經網絡中:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def model(input_shape):
  # Define the input placeholder as a tensor with shape input_shape.
  X_input = Input(input_shape)
  # Zero-Padding: pads the border of X_input with zeroes
  X = ZeroPadding2D((3, 3))(X_input)
  # CONV -> BN -> RELU Block applied to X
  X = Conv2D(32, (7, 7), strides = (1, 1), name = 'conv0')(X)
  X = BatchNormalization(axis = 3, name = 'bn0')(X)
  X = Activation('relu')(X)
  # MAXPOOL
  X = MaxPooling2D((2, 2), name='max_pool')(X)
  # FLATTEN X (means convert it to a vector) + FULLYCONNECTED
  X = Flatten()(X)
  X = Dense(1, activation='sigmoid', name='fc')(X)
  # Create model. This creates your Keras model instance, you'll use this instance to train/test the model.
  model = Model(inputs = X_input, outputs = X, name='HappyModel')
  return model

總結

以上所述是小編給大家介紹的Python 中 function(#) (X)格式 和 (#)在Python3.*中的注意,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對服務器之家網站的支持!

原文鏈接:https://blog.csdn.net/shenziheng1/article/details/84646453

延伸 · 閱讀

精彩推薦
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 伊人福利视频 | 欧美综合在线观看 | 国产成人免费 | 亚洲自拍中文 | 国产在线高清视频 | 天堂av资源| 在线成人www免费观看视频 | 国产一区二区三区视频在线观看 | 欧美在线视屏 | 日本中文字幕免费 | 在线观看中文字幕亚洲 | 久久久国色 | 久久久久久久久久久久99 | 一级黄色大片 | 午夜黄色影院 | 午夜在线小视频 | 最新中文字幕视频 | 黄色毛片免费网站 | 最近韩国日本免费观看mv免费版 | 精品久久国产老人久久综合 | 四虎久久精品 | 久久最新 | 91久久久久久久久久久久久 | 午夜精品久久久久久久久久久久 | 免费看黄色电影 | 国产精品高潮呻吟久久 | 亚洲精品一区二三区不卡 | 欧美成人自拍 | 国产成人欧美一区二区三区的 | 国产欧美精品一区二区三区 | 久草热在线 | 中文字幕亚洲欧美 | 成人网av| 在线色网站 | 亚洲精品久久久久久久久久久 | 成人午夜视频在线观看 | 亚洲视频免费观看 | 午夜视频在线观看网站 | 国产精品不卡视频 | 免费在线成人网 | 精品国产乱码一区二区三区 |