tensorflow使用过程中报错,有关tf.compat.v1.losses.Reduction.SUM这句的报错,如何修改?
非常感谢!
classifier = tf.estimator.DNNClassifier(
feature_columns=feature_columns,
hidden_units=[256, 32],
optimizer=tf.compat.v1.train.AdamOptimizer(learning_rate),
n_classes=10,
dropout=0.1,
model_dir="./tmp/mnist_modelx",
loss_reduction=tf.compat.v1.losses.Reduction.SUM)
Traceback (most recent call last):
File "C:/Users/User/PycharmProjects/HML/.idea/TensorFlow_Estimators.py", line 26, in
loss_reduction=tf.compat.v1.losses.Reduction.SUM)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py", line 745, in init
loss_reduction=loss_reduction)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\python\estimator\head\head_utils.py", line 65, in binary_or_multi_class_head
loss_reduction=loss_reduction)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\python\estimator\head\multi_class_head.py", line 155, in init
base_head.validate_loss_reduction(loss_reduction)
File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow_estimator\python\estimator\head\base_head.py", line 656, in validate_loss_reduction
'options.'.format(loss_reduction))
ValueError: Invalid loss_reduction: weighted_sum. See tf.losses.Reduction
for valid options.