(*args, **kwargs)
| 130 | return dtype |
| 131 | |
| 132 | def func(*args, **kwargs) -> Tensor: |
| 133 | helper = LayerHelper(op_type, **kwargs) |
| 134 | |
| 135 | dtype = infer_and_check_dtype(op_proto, *args, **kwargs) |
| 136 | |
| 137 | inputs = {} |
| 138 | for ipt in op_proto.inputs: |
| 139 | name = _convert_(ipt.name) |
| 140 | val = kwargs.pop(name, []) |
| 141 | if not isinstance(val, list) and not isinstance(val, tuple): |
| 142 | val = [val] |
| 143 | if len(val) == 0 and len(args) != 0: |
| 144 | val = args[0] |
| 145 | args = args[1:] |
| 146 | inputs[ipt.name] = val |
| 147 | |
| 148 | outputs = {} |
| 149 | out = kwargs.pop(_convert_(o_name), []) |
| 150 | if out: |
| 151 | out_var = out[0] if isinstance(out, (list, tuple)) else out |
| 152 | else: |
| 153 | out_var = helper.create_variable_for_type_inference(dtype=dtype) |
| 154 | outputs[o_name] = [out_var] |
| 155 | for name in intermediate_output_names: |
| 156 | outputs[name] = [ |
| 157 | helper.create_variable_for_type_inference(dtype=dtype) |
| 158 | ] |
| 159 | helper.append_op( |
| 160 | type=op_type, inputs=inputs, outputs=outputs, attrs=kwargs |
| 161 | ) |
| 162 | return helper.append_activation(out_var) |
| 163 | |
| 164 | func.__name__ = op_type |
| 165 | return func |
no test coverage detected