Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with tf.variable_scope(scope):
- # get size of features from action_spec and observation_spec
- nonspatial_size = 0
- spatial_features = ['feature_minimap', 'feature_screen']
- initially_zero_features = {'cargo': 500, 'multi_select': 500, 'build_queue': 10, 'single_select': 1}
- for feature_name, feature_dim in observation_spec:
- if feature_name not in spatial_features:
- if feature_name == 'available_actions':
- feature_size = len(action_spec.functions)
- elif feature_name in initially_zero_features:
- feature_size = initially_zero_features[feature_name] * feature_dim[1]
- else:
- feature_size = 1
- for dim in feature_dim:
- feature_size *= dim
- nonspatial_size += feature_size
- screen_channels = observation_spec['screen'][0]
- minimap_channels = observation_spec['minimap'][0]
- Old data type for observation_spec was dict-based but I don't know the exact arrangement without reading through the old changelogs.
- New data type for observation_spec is a tuple like this:
- <class 'tuple'>: ({'action_result': (0,), 'alerts': (0,), 'available_actions': (0,), 'build_queue': (0, 7), 'cargo': (0, 7), 'cargo_slots_available': (1,), 'control_groups': (10, 2), 'game_loop': (1,), 'last_actions': (0,), 'multi_select': (0, 7), 'player': (11,), 'score_cumulative': (13,), 'single_select': (0, 7), 'feature_screen': (17, 84, 84), 'feature_minimap': (7, 64, 64), 'feature_units': (0, 26)},)
- Data in the tuple observation_spec is addressable by [0].action_result[0]
Advertisement
Add Comment
Please, Sign In to add comment