rows.append(("Variable", "Shape", "Type", "Trainable", "Device"))
for var in sorted(variables, key=lambda var: var.name):
name = var.name.split(":")[0] // Remove the ":0" suffix.
shape = "x".join(str(dim) for dim in var.shape)
dtype = repr(var.dtype).replace("tf.", "")
trainable = str(var.trainable)
device = str(var.device) if var.device else ""
rows.append((name, shape, dtype, trainable, device))
After Change
rows = []
header = ("Variable", "Spec", "Trainable", "Device")
rows.append(header)
rows.append(tuple("=" * len(c) for c in header))
for var in sorted(variables, key=_name_scope_then_rank):
name = var.name.split(":")[0] // Remove the ":0" suffix.
spec = _render_spec(var.shape, var.dtype)