From ca5f155f77a2b7bdaf7829d2dd3476f62e62addf Mon Sep 17 00:00:00 2001 From: FredericWantiez Date: Wed, 2 Nov 2022 20:44:29 +0000 Subject: [PATCH] Fix for #158 (#159) * Cache key * Update Project.toml Co-authored-by: Hong Ge <3279477+yebai@users.noreply.github.com> --- Project.toml | 2 +- src/tapedfunction.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index b415ac6..7d871e5 100644 --- a/Project.toml +++ b/Project.toml @@ -3,7 +3,7 @@ uuid = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f" license = "MIT" desc = "Tape based task copying in Turing" repo = "https://github.com/TuringLang/Libtask.jl.git" -version = "0.8.3" +version = "0.8.4" [deps] FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e" diff --git a/src/tapedfunction.jl b/src/tapedfunction.jl index 8f2e27b..963fea4 100644 --- a/src/tapedfunction.jl +++ b/src/tapedfunction.jl @@ -62,7 +62,7 @@ mutable struct TapedFunction{F, TapeType} function TapedFunction{F, T}(f::F, args...; cache=false, deepcopy_types=Union{}) where {F, T} args_type = _accurate_typeof.(args) - cache_key = (f, args_type...) + cache_key = (f, deepcopy_types, args_type...) if cache && haskey(TRCache, cache_key) # use cache cached_tf = TRCache[cache_key]::TapedFunction{F, T}