modulepackagejuliaflux.jl

How to know which module exports a certain function


I was going through this Flux.jl tutorial and came across something called Chain.

m = Chain(Dense(10, 5, relu), Dense(5, 2), softmax)

It was not imported from any of the used modules and no namespace was used, so I did not know which module it belonged to. Although I managed to find that I belongs to Flux package, I wonder if there is a general way of figuring this out within the script.


Solution

  • To figure out where a specific function comes from, you can use the parentmodule function:

    julia> parentmodule(Chain)
    Flux
    

    Read more in the Julia docs: https://docs.julialang.org/en/v1/base/base/#Base.parentmodule