(input)
| 84 | // This function runs sub-model 2 and extracts the slice of the probability |
| 85 | // output that corresponds to the desired class. |
| 86 | const convOutput2ClassOutput = (input) => |
| 87 | subModel2.apply(input, {training: true}).gather([classIndex], 1); |
| 88 | // This is the gradient function of the output corresponding to the desired |
| 89 | // class with respect to its input (i.e., the output of the last |
| 90 | // convolutional layer of the original model). |