(var)
| 166 | |
| 167 | |
| 168 | def _get_max_width(var): |
| 169 | # return max_width for a scalar |
| 170 | max_width = 0 |
| 171 | signed = False |
| 172 | for item in list(var.flatten()): |
| 173 | if (not signed) and (item < 0): |
| 174 | signed = True |
| 175 | item_str = _format_item(item) |
| 176 | max_width = max(max_width, len(item_str)) |
| 177 | |
| 178 | return max_width, signed |
| 179 | |
| 180 | |
| 181 | def _format_tensor(var, summary, indent=0, max_width=0, signed=False): |