IndexSet Class Reference

An abstract representation of a set of Indexes. More...

#include <nnet-computation-graph.h>

Collaboration diagram for IndexSet:

Public Member Functions

bool operator() (const Index &index) const
 Returns true if this Index exists in the set. More...
 
 IndexSet (const ComputationGraph &graph, const std::vector< ComputationGraphBuilder::CindexInfo > &info, int32 node_id, bool treat_unknown_as_computable)
 This constructor creates the set of all Indexes x such that a Cindex (node_id, x) which is computable exists in this graph. More...
 

Private Attributes

const ComputationGraphgraph_
 
const std::vector< ComputationGraphBuilder::CindexInfo > & info_
 
int32 node_id_
 
bool treat_unknown_as_computable_
 

Detailed Description

An abstract representation of a set of Indexes.

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

Constructor & Destructor Documentation

◆ IndexSet()

IndexSet ( const ComputationGraph graph,
const std::vector< ComputationGraphBuilder::CindexInfo > &  info,
int32  node_id,
bool  treat_unknown_as_computable 
)

This constructor creates the set of all Indexes x such that a Cindex (node_id, x) which is computable exists in this graph.

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. The `info` input is only needed for its `computable` member.

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

1496  :
1497  graph_(graph), info_(info), node_id_(node_id),
1498  treat_unknown_as_computable_(treat_unknown_as_computable) { }
const ComputationGraph & graph_
const std::vector< ComputationGraphBuilder::CindexInfo > & info_

Member Function Documentation

◆ operator()()

bool operator() ( const Index index) const

Returns true if this Index exists in the set.

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

References ComputationGraph::GetCindexId(), IndexSet::graph_, IndexSet::info_, ComputationGraphBuilder::kComputable, ComputationGraphBuilder::kUnknown, IndexSet::node_id_, and IndexSet::treat_unknown_as_computable_.

1500  {
1501  int32 cindex_id = graph_.GetCindexId(Cindex(node_id_, index));
1502  if (cindex_id == -1) {
1503  return false;
1504  } else {
1505  ComputationGraphBuilder::ComputableInfo c = info_[cindex_id].computable;
1507  return (c == ComputationGraphBuilder::kComputable ||
1509  else
1511  }
1512 }
kaldi::int32 int32
const ComputationGraph & graph_
std::pair< int32, Index > Cindex
Definition: nnet-common.h:115
int32 GetCindexId(const Cindex &cindex, bool is_input, bool *is_new)
Maps a Cindex to an integer cindex_id.
const std::vector< ComputationGraphBuilder::CindexInfo > & info_

Member Data Documentation

◆ graph_

const ComputationGraph& graph_
private

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

Referenced by IndexSet::operator()().

◆ info_

const std::vector<ComputationGraphBuilder::CindexInfo>& info_
private

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

Referenced by IndexSet::operator()().

◆ node_id_

int32 node_id_
private

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

Referenced by IndexSet::operator()().

◆ treat_unknown_as_computable_

bool treat_unknown_as_computable_
private

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

Referenced by IndexSet::operator()().


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