(output, target)
| 100 | return res |
| 101 | |
| 102 | def accuracy_multi(output, target): |
| 103 | pred = (output > 0).float() |
| 104 | tf = (pred == target).float() |
| 105 | acc = tf.sum() / output.size(0) / output.size(1) * 100 |
| 106 | return acc |
| 107 | |
| 108 | def save_state(state, path, step): |
| 109 | path, filename = os.path.split(path) |