Я использую этот код для подсчета баллов mnist (начальный балл). функция mnist_score
возвращает счет в виде тензора. как я могу преобразовать его в плавающее?
def mnist_score(images, graph_def_filename=None, input_tensor=INPUT_TENSOR,
output_tensor=OUTPUT_TENSOR, num_batches=1):
"""Get MNIST logits of a fully-trained classifier.
Args:
images: A minibatch tensor of MNIST digits. Shape must be
[batch, 28, 28, 1].
graph_def_filename: Location of a frozen GraphDef binary file on disk. If
`None`, uses a default graph.
input_tensor: GraphDef's input tensor name.
output_tensor: GraphDef's output tensor name.
num_batches: Number of batches to split `generated_images` in to in order to
efficiently run them through Inception.
Returns:
A logits tensor of [batch, 10].
"""
images.shape.assert_is_compatible_with([None, 28, 28, 1])
graph_def = _graph_def_from_par_or_disk(graph_def_filename)
mnist_classifier_fn = lambda x: tfgan.eval.run_image_classifier( # pylint: disable=g-long-lambda
x, graph_def, input_tensor, output_tensor)
score = tfgan.eval.classifier_score(
images, mnist_classifier_fn, num_batches)
score.shape.assert_is_compatible_with([])
return score