Network API and phase


#1

Hi !
I look at Network.cpp and have some questions. I found some code by @vkruglikov, Maybe somebody can explain me what do the function means:

    void setPhases(const std::string& name, std::set<UInt32>& phases);
     UInt32 getMinPhase() const.

Thanx a lot,
Sergey


#2

I’m not familiar with this area of the codebase, but I found some references to a network’s phase in the docs:


#3

Thanx @rhyolight Matt for your links. It is very useful information. But I want to clarify some moments. I look at pseudocode Running a network on Network API Guide.
for iteration in (1, …, n):
for phase in (minPhase, …, maxPhase):
for each region associated with this phase:
region.prepareInputs()
region.compute()
invoke all network callbacks

What value can I set on phase, minPhase, maxPhase? 
Can I compute only necessary region?

#4

@scott do you know any answers to these questions?


#5

Every region in a network has a phase and the regions are executed in the order of phase (ascending). When you call network.run, all regions are executed in this order. If you want to execute a single region, you can call the methods on the region directly.


#6

That’s exactly what I’m looking for! Could you specify how to do it?

Thanx a lot!


#7

you can get your region by its name like:

Network *netA;
Region* myRegion = netA->getRegions().getByName("name");