/Users/jbclarke/Code/tensorflow/tensorflow/python/keras/engine/keras_tensor.py class class KerasTensor
I am not sure we will copy this pattern, but for now I am just investigating.
In keras.Model, they store the model Tensors for input and output and use the “KerasHistory” class
to get to the originating Layer from the “KerasTensor” when needed. The other approach I am thinking
about is just mapping the Layers to the Operands produced by the input and output layers.
SequentialModel is a subclass of Model, and I haven’t gotten that far.
Here is what sample TF Python code looks like for using a Model directly.
In this example, “inputs", “x", and “outputs" are tensors.
inputs = tf.keras.Input(shape=(3,))
x = tf.keras.layers.Dense(4, activation=tf.nn.relu)(inputs)
outputs = tf.keras.layers.Dense(5, activation=tf.nn.softmax)(x)
model = tf.keras.Model(inputs=inputs, outputs=outputs)
jim