generated fromfastai/nbdev_template
- Notifications
You must be signed in to change notification settings - Fork286
Open
Description
Adding adelegates decorator to a method preventsTypeDispatch from creating the correct dispatching table.
Withoutdelegates, the dispatch forTensorAudio.create is correct:
classTensorAudio(TensorBase):@classmethoddefcreate(cls,fn:str|Path,**kwargs):sig,sr=torchaudio.load(fn,**kwargs)returncls(sig,sr=sr)
TypeDispatch(TensorAudio.create) returns
(str,object) -> create(Path,object) -> createBut with delegates,TypeDispatch doesn't create the correct dispatch table:
classTensorAudio(TensorBase):@delegates(torchaudio.load)@classmethoddefcreate(cls,fn:str|Path,**kwargs):sig,sr=torchaudio.load(fn,**kwargs)returncls(sig,sr=sr)TypeDispatch(TensorAudio.create)
InsteadTypeDispatch(TensorAudio.create) returns:
(str,BinaryIO) -> create(str,str) -> create(str,PathLike) -> create(Path,BinaryIO) -> create(Path,str) -> create(Path,PathLike) -> createTheBinaryIO,str, andPathLike in the type dispatch are fromtorchaudio.load. It's missing(str,object) and(Path,object). This incorrect dispatch prevents fromTensorAudio.create dispatching in a fastai datablock.
Previous versions of fastcore did not have this interplay betweendelegates andTypeDispatch, but I am not sure when it cropped up.
Metadata
Metadata
Assignees
Labels
No labels