abcdaire
abcdaire

Reputation: 1598

Tensorflow - Nodedef difference between keys DTYPE and T

I would like to know what is the difference in the protobuf file of the graph between the attribute with keys "T" and "dtype"

For example for the add operator we have a key "T" with the type as value:

name: "conv1/truncated_normal"
op: "Add"
input: "conv1/truncated_normal/mul"
input: "conv1/truncated_normal/mean"
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}

Whereas for constant we have in general "dtype" as key to specify the type :

name: "conv1/Const"
op: "Const"
attr {
  key: "dtype"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "value"
  value {
    tensor {
      dtype: DT_FLOAT
      tensor_shape {
        dim {
          size: 32
        }
      }
      float_val: 0.10000000149011612
    }
  }
}

And for the TruncatedNormal we have both "T" and "dtype"

name: "conv2/truncated_normal/TruncatedNormal"
op: "TruncatedNormal"
input: "conv2/truncated_normal/shape"
attr {
  key: "T"
  value {
    type: DT_INT32
  }
}
attr {
  key: "dtype"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "seed"
  value {
    i: 0
  }
}
attr {
  key: "seed2"
  value {
    i: 0
  }
}

Thanks by advance :)

Upvotes: 2

Views: 911

Answers (1)

Yaroslav Bulatov
Yaroslav Bulatov

Reputation: 57973

Note that for TruncatedNormal both T and dtype are "type" attributes. shape input argument takes its type from "T" and output takes its type from "dtype". Names "T" and "dtype" are arbitrary, an op creator could've called them "T1" and "T2" instead, which would be more natural.

Upvotes: 2

Related Questions