-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I'd like to further confirm my understanding of how xfac interacts with the user-provided function f.
My main question is: can f be treated as a complete black box? Specifically, is it sufficient for f to have a signature that accepts the required input (e.g., an index/coordinate structure) and returns a standard scalar type (like double, int, float) to be used by xfac for TCI sampling?
Following up on this, is the primary purpose of the wrapper around f within the TensorCI2 class simply to add an optional caching layer?
To make my "black box" question clearer, consider a function with a side effect, like the following Python-style pseudo-code:
def f(x): print(x) return 2 * x
If a function like this is passed to the TCI algorithm, will the print(x) statement be executed every time the function is sampled?
Extending this idea further, can I also set f to be a neural network defined in PyTorch (and loaded in C++ via LibTorch)? My assumption is that this is also possible, as long as my wrapper function converts the final torch::Tensor output back into a scalar value before returning.
Thank you for your clarification.