Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Perform multiple operations on an input in a neural net
ResourceFunction["NetParallelOperator"][{net1,net2,…}] represents a net with a single input and multiple outputs which correspond to applying the different networks to the input. | |
ResourceFunction["NetParallelOperator"][<|out1→ net1,out2→net2,…|>] specifies that the output of neti should be linked to output port outi. | |
ResourceFunction["NetParallelOperator"][spec, cat] uses a layer or net to combine the outputs into a single array again. | |
ResourceFunction["NetParallelOperator"][spec,Automatic] catenates the outputs sequentially using CatenateLayer[0]. |
Define a net that computes the Sin, Cos and Tan of an input:
In[1]:= |
Out[1]= |
Apply it to one or more values:
In[2]:= |
Out[2]= |
In[3]:= |
Out[3]= |
Specify custom names for the output ports:
In[4]:= |
Out[4]= |
In[5]:= |
Out[5]= |
Convert the output to a single array again by joining the results:
In[6]:= |
Out[6]= |
In[7]:= |
Out[7]= |
In[8]:= |
Out[8]= |
Use a different operation for combining the results into tuples:
In[9]:= |
Out[9]= |
In[10]:= |
Out[10]= |
Create a network that can find a matrix with specific row and column sums while keeping the size of the elements as small as possible. NetParallelOperatorcan be used to calculate the required sums:
In[11]:= |
Out[11]= |
Define a training net with a learnable matrix:
In[12]:= |
Out[12]= |
Train the net to find a matrix with the given row and column sums:
In[13]:= |
Out[14]= |
Extract the matrix found by the model:
In[15]:= |
Out[15]= |
Check the losses of the row and column deviations:
In[16]:= |
Out[16]= |
This work is licensed under a Creative Commons Attribution 4.0 International License