Skip to content

Keep the dtype of integer input tensors in _process_input_tensor - #185

Open
model-collapse wants to merge 1 commit into
ScalingIntelligence:mainfrom
model-collapse:fix/keep-integer-input-dtype
Open

model-collapse wants to merge 1 commit into
ScalingIntelligence:mainfrom
model-collapse:fix/keep-integer-input-dtype

Conversation

@model-collapse

Copy link
Copy Markdown

_process_input_tensor casts every input tensor to the evaluation precision, including integer tensors such as class-index targets. For problems like level1/95_CrossEntropyLoss this makes the timing paths (performance measurement and the excessive-speedup check) fail with RuntimeError: expected target dtype to be Long or Byte, but got Float.

Only cast floating-point tensors; leave integer/bool tensors unchanged.

`_process_input_tensor` casts every input tensor to the evaluation
precision, including integer tensors such as class-index targets. For
problems like level1/95_CrossEntropyLoss this makes the timing paths
(performance measurement and the excessive-speedup check) fail with
`RuntimeError: expected target dtype to be Long or Byte, but got Float`.

Only cast floating-point tensors; leave integer/bool tensors unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants