as_tensor_variable(range(n)) currently raises NotImplementedError because there is no singledispatch handler for range objects.
Workaround: as_tensor_variable(list(range(n))).
Proposed fix: add a range handler in pytensor/tensor/basic.py that converts to a list and delegates to the existing sequence handler (same behavior as list/tuple). Empty ranges are already covered via the empty-sequence path.
as_tensor_variable(range(n))currently raisesNotImplementedErrorbecause there is no singledispatch handler forrangeobjects.Workaround:
as_tensor_variable(list(range(n))).Proposed fix: add a
rangehandler inpytensor/tensor/basic.pythat converts to a list and delegates to the existing sequence handler (same behavior aslist/tuple). Empty ranges are already covered via the empty-sequence path.