(inp, w, b)
| 114 | return var |
| 115 | |
| 116 | def run_conv2d(inp, w, b): |
| 117 | O = F.conv2d( |
| 118 | inp, w, b if has_bias else None, stride=(SH, SW), padding=(PH, PW), |
| 119 | ) |
| 120 | if nonlinear_mode == "relu": |
| 121 | return F.relu(O) |
| 122 | else: |
| 123 | return O |
| 124 | |
| 125 | def run_conv_bias(inp, w, b, format="NCHW"): |
| 126 | b = b if has_bias else mge.Parameter(np.zeros_like(b.numpy())) |