unexpected auto-casting / use input references
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9k
- Forks
- 1.5k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 3
Description
Hi,
I'm facing two strange issues when I use Apex with fp16:
-
When I use an encoder-decoder architecture, at the end of my encoder forward function the type of my tensor is fp16, as expected. But if I do
h = encoder(x)thenhis of type fp32, although the type was fp16 in the forward function just before I returnh. This is a bit weird and then I have to do something like:output = decoder(h.half()). Is that expected? -
Sometimes I provide as input a tensor and a dictionary to the encoder:
h = encoder(x, dico)and the forward function of my encoder modifies the dictionary. But everything happens like if I was doingh = encoder(x, copy.deepcopy(dico)), i.e. the dictionary is identical when I exit the forward function.
Any ideas?
Thank you
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two reported cases: fp16 output changing to fp32 after the encoder call, and dictionary changes not persisting when passed alongside the tensor. Compare behavior inside and outside the encoder forward function, then determine whether the observed behavior is expected or should be corrected and documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100