fix(optim): support like factories for placeholder contexts - #785
Conversation
c729df2 to
836cdd8
Compare
|
Hi @PabloCarmona, Possible solution: tests/test_simulator_tiles.py:686 compares only one randomly selected noisy-output pair, so it can falsely fail when both samples quantize to the same value. |
|
Thanks @Zhaoxian-Wu ! I will take a look at the PR and what are you talking about the tests for the random noisy value, we are aware of it, we will take a look again. Thanks again! |
|
@Zhaoxian-Wu could you sync up this branch with the master branch? We are planning to launch a new release very soon. Thanks again! |
Allow torch like-factory operations to use placeholder metadata without reading backing values, with CPU and CUDA regression tests. Signed-off-by: Zhaoxian Wu <wuzhaoxian97@gmail.com>
836cdd8 to
53f3af5
Compare
|
Hi @PabloCarmona. Sure thing. I've pull the branch and it's undergoing test. Hopefully it would work this time. |
Why
AnalogContextexposes placeholder data by default so public tensor operations cannot accidentally read meaningless backing weights. Tensor*_likefactories only need metadata such as shape, dtype, and device, and should be valid in this mode. Before this change, they were rejected as value-reading operations.This is related to the placeholder-data feature introduced by IBM/aihwkit#765, and completes its compatibility with standard PyTorch
*_likefactories.Failure case
Before this fix, the final line raised:
This prevented metadata-only tensor construction during CUDA model setup and other generic PyTorch code paths.
What changed
empty_like,full_like,ones_like,rand_like,randint_like,randn_like, andzeros_likein placeholder mode.*_likefactories and a CUDA regression test forzeros_like.