我在终端内部运行以下代码与脚本文件中的结果不同。
for i in {1..5}
do
echo $i is a number
done
终端输出:
1 is a number
2 is a number
3 is a number
4 is a number
5 is a number
脚本输出
{1..5} is a number
答案 0 :(得分:1)
添加:
def calLoss(logits, labels, augs):
noAugLogits = []
noAugLabels = []
augLogits = []
augLabels = []
tf.get_collection()
for i in range(augs.shape[0]):
if augs[i] == 1:
noAugLogits.append(logits[i])
noAugLabels.append(labels[i])
else:
augLogits.append(logits[i])
augLabels.append(labels[i])
noAugLogits = tf.convert_to_tensor(noAugLogits)
noAugLabels = tf.convert_to_tensor(noAugLabels)
augLogits = tf.convert_to_tensor(augLogits)
augLabels = tf.convert_to_tensor(augLabels)
return tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(
noAugLogits, noAugLabels)) * PENALTY_COEFFICIENT + \
tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(augLogits, augLabels))
你的默认shell可能是sh,这是sh:
的另一个例子#!/bin/bash
答案 1 :(得分:0)
#!/bin/bash
for i in {1..5}
do
echo $i is a number
done
得到以下输出:
1 is a number
2 is a number
3 is a number
4 is a number
5 is a number