Message Boards Message Boards

2
|
4865 Views
|
2 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Linking NetGraph changed the input order in 12.2

After upgrading some neural nets were not generated as expected. After some digging, if found that the linking of some netgraphs has changed the input order.

To generate the networks in 12.1 and 12.2, which are identical, I had had to make the following code change.

Version 12.1 enter image description here

Version 12.2 enter image description here

code change enter image description here

POSTED BY: Martijn Froeling
2 Replies

Indeed things changed in 12.2 w.r.t the order of NetGraph's port.

The rule is the following: the ports are in the order in which they appear in the list of edges.

Note that some ports, like NetPort["Input"] (or NetPort["Output"]), can be implicit. In this case, we treat them as if they appeared in the list the first time they should appear.

So for example, in 12.2:

In[1]:= Information[NetGraph[{1,2,3}, {1->2, NetPort["B"]->3}], "InputPorts"]
Out[1]= <|Input->Automatic, B->Automatic|>

In[2]:= Information[NetGraph[{1,2,3}, {NetPort["B"]->3, 1->2}], "InputPorts"]
Out[2]= <|B->Automatic, Input->Automatic|>

whereas both these two commands used to return <|Input->Automatic,B->Automatic|> in 12.1 and before (where the port order only depended on the NetGraph topology, and was independent of how the user ordered the layers and the edges).

In your example, you should rather change how the NetGraph "dec_1", "dec_2", ... are defined (so the definition of dec2), so that the ports "Input1" and "Input2" are ordered as you want. I believe the same code can work both for 12.1 and 12.2

Hi Jérôme, Thanks for this information, I will try this. So if I understand correctly the correct thing to do is to explicitly define the order of the inputs of the decoding layers such that it matches the order defined by the topology of input layers.

Somehow solving the problem in the dec layers did not cross my mind, that indeed sounds like a much simpler solution!

Thanks for the response.

POSTED BY: Martijn Froeling
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract