MCPcopy Create free account
hub / github.com/BVLC/caffe / conv_params

Function conv_params

python/caffe/coord_map.py:18–37  ·  view source on GitHub ↗

Extract the spatial parameters that determine the coordinate mapping: kernel size, stride, padding, and dilation. Implementation detail: Convolution, Deconvolution, and Im2col layers define these in the convolution_param message, while Pooling has its own fields in pooling_para

(fn)

Source from the content-addressed store, hash-verified

16
17
18def conv_params(fn):
19 """
20 Extract the spatial parameters that determine the coordinate mapping:
21 kernel size, stride, padding, and dilation.
22
23 Implementation detail: Convolution, Deconvolution, and Im2col layers
24 define these in the convolution_param message, while Pooling has its
25 own fields in pooling_param. This method deals with these details to
26 extract canonical parameters.
27 """
28 params = fn.params.get('convolution_param', fn.params)
29 axis = params.get('axis', 1)
30 ks = np.array(params['kernel_size'], ndmin=1)
31 dilation = np.array(params.get('dilation', 1), ndmin=1)
32 assert len({'pad_h', 'pad_w', 'kernel_h', 'kernel_w', 'stride_h',
33 'stride_w'} & set(fn.params)) == 0, \
34 'cropping does not support legacy _h/_w params'
35 return (axis, np.array(params.get('stride', 1), ndmin=1),
36 (ks - 1) * dilation + 1,
37 np.array(params.get('pad', 0), ndmin=1))
38
39
40def crop_params(fn):

Callers 1

coord_mapFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected