fix ModelToTensorBoard max_size = -1
@@ -116,11 +116,12 @@ class ModelToTensorBoard(ToTensorBoard):
"make sure the shape of all parameters is known beforehand. Otherwise, "
"run the monitor outside the `tf.function`."
)
-
if size == 1:
+ # if there's only one element do not add a numbered suffix
tf.summary.scalar(name, param[0], step=self.current_step)
else:
- for i in range(min(size, self.max_size)):
+ it = range(size) if self.max_size == -1 else range(min(size, self.max_size))
+ for i in it:
tf.summary.scalar(f"{name}[{i}]", param[i], step=self.current_step)
