# Is it possible to combine two neural networks trained on different tasks into one that knows both tasks?

I'm relatively new to artificial intelligence and neural networks.

Let's say I have two different fully trained neural networks. The first one is trained for mathematical addition and the second one on mathematical multiplication. Now, I want to combine these two neural networks into one that knows about both operations.

Is this possible? Is there a representative name for this kind of technique?

I had read something about bilinear CNN models that sounds similar to what I'm looking for, right?

Combining two different fully trained neural networks is not only feasible, it is commonly done. Let's look at the example given as two concepts involving integers, $$C_a$$ and $$C_m$$.

$$C_a: \mathcal{Y} = f_a (\mathcal{X}) = x_0 + x_1$$

$$C_m: \mathcal{Y} = f_m (\mathcal{X}) = x_0 \, x_1$$

Now let's define a palette of operations, including these two binary operations, that can be used to construct, a concept $$C_e$$, an expression comprised of an arbitrary hierarchy of addition, multiplication, constants, and substitution.

$$C_e: \mathcal{Y} = f_e (\mathcal{X}) \; \text{, where}$$

$$f_e \in \{f_a, f_b\} \; \land \; i \in \{0, 1\} \; \land \; ( \, x_i \in \mathbb{I} \; \lor \; x_i \in \mathcal{Y} \, ) \; \text{.}$$

Now, one artificial network can be trained to approximate $$f_a$$ within a concept class $$\mathbb{C}$$ of which $$C_a$$ and $$C_m$$ are members, using labeled examples of correct integer additions and another artificial network can be trained to approximate $$f_b$$ within that same concept class, using labeled examples of correct integer multiplications.

An expression involving both can be trained to approximate arbitrary product of sums or sum of products under specific conditions. It's unclear though if this is what you are looking for.

Normally, one wouldn't train a network to perform operations that are already known. Training is normally used to model operations that are not known.

(Bilinear Convolutional Neural Networks (B-CNNs), introduced in Bilinear CNNs for Fine-grained Visual Recognition, 2017, Tsung-Yu Lin, Aruni RoyChowdhury, Subhransu Maji, is an approach to using two CNNs in conjunction to provide two fine and course visual recognition in the same way the human visual system can have a dual awareness of detail and panorama. B-CNNs probably don't apply to the scenario given in the question.)