function pi_from_inputs = collect_pi_from_inputs_mux2(bnode, bnet)

n = bnode.self;
X = bnode.self_size;
[nrows ncols] = size(bnode.input);
pi_from_inputs = zeros(X, nrows, ncols);
for r=1:nrows
  for c=1:ncols
    j = bnet.pearl.parent_index{n}(bnode.input(r,c)); % input (r,c) is my j'th parent
    m = bnet.pearl.msg{n}.pi_from_parent{j};
    pi_from_inputs(:,r,c) = m;
  end
end
