麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > Python > 正文

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

2020-02-15 23:52:38
字體:
來源:轉載
供稿:網友

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

1. 括號與函數調用

def devided_3(x):   return x/3.

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

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

2. 括號與類調用

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)

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 funcfunc(2018)(11)>>> this is func with another func as return  2018  this is another function  11

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

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.*中的注意,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對武林站長站網站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 国产精品成人亚洲一区二区 | 亚洲国产一区二区三区 | 九九热视频这里只有精品 | 日韩av片在线免费观看 | 精品一区二区在线观看视频 | 黄色片免费看看 | 中文字幕四区 | 黄色网址免费在线 | 亚洲精中文字幕二区三区 | 毛片118极品美女写真 | 草草视频免费观看 | 91av久久| 欧美黑大粗硬毛片视频 | 国产一级性生活视频 | 国产乱淫av| 天天鲁在线视频免费观看 | 天海翼四虎精品正在播放 | 亚洲成人免费电影 | 国产成人综合在线视频 | 依依成人精品视频 | 91九色福利 | 色女生影院 | 中文在线观看视频 | 精品久久久久久中文字幕 | 国产成人精品区 | 九一免费国产 | 丰满年轻岳中文字幕一区二区 | 日本黄色一级视频 | 92看片淫黄大片一级 | 精品一区二区亚洲 | 天天看成人免费毛片视频 | 国产四区| 国产精品毛片va一区二区三区 | 国产美女爽到喷白浆的 | 好吊色欧美一区二区三区四区 | 国产一区二区三区视频免费 | a级在线 | 超级av在线| 国产精品久久久久久久亚洲按摩 | 精品国产一区二区三区四区阿崩 | 午夜在线视频一区二区三区 |