Skip to content

test_get_online_features fails on GPU hosts: expected tensor built on cpu #6778

Description

@piyush182004

Expected Behavior

sdk/python/tests/unit/online_store/test_online_retrieval.py::test_get_online_features should pass on any host, with or without a CUDA device.

Current Behavior

On a host with CUDA available, the test fails:

RuntimeError: Expected all tensors to be on the same device, but got other
is on cpu, different from other tensors on cuda:0
(when checking argument in method wrapper_CUDA__equal)

OnlineResponse.to_tensor() places its output on cuda when a GPU is present (sdk/python/feast/online_response.py), but the avg_orders_day assertion builds its expected tensor without a device= argument, so it stays on cpu.

The test already computes device and passes it for the driver_id and trips assertions — only avg_orders_day omits it.

Steps to reproduce

On a machine with CUDA-enabled torch installed:

python -m pytest sdk/python/tests/unit/online_store/test_online_retrieval.py::test_get_online_features

Fails with the GPU visible; passes under CUDA_VISIBLE_DEVICES="". CI is CPU-only, where device resolves to "cpu" and the omission has no effect.

Specifications

  • Version: master (0.66.0 dev)
  • Platform: Ubuntu 24.04 (WSL2), Python 3.11, torch 2.13.0+cu130, RTX 4050
  • Subsystem: online store / tests

Possible Solution

Pass device=device to the expected tensor, matching the neighbouring assertions. Submitted as #6777.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions