Hello, I am optimizing my code. I have made all the types stable according to @code_warntype, but @trace is still giving me this warning throughout my code
Warning: is assigned as Union{Nothing, Tuple{Int64, Int64}}
The warnings are on all lines referencing graph[n].from e.g.
...
for f in graph[n].from
...
if f == fmax
....
Here is the definition of my graph structure
struct Node
id::Int
phoneme::Int
from::Array{Int,1}
end
struct Graph
nodes::Array{Node,1}
start::Int
finish::Int
end
Here is the full code with the warning lines marked with >>>
>>>for t in 2:duration
total_total::Float64 = 0.0
>>> for n in 1:node_count(graph)
if n != graph.start
# compute logsumexp([alpha(t-1,f) for f in graph[n].from])
tl = total_likelihood(t,n,graph,alphas,scores)
if tl > -Inf64
# alphas[t,n] = max + log(sum(e.(xs -. max))) + scores[t,phoneme+1]
>>> alphas[t,n] = tl
@fastmath total_total += exp(tl)
end
end
end
#@assert total_total >= 0.0
#@assert total_total <= 1.0
>>> alphas[t,graph.start] = log(1.0 - total_total)
What does this warning mean? Is it a problem? How do I fix it?
Thanks
Peter