Commit 17dfe3ed authored by Igor Ganichev's avatar Igor Ganichev Committed by TensorFlower Gardener
Browse files

Implement assert_same_structure in C++

Also implements helper functions nest._is_namedtuple
nest._same_namedtuple.

Also, fix a bug in FlattenHelper where error from recursive
calls were not propagated up immediately.

This change implements a good chunk of machinery that will
allow us to move map_structure to C++.

Before:
entry {
  name: "NestBenchmark.assert_same_structure_6_elem"
  iters: 30000
  wall_time: 4.79532718658e-05
}

entry {
  name: "NestBenchmark.assert_same_structure_60_elem"
  iters: 30000
  wall_time: 0.000403008667628
}

After:
entry {
  name: "NestBenchmark.assert_same_structure_6_elem"
  iters: 30000
  wall_time: 1.65301720301e-05
}

entry {
  name: "NestBenchmark.assert_same_structure_60_elem"
  iters: 30000
  wall_time: 0.000147621099154
}

PiperOrigin-RevId: 190869007
parent 62855222
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment