(
model,
is_nd,
blob_in,
blob_out,
dim_in,
dim_out,
kernel,
weight_init=None,
bias_init=None,
WeightInitializer=None,
BiasInitializer=None,
group=1,
transform_inputs=None,
use_cudnn=False,
order="NCHW",
cudnn_exhaustive_search=False,
ws_nbytes_limit=None,
float16_compute=False,
**kwargs
)
| 10 | from caffe2.python.modeling.parameter_info import ParameterTags |
| 11 | |
| 12 | def _ConvBase( |
| 13 | model, |
| 14 | is_nd, |
| 15 | blob_in, |
| 16 | blob_out, |
| 17 | dim_in, |
| 18 | dim_out, |
| 19 | kernel, |
| 20 | weight_init=None, |
| 21 | bias_init=None, |
| 22 | WeightInitializer=None, |
| 23 | BiasInitializer=None, |
| 24 | group=1, |
| 25 | transform_inputs=None, |
| 26 | use_cudnn=False, |
| 27 | order="NCHW", |
| 28 | cudnn_exhaustive_search=False, |
| 29 | ws_nbytes_limit=None, |
| 30 | float16_compute=False, |
| 31 | **kwargs |
| 32 | ): |
| 33 | kernels = [] |
| 34 | if is_nd: |
| 35 | if not isinstance(kernel, list): |
| 36 | kernels = [kernel] |
| 37 | else: |
| 38 | kernels = kernel |
| 39 | else: |
| 40 | if isinstance(kernel, list): |
| 41 | assert len(kernel) == 2, "Conv support only a 2D kernel." |
| 42 | kernels = kernel |
| 43 | else: |
| 44 | kernels = [kernel] * 2 |
| 45 | |
| 46 | requested_engine = kwargs.get('engine') |
| 47 | if requested_engine is not None: |
| 48 | if use_cudnn and requested_engine != 'CUDNN': |
| 49 | raise ValueError( |
| 50 | 'When use_cudnn=True, the only engine you can specify is ' |
| 51 | '"CUDNN"') |
| 52 | elif not use_cudnn and requested_engine == 'CUDNN': |
| 53 | raise ValueError( |
| 54 | 'When use_cudnn=False, the only engine you can specify is ' |
| 55 | '""') |
| 56 | |
| 57 | if use_cudnn: |
| 58 | kwargs['engine'] = 'CUDNN' |
| 59 | kwargs['exhaustive_search'] = cudnn_exhaustive_search |
| 60 | if ws_nbytes_limit: |
| 61 | kwargs['ws_nbytes_limit'] = ws_nbytes_limit |
| 62 | |
| 63 | use_bias =\ |
| 64 | False if ("no_bias" in kwargs and kwargs["no_bias"]) else True |
| 65 | blob_out = blob_out or model.net.NextName() |
| 66 | weight_shape = [dim_out] |
| 67 | if order == "NCHW": |
| 68 | weight_shape.append(int(dim_in / group)) |
| 69 | weight_shape.extend(kernels) |
no test coverage detected
searching dependent graphs…