(self)
Dump computation graphs to files.
Dump computation graphs to files.
Dump computation graphs to files .
def save_computation_graphs(self):
    """Dump computation graphs to files."""
    if self.n_devices != 1:
      return  # TODO(lukaszkaiser): make this work with more devices.
    batch = next(self._train_stream)
    output_dir = self._output_dir
    if self.n_devices > 1:
      batch = _reshape_by_device(batch, self.n_devices)
    weights = self._opt_state.weights[0]
    forward_computation = jax.xla_computation(self._model_predict_eval)(
        batch, weights=weights, state=self._model_state[0],
        rng=self._rngs[0])
    with tf.io.gfile.GFile(os.path.join(output_dir, 'forward.txt'), 'w') as f:
      f.write(forward_computation.as_hlo_text())
    with tf.io.gfile.GFile(os.path.join(output_dir, 'forward.dot'), 'w') as f:
      f.write(forward_computation.as_hlo_dot_graph())
def save_computation_graphs ( self ) : if self . n_devices != 1 : return # TODO(lukaszkaiser): make this work with more devices. batch = next ( self . _train_stream ) output_dir = self . _output_dir if self . n_devices > 1 : batch = _reshape_by_device ( batch , self . n_devices ) weights = self . _opt_state . weights [ 0 ] forward_computation = jax . xla_computation ( self . _model_predict_eval ) ( batch , weights = weights , state = self . _model_state [ 0 ] , rng = self . _rngs [ 0 ] ) with tf . io . gfile . GFile ( os . path . join ( output_dir , 'forward.txt' ) , 'w' ) as f : f . write ( forward_computation . as_hlo_text ( ) ) with tf . io . gfile . GFile ( os . path . join ( output_dir , 'forward.dot' ) , 'w' ) as f : f . write ( forward_computation . as_hlo_dot_graph ( ) )