1
I했습니다 같은 간단한 모델 :tensorflow의 손실을 계산하는 방법은 무엇입니까?
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
"행"치수 (N, 14) 및 "밖으로"치수는 (N)이다 "밖으로", "행"로 모델을 실행의 결과는 "input_tensor"로 지정하십시오.
그리고 tensorflow의 손실을 계산하고 싶습니다. 계산의 Algorythm은 다음과 같습니다.
ls = 0
for i in range(len(out)-1):
if out[i] < out[i+1]:
ls += 1
"ls"는 모델 손실입니다. 어떻게 그것을 텐서 플로우 표기법으로 계산할 수 있습니까?