caffe的python接口学习(12):查看属性、方法以及函数参数

1.使用dir命令查看属性和方法

dir(solver.net)

"""

查看 sovler.net 属性

'forward': 前向传播

'backward': 反向传播

'params': 保存各层的参数值(w和b)

'blobs': 保存各层的数据值

'bottom_names': 每一层中底层的名称

'top_names': 每一层中顶层的名称

'inputs': 输入

'outputs': 输出

'blob_loss_weights':

'clear_param_diffs':

'copy_from': 拷贝权重

'forward_all': 批量前向传播

'forward_backward_all': 批量反向传播

'layers':

'load_hdf5'

'reshape':

'save':

'save_hdf5':

'set_input_arrays':

'share_with'

"""

dir(sovler.net.blobs)

dir(solver.net.params)

"""

查看 blobs,param 属性

'clear':

'copy':

'fromkeys':

'get':

'has_key':

'items':

'iteritems':

'iterkeys':

'itervalus':

'keys':

'pop':

'popitem':

'values':

'update'

'viewitems':

'viewkeys':

'viewvalus':

"""



2.使用help()查看函数的输入和输出

help(solver.net.forward)

help(solver.net.forward_all)


Help on method _Net_forward_all in module caffe.pycaffe:


_Net_forward_all(self, blobs=None, **kwargs) method of caffe._caffe.Net instance

Run net forward in batches.

Parameters

----------

blobs : list of blobs to extract as in forward()

kwargs : Keys are input blob names and values are blob ndarrays.

Refer to forward().

Returns

-------

all_outs : {blob name: list of blobs} dict.


None

Help on method _Net_forward in module caffe.pycaffe:


_Net_forward(self, blobs=None, start=None, end=None, **kwargs) method of caffe._caffe.Net instance

Forward pass: prepare inputs and run the net forward.

Parameters

----------

blobs : list of blobs to return in addition to output blobs.

kwargs : Keys are input blob names and values are blob ndarrays.

For formatting inputs for Caffe, see Net.preprocess().

If None, input is taken from data layers.

start : optional name of layer at which to begin the forward pass

end : optional name of layer at which to finish the forward pass

(inclusive)

Returns

-------

outs : {blob name: blob ndarray} dict.


None


你可能感兴趣的:(深度学习)