From 8662dab6740ff6e5e0ac17d7cc86ed3d8ed74260 Mon Sep 17 00:00:00 2001 From: TF-Agents Team Date: Mon, 19 Aug 2024 10:08:36 -0700 Subject: [PATCH] fix type promotion issue in tensorspec PiperOrigin-RevId: 664858958 Change-Id: Ia57049212d622770c617342b17ead8c542a650f4 --- tf_agents/specs/tensor_spec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tf_agents/specs/tensor_spec.py b/tf_agents/specs/tensor_spec.py index f3ef23bf7..1f24b2fab 100644 --- a/tf_agents/specs/tensor_spec.py +++ b/tf_agents/specs/tensor_spec.py @@ -293,7 +293,7 @@ def _unique_vals(vals): # behavior. # However +1 will cause overflow, in such cases we use the original maxval. if sampling_dtype.is_integer and maxval < sampling_dtype.max: - maxval = maxval + 1 + maxval = int(maxval) + 1 shape = tf.convert_to_tensor(spec.shape, dtype=tf.int32) full_shape = tf.concat((outer_dims, shape), axis=0)