How to Extract Information from Protobuf MessageMap (Python)

590 views Asked by At

I have a MessageMap object (in Python) and I can't for the life of me figure out how to properly extract the information I need:

MessageMap object:

outputs {
  key: "outputs"
  value {
    dtype: DT_FLOAT
    tensor_shape {
      dim {
        size: 1
      }
      dim {
        size: 20
      }
    }
    float_val: 0.999675273895
    float_val: 0.000314112228807
    float_val: 2.59503778466e-08
    float_val: 2.44331226895e-06
    float_val: 4.54330323363e-11
    float_val: 7.71099075791e-06
    float_val: 2.24508878155e-09
    float_val: 2.77518591441e-10
    float_val: 1.23966522811e-11
    float_val: 3.66186220235e-10
    float_val: 3.70352438495e-07
    float_val: 1.26812804702e-09
    float_val: 2.57038501594e-10
    float_val: 2.2157300994e-10
    float_val: 4.33188180422e-13
    float_val: 8.9858339436e-08
    float_val: 1.4697809636e-09
    float_val: 2.74241731546e-08
    float_val: 3.08812177219e-11
    float_val: 5.85364867689e-10
  }
}

Is what I have.

Any help greatly appreciated.

1

There are 1 answers

0
pzegadlo On

It's been a while, but maybe you still need this. For a MessageMap object named "obj" try:

obj.get('key name')

so in your case:

obj.get('outputs')

Documentation is here.