All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CindexSet Class Reference

#include <nnet-computation-graph.h>

Collaboration diagram for CindexSet:

Public Member Functions

bool operator() (const Cindex &cindex) const
 Parenthesis operator; returns true if this cindex exists in the set. More...
 
 CindexSet (const ComputationGraph &graph)
 with this constructor, represents the set of all Cindexes that exist in the graph. More...
 
 CindexSet (const ComputationGraph &graph, const std::vector< char > &is_computable, bool treat_unknown_as_computable)
 with this constructor, represents the set of all Cindexes that exist in the graph and which are computable. More...
 

Private Attributes

const ComputationGraphgraph_
 
const std::vector< char > * is_computable_
 
bool treat_unknown_as_computable_
 

Detailed Description

Definition at line 297 of file nnet-computation-graph.h.

Constructor & Destructor Documentation

CindexSet ( const ComputationGraph graph)

with this constructor, represents the set of all Cindexes that exist in the graph.

Definition at line 1485 of file nnet-computation-graph.cc.

1485  :
1486  graph_(graph), is_computable_(NULL) { }
const std::vector< char > * is_computable_
const ComputationGraph & graph_
CindexSet ( const ComputationGraph graph,
const std::vector< char > &  is_computable,
bool  treat_unknown_as_computable 
)

with this constructor, represents the set of all Cindexes that exist in the graph and which are computable.

If treat_unknown_as_computable is true then we consider kComputable and kUnknown to be computable, else we consider just nodes that are kComputable to be computable.

Definition at line 1488 of file nnet-computation-graph.cc.

1490  :
1491  graph_(graph), is_computable_(&is_computable),
1492  treat_unknown_as_computable_(treat_unknown_as_computable) { }
const std::vector< char > * is_computable_
const ComputationGraph & graph_

Member Function Documentation

bool operator() ( const Cindex cindex) const

Parenthesis operator; returns true if this cindex exists in the set.

Definition at line 1495 of file nnet-computation-graph.cc.

References ComputationGraph::GetCindexId(), CindexSet::graph_, CindexSet::is_computable_, ComputationGraphBuilder::kComputable, ComputationGraphBuilder::kUnknown, and CindexSet::treat_unknown_as_computable_.

1495  {
1496  int32 cindex_id = graph_.GetCindexId(cindex);
1497  if (cindex_id == -1) {
1498  return false;
1499  } else {
1500  if (is_computable_ == NULL) {
1501  return true;
1502  } else {
1504  c = static_cast<ComputationGraphBuilder::ComputableInfo>(
1505  ((*is_computable_)[cindex_id]));
1507  return (c == ComputationGraphBuilder::kComputable ||
1509  else
1511  }
1512  }
1513 }
int32 GetCindexId(const Cindex &cindex, bool is_input, bool *is_new)
Maps a Cindex to an integer cindex_id.
const std::vector< char > * is_computable_
const ComputationGraph & graph_

Member Data Documentation

const ComputationGraph& graph_
private

Definition at line 314 of file nnet-computation-graph.h.

Referenced by CindexSet::operator()().

const std::vector<char>* is_computable_
private

Definition at line 315 of file nnet-computation-graph.h.

Referenced by CindexSet::operator()().

bool treat_unknown_as_computable_
private

Definition at line 316 of file nnet-computation-graph.h.

Referenced by CindexSet::operator()().


The documentation for this class was generated from the following files: