main.cc
// This is a testing function that returns whether the top label index is the
// one that's expected.
This is a testing function that returns whether the top label index is the
one that's expected.
This is a testing function that returns whether the top label index is the one that ' s expected .
Status CheckTopLabel(const std::vector<Tensor> &outputs, int expected,
                     bool *is_expected) {
  *is_expected = false;
  Tensor indices;
  Tensor scores;
  const int how_many_labels = 1;
  TF_RETURN_IF_ERROR(GetTopLabels(outputs, how_many_labels, &indices, &scores));
  tensorflow::TTypes<int32>::Flat indices_flat = indices.flat<int32>();
  if (indices_flat(0) != expected) {
    LOG(ERROR) << "Expected label #" << expected << " but got #"
               << indices_flat(0);
    *is_expected = false;
  } else {
    *is_expected = true;
  }
  return Status::OK();
}
Status CheckTopLabel ( const std :: vector < Tensor > & outputs , int expected , bool * is_expected ) { * is_expected = false ; Tensor indices ; Tensor scores ; const int how_many_labels = 1 ; TF_RETURN_IF_ERROR ( GetTopLabels ( outputs , how_many_labels , & indices , & scores ) ) ; tensorflow :: TTypes < int32 > :: Flat indices_flat = indices . flat < int32 > ( ) ; if ( indices_flat ( 0 ) != expected ) { LOG ( ERROR ) << " " << expected << " " << indices_flat ( 0 ) ; * is_expected = false ; } else { * is_expected = true ; } return Status :: OK ( ) ; }
This is a testing function that returns whether the top label index is the
one that's expected.
This is a testing function that returns whether the top label index is the one that ' s expected .