Skip to content

Conversation

@groszewn
Copy link
Contributor

@groszewn groszewn commented Jun 6, 2023

A zero dimension tensor results in a proto with an empty size field, as seen below:

node {
  name: "input/b"
  op: "IO Node"
  attr {
    key: "attr"
    value {
      s: ""
    }
  }
  attr {
    key: "_output_shapes"
    value {
      list {
        shape {
          dim {
            size: 1
          }
          dim { <<<
          }
        }
      }
    }
  }
}

This results in dim.size returning null for these particular cases, breaking graph rendering. We update to default the null case to 0.

Fixes #6418

A zero dimension tensor results in a proto with an empty `size` field,
as seen below:

```
node {
  name: "input/b"
  op: "IO Node"
  attr {
    key: "attr"
    value {
      s: ""
    }
  }
  attr {
    key: "_output_shapes"
    value {
      list {
        shape {
          dim {
            size: 1
          }
          dim { <<<
          }
        }
      }
    }
  }
}
```

This results in `dim.size` returning null for these particular cases,
breaking graph rendering. We update to default the null case to 0.

Fixes to tensorflow#6418
@raphCode
Copy link

raphCode commented Jun 6, 2023

Seems I was about right with my assumption about empty protobuf messages?
I actually thought protobuf parsing code is always autogenerated and correctly populates omitted values with their defaults.

@groszewn
Copy link
Contributor Author

groszewn commented Jun 6, 2023

@raphCode

Seems I was about right with my assumption about empty protobuf messages? I actually thought protobuf parsing code is always autogenerated and correctly populates omitted values with their defaults.

The graph plugin README specifies that we use a custom parser for this plugin. I'm not quite sure why that is the case, but that would explain the root of the issue.

@groszewn groszewn merged commit 39172a9 into tensorflow:master Jun 6, 2023
@groszewn groszewn deleted the graph_zero_dim_fix branch June 6, 2023 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graph display breaks when using zero dimension tensors

3 participants