所以我有这个代码需要检查多个变量,所以如果对于ex 1 id或id 2为true它会播放console.log所以我可以创建多个var或测试indexOf mutliple行,当1为真时它播放console.log
Traceback (most recent call last):
File "main.py", line 69, in <module>
main();
File "main.py", line 66, in main
train_model(iris_dataset, model, optimizer);
File "main.py", line 41, in train_model
gradients = gradient_tune(features, label, model);
File "main.py", line 27, in gradient_tune
prediction_loss = prediction_loss_diff(features, targets, model);
File "main.py", line 23, in prediction_loss_diff
return tf.losses.sparse_softmax_cross_entropy(label, predicted_label);
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/losses/losses_impl.py", line 853, in sparse_softmax_cross_entropy
name="xentropy")
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/nn_ops.py", line 2050, in sparse_softmax_cross_entropy_with_logits
precise_logits, labels, name=name)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 7504, in sparse_softmax_cross_entropy_with_logits
_six.raise_from(_core._status_to_exception(e.code, message), None)
File "<string>", line 2, in raise_from
tensorflow.python.framework.errors_impl.InternalError: Could not find valid device for node name: "SparseSoftmaxCrossEntropyWithLogits"
op: "SparseSoftmaxCrossEntropyWithLogits"
input: "dummy_input"
input: "dummy_input"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
attr {
key: "Tlabels"
value {
type: DT_FLOAT
}
}
答案 0 :(得分:0)
您希望将||
放在indexOf
之外:
var id = '76561198331632938';
if (document.getElementById("id").innerHTML.indexOf(id) !== -1 ||
document.getElementById("id2").innerHTML.indexOf(id) !== -1) {
console.log("Hello world!");
}