Skip to content Skip to sidebar Skip to footer

How To Use Tf Operations In Keras Models

I am trying to us tensorflow operations within a keras model and I am quite confused about the mechanism and what Lambda layers do to tf tensors. So this works: a = keras.laye

Solution 1:

Question 1: Yes, it is necessary to wrap tf operations with a layer, because keras models require certain functions/variables that aren't included with tensorflow ops. In this case, _keras_history is a property that is only produced by wrapping the op with a layer.

Question 2: Is the matrix multiplication traHave you considered using a keras Dense layer, with use_bias=False? If you want to use a constant for the weight vector, you could set the kernel_initializer={constant}, and trainable=False.

Post a Comment for "How To Use Tf Operations In Keras Models"