Тензорное обратное распространение - PullRequest
0 голосов
/ 10 марта 2020

Я пытаюсь обмануть нейронную сеть, как в этой статье: https://codewords.recurse.com/issues/five/why-do-neural-networks-think-a-panda-is-a-vulture

Я изо всех сил пытаюсь найти способ создания compute_gradient метода с использованием tenorflow:

def compute_gradient(image, intended_outcome):
    # Put the image into the network and make the prediction
    predict(image)
    # Get an empty set of probabilities
    probs = np.zeros_like(net.blobs['prob'].data)
    # Set the probability for our intended outcome to 1
    probs[0][intended_outcome] = 1
    # Do backpropagation to calculate the gradient for that outcome
    # and the image we put in
    gradient = net.backward(prob=probs)
    return gradient['data'].copy()

Буду признателен за любые советы о том, как рассчитать «градиент бумажного полотенца».

...