Home › Forums › KX Solutions › Anyone using the Tensorflow functional API from inside q(embedpy)? › Re: Anyone using the Tensorflow functional API from inside q(embedpy)?
-
You could load the function in to q rather than redefine it line by line.
Example file.p
def get_model(input_shape, time2vec_dim = 3): inp = Input(input_shape) x = inp time_embedding = keras.layers.TimeDistributed(Time2Vec(time2vec_dim – 1))(x)
Load it and pull in the function:
q)l file.p q)get_model:.p.get`get_model q)get_model[(65;16)]
Another example of this: https://github.com/rianoc/qparquet
Looking to replicate an example from https://keras.io/api/layers/recurrent_layers/time_distributed/
q)lyr:.p.import`keras.layers q)x:lyr[`:Input;`shape pykw (10, 128, 128, 3)] q)conv_2d_layer:lyr[`:Conv2D;64;(3;3)] q)time_embedding:lyr[`:TimeDistributed;conv_2d_layer] q )outputs:time_embedding[x] q)print outputs[`:shape] (None, 10, 126, 126, 64)