MCPcopy
hub / github.com/google-deepmind/acme / signature

Method signature

acme/adders/reverb/base.py:219–245  ·  view source on GitHub ↗

This is a helper method for generating signatures for Reverb tables. Signatures are useful for validating data types and shapes, see Reverb's documentation for details on how they are used. Args: environment_spec: A `specs.EnvironmentSpec` whose fields are nested structur

(cls, environment_spec: specs.EnvironmentSpec,
                extras_spec: types.NestedSpec = ())

Source from the content-addressed store, hash-verified

217
218 @classmethod
219 def signature(cls, environment_spec: specs.EnvironmentSpec,
220 extras_spec: types.NestedSpec = ()):
221 """This is a helper method for generating signatures for Reverb tables.
222
223 Signatures are useful for validating data types and shapes, see Reverb's
224 documentation for details on how they are used.
225
226 Args:
227 environment_spec: A `specs.EnvironmentSpec` whose fields are nested
228 structures with leaf nodes that have `.shape` and `.dtype` attributes.
229 This should come from the environment that will be used to generate
230 the data inserted into the Reverb table.
231 extras_spec: A nested structure with leaf nodes that have `.shape` and
232 `.dtype` attributes. The structure (and shapes/dtypes) of this must
233 be the same as the `extras` passed into `ReverbAdder.add`.
234
235 Returns:
236 A `Step` whose leaf nodes are `tf.TensorSpec` objects.
237 """
238 spec_step = Step(
239 observation=environment_spec.observations,
240 action=environment_spec.actions,
241 reward=environment_spec.rewards,
242 discount=environment_spec.discounts,
243 start_of_episode=specs.Array(shape=(), dtype=bool),
244 extras=extras_spec)
245 return tree.map_structure_with_path(spec_like_to_tensor_spec, spec_step)
246
247 @abc.abstractmethod
248 def _write(self):

Callers 15

make_reverb_online_queueFunction · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
make_replay_tablesMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
make_replay_tablesMethod · 0.45

Calls 1

StepClass · 0.85

Tested by

no test coverage detected