tensorforce package

Subpackages

Submodules

tensorforce.exception module

exception tensorforce.exception.TensorForceError

Bases: exceptions.Exception

TensorForce error

tensorforce.meta_parameter_recorder module

class tensorforce.meta_parameter_recorder.MetaParameterRecorder(current_frame)

Bases: object

Class to record MetaParameters as well as Summary/Description for TensorBoard (TEXT & FILE will come later)

General:

  • format_type: used to configure data conversion for TensorBoard=0, TEXT & JSON (not Implemented), etc
build_metagraph_list()

Convert MetaParams into TF Summary Format and create summary_op

Parameters:None
Returns:Merged TF Op for TEXT summary elements, should only be executed once to reduce data duplication
convert_data_to_string(data, indent=0, format_type=0, separator=None, eol=None)
convert_dictionary_to_string(data, indent=0, format_type=0, separator=None, eol=None)
convert_list_to_string(data, indent=0, format_type=0, eol=None, count=True)
convert_ndarray_to_md(data, format_type=0, eol=None)
merge_custom(custom_dict)
text_output(format_type=1)

tensorforce.util module

tensorforce.util.cumulative_discount(values, terminals, discount, cumulative_start=0.0)

Compute cumulative discounts. :param values: Values to discount :param terminals: Booleans indicating terminal states :param discount: Discount factor :param cumulative_start: Float or ndarray, estimated reward for state t + 1. Default 0.0

Returns:The cumulative discounted rewards.
Return type:dicounted_values
tensorforce.util.get_object(obj, predefined_objects=None, default_object=None, kwargs=None)

Utility method to map some kind of object specification to its content, e.g. optimizer or baseline specifications to the respective classes.

Parameters:
  • obj – A specification dict (value for key ‘type’ optionally specifies the object, options as follows), a module path (e.g., my_module.MyClass), a key in predefined_objects, or a callable (e.g., the class type object).
  • predefined_objects – Dict containing predefined set of objects, accessible via their key
  • default_object – Default object is no other is specified
  • kwargs – Arguments for object creation

Returns: The retrieved object

tensorforce.util.np_dtype(dtype)

Translates dtype specifications in configurations to numpy data types. :param dtype: String describing a numerical type (e.g. ‘float’) or numerical type primitive.

Returns: Numpy data type

tensorforce.util.prod(xs)

Computes the product along the elements in an iterable. Returns 1 for empty iterable.

Parameters:xs – Iterable containing numbers.

Returns: Product along iterable.

tensorforce.util.rank(x)
tensorforce.util.shape(x, unknown=-1)
tensorforce.util.tf_dtype(dtype)

Translates dtype specifications in configurations to tensorflow data types.

Parameters:dtype – String describing a numerical type (e.g. ‘float’), numpy data type, or numerical type primitive.

Returns: TensorFlow data type

Module contents

exception tensorforce.TensorForceError

Bases: exceptions.Exception

TensorForce error