GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: Resolve mypy [valid-type] error for TorchTensor TypeAlias by Copilot · Pull Request #5984 · feast-dev/feast

Conversation

Copilot AI commented Feb 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Fixes mypy type checking error where TorchTensor was not recognized as a valid type alias:

feast/online_response.py:104: error: Variable "feast.online_response.TorchTensor" is not valid as a type [valid-type]

Root Cause

TypeAlias imported at module level while type alias defined conditionally inside TYPE_CHECKING block. Mypy cannot disambiguate whether TorchTensor is a variable or type alias.

Changes

Move TypeAlias import into both branches of TYPE_CHECKING conditional:

# Before
from typing import TYPE_CHECKING, Any, Dict, List, TypeAlias, Union
if TYPE_CHECKING:
    import torch
    TorchTensor: TypeAlias = torch.Tensor
else:
    TorchTensor: TypeAlias = Any

# After  
from typing import TYPE_CHECKING, Any, Dict, List, Union
if TYPE_CHECKING:
    from typing import TypeAlias
    import torch
    TorchTensor: TypeAlias = torch.Tensor
else:
    from typing import TypeAlias
    TorchTensor: TypeAlias = Any

Type-checking only change. No runtime impact.

Misc

N/A

Original prompt

This section details on the original issue you should resolve

<issue_title>torch tensor type error with mypy</issue_title>
<issue_description>## Expected Behavior

Current Behavior

feast/online_response.py:104: error: Variable "feast.online_response.TorchTensor" is not valid as a type [valid-type]

Steps to reproduce

Specifications

  • Version:
  • Platform:
  • Subsystem:

Possible Solution

</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes torch tensor type error with mypy #5563

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Initial plan
59c3ef7
Copilot AI assigned Copilot and franciscojavierarceo Feb 18, 2026
Copilot started work on behalf of franciscojavierarceo February 18, 2026 15:46
View session
@franciscojavierarceo
Fix TorchTensor TypeAlias mypy error by moving TypeAlias import insid…
a5f8edf
…e TYPE_CHECKING blocks

Co-authored-by: franciscojavierarceo <[email protected]>
Copilot AI changed the title [WIP] Fix torch tensor type error with mypy fix: resolve mypy [valid-type] error for TorchTensor TypeAlias Feb 18, 2026
Copilot AI requested a review from franciscojavierarceo February 18, 2026 15:51
Copilot finished work on behalf of franciscojavierarceo February 18, 2026 15:52
jyejare
jyejare reviewed Feb 19, 2026
View reviewed changes

@jyejare jyejare left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, needs to rerun checks I think.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@franciscojavierarceo franciscojavierarceo changed the title fix: resolve mypy [valid-type] error for TorchTensor TypeAlias fix: Resolve mypy [valid-type] error for TorchTensor TypeAlias Feb 19, 2026
@franciscojavierarceo franciscojavierarceo added the ok-to-test label Feb 19, 2026
@franciscojavierarceo
Merge branch 'master' into copilot/fix-torch-tensor-type-error
c611f91

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jyejare jyejare jyejare left review comments
@franciscojavierarceo franciscojavierarceo Awaiting requested review from franciscojavierarceo

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@franciscojavierarceo franciscojavierarceo

Copilot code review Copilot

Labels

ok-to-test

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

torch tensor type error with mypy

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@jyejare @franciscojavierarceo
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.