contrib.training.parse_values

tf.contrib.training.parse_values

tf.contrib.training.parse_values

parse_values(
    values,
    type_map
)

Defined in tensorflow/contrib/training/python/training/hparam.py.

Parses hyperparameter values from a string into a python map..

values is a string containing comma-separated name=value pairs. For each pair, the value of the hyperparameter named name is set to value.

If a hyperparameter name appears multiple times in values, the last value is used.

The value in name=value must follows the syntax according to the type of the parameter:

  • Scalar integer: A Python-parsable integer point value. E.g.: 1, 100, -12.
  • Scalar float: A Python-parsable floating point value. E.g.: 1.0, -.54e89.
  • Boolean: Either true or false.
  • Scalar string: A non-empty sequence of characters, excluding comma, spaces, and square brackets. E.g.: foo, bar_1.
  • List: A comma separated list of scalar values of the parameter type enclosed in square backets. E.g.: [1,2,3], [1.0,1e-12], [high,low].

Args:

  • values: String. Comma separated list of name=value pairs where 'value' must follow the syntax described above.
  • type_map: A dictionary mapping hyperparameter names to types. Note every parameter name in values must be a key in type_map. The values must conform to the types indicated, where a value V is said to conform to a type T if either V has type T, or V is a list of elements of type T. Hence, for a multidimensional parameter 'x' taking float values, 'x=[0.1,0.2]' will parse successfully if type_map['x'] = float.

Returns:

A python map containing the name, value pairs.

Raises:

  • ValueError: If values cannot be parsed.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/training/parse_values

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部