MCPcopy Create free account
hub / github.com/ardamavi/PI-rCNN / predict

Function predict

code/Model/model_procedure.py:575–593  ·  view source on GitHub ↗
(Model, initial_conidtion, time_steps=1000, get_latent=False)

Source from the content-addressed store, hash-verified

573
574# Predict Function:
575def 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

Callers 1

plotting_pipelineFunction · 0.90

Calls 1

get_inital_statesFunction · 0.85

Tested by

no test coverage detected