def restore(self) -> None: """Restore all loss tensor attributes.""" self.loss = get_tf_tensor(name="loss") self.loss_opt = get_tf_tensor(name="loss_opt") self.y_pred = get_tf_tensor(name="y_pred") self.y = get_tf_tensor(name="y") self.x_out = get_tf_tensor(name="x_out")
def restore(self) -> None: """ Restore all loss tensor from the current graph. """ self.dis_out = get_tf_tensor(name='dis_out') self.dis_gen_out = get_tf_tensor(name='dis_gen_out') self.dis_loss = get_tf_tensor(name='dis_loss') self.gen_loss = get_tf_tensor(name='gen_loss')
def restore(self) -> None: """ Method which restore all class tensor given the operator name and the current graph. The parent class can be call to restore standard input and output tensor avoiding code repetition. Use `core.deep_learning.tf_utils.get_tf_tensor` to safely restore a tensor. """ self.x = get_tf_tensor(name="x") self.x_out = get_tf_tensor(name="x_out")
def restore(self) -> None: """ Restore input/output tensor and all layer variables. """ self.w = get_tf_tensor(name="w") if self.add_bias and not (self.batch_norm or self.batch_renorm): self.b = get_tf_tensor(name="b") super().restore()
def _placeholder(self, dtype: tf.DType, shape: Union[Sequence[Union[int, None]], int, None], name: str) -> tf.placeholder: """ Set or restore a placeholder. Args ---- dtype : tf.DType Type of the placeholder. shape : Sequence[int], int, None Size of the placeholder. name : str name of the placeholder. Returns ------- tf.placeholder Tensorflow placeholder object. """ if env.RESTORE: return get_tf_tensor(name, self.graph) else: is_not_in_graph(name, self.graph) if shape is None: return tf.placeholder(dtype, name=name) else: return tf.placeholder(dtype, shape, name)