20 #ifndef KALDI_NNET3_NNET_NNET_H_ 21 #define KALDI_NNET3_NNET_NNET_H_ 108 node_type(nt), dim(-1), dim_offset(-1) {
u.component_index = -1; }
122 void ReadConfig(std::istream &config_file);
143 int32 AddComponent(
const std::string &name,
Component *component);
159 bool IsComponentNode(
int32 node)
const;
163 bool IsDimRangeNode(
int32 node)
const;
167 bool IsInputNode(
int32 node)
const;
172 bool IsDescriptorNode(
int32 node)
const;
176 bool IsOutputNode(
int32 node)
const;
180 bool IsComponentInputNode(
int32 node)
const;
183 const std::vector<std::string> &GetNodeNames()
const;
191 void SetNodeName(
int32 node_index,
const std::string &new_name);
194 const std::vector<std::string> &GetComponentNames()
const;
200 int32 GetNodeIndex(
const std::string &node_name)
const;
203 int32 GetComponentIndex(
const std::string &node_name)
const;
208 int32 InputDim(
const std::string &input_name)
const;
213 int32 OutputDim(
const std::string &output_name)
const;
215 void Read(std::istream &istream,
bool binary);
217 void Write(std::ostream &ostream,
bool binary)
const;
223 void Check(
bool warn_for_orphans =
true)
const;
229 std::string Info()
const;
235 int32 Modulus()
const;
248 void Swap(
Nnet *other);
254 void RemoveOrphanNodes(
bool remove_orphan_inputs =
false);
257 void RemoveOrphanComponents();
261 void RemoveSomeNodes(
const std::vector<int32> &nodes_to_remove);
274 void GetConfigLines(
bool include_dim,
275 std::vector<std::string> *config_lines)
const;
286 std::string GetAsConfigLine(
int32 node_index,
bool include_dim)
const;
301 static void RemoveRedundantConfigLines(
int32 num_lines_initial,
302 std::vector<ConfigLine> *config_lines);
304 void ProcessComponentConfigLine(
int32 initial_num_components,
306 void ProcessComponentNodeConfigLine(
int32 pass,
308 void ProcessInputNodeConfigLine(
ConfigLine *config);
309 void ProcessOutputNodeConfigLine(
int32 pass,
311 void ProcessDimRangeNodeConfigLine(
int32 pass,
319 void GetSomeNodeNames(std::vector<std::string> *modified_node_names)
const;
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
NetworkNode & GetNode(int32 node)
Non-const accessor for the node... use with extreme caution.
Abstract base-class for neural-net components.
std::vector< std::string > component_names_
std::vector< Component * > components_
ObjectiveType objective_type
std::vector< std::string > node_names_
std::vector< NetworkNode > nodes_
void ResetGenerators(Nnet *nnet)
This function calls 'ResetGenerator()' on all components in 'nnet' that inherit from class RandomComp...
const NetworkNode & GetNode(int32 node) const
returns const reference to a particular numbered network node.
int32 Dim(const Nnet &nnet) const
NetworkNode is used to represent, three types of thing: either an input of the network (which pretty ...
ObjectiveType
This enum is for a kind of annotation we associate with output nodes of the network; it's for the con...
int32 NumComponents() const
This class is responsible for parsing input like hi-there xx=yyy a=b c empty= f-oo=Append(bar, sss) ba_z=123 bing='a b c' baz="a b c d='a b' e" and giving you access to the fields, in this case.
#define KALDI_ASSERT(cond)
union kaldi::nnet3::NetworkNode::@15 u
This file contains class definitions for classes ForwardingDescriptor, SumDescriptor and Descriptor...
NetworkNode(NodeType nt=kNone)