From e39c24fd8617734b3578446f199c22e35c377cee Mon Sep 17 00:00:00 2001 From: Mike J Innes Date: Mon, 17 Apr 2017 15:56:59 +0100 Subject: [PATCH] lazy loading note --- src/backend/backend.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/backend.jl b/src/backend/backend.jl index ec64cc23..6f8f9d33 100644 --- a/src/backend/backend.jl +++ b/src/backend/backend.jl @@ -1,5 +1,14 @@ export tf, mxnet +# We use a lazy-loading trick to load the backend code as needed; this avoids +# the need for a hard dependency on both backends. + +# This is effectively equivalent to: +# include("tensorflow/tensorflow.jl") +# using .TF +# export tf +# but instead of loading immediately, we wait until `tf` is first called. + function loadtf() isdefined(Flux, :TF) && return @eval include(joinpath(dirname($@__FILE__), "tensorflow/tensorflow.jl"))