  Trajectory sampling in the Frenet(road-aligned) frame, is one of the most
popular methods for motion planning of autonomous vehicles. It operates by
sampling a set of behavioural inputs, such as lane offset and forward speed,
before solving a trajectory optimization problem conditioned on the sampled
inputs. The sampling is handcrafted based on simple heuristics, does not adapt
to driving scenarios, and is oblivious to the capabilities of downstream
trajectory planners. In this paper, we propose an end-to-end learning of
behavioural input distribution from expert demonstrations or in a
self-supervised manner. Our core novelty lies in embedding a custom
differentiable trajectory optimizer as a layer in neural networks, allowing us
to update behavioural inputs by considering the optimizer's feedback. Moreover,
our end-to-end approach also ensures that the learned behavioural inputs aid
the convergence of the optimizer. We improve the state-of-the-art in the
following aspects. First, we show that learned behavioural inputs substantially
decrease collision rate while improving driving efficiency over handcrafted
approaches. Second, our approach outperforms model predictive control methods
based on sampling-based optimization.
