(Model, initial_conidtion, time_steps=1000, get_latent=False)
| 573 | |
| 574 | # Predict Function: |
| 575 | def predict(Model, initial_conidtion, time_steps=1000, get_latent=False): |
| 576 | # Get inital data: |
| 577 | prev_out = initial_conidtion |
| 578 | prev_h, prev_c = get_inital_states() |
| 579 | |
| 580 | # Output list: |
| 581 | outputs = tf.reshape(tf.constant([], dtype=prev_out.dtype), (0,)+prev_out.shape[1:]) |
| 582 | latents = tf.reshape(tf.constant([], dtype=prev_h.dtype), (0,)+prev_h.shape[1:]) |
| 583 | |
| 584 | # Predict time series: |
| 585 | for t in ProgressBar(range(time_steps)): |
| 586 | prev_out, prev_h, prev_c, encode = Model.predict([prev_out, prev_h, prev_c]) |
| 587 | outputs = tf.concat([outputs, prev_out], axis=0) |
| 588 | latents = tf.concat([latents, encode], axis=0) |
| 589 | |
| 590 | if get_latent: |
| 591 | return outputs.numpy(), latents.numpy() |
| 592 | else: |
| 593 | return outputs.numpy() |
| 594 | |
| 595 | |
| 596 |
no test coverage detected