The name of the closure, or the function to execute. If a name is provided, the 2nd argument should be the function. If debug mode is on, the timing and the memory usage of the function will be tracked and displayed on the console using the provided name.
Optionalfn: ScopeFn<T>The function to execute.
Executes the provided function
fnand after it is executed, cleans up all intermediate tensors allocated byfnexcept those returned byfn.fnmust not return a Promise (async functions not allowed). The returned result can be a complex object.Using this method helps avoid memory leaks. In general, wrap calls to operations in
tf.tidyfor automatic memory cleanup.NOTE: Variables do not get cleaned up when inside a tidy(). If you want to dispose variables, please use
tf.disposeVariablesor call dispose() directly on variables.