You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are the cases I've encountered where the eltype of the returns samples is not T:
samples are already decoded (no-op)
samples are encoded but resolution/offset is 1/0 (also no-op)
To be fair, this is consistent with the documentation but you have to read a few layers deep to grasp it. I think at least this needs to be called out in the docstring for decode(::Samples, ::Type{T}), and we may possibly want to change the behavior to make this actually useful in cases where the eltype really does need to be T.
since decode! actually does a copyto/broadcast!. However, in the broadcast! case, the scale/offset are not converted to T so you will end up converting to Float64 before going to whatever T is on copy, and there's no way around that. You could decodefirst and thendecode! but that seems pretty roundabout and requires you to read all the various methods' docstrings to figure out whether adn why that would work.
The text was updated successfully, but these errors were encountered:
omus
linked a pull request
May 3, 2024
that will
close
this issue
Here are the cases I've encountered where the eltype of the returns samples is not
T
:To be fair, this is consistent with the documentation but you have to read a few layers deep to grasp it. I think at least this needs to be called out in the docstring for
decode(::Samples, ::Type{T})
, and we may possibly want to change the behavior to make this actually useful in cases where the eltype really does need to beT
.The current workaround is to use something like
since
decode!
actually does a copyto/broadcast!. However, in thebroadcast!
case, the scale/offset are not converted toT
so you will end up converting toFloat64
before going to whateverT
is on copy, and there's no way around that. You coulddecode
first and thendecode!
but that seems pretty roundabout and requires you to read all the various methods' docstrings to figure out whether adn why that would work.The text was updated successfully, but these errors were encountered: