Nego DL Converter and Keras Subclass Model

Hi all,

It looks like the examples for nengo_dl converter all use the Keras functional model API. Is there any support for Keras model subclass API, i.e,.

class Net(tf.keras.Model):
  def __init__(self):
    // ....
  def call(x):
    // ....

I didn’t see much in the documentation related to this. To work with the converter, would I have to define my own converter class for Net?

Hi @acanino1, and welcome to the Nengo forums! :smiley:

Unfortunately, given the flexibility of Keras model subclasses, NengoDL does not provide a built in converter to convert these models. Thus, you will need to write your own converter to use with your custom Keras models.

However, our recommendation is to convert your model subclass into a functional model, and to write a custom Keras layer (and NengoDL converter only for that layer) for any custom logic you have in your call method. This approach should be less complicated than writing a converter for your entire model.