(net, net_params, dummy_input, legacy_pad_ops)
| 48 | |
| 49 | |
| 50 | def _GetLegacyDims(net, net_params, dummy_input, legacy_pad_ops): |
| 51 | dim_map = {} |
| 52 | ws = workspace.C.Workspace() |
| 53 | for param in net_params.protos: |
| 54 | ws.create_blob(param.name) \ |
| 55 | .feed(utils.Caffe2TensorToNumpyArray(param)) |
| 56 | external_input = net.op[0].input[0] |
| 57 | ws.create_blob(external_input).feed(dummy_input) |
| 58 | # Get dimensions with legacy pad |
| 59 | for i in range(len(net.op)): |
| 60 | op_def = net.op[i] |
| 61 | ws._run_operator(op_def.SerializeToString()) |
| 62 | if i in legacy_pad_ops: |
| 63 | output = op_def.output[0] |
| 64 | blob_legacy = ws.fetch_blob(output) |
| 65 | dim_map[i] = blob_legacy.shape |
| 66 | return dim_map |
| 67 | |
| 68 | |
| 69 | def _GetLegacyPadArgs(op_def, arg_map): |
no test coverage detected
searching dependent graphs…