Collect the scalar parameters of a multilayer perceptron from the supplied weight matrices and bias vectors. Traverse layers in list order, then neurons in weight-row order. For each neuron, include its weights in column order followed immediately by its bias.
Return a tuple containing a Python list of zero-dimensional PyTorch tensor views and a Python integer equal to the list's length. Every view must refer to its original parameter entry, preserving its dtype and device; copied tensors and Python numbers are not valid substitutes.
Input: weights = [[[1,2],[3,4]]], biases = [[5,6]]
Output: ([1.0, 2.0, 5.0, 3.0, 4.0, 6.0], 6)
Explanation: Each neuron contributes its two weight entries followed by its bias, for six scalar views.
Input: weights = [[[1,-1],[2,-2]],[[3,4]]], biases = [[0.5,-0.5],[1]]
Output: ([1.0, -1.0, 0.5, 2.0, -2.0, -0.5, 3.0, 4.0, 1.0], 9)
Input: weights = [[[-2.5]]], biases = [[0.25]]
Output: ([-2.5, 0.25], 2)
Integer tensor indexing produces a scalar view.
zip pairs matching weight matrices and bias vectors.
len gives the number of collected entries.
Accepts: array
Accepts: array
Collect the scalar parameters of a multilayer perceptron from the supplied weight matrices and bias vectors. Traverse layers in list order, then neurons in weight-row order. For each neuron, include its weights in column order followed immediately by its bias.
Return a tuple containing a Python list of zero-dimensional PyTorch tensor views and a Python integer equal to the list's length. Every view must refer to its original parameter entry, preserving its dtype and device; copied tensors and Python numbers are not valid substitutes.
Input: weights = [[[1,2],[3,4]]], biases = [[5,6]]
Output: ([1.0, 2.0, 5.0, 3.0, 4.0, 6.0], 6)
Explanation: Each neuron contributes its two weight entries followed by its bias, for six scalar views.
Input: weights = [[[1,-1],[2,-2]],[[3,4]]], biases = [[0.5,-0.5],[1]]
Output: ([1.0, -1.0, 0.5, 2.0, -2.0, -0.5, 3.0, 4.0, 1.0], 9)
Input: weights = [[[-2.5]]], biases = [[0.25]]
Output: ([-2.5, 0.25], 2)
Integer tensor indexing produces a scalar view.
zip pairs matching weight matrices and bias vectors.
len gives the number of collected entries.
Accepts: array
Accepts: array