$$ \begin{array}{l} B_1 \cdot s=\left[\begin{array}{cccc} b_{11} & b_{12} & \cdots & b_{1d_1} \\ \vdots & \cdots & & \vdots \\ b_{q_1 1} & \cdots & b_{q_1 d_1} \end{array}\right]_{q_1 \times d_1} \cdot \left[\begin{array}{c} s_1 \\ s_2 \\ s_3 \\ s_{d_1} \end{array}\right]_{d_1 \times 1} \\ =\left[\begin{array}{ccc} b_{11} s_1+b_{12} s_2+\cdots b_{1 d_1} s_{d_1} \\ \vdots \\ b_{q_1 1} s_1 & \cdots & b_{q_1 d_1} s_{d_1} \end{array}\right]_{q_1 \times 1} \\ \sigma\left(B_1 \cdot s\right)=\left[\begin{array}{c} \sigma\left(b_{11} s_1+\cdots b_{1 d_1} s_{d_1}\right) \\ \vdots \\ \sigma\left(b_{q_1} s_1+\cdots b_{q_1 d_1} s_{d_1}\right) \end{array}\right]_{q_1 \times 1} \\ =\left[\begin{array}{c} u_1 \\ u_2 \\ \vdots \\ u_{q_1} \end{array}\right]_{q_1 \times 1} \\ \end{array} $$ Following the same calculation for $\sigma\left(T_1 p\right)$ $=\left[\begin{array}{cc}\sigma\left(t_{11} p_1+\cdots \cdot t_{1 d_2} p_{d_2}\right) \\ \vdots \\ \sigma\left(t_{q_2 1} p_1+\cdots \cdot t_{q_2 d_2} p_{d_2}\right)\end{array}\right]$ $=\left[\begin{array}{c}v_1 \\ v_2 \\ v_{q_2}\end{array}\right]_{q_2 \times 1}$
$h=\left\langle\sigma\left(B_1 \cdot s\right), \sigma\left(T_1 \cdot p\right)\right\rangle$
How to get $h$ ? Here $\sigma$ = sigmoid
Edit
Here $q_1 = q_2 = q$ and ,$d$ = 2
I particularly interested to implement this calculation for my $h(s,p)$ . But getting no clue :(


For typing convenience, define the variables $$\eqalign{ \def\s{\sigma} \def\D{{\rm Diag}} \def\qiq{\quad\implies\quad} \def\p{{\partial}} \def\g#1#2{\frac{\p #1}{\p #2}} z &= B_1s,\qquad e=\s(z),\qquad E=\D(e) \\ y &= T_1p,\qquad f=\s(y),\qquad F=\D(f) \\ }$$ The derivative of the logistic sigmoid is well known $$\eqalign{ de &= \left(E-E^2\right)dz \\ df &= \left(F-F^2\right)dy \qquad\qquad\qquad\qquad\qquad \\ }$$ Now calculate the derivative of the $h$-function wrt some independent $x$ variable $$\eqalign{ h &= e^Tf \\ dh &= e^Tdf \;+\; f^Tde \\ &= e^T\left(F-F^2\right)dy \;+\; f^T\left(E-E^2\right)dz \\ &= e^T\left(F-F^2\right)\g{y}{x}\:dx \;+\; f^T\left(E-E^2\right)\g{z}{x}\:dx \\ J = \g{h}{x} &= e^T\left(F-F^2\right)\g{y}{x} \;+\; f^T\left(E-E^2\right)\g{z}{x} \\ }$$ The norm of $J$ can be calculated as $$\|J\|_F^2 = {\rm Trace}\left(J^TJ\right)$$
Update
The independent variable $x$ was not specified in the question, but assuming $\,x=s$ $$\eqalign{ \g{z}{x} = \g{(B_1s)}{s} = B_1,\qquad \g{y}{x} = \g{(T_1p)}{s} = 0\; \\ }$$ Conversely, assuming $\,x=p\;$ yields $$\eqalign{ \g{z}{x} = \g{(B_1s)}{p} = 0,\qquad \;\; \g{y}{x} = \g{(T_1p)}{p} = T_1 \\ }$$