[Feature Request] Add BC Loss for behavior cloning
Motivation
Every robotics paper uses behavior cloning as a baseline, but TorchRL has no standalone BC loss. The only BC-adjacent module is TD3BCLoss, which mixes BC with RL and can't be used in isolation. This PR adds a dedicated BCLoss that works with any actor network — stochastic or deterministic — and integrates cleanly with the existing offline RL stack (CQL, IQL, Decision Transformer).
Changes
torchrl/objectives/bc.py — new BCLoss module Stochastic policy: minimises -E[log π(a_expert | s)] using the policy's log_prob output Deterministic policy: minimises distance(a_pred, a_expert) with configurable loss_function ("l1", "l2", "smooth_l1") Auto-detects which mode to use based on whether the actor writes a log_prob key Follows the standard LossModule pattern with _AcceptedKeys, @dispatch, _reduce torchrl/objectives/init.py — registers BCLoss test/test_objectives.py — TestBCLoss covering forward/backward, all loss functions, reduction modes docs/source/reference/objectives_other.rst — adds BCLoss to the reference Checklist
@vmoens, I would like to implement this feature.