Skip to content

[core] [Parameter] Getting parameter from a Node recquire difficult cast

Issue

Getting a parameter from a Node is currently quite tedious:

float epsilon = std::static_pointer_cast<BatchNorm_Op<2>>(batchnorm->getOperator())->get<float>("Epsilon");

The biggest issue I see is that we need to cast to a templated type. This is mostly due to Operator not inheriting from Parametrizable and thus not having the get() method in its declaration.

Solutions

  • Invert Node -> Operator hierarchy in the user interface (see #15 (moved))
  • Add in Operator a trampoline method which calls the Parametrizable.get<T> method.
Edited by Maxence Naud