<p>In the cases of (a) and (c), <code>pybind11</code> provides sufficient mechanisms to provide an unambiguous output return type. However, for (b), <code>pybind11</code> will return <code>ndarray</code> with shape <code>(3,)</code>. This can cause an issue when users pass a vector of shape <code>(3, 1)</code> as input. Nominally, pybind11 will return a <code>(3,)</code> array, but the user may expect <code>(3, 1)</code> as an output. To accommodate this, you should use the <a class="el" href="namespacedrake_1_1pydrake.html#af5f81d7315477aaa1694d9aa02a1346b" title="Wraps a overload instance method to reshape the output to be the same as a given input argument.">drake::pydrake::WrapToMatchInputShape</a> function.</p>
0 commit comments