(*inputs)
| 140 | |
| 141 | # The inputs of the forward function are inputs_filtered below. |
| 142 | def forward(*inputs): |
| 143 | inputs_iter = iter(inputs) |
| 144 | inputs_tvm = [ |
| 145 | _numpy_to_tvm(next(inputs_iter)) |
| 146 | if i not in ignore_grads |
| 147 | else _numpy_to_tvm(inputs_numpy[i]) |
| 148 | for i in range(len(inputs_numpy)) |
| 149 | ] |
| 150 | result = forward_vm[func_name](*inputs_tvm) |
| 151 | result_numpy = _tvm_to_numpy(result) |
| 152 | if isinstance(result_numpy, list): |
| 153 | assert isinstance(weights, list) |
| 154 | assert len(weights) == len(result_numpy) |
| 155 | ret = 0 |
| 156 | for i, weight in enumerate(weights): |
| 157 | ret += np.sum(weight * result_numpy[i]) |
| 158 | return ret |
| 159 | return np.sum(weights * result_numpy) |
| 160 | |
| 161 | # The gradient function |
| 162 | assert isinstance(call.op, Op) |
nothing calls this directly
no test coverage detected
searching dependent graphs…