Ich habe einfaches Modell wie folgt aus:Wie wird der Verlust im Tensorflow berechnet?
n_input = 14
n_out = 1
weights = {
'out': tf.Variable(tf.random_normal([n_input, n_out]))
}
biases = {
'out': tf.Variable(tf.random_normal([n_out]))
}
def perceptron(input_tensor, weights, biases):
out_layer_multiplication = tf.matmul(input_tensor, weights['out'])
out_layer_addition = out_layer_multiplication + biases['out']
return out_layer_addition
input_tensor = rows
model = perceptron
"Reihen" Dimension ist (N, 14) und "out" Dimension ist (N), wobei "out" ist Ergebnis Modell des Laufens mit "Zeilen" als "input_tensor".
Und ich möchte Verlust im Tensorflow berechnen. Algorythm der Berechnung ist:
ls = 0
for i in range(len(out)-1):
if out[i] < out[i+1]:
ls += 1
Wo "ls" ist Modellverlust. Wie kann ich es in Tensorflow-Notation berechnen?