36 """Returns (time_step_spec, action_spec) for LLVM register allocation."""
38 (key, tf.TensorSpec(dtype=tf.int64, shape=(), name=key))
39 for key
in PER_LIVEINTERVAL_INT64_FEATURE_LIST
43 (key, tf.TensorSpec(dtype=tf.float32, shape=(), name=key))
44 for key
in PER_LIVEINTERVAL_FLOAT32_FEATURE_LIST
49 (key, tf.TensorSpec(dtype=tf.float32, shape=(), name=key))
50 for key
in [
"discount",
"reward"]
55 (key, tf.TensorSpec(dtype=tf.int32, shape=(), name=key))
56 for key
in [
"step_type"]
67 """Build and save the mock model with the given signature."""
71 module.var = tf.Variable(0, dtype=tf.float32)
76 tf.cast(inputs[0][key], tf.float32)
77 for key
in PER_LIVEINTERVAL_FEATURE_LIST
82 [tf.cast(inputs[0][key], tf.float32)
for key
in CONTEXT_FEATURE_LIST]
86 result = s + module.var
87 return {POLICY_DECISION_LABEL: result}
89 module.action = tf.function()(action)
92 tf.saved_model.save(module, path, signatures=action)
94 with open(output_spec_path,
"w")
as f:
95 print(f
"Writing output spec to {output_spec_path}.")
96 f.write(POLICY_OUTPUT_SPEC)