Skip to content

Potential linking issue in PyPI wheel version

What commit version of aidge do you use

  • aidge_core: 0.7.0
  • aidge_backend_cpu: 0.7.0
  • aidge_learning: 0.4.0

Problem description

I have a runtime error when using the package installed from PyPI, but not when using a local build from source (latest main branch). Both versions should theoretically be identical.

Logs:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[5], line 4
      1 opt = aidge_learning.Adam()
      2 opt.set_learning_rate_scheduler(aidge_learning.constant_lr(0.0005))
----> 4 opt.set_parameters(
      5     ([
      6        fc1.get_operator().get_input(1), # FC1 weight
      7        fc2.get_operator().get_input(1), # FC2 bias
      8        fc1.get_operator().get_input(2), # FC2 weight
      9        fc2.get_operator().get_input(2), # FC2 bias
     10     ]))

TypeError: set_parameters(): incompatible function arguments. The following argument types are supported:
    1. (self: aidge_learning.aidge_learning.Optimizer, arg0: list[Aidge::Tensor]) -> None

Invoked with: <aidge_learning.aidge_learning.Adam object at 0x70ed1a2122b0>, [Tensor([[...]]), Tensor() ...)

From what I understand, it is a TypeError, probably due to a linking problem. From the logs we see that aidge_learning.aidge_learning.Optimizer.set_parameters()in this case requires a list[Aidge::Tensor]) and not a list[aidge_core.aidge_core.Tensor]).

When compiling the modules from source, the following code snippet:

print(aidge_learning.Optimizer.set_parameters.__doc__)

returns, as expected:

set_parameters(self: aidge_learning.aidge_learning.Optimizer, arg0: list[aidge_core.aidge_core.Tensor]) -> None

I built the wheels for aidge_learning locally and managed to reproduce the error but could not fix it.

Reproducible example code

One can try with the Learning/snn.ipynb tutorial. This is the code snippet that causes the error:


opt = aidge_learning.Adam()
opt.set_learning_rate_scheduler(aidge_learning.constant_lr(0.0005))

opt.set_parameters(
    ([
       fc1.get_operator().get_input(1), # FC1 weight
       fc2.get_operator().get_input(1), # FC2 bias
       fc1.get_operator().get_input(2), # FC2 weight
       fc2.get_operator().get_input(2), # FC2 bias
    ]))
Edited by Iryna de Albuquerque Silva