def on_value_event(self, event): """Implementation of the tensor value-carrying Event proto callback. Writes the Event proto to the file system for testing. The path written to follows the same pattern as the file:// debug URLs of tfdbg, i.e., the name scope of the op becomes the directory structure under the dump root directory. Args: event: The Event proto carrying a tensor value. Returns: If the debug node belongs to the set of currently activated breakpoints, a `EventReply` proto will be returned. """ if self._dump_dir: self._write_value_event(event) else: value = event.summary.value[0] tensor_value = debug_data.load_tensor_from_event(event) self._event_listener_servicer.debug_tensor_values[value.node_name].append( tensor_value) items = event.summary.value[0].node_name.split(":") node_name = items[0] output_slot = int(items[1]) debug_op = items[2] if ((node_name, output_slot, debug_op) in self._event_listener_servicer.breakpoints): return debug_service_pb2.EventReply()
def on_value_event(self, event): """Implementation of the tensor value-carrying Event proto callback. Writes the Event proto to the file system for testing. The path written to follows the same pattern as the file:// debug URLs of tfdbg, i.e., the name scope of the op becomes the directory structure under the dump root directory. Args: event: The Event proto carrying a tensor value. Returns: If the debug node belongs to the set of currently activated breakpoints, a `EventReply` proto will be returned. """ if self._dump_dir: self._write_value_event(event) else: value = event.summary.value[0] tensor_value = debug_data.load_tensor_from_event(event) self._event_listener_servicer.debug_tensor_values[value.node_name].append( tensor_value) items = event.summary.value[0].node_name.split(":") node_name = items[0] output_slot = int(items[1]) debug_op = items[2] if ((node_name, output_slot, debug_op) in self._event_listener_servicer.breakpoints): return debug_service_pb2.EventReply()
def on_value_event(self, event): """Records the summary values based on an updated message from the debugger. Logs an error message if writing the event to disk fails. Args: event: The Event proto to be processed. """ if not event.summary.value: logger.info("The summary of the event lacks a value.") return None # The node name property in the event proto is actually a watch key, which # is a concatenation of several pieces of data. watch_key = event.summary.value[0].node_name tensor_value = debug_data.load_tensor_from_event(event) device_name = _extract_device_name_from_event(event) node_name, output_slot, debug_op = event.summary.value[ 0 ].node_name.split(":") maybe_base_expanded_node_name = self._run_states.get_maybe_base_expanded_node_name( node_name, self._run_key, device_name ) self._tensor_store.add(watch_key, tensor_value) self._outgoing_channel.put( _comm_tensor_data( device_name, node_name, maybe_base_expanded_node_name, output_slot, debug_op, tensor_value, event.wall_time, ) ) logger.info("on_value_event(): waiting for client ack (tensors)...") self._incoming_channel.get() logger.info("on_value_event(): client ack received (tensor).") # Determine if the particular debug watch key is in the current list of # breakpoints. If it is, send an EventReply() to unblock the debug op. if self._is_debug_node_in_breakpoints(event.summary.value[0].node_name): logger.info( "Sending empty EventReply for breakpoint: %s", event.summary.value[0].node_name, ) # TODO(cais): Support receiving and sending tensor value from front-end. return debug_service_pb2.EventReply() return None
def on_value_event(self, event): """Implementation of the tensor value-carrying Event proto callback. Writes the Event proto to the file system for testing. The path written to follows the same pattern as the file:// debug URLs of tfdbg, i.e., the name scope of the op becomes the directory structure under the dump root directory. Args: event: The Event proto carrying a tensor value. """ if self._dump_dir: self._write_value_event(event) else: value = event.summary.value[0] self._event_listener_servicer.debug_tensor_values[value.node_name].append( debug_data.load_tensor_from_event(event))
def on_value_event(self, event): """Implementation of the tensor value-carrying Event proto callback. Writes the Event proto to the file system for testing. The path written to follows the same pattern as the file:// debug URLs of tfdbg, i.e., the name scope of the op becomes the directory structure under the dump root directory. Args: event: The Event proto carrying a tensor value. """ if self._dump_dir: self._write_value_event(event) else: value = event.summary.value[0] self._event_listener_servicer.debug_tensor_values[value.node_name].append( debug_data.load_tensor_from_event(event))
def on_value_event(self, event): """Records the summary values based on an updated message from the debugger. Logs an error message if writing the event to disk fails. Args: event: The Event proto to be processed. """ if not event.summary.value: tf.logging.info('The summary of the event lacks a value.') return None # The node name property in the event proto is actually a watch key, which # is a concatenation of several pieces of data. watch_key = event.summary.value[0].node_name tensor_value = debug_data.load_tensor_from_event(event) device_name = _extract_device_name_from_event(event) node_name, output_slot, debug_op = ( event.summary.value[0].node_name.split(':')) maybe_base_expanded_node_name = ( self._run_states.get_maybe_base_expanded_node_name(node_name, self._run_key, device_name)) self._tensor_store.add(watch_key, tensor_value) self._outgoing_channel.put(_comm_tensor_data( device_name, node_name, maybe_base_expanded_node_name, output_slot, debug_op, tensor_value, event.wall_time)) tf.logging.info('on_value_event(): waiting for client ack (tensors)...') self._incoming_channel.get() tf.logging.info('on_value_event(): client ack received (tensor).') # Determine if the particular debug watch key is in the current list of # breakpoints. If it is, send an EventReply() to unblock the debug op. if self._is_debug_node_in_breakpoints(event.summary.value[0].node_name): tf.logging.info('Sending empty EventReply for breakpoint: %s', event.summary.value[0].node_name) # TODO(cais): Support receiving and sending tensor value from front-end. return debug_service_pb2.EventReply() return None