repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
tensorflow/tensorboard
tensorboard/plugins/debugger/debugger_plugin.py
DebuggerPlugin._obtain_health_pills_at_step
def _obtain_health_pills_at_step(self, events_directory, node_names, step): """Reads disk to obtain the health pills for a run at a specific step. This could be much slower than the alternative path of just returning all health pills sampled by the event multiplexer. It could take tens of minutes to co...
python
def _obtain_health_pills_at_step(self, events_directory, node_names, step): """Reads disk to obtain the health pills for a run at a specific step. This could be much slower than the alternative path of just returning all health pills sampled by the event multiplexer. It could take tens of minutes to co...
[ "def", "_obtain_health_pills_at_step", "(", "self", ",", "events_directory", ",", "node_names", ",", "step", ")", ":", "# Obtain all files with debugger-related events.", "pattern", "=", "os", ".", "path", ".", "join", "(", "events_directory", ",", "_DEBUGGER_EVENTS_GLO...
Reads disk to obtain the health pills for a run at a specific step. This could be much slower than the alternative path of just returning all health pills sampled by the event multiplexer. It could take tens of minutes to complete this call for large graphs for big step values (in the thousands). ...
[ "Reads", "disk", "to", "obtain", "the", "health", "pills", "for", "a", "run", "at", "a", "specific", "step", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_plugin.py#L325-L365
train
tensorflow/tensorboard
tensorboard/plugins/debugger/debugger_plugin.py
DebuggerPlugin._process_health_pill_event
def _process_health_pill_event(self, node_name_set, mapping, target_step, file_path): """Creates health pills out of data in an event. Creates health pills out of the event and adds them to the mapping. Args: node_name_set: A set of node names that are relevant. ...
python
def _process_health_pill_event(self, node_name_set, mapping, target_step, file_path): """Creates health pills out of data in an event. Creates health pills out of the event and adds them to the mapping. Args: node_name_set: A set of node names that are relevant. ...
[ "def", "_process_health_pill_event", "(", "self", ",", "node_name_set", ",", "mapping", ",", "target_step", ",", "file_path", ")", ":", "events_loader", "=", "event_file_loader", ".", "EventFileLoader", "(", "file_path", ")", "for", "event", "in", "events_loader", ...
Creates health pills out of data in an event. Creates health pills out of the event and adds them to the mapping. Args: node_name_set: A set of node names that are relevant. mapping: The mapping from node name to HealthPillEvents. This object may be destructively modified. target_s...
[ "Creates", "health", "pills", "out", "of", "data", "in", "an", "event", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_plugin.py#L367-L447
train
tensorflow/tensorboard
tensorboard/plugins/debugger/debugger_plugin.py
DebuggerPlugin._process_health_pill_value
def _process_health_pill_value(self, wall_time, step, device_name, output_slot, node_name, tensor_proto, ...
python
def _process_health_pill_value(self, wall_time, step, device_name, output_slot, node_name, tensor_proto, ...
[ "def", "_process_health_pill_value", "(", "self", ",", "wall_time", ",", "step", ",", "device_name", ",", "output_slot", ",", "node_name", ",", "tensor_proto", ",", "node_name_set", "=", "None", ")", ":", "if", "node_name_set", "and", "node_name", "not", "in", ...
Creates a HealthPillEvent containing various properties of a health pill. Args: wall_time: The wall time in seconds. step: The session run step of the event. device_name: The name of the node's device. output_slot: The numeric output slot. node_name: The name of the node (without the ...
[ "Creates", "a", "HealthPillEvent", "containing", "various", "properties", "of", "a", "health", "pill", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_plugin.py#L449-L488
train
tensorflow/tensorboard
tensorboard/plugins/debugger/debugger_plugin.py
DebuggerPlugin._serve_numerics_alert_report_handler
def _serve_numerics_alert_report_handler(self, request): """A (wrapped) werkzeug handler for serving numerics alert report. Accepts GET requests and responds with an array of JSON-ified NumericsAlertReportRow. Each JSON-ified NumericsAlertReportRow object has the following format: { 'devic...
python
def _serve_numerics_alert_report_handler(self, request): """A (wrapped) werkzeug handler for serving numerics alert report. Accepts GET requests and responds with an array of JSON-ified NumericsAlertReportRow. Each JSON-ified NumericsAlertReportRow object has the following format: { 'devic...
[ "def", "_serve_numerics_alert_report_handler", "(", "self", ",", "request", ")", ":", "if", "request", ".", "method", "!=", "'GET'", ":", "logger", ".", "error", "(", "'%s requests are forbidden by the debugger plugin.'", ",", "request", ".", "method", ")", "return"...
A (wrapped) werkzeug handler for serving numerics alert report. Accepts GET requests and responds with an array of JSON-ified NumericsAlertReportRow. Each JSON-ified NumericsAlertReportRow object has the following format: { 'device_name': string, 'tensor_name': string, 'first_t...
[ "A", "(", "wrapped", ")", "werkzeug", "handler", "for", "serving", "numerics", "alert", "report", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_plugin.py#L491-L525
train
tensorflow/tensorboard
tensorboard/manager.py
_info_to_string
def _info_to_string(info): """Convert a `TensorBoardInfo` to string form to be stored on disk. The format returned by this function is opaque and should only be interpreted by `_info_from_string`. Args: info: A valid `TensorBoardInfo` object. Raises: ValueError: If any field on `info` is not of the...
python
def _info_to_string(info): """Convert a `TensorBoardInfo` to string form to be stored on disk. The format returned by this function is opaque and should only be interpreted by `_info_from_string`. Args: info: A valid `TensorBoardInfo` object. Raises: ValueError: If any field on `info` is not of the...
[ "def", "_info_to_string", "(", "info", ")", ":", "for", "key", "in", "_TENSORBOARD_INFO_FIELDS", ":", "field_type", "=", "_TENSORBOARD_INFO_FIELDS", "[", "key", "]", "if", "not", "isinstance", "(", "getattr", "(", "info", ",", "key", ")", ",", "field_type", ...
Convert a `TensorBoardInfo` to string form to be stored on disk. The format returned by this function is opaque and should only be interpreted by `_info_from_string`. Args: info: A valid `TensorBoardInfo` object. Raises: ValueError: If any field on `info` is not of the correct type. Returns: A...
[ "Convert", "a", "TensorBoardInfo", "to", "string", "form", "to", "be", "stored", "on", "disk", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L97-L128
train
tensorflow/tensorboard
tensorboard/manager.py
_info_from_string
def _info_from_string(info_string): """Parse a `TensorBoardInfo` object from its string representation. Args: info_string: A string representation of a `TensorBoardInfo`, as produced by a previous call to `_info_to_string`. Returns: A `TensorBoardInfo` value. Raises: ValueError: If the prov...
python
def _info_from_string(info_string): """Parse a `TensorBoardInfo` object from its string representation. Args: info_string: A string representation of a `TensorBoardInfo`, as produced by a previous call to `_info_to_string`. Returns: A `TensorBoardInfo` value. Raises: ValueError: If the prov...
[ "def", "_info_from_string", "(", "info_string", ")", ":", "try", ":", "json_value", "=", "json", ".", "loads", "(", "info_string", ")", "except", "ValueError", ":", "raise", "ValueError", "(", "\"invalid JSON: %r\"", "%", "(", "info_string", ",", ")", ")", "...
Parse a `TensorBoardInfo` object from its string representation. Args: info_string: A string representation of a `TensorBoardInfo`, as produced by a previous call to `_info_to_string`. Returns: A `TensorBoardInfo` value. Raises: ValueError: If the provided string is not valid JSON, or if it d...
[ "Parse", "a", "TensorBoardInfo", "object", "from", "its", "string", "representation", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L131-L174
train
tensorflow/tensorboard
tensorboard/manager.py
cache_key
def cache_key(working_directory, arguments, configure_kwargs): """Compute a `TensorBoardInfo.cache_key` field. The format returned by this function is opaque. Clients may only inspect it by comparing it for equality with other results from this function. Args: working_directory: The directory from which...
python
def cache_key(working_directory, arguments, configure_kwargs): """Compute a `TensorBoardInfo.cache_key` field. The format returned by this function is opaque. Clients may only inspect it by comparing it for equality with other results from this function. Args: working_directory: The directory from which...
[ "def", "cache_key", "(", "working_directory", ",", "arguments", ",", "configure_kwargs", ")", ":", "if", "not", "isinstance", "(", "arguments", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "TypeError", "(", "\"'arguments' should be a list of arguments, ...
Compute a `TensorBoardInfo.cache_key` field. The format returned by this function is opaque. Clients may only inspect it by comparing it for equality with other results from this function. Args: working_directory: The directory from which TensorBoard was launched and relative to which paths like `--...
[ "Compute", "a", "TensorBoardInfo", ".", "cache_key", "field", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L177-L222
train
tensorflow/tensorboard
tensorboard/manager.py
_get_info_dir
def _get_info_dir(): """Get path to directory in which to store info files. The directory returned by this function is "owned" by this module. If the contents of the directory are modified other than via the public functions of this module, subsequent behavior is undefined. The directory will be created if ...
python
def _get_info_dir(): """Get path to directory in which to store info files. The directory returned by this function is "owned" by this module. If the contents of the directory are modified other than via the public functions of this module, subsequent behavior is undefined. The directory will be created if ...
[ "def", "_get_info_dir", "(", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "tempfile", ".", "gettempdir", "(", ")", ",", "\".tensorboard-info\"", ")", "try", ":", "os", ".", "makedirs", "(", "path", ")", "except", "OSError", "as", "e", ...
Get path to directory in which to store info files. The directory returned by this function is "owned" by this module. If the contents of the directory are modified other than via the public functions of this module, subsequent behavior is undefined. The directory will be created if it does not exist.
[ "Get", "path", "to", "directory", "in", "which", "to", "store", "info", "files", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L225-L244
train
tensorflow/tensorboard
tensorboard/manager.py
write_info_file
def write_info_file(tensorboard_info): """Write TensorBoardInfo to the current process's info file. This should be called by `main` once the server is ready. When the server shuts down, `remove_info_file` should be called. Args: tensorboard_info: A valid `TensorBoardInfo` object. Raises: ValueError...
python
def write_info_file(tensorboard_info): """Write TensorBoardInfo to the current process's info file. This should be called by `main` once the server is ready. When the server shuts down, `remove_info_file` should be called. Args: tensorboard_info: A valid `TensorBoardInfo` object. Raises: ValueError...
[ "def", "write_info_file", "(", "tensorboard_info", ")", ":", "payload", "=", "\"%s\\n\"", "%", "_info_to_string", "(", "tensorboard_info", ")", "with", "open", "(", "_get_info_file_path", "(", ")", ",", "\"w\"", ")", "as", "outfile", ":", "outfile", ".", "writ...
Write TensorBoardInfo to the current process's info file. This should be called by `main` once the server is ready. When the server shuts down, `remove_info_file` should be called. Args: tensorboard_info: A valid `TensorBoardInfo` object. Raises: ValueError: If any field on `info` is not of the corre...
[ "Write", "TensorBoardInfo", "to", "the", "current", "process", "s", "info", "file", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L256-L270
train
tensorflow/tensorboard
tensorboard/manager.py
remove_info_file
def remove_info_file(): """Remove the current process's TensorBoardInfo file, if it exists. If the file does not exist, no action is taken and no error is raised. """ try: os.unlink(_get_info_file_path()) except OSError as e: if e.errno == errno.ENOENT: # The user may have wiped their temporary...
python
def remove_info_file(): """Remove the current process's TensorBoardInfo file, if it exists. If the file does not exist, no action is taken and no error is raised. """ try: os.unlink(_get_info_file_path()) except OSError as e: if e.errno == errno.ENOENT: # The user may have wiped their temporary...
[ "def", "remove_info_file", "(", ")", ":", "try", ":", "os", ".", "unlink", "(", "_get_info_file_path", "(", ")", ")", "except", "OSError", "as", "e", ":", "if", "e", ".", "errno", "==", "errno", ".", "ENOENT", ":", "# The user may have wiped their temporary ...
Remove the current process's TensorBoardInfo file, if it exists. If the file does not exist, no action is taken and no error is raised.
[ "Remove", "the", "current", "process", "s", "TensorBoardInfo", "file", "if", "it", "exists", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L273-L286
train
tensorflow/tensorboard
tensorboard/manager.py
get_all
def get_all(): """Return TensorBoardInfo values for running TensorBoard processes. This function may not provide a perfect snapshot of the set of running processes. Its result set may be incomplete if the user has cleaned their /tmp/ directory while TensorBoard processes are running. It may contain extraneou...
python
def get_all(): """Return TensorBoardInfo values for running TensorBoard processes. This function may not provide a perfect snapshot of the set of running processes. Its result set may be incomplete if the user has cleaned their /tmp/ directory while TensorBoard processes are running. It may contain extraneou...
[ "def", "get_all", "(", ")", ":", "info_dir", "=", "_get_info_dir", "(", ")", "results", "=", "[", "]", "for", "filename", "in", "os", ".", "listdir", "(", "info_dir", ")", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "info_dir", ",", ...
Return TensorBoardInfo values for running TensorBoard processes. This function may not provide a perfect snapshot of the set of running processes. Its result set may be incomplete if the user has cleaned their /tmp/ directory while TensorBoard processes are running. It may contain extraneous entries if TensorB...
[ "Return", "TensorBoardInfo", "values", "for", "running", "TensorBoard", "processes", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L289-L325
train
tensorflow/tensorboard
tensorboard/manager.py
start
def start(arguments, timeout=datetime.timedelta(seconds=60)): """Start a new TensorBoard instance, or reuse a compatible one. If the cache key determined by the provided arguments and the current working directory (see `cache_key`) matches the cache key of a running TensorBoard process (see `get_all`), that pr...
python
def start(arguments, timeout=datetime.timedelta(seconds=60)): """Start a new TensorBoard instance, or reuse a compatible one. If the cache key determined by the provided arguments and the current working directory (see `cache_key`) matches the cache key of a running TensorBoard process (see `get_all`), that pr...
[ "def", "start", "(", "arguments", ",", "timeout", "=", "datetime", ".", "timedelta", "(", "seconds", "=", "60", ")", ")", ":", "match", "=", "_find_matching_instance", "(", "cache_key", "(", "working_directory", "=", "os", ".", "getcwd", "(", ")", ",", "...
Start a new TensorBoard instance, or reuse a compatible one. If the cache key determined by the provided arguments and the current working directory (see `cache_key`) matches the cache key of a running TensorBoard process (see `get_all`), that process will be reused. Otherwise, a new TensorBoard process will ...
[ "Start", "a", "new", "TensorBoard", "instance", "or", "reuse", "a", "compatible", "one", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L361-L425
train
tensorflow/tensorboard
tensorboard/manager.py
_find_matching_instance
def _find_matching_instance(cache_key): """Find a running TensorBoard instance compatible with the cache key. Returns: A `TensorBoardInfo` object, or `None` if none matches the cache key. """ infos = get_all() candidates = [info for info in infos if info.cache_key == cache_key] for candidate in sorted(...
python
def _find_matching_instance(cache_key): """Find a running TensorBoard instance compatible with the cache key. Returns: A `TensorBoardInfo` object, or `None` if none matches the cache key. """ infos = get_all() candidates = [info for info in infos if info.cache_key == cache_key] for candidate in sorted(...
[ "def", "_find_matching_instance", "(", "cache_key", ")", ":", "infos", "=", "get_all", "(", ")", "candidates", "=", "[", "info", "for", "info", "in", "infos", "if", "info", ".", "cache_key", "==", "cache_key", "]", "for", "candidate", "in", "sorted", "(", ...
Find a running TensorBoard instance compatible with the cache key. Returns: A `TensorBoardInfo` object, or `None` if none matches the cache key.
[ "Find", "a", "running", "TensorBoard", "instance", "compatible", "with", "the", "cache", "key", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L428-L439
train
tensorflow/tensorboard
tensorboard/manager.py
_maybe_read_file
def _maybe_read_file(filename): """Read the given file, if it exists. Args: filename: A path to a file. Returns: A string containing the file contents, or `None` if the file does not exist. """ try: with open(filename) as infile: return infile.read() except IOError as e: if e.err...
python
def _maybe_read_file(filename): """Read the given file, if it exists. Args: filename: A path to a file. Returns: A string containing the file contents, or `None` if the file does not exist. """ try: with open(filename) as infile: return infile.read() except IOError as e: if e.err...
[ "def", "_maybe_read_file", "(", "filename", ")", ":", "try", ":", "with", "open", "(", "filename", ")", "as", "infile", ":", "return", "infile", ".", "read", "(", ")", "except", "IOError", "as", "e", ":", "if", "e", ".", "errno", "==", "errno", ".", ...
Read the given file, if it exists. Args: filename: A path to a file. Returns: A string containing the file contents, or `None` if the file does not exist.
[ "Read", "the", "given", "file", "if", "it", "exists", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/manager.py#L442-L457
train
tensorflow/tensorboard
tensorboard/plugins/profile/profile_plugin.py
process_raw_trace
def process_raw_trace(raw_trace): """Processes raw trace data and returns the UI data.""" trace = trace_events_pb2.Trace() trace.ParseFromString(raw_trace) return ''.join(trace_events_json.TraceEventsJsonStream(trace))
python
def process_raw_trace(raw_trace): """Processes raw trace data and returns the UI data.""" trace = trace_events_pb2.Trace() trace.ParseFromString(raw_trace) return ''.join(trace_events_json.TraceEventsJsonStream(trace))
[ "def", "process_raw_trace", "(", "raw_trace", ")", ":", "trace", "=", "trace_events_pb2", ".", "Trace", "(", ")", "trace", ".", "ParseFromString", "(", "raw_trace", ")", "return", "''", ".", "join", "(", "trace_events_json", ".", "TraceEventsJsonStream", "(", ...
Processes raw trace data and returns the UI data.
[ "Processes", "raw", "trace", "data", "and", "returns", "the", "UI", "data", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/profile/profile_plugin.py#L70-L74
train
tensorflow/tensorboard
tensorboard/plugins/profile/profile_plugin.py
ProfilePlugin.is_active
def is_active(self): """Whether this plugin is active and has any profile data to show. Detecting profile data is expensive, so this process runs asynchronously and the value reported by this method is the cached value and may be stale. Returns: Whether any run has profile data. """ # If...
python
def is_active(self): """Whether this plugin is active and has any profile data to show. Detecting profile data is expensive, so this process runs asynchronously and the value reported by this method is the cached value and may be stale. Returns: Whether any run has profile data. """ # If...
[ "def", "is_active", "(", "self", ")", ":", "# If we are already active, we remain active and don't recompute this.", "# Otherwise, try to acquire the lock without blocking; if we get it and", "# we're still not active, launch a thread to check if we're active and", "# release the lock once the com...
Whether this plugin is active and has any profile data to show. Detecting profile data is expensive, so this process runs asynchronously and the value reported by this method is the cached value and may be stale. Returns: Whether any run has profile data.
[ "Whether", "this", "plugin", "is", "active", "and", "has", "any", "profile", "data", "to", "show", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/profile/profile_plugin.py#L103-L128
train
tensorflow/tensorboard
tensorboard/plugins/profile/profile_plugin.py
ProfilePlugin._run_dir
def _run_dir(self, run): """Helper that maps a frontend run name to a profile "run" directory. The frontend run name consists of the TensorBoard run name (aka the relative path from the logdir root to the directory containing the data) path-joined to the Profile plugin's "run" concept (which is a subdi...
python
def _run_dir(self, run): """Helper that maps a frontend run name to a profile "run" directory. The frontend run name consists of the TensorBoard run name (aka the relative path from the logdir root to the directory containing the data) path-joined to the Profile plugin's "run" concept (which is a subdi...
[ "def", "_run_dir", "(", "self", ",", "run", ")", ":", "run", "=", "run", ".", "rstrip", "(", "'/'", ")", "if", "'/'", "not", "in", "run", ":", "run", "=", "'./'", "+", "run", "tb_run_name", ",", "_", ",", "profile_run_name", "=", "run", ".", "rpa...
Helper that maps a frontend run name to a profile "run" directory. The frontend run name consists of the TensorBoard run name (aka the relative path from the logdir root to the directory containing the data) path-joined to the Profile plugin's "run" concept (which is a subdirectory of the plugins/profi...
[ "Helper", "that", "maps", "a", "frontend", "run", "name", "to", "a", "profile", "run", "directory", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/profile/profile_plugin.py#L149-L190
train
tensorflow/tensorboard
tensorboard/plugins/profile/profile_plugin.py
ProfilePlugin.generate_run_to_tools
def generate_run_to_tools(self): """Generator for pairs of "run name" and a list of tools for that run. The "run name" here is a "frontend run name" - see _run_dir() for the definition of a "frontend run name" and how it maps to a directory of profile data for a specific profile "run". The profile plug...
python
def generate_run_to_tools(self): """Generator for pairs of "run name" and a list of tools for that run. The "run name" here is a "frontend run name" - see _run_dir() for the definition of a "frontend run name" and how it maps to a directory of profile data for a specific profile "run". The profile plug...
[ "def", "generate_run_to_tools", "(", "self", ")", ":", "self", ".", "start_grpc_stub_if_necessary", "(", ")", "plugin_assets", "=", "self", ".", "multiplexer", ".", "PluginAssets", "(", "PLUGIN_NAME", ")", "tb_run_names_to_dirs", "=", "self", ".", "multiplexer", "...
Generator for pairs of "run name" and a list of tools for that run. The "run name" here is a "frontend run name" - see _run_dir() for the definition of a "frontend run name" and how it maps to a directory of profile data for a specific profile "run". The profile plugin concept of "run" is different fro...
[ "Generator", "for", "pairs", "of", "run", "name", "and", "a", "list", "of", "tools", "for", "that", "run", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/profile/profile_plugin.py#L192-L270
train
tensorflow/tensorboard
tensorboard/plugins/profile/profile_plugin.py
ProfilePlugin.host_impl
def host_impl(self, run, tool): """Returns available hosts for the run and tool in the log directory. In the plugin log directory, each directory contains profile data for a single run (identified by the directory name), and files in the run directory contains data for different tools and hosts. The fi...
python
def host_impl(self, run, tool): """Returns available hosts for the run and tool in the log directory. In the plugin log directory, each directory contains profile data for a single run (identified by the directory name), and files in the run directory contains data for different tools and hosts. The fi...
[ "def", "host_impl", "(", "self", ",", "run", ",", "tool", ")", ":", "hosts", "=", "{", "}", "run_dir", "=", "self", ".", "_run_dir", "(", "run", ")", "if", "not", "run_dir", ":", "logger", ".", "warn", "(", "\"Cannot find asset directory for: %s\"", ",",...
Returns available hosts for the run and tool in the log directory. In the plugin log directory, each directory contains profile data for a single run (identified by the directory name), and files in the run directory contains data for different tools and hosts. The file that contains profile for a spec...
[ "Returns", "available", "hosts", "for", "the", "run", "and", "tool", "in", "the", "log", "directory", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/profile/profile_plugin.py#L304-L341
train
tensorflow/tensorboard
tensorboard/plugins/profile/profile_plugin.py
ProfilePlugin.data_impl
def data_impl(self, request): """Retrieves and processes the tool data for a run and a host. Args: request: XMLHttpRequest Returns: A string that can be served to the frontend tool or None if tool, run or host is invalid. """ run = request.args.get('run') tool = request.arg...
python
def data_impl(self, request): """Retrieves and processes the tool data for a run and a host. Args: request: XMLHttpRequest Returns: A string that can be served to the frontend tool or None if tool, run or host is invalid. """ run = request.args.get('run') tool = request.arg...
[ "def", "data_impl", "(", "self", ",", "request", ")", ":", "run", "=", "request", ".", "args", ".", "get", "(", "'run'", ")", "tool", "=", "request", ".", "args", ".", "get", "(", "'tag'", ")", "host", "=", "request", ".", "args", ".", "get", "("...
Retrieves and processes the tool data for a run and a host. Args: request: XMLHttpRequest Returns: A string that can be served to the frontend tool or None if tool, run or host is invalid.
[ "Retrieves", "and", "processes", "the", "tool", "data", "for", "a", "run", "and", "a", "host", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/profile/profile_plugin.py#L351-L409
train
tensorflow/tensorboard
tensorboard/plugins/scalar/scalars_demo.py
run
def run(logdir, run_name, initial_temperature, ambient_temperature, heat_coefficient): """Run a temperature simulation. This will simulate an object at temperature `initial_temperature` sitting at rest in a large room at temperature `ambient_temperature`. The object has some intrinsic `heat_coefficient...
python
def run(logdir, run_name, initial_temperature, ambient_temperature, heat_coefficient): """Run a temperature simulation. This will simulate an object at temperature `initial_temperature` sitting at rest in a large room at temperature `ambient_temperature`. The object has some intrinsic `heat_coefficient...
[ "def", "run", "(", "logdir", ",", "run_name", ",", "initial_temperature", ",", "ambient_temperature", ",", "heat_coefficient", ")", ":", "tf", ".", "compat", ".", "v1", ".", "reset_default_graph", "(", ")", "tf", ".", "compat", ".", "v1", ".", "set_random_se...
Run a temperature simulation. This will simulate an object at temperature `initial_temperature` sitting at rest in a large room at temperature `ambient_temperature`. The object has some intrinsic `heat_coefficient`, which indicates how much thermal conductivity it has: for instance, metals have high thermal ...
[ "Run", "a", "temperature", "simulation", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/scalar/scalars_demo.py#L35-L116
train
tensorflow/tensorboard
tensorboard/plugins/scalar/scalars_demo.py
run_all
def run_all(logdir, verbose=False): """Run simulations on a reasonable set of parameters. Arguments: logdir: the directory into which to store all the runs' data verbose: if true, print out each run's name as it begins """ for initial_temperature in [270.0, 310.0, 350.0]: for final_temperature in [...
python
def run_all(logdir, verbose=False): """Run simulations on a reasonable set of parameters. Arguments: logdir: the directory into which to store all the runs' data verbose: if true, print out each run's name as it begins """ for initial_temperature in [270.0, 310.0, 350.0]: for final_temperature in [...
[ "def", "run_all", "(", "logdir", ",", "verbose", "=", "False", ")", ":", "for", "initial_temperature", "in", "[", "270.0", ",", "310.0", ",", "350.0", "]", ":", "for", "final_temperature", "in", "[", "270.0", ",", "310.0", ",", "350.0", "]", ":", "for"...
Run simulations on a reasonable set of parameters. Arguments: logdir: the directory into which to store all the runs' data verbose: if true, print out each run's name as it begins
[ "Run", "simulations", "on", "a", "reasonable", "set", "of", "parameters", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/scalar/scalars_demo.py#L119-L134
train
tensorflow/tensorboard
tensorboard/backend/json_util.py
Cleanse
def Cleanse(obj, encoding='utf-8'): """Makes Python object appropriate for JSON serialization. - Replaces instances of Infinity/-Infinity/NaN with strings. - Turns byte strings into unicode strings. - Turns sets into sorted lists. - Turns tuples into lists. Args: obj: Python data structure. encodi...
python
def Cleanse(obj, encoding='utf-8'): """Makes Python object appropriate for JSON serialization. - Replaces instances of Infinity/-Infinity/NaN with strings. - Turns byte strings into unicode strings. - Turns sets into sorted lists. - Turns tuples into lists. Args: obj: Python data structure. encodi...
[ "def", "Cleanse", "(", "obj", ",", "encoding", "=", "'utf-8'", ")", ":", "if", "isinstance", "(", "obj", ",", "int", ")", ":", "return", "obj", "elif", "isinstance", "(", "obj", ",", "float", ")", ":", "if", "obj", "==", "_INFINITY", ":", "return", ...
Makes Python object appropriate for JSON serialization. - Replaces instances of Infinity/-Infinity/NaN with strings. - Turns byte strings into unicode strings. - Turns sets into sorted lists. - Turns tuples into lists. Args: obj: Python data structure. encoding: Charset used to decode byte strings. ...
[ "Makes", "Python", "object", "appropriate", "for", "JSON", "serialization", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/json_util.py#L39-L74
train
tensorflow/tensorboard
tensorboard/plugins/text/summary.py
op
def op(name, data, display_name=None, description=None, collections=None): """Create a legacy text summary op. Text data summarized via this plugin will be visible in the Text Dashboard in TensorBoard. The standard TensorBoard Text Dashboard will render markdown in the strings, and ...
python
def op(name, data, display_name=None, description=None, collections=None): """Create a legacy text summary op. Text data summarized via this plugin will be visible in the Text Dashboard in TensorBoard. The standard TensorBoard Text Dashboard will render markdown in the strings, and ...
[ "def", "op", "(", "name", ",", "data", ",", "display_name", "=", "None", ",", "description", "=", "None", ",", "collections", "=", "None", ")", ":", "# TODO(nickfelt): remove on-demand imports once dep situation is fixed.", "import", "tensorflow", ".", "compat", "."...
Create a legacy text summary op. Text data summarized via this plugin will be visible in the Text Dashboard in TensorBoard. The standard TensorBoard Text Dashboard will render markdown in the strings, and will automatically organize 1D and 2D tensors into tables. If a tensor with more than 2 dimensions is prov...
[ "Create", "a", "legacy", "text", "summary", "op", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/text/summary.py#L30-L76
train
tensorflow/tensorboard
tensorboard/plugins/text/summary.py
pb
def pb(name, data, display_name=None, description=None): """Create a legacy text summary protobuf. Arguments: name: A name for the generated node. Will also serve as a series name in TensorBoard. data: A Python bytestring (of type bytes), or Unicode string. Or a numpy data array of those types....
python
def pb(name, data, display_name=None, description=None): """Create a legacy text summary protobuf. Arguments: name: A name for the generated node. Will also serve as a series name in TensorBoard. data: A Python bytestring (of type bytes), or Unicode string. Or a numpy data array of those types....
[ "def", "pb", "(", "name", ",", "data", ",", "display_name", "=", "None", ",", "description", "=", "None", ")", ":", "# TODO(nickfelt): remove on-demand imports once dep situation is fixed.", "import", "tensorflow", ".", "compat", ".", "v1", "as", "tf", "try", ":",...
Create a legacy text summary protobuf. Arguments: name: A name for the generated node. Will also serve as a series name in TensorBoard. data: A Python bytestring (of type bytes), or Unicode string. Or a numpy data array of those types. display_name: Optional name for this summary in TensorBoa...
[ "Create", "a", "legacy", "text", "summary", "protobuf", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/text/summary.py#L79-L116
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
_GetPurgeMessage
def _GetPurgeMessage(most_recent_step, most_recent_wall_time, event_step, event_wall_time, num_expired_scalars, num_expired_histos, num_expired_comp_histos, num_expired_images, num_expired_audio): """Return the string message associated with TensorBoard p...
python
def _GetPurgeMessage(most_recent_step, most_recent_wall_time, event_step, event_wall_time, num_expired_scalars, num_expired_histos, num_expired_comp_histos, num_expired_images, num_expired_audio): """Return the string message associated with TensorBoard p...
[ "def", "_GetPurgeMessage", "(", "most_recent_step", ",", "most_recent_wall_time", ",", "event_step", ",", "event_wall_time", ",", "num_expired_scalars", ",", "num_expired_histos", ",", "num_expired_comp_histos", ",", "num_expired_images", ",", "num_expired_audio", ")", ":",...
Return the string message associated with TensorBoard purges.
[ "Return", "the", "string", "message", "associated", "with", "TensorBoard", "purges", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L719-L733
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
_GeneratorFromPath
def _GeneratorFromPath(path): """Create an event generator for file or directory at given path string.""" if not path: raise ValueError('path must be a valid string') if io_wrapper.IsTensorFlowEventsFile(path): return event_file_loader.EventFileLoader(path) else: return directory_watcher.DirectoryWa...
python
def _GeneratorFromPath(path): """Create an event generator for file or directory at given path string.""" if not path: raise ValueError('path must be a valid string') if io_wrapper.IsTensorFlowEventsFile(path): return event_file_loader.EventFileLoader(path) else: return directory_watcher.DirectoryWa...
[ "def", "_GeneratorFromPath", "(", "path", ")", ":", "if", "not", "path", ":", "raise", "ValueError", "(", "'path must be a valid string'", ")", "if", "io_wrapper", ".", "IsTensorFlowEventsFile", "(", "path", ")", ":", "return", "event_file_loader", ".", "EventFile...
Create an event generator for file or directory at given path string.
[ "Create", "an", "event", "generator", "for", "file", "or", "directory", "at", "given", "path", "string", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L736-L746
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
_ParseFileVersion
def _ParseFileVersion(file_version): """Convert the string file_version in event.proto into a float. Args: file_version: String file_version from event.proto Returns: Version number as a float. """ tokens = file_version.split('brain.Event:') try: return float(tokens[-1]) except ValueError: ...
python
def _ParseFileVersion(file_version): """Convert the string file_version in event.proto into a float. Args: file_version: String file_version from event.proto Returns: Version number as a float. """ tokens = file_version.split('brain.Event:') try: return float(tokens[-1]) except ValueError: ...
[ "def", "_ParseFileVersion", "(", "file_version", ")", ":", "tokens", "=", "file_version", ".", "split", "(", "'brain.Event:'", ")", "try", ":", "return", "float", "(", "tokens", "[", "-", "1", "]", ")", "except", "ValueError", ":", "## This should never happen...
Convert the string file_version in event.proto into a float. Args: file_version: String file_version from event.proto Returns: Version number as a float.
[ "Convert", "the", "string", "file_version", "in", "event", ".", "proto", "into", "a", "float", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L749-L767
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator.Reload
def Reload(self): """Loads all events added since the last call to `Reload`. If `Reload` was never called, loads all events in the file. Returns: The `EventAccumulator`. """ with self._generator_mutex: for event in self._generator.Load(): self._ProcessEvent(event) return se...
python
def Reload(self): """Loads all events added since the last call to `Reload`. If `Reload` was never called, loads all events in the file. Returns: The `EventAccumulator`. """ with self._generator_mutex: for event in self._generator.Load(): self._ProcessEvent(event) return se...
[ "def", "Reload", "(", "self", ")", ":", "with", "self", ".", "_generator_mutex", ":", "for", "event", "in", "self", ".", "_generator", ".", "Load", "(", ")", ":", "self", ".", "_ProcessEvent", "(", "event", ")", "return", "self" ]
Loads all events added since the last call to `Reload`. If `Reload` was never called, loads all events in the file. Returns: The `EventAccumulator`.
[ "Loads", "all", "events", "added", "since", "the", "last", "call", "to", "Reload", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L220-L231
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator.RetrievePluginAsset
def RetrievePluginAsset(self, plugin_name, asset_name): """Return the contents of a given plugin asset. Args: plugin_name: The string name of a plugin. asset_name: The string name of an asset. Returns: The string contents of the plugin asset. Raises: KeyError: If the asset is ...
python
def RetrievePluginAsset(self, plugin_name, asset_name): """Return the contents of a given plugin asset. Args: plugin_name: The string name of a plugin. asset_name: The string name of an asset. Returns: The string contents of the plugin asset. Raises: KeyError: If the asset is ...
[ "def", "RetrievePluginAsset", "(", "self", ",", "plugin_name", ",", "asset_name", ")", ":", "return", "plugin_asset_util", ".", "RetrieveAsset", "(", "self", ".", "path", ",", "plugin_name", ",", "asset_name", ")" ]
Return the contents of a given plugin asset. Args: plugin_name: The string name of a plugin. asset_name: The string name of an asset. Returns: The string contents of the plugin asset. Raises: KeyError: If the asset is not available.
[ "Return", "the", "contents", "of", "a", "given", "plugin", "asset", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L245-L258
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator.FirstEventTimestamp
def FirstEventTimestamp(self): """Returns the timestamp in seconds of the first event. If the first event has been loaded (either by this method or by `Reload`, this returns immediately. Otherwise, it will load in the first event. Note that this means that calling `Reload` will cause this to block unti...
python
def FirstEventTimestamp(self): """Returns the timestamp in seconds of the first event. If the first event has been loaded (either by this method or by `Reload`, this returns immediately. Otherwise, it will load in the first event. Note that this means that calling `Reload` will cause this to block unti...
[ "def", "FirstEventTimestamp", "(", "self", ")", ":", "if", "self", ".", "_first_event_timestamp", "is", "not", "None", ":", "return", "self", ".", "_first_event_timestamp", "with", "self", ".", "_generator_mutex", ":", "try", ":", "event", "=", "next", "(", ...
Returns the timestamp in seconds of the first event. If the first event has been loaded (either by this method or by `Reload`, this returns immediately. Otherwise, it will load in the first event. Note that this means that calling `Reload` will cause this to block until `Reload` has finished. Retu...
[ "Returns", "the", "timestamp", "in", "seconds", "of", "the", "first", "event", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L260-L284
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator.PluginTagToContent
def PluginTagToContent(self, plugin_name): """Returns a dict mapping tags to content specific to that plugin. Args: plugin_name: The name of the plugin for which to fetch plugin-specific content. Raises: KeyError: if the plugin name is not found. Returns: A dict mapping tags...
python
def PluginTagToContent(self, plugin_name): """Returns a dict mapping tags to content specific to that plugin. Args: plugin_name: The name of the plugin for which to fetch plugin-specific content. Raises: KeyError: if the plugin name is not found. Returns: A dict mapping tags...
[ "def", "PluginTagToContent", "(", "self", ",", "plugin_name", ")", ":", "if", "plugin_name", "not", "in", "self", ".", "_plugin_to_tag_to_content", ":", "raise", "KeyError", "(", "'Plugin %r could not be found.'", "%", "plugin_name", ")", "return", "self", ".", "_...
Returns a dict mapping tags to content specific to that plugin. Args: plugin_name: The name of the plugin for which to fetch plugin-specific content. Raises: KeyError: if the plugin name is not found. Returns: A dict mapping tags to plugin-specific content (which are always stri...
[ "Returns", "a", "dict", "mapping", "tags", "to", "content", "specific", "to", "that", "plugin", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L286-L302
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator.Tags
def Tags(self): """Return all tags found in the value stream. Returns: A `{tagType: ['list', 'of', 'tags']}` dictionary. """ return { IMAGES: self.images.Keys(), AUDIO: self.audios.Keys(), HISTOGRAMS: self.histograms.Keys(), SCALARS: self.scalars.Keys(), CO...
python
def Tags(self): """Return all tags found in the value stream. Returns: A `{tagType: ['list', 'of', 'tags']}` dictionary. """ return { IMAGES: self.images.Keys(), AUDIO: self.audios.Keys(), HISTOGRAMS: self.histograms.Keys(), SCALARS: self.scalars.Keys(), CO...
[ "def", "Tags", "(", "self", ")", ":", "return", "{", "IMAGES", ":", "self", ".", "images", ".", "Keys", "(", ")", ",", "AUDIO", ":", "self", ".", "audios", ".", "Keys", "(", ")", ",", "HISTOGRAMS", ":", "self", ".", "histograms", ".", "Keys", "("...
Return all tags found in the value stream. Returns: A `{tagType: ['list', 'of', 'tags']}` dictionary.
[ "Return", "all", "tags", "found", "in", "the", "value", "stream", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L406-L424
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator.Graph
def Graph(self): """Return the graph definition, if there is one. If the graph is stored directly, return that. If no graph is stored directly but a metagraph is stored containing a graph, return that. Raises: ValueError: If there is no graph for this run. Returns: The `graph_def` pr...
python
def Graph(self): """Return the graph definition, if there is one. If the graph is stored directly, return that. If no graph is stored directly but a metagraph is stored containing a graph, return that. Raises: ValueError: If there is no graph for this run. Returns: The `graph_def` pr...
[ "def", "Graph", "(", "self", ")", ":", "graph", "=", "graph_pb2", ".", "GraphDef", "(", ")", "if", "self", ".", "_graph", "is", "not", "None", ":", "graph", ".", "ParseFromString", "(", "self", ".", "_graph", ")", "return", "graph", "raise", "ValueErro...
Return the graph definition, if there is one. If the graph is stored directly, return that. If no graph is stored directly but a metagraph is stored containing a graph, return that. Raises: ValueError: If there is no graph for this run. Returns: The `graph_def` proto.
[ "Return", "the", "graph", "definition", "if", "there", "is", "one", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L440-L456
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator.MetaGraph
def MetaGraph(self): """Return the metagraph definition, if there is one. Raises: ValueError: If there is no metagraph for this run. Returns: The `meta_graph_def` proto. """ if self._meta_graph is None: raise ValueError('There is no metagraph in this EventAccumulator') meta_g...
python
def MetaGraph(self): """Return the metagraph definition, if there is one. Raises: ValueError: If there is no metagraph for this run. Returns: The `meta_graph_def` proto. """ if self._meta_graph is None: raise ValueError('There is no metagraph in this EventAccumulator') meta_g...
[ "def", "MetaGraph", "(", "self", ")", ":", "if", "self", ".", "_meta_graph", "is", "None", ":", "raise", "ValueError", "(", "'There is no metagraph in this EventAccumulator'", ")", "meta_graph", "=", "meta_graph_pb2", ".", "MetaGraphDef", "(", ")", "meta_graph", "...
Return the metagraph definition, if there is one. Raises: ValueError: If there is no metagraph for this run. Returns: The `meta_graph_def` proto.
[ "Return", "the", "metagraph", "definition", "if", "there", "is", "one", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L458-L471
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator.RunMetadata
def RunMetadata(self, tag): """Given a tag, return the associated session.run() metadata. Args: tag: A string tag associated with the event. Raises: ValueError: If the tag is not found. Returns: The metadata in form of `RunMetadata` proto. """ if tag not in self._tagged_meta...
python
def RunMetadata(self, tag): """Given a tag, return the associated session.run() metadata. Args: tag: A string tag associated with the event. Raises: ValueError: If the tag is not found. Returns: The metadata in form of `RunMetadata` proto. """ if tag not in self._tagged_meta...
[ "def", "RunMetadata", "(", "self", ",", "tag", ")", ":", "if", "tag", "not", "in", "self", ".", "_tagged_metadata", ":", "raise", "ValueError", "(", "'There is no run metadata with this tag name'", ")", "run_metadata", "=", "config_pb2", ".", "RunMetadata", "(", ...
Given a tag, return the associated session.run() metadata. Args: tag: A string tag associated with the event. Raises: ValueError: If the tag is not found. Returns: The metadata in form of `RunMetadata` proto.
[ "Given", "a", "tag", "return", "the", "associated", "session", ".", "run", "()", "metadata", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L473-L490
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._MaybePurgeOrphanedData
def _MaybePurgeOrphanedData(self, event): """Maybe purge orphaned data due to a TensorFlow crash. When TensorFlow crashes at step T+O and restarts at step T, any events written after step T are now "orphaned" and will be at best misleading if they are included in TensorBoard. This logic attempts t...
python
def _MaybePurgeOrphanedData(self, event): """Maybe purge orphaned data due to a TensorFlow crash. When TensorFlow crashes at step T+O and restarts at step T, any events written after step T are now "orphaned" and will be at best misleading if they are included in TensorBoard. This logic attempts t...
[ "def", "_MaybePurgeOrphanedData", "(", "self", ",", "event", ")", ":", "if", "not", "self", ".", "purge_orphaned_data", ":", "return", "## Check if the event happened after a crash, and purge expired tags.", "if", "self", ".", "file_version", "and", "self", ".", "file_v...
Maybe purge orphaned data due to a TensorFlow crash. When TensorFlow crashes at step T+O and restarts at step T, any events written after step T are now "orphaned" and will be at best misleading if they are included in TensorBoard. This logic attempts to determine if there is orphaned data, and purge ...
[ "Maybe", "purge", "orphaned", "data", "due", "to", "a", "TensorFlow", "crash", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L562-L585
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._CheckForRestartAndMaybePurge
def _CheckForRestartAndMaybePurge(self, event): """Check and discard expired events using SessionLog.START. Check for a SessionLog.START event and purge all previously seen events with larger steps, because they are out of date. Because of supervisor threading, it is possible that this logic will cause...
python
def _CheckForRestartAndMaybePurge(self, event): """Check and discard expired events using SessionLog.START. Check for a SessionLog.START event and purge all previously seen events with larger steps, because they are out of date. Because of supervisor threading, it is possible that this logic will cause...
[ "def", "_CheckForRestartAndMaybePurge", "(", "self", ",", "event", ")", ":", "if", "event", ".", "HasField", "(", "'session_log'", ")", "and", "event", ".", "session_log", ".", "status", "==", "event_pb2", ".", "SessionLog", ".", "START", ":", "self", ".", ...
Check and discard expired events using SessionLog.START. Check for a SessionLog.START event and purge all previously seen events with larger steps, because they are out of date. Because of supervisor threading, it is possible that this logic will cause the first few event messages to be discarded since...
[ "Check", "and", "discard", "expired", "events", "using", "SessionLog", ".", "START", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L587-L605
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._CheckForOutOfOrderStepAndMaybePurge
def _CheckForOutOfOrderStepAndMaybePurge(self, event): """Check for out-of-order event.step and discard expired events for tags. Check if the event is out of order relative to the global most recent step. If it is, purge outdated summaries for tags that the event contains. Args: event: The event...
python
def _CheckForOutOfOrderStepAndMaybePurge(self, event): """Check for out-of-order event.step and discard expired events for tags. Check if the event is out of order relative to the global most recent step. If it is, purge outdated summaries for tags that the event contains. Args: event: The event...
[ "def", "_CheckForOutOfOrderStepAndMaybePurge", "(", "self", ",", "event", ")", ":", "if", "event", ".", "step", "<", "self", ".", "most_recent_step", "and", "event", ".", "HasField", "(", "'summary'", ")", ":", "self", ".", "_Purge", "(", "event", ",", "by...
Check for out-of-order event.step and discard expired events for tags. Check if the event is out of order relative to the global most recent step. If it is, purge outdated summaries for tags that the event contains. Args: event: The event to use as reference. If the event is out-of-order, all ...
[ "Check", "for", "out", "-", "of", "-", "order", "event", ".", "step", "and", "discard", "expired", "events", "for", "tags", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L607-L621
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._ProcessHistogram
def _ProcessHistogram(self, tag, wall_time, step, histo): """Processes a proto histogram by adding it to accumulated state.""" histo = self._ConvertHistogramProtoToTuple(histo) histo_ev = HistogramEvent(wall_time, step, histo) self.histograms.AddItem(tag, histo_ev) self.compressed_histograms.AddItem...
python
def _ProcessHistogram(self, tag, wall_time, step, histo): """Processes a proto histogram by adding it to accumulated state.""" histo = self._ConvertHistogramProtoToTuple(histo) histo_ev = HistogramEvent(wall_time, step, histo) self.histograms.AddItem(tag, histo_ev) self.compressed_histograms.AddItem...
[ "def", "_ProcessHistogram", "(", "self", ",", "tag", ",", "wall_time", ",", "step", ",", "histo", ")", ":", "histo", "=", "self", ".", "_ConvertHistogramProtoToTuple", "(", "histo", ")", "histo_ev", "=", "HistogramEvent", "(", "wall_time", ",", "step", ",", ...
Processes a proto histogram by adding it to accumulated state.
[ "Processes", "a", "proto", "histogram", "by", "adding", "it", "to", "accumulated", "state", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L632-L637
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._CompressHistogram
def _CompressHistogram(self, histo_ev): """Callback for _ProcessHistogram.""" return CompressedHistogramEvent( histo_ev.wall_time, histo_ev.step, compressor.compress_histogram_proto( histo_ev.histogram_value, self._compression_bps))
python
def _CompressHistogram(self, histo_ev): """Callback for _ProcessHistogram.""" return CompressedHistogramEvent( histo_ev.wall_time, histo_ev.step, compressor.compress_histogram_proto( histo_ev.histogram_value, self._compression_bps))
[ "def", "_CompressHistogram", "(", "self", ",", "histo_ev", ")", ":", "return", "CompressedHistogramEvent", "(", "histo_ev", ".", "wall_time", ",", "histo_ev", ".", "step", ",", "compressor", ".", "compress_histogram_proto", "(", "histo_ev", ".", "histogram_value", ...
Callback for _ProcessHistogram.
[ "Callback", "for", "_ProcessHistogram", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L639-L645
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._ProcessImage
def _ProcessImage(self, tag, wall_time, step, image): """Processes an image by adding it to accumulated state.""" event = ImageEvent(wall_time=wall_time, step=step, encoded_image_string=image.encoded_image_string, width=image.width, ...
python
def _ProcessImage(self, tag, wall_time, step, image): """Processes an image by adding it to accumulated state.""" event = ImageEvent(wall_time=wall_time, step=step, encoded_image_string=image.encoded_image_string, width=image.width, ...
[ "def", "_ProcessImage", "(", "self", ",", "tag", ",", "wall_time", ",", "step", ",", "image", ")", ":", "event", "=", "ImageEvent", "(", "wall_time", "=", "wall_time", ",", "step", "=", "step", ",", "encoded_image_string", "=", "image", ".", "encoded_image...
Processes an image by adding it to accumulated state.
[ "Processes", "an", "image", "by", "adding", "it", "to", "accumulated", "state", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L647-L654
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._ProcessAudio
def _ProcessAudio(self, tag, wall_time, step, audio): """Processes a audio by adding it to accumulated state.""" event = AudioEvent(wall_time=wall_time, step=step, encoded_audio_string=audio.encoded_audio_string, content_type=audio.content_typ...
python
def _ProcessAudio(self, tag, wall_time, step, audio): """Processes a audio by adding it to accumulated state.""" event = AudioEvent(wall_time=wall_time, step=step, encoded_audio_string=audio.encoded_audio_string, content_type=audio.content_typ...
[ "def", "_ProcessAudio", "(", "self", ",", "tag", ",", "wall_time", ",", "step", ",", "audio", ")", ":", "event", "=", "AudioEvent", "(", "wall_time", "=", "wall_time", ",", "step", "=", "step", ",", "encoded_audio_string", "=", "audio", ".", "encoded_audio...
Processes a audio by adding it to accumulated state.
[ "Processes", "a", "audio", "by", "adding", "it", "to", "accumulated", "state", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L656-L664
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._ProcessScalar
def _ProcessScalar(self, tag, wall_time, step, scalar): """Processes a simple value by adding it to accumulated state.""" sv = ScalarEvent(wall_time=wall_time, step=step, value=scalar) self.scalars.AddItem(tag, sv)
python
def _ProcessScalar(self, tag, wall_time, step, scalar): """Processes a simple value by adding it to accumulated state.""" sv = ScalarEvent(wall_time=wall_time, step=step, value=scalar) self.scalars.AddItem(tag, sv)
[ "def", "_ProcessScalar", "(", "self", ",", "tag", ",", "wall_time", ",", "step", ",", "scalar", ")", ":", "sv", "=", "ScalarEvent", "(", "wall_time", "=", "wall_time", ",", "step", "=", "step", ",", "value", "=", "scalar", ")", "self", ".", "scalars", ...
Processes a simple value by adding it to accumulated state.
[ "Processes", "a", "simple", "value", "by", "adding", "it", "to", "accumulated", "state", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L666-L669
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_accumulator.py
EventAccumulator._Purge
def _Purge(self, event, by_tags): """Purge all events that have occurred after the given event.step. If by_tags is True, purge all events that occurred after the given event.step, but only for the tags that the event has. Non-sequential event.steps suggest that a TensorFlow restart occurred, and we dis...
python
def _Purge(self, event, by_tags): """Purge all events that have occurred after the given event.step. If by_tags is True, purge all events that occurred after the given event.step, but only for the tags that the event has. Non-sequential event.steps suggest that a TensorFlow restart occurred, and we dis...
[ "def", "_Purge", "(", "self", ",", "event", ",", "by_tags", ")", ":", "## Keep data in reservoirs that has a step less than event.step", "_NotExpired", "=", "lambda", "x", ":", "x", ".", "step", "<", "event", ".", "step", "if", "by_tags", ":", "def", "_ExpiredPe...
Purge all events that have occurred after the given event.step. If by_tags is True, purge all events that occurred after the given event.step, but only for the tags that the event has. Non-sequential event.steps suggest that a TensorFlow restart occurred, and we discard the out-of-order events to displ...
[ "Purge", "all", "events", "that", "have", "occurred", "after", "the", "given", "event", ".", "step", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_accumulator.py#L675-L716
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_file_loader.py
RawEventFileLoader.Load
def Load(self): """Loads all new events from disk as raw serialized proto bytestrings. Calling Load multiple times in a row will not 'drop' events as long as the return value is not iterated over. Yields: All event proto bytestrings in the file that have not been yielded yet. """ logger....
python
def Load(self): """Loads all new events from disk as raw serialized proto bytestrings. Calling Load multiple times in a row will not 'drop' events as long as the return value is not iterated over. Yields: All event proto bytestrings in the file that have not been yielded yet. """ logger....
[ "def", "Load", "(", "self", ")", ":", "logger", ".", "debug", "(", "'Loading events from %s'", ",", "self", ".", "_file_path", ")", "# GetNext() expects a status argument on TF <= 1.7.", "get_next_args", "=", "inspect", ".", "getargspec", "(", "self", ".", "_reader"...
Loads all new events from disk as raw serialized proto bytestrings. Calling Load multiple times in a row will not 'drop' events as long as the return value is not iterated over. Yields: All event proto bytestrings in the file that have not been yielded yet.
[ "Loads", "all", "new", "events", "from", "disk", "as", "raw", "serialized", "proto", "bytestrings", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_file_loader.py#L49-L79
train
tensorflow/tensorboard
tensorboard/backend/event_processing/event_file_loader.py
EventFileLoader.Load
def Load(self): """Loads all new events from disk. Calling Load multiple times in a row will not 'drop' events as long as the return value is not iterated over. Yields: All events in the file that have not been yielded yet. """ for record in super(EventFileLoader, self).Load(): yie...
python
def Load(self): """Loads all new events from disk. Calling Load multiple times in a row will not 'drop' events as long as the return value is not iterated over. Yields: All events in the file that have not been yielded yet. """ for record in super(EventFileLoader, self).Load(): yie...
[ "def", "Load", "(", "self", ")", ":", "for", "record", "in", "super", "(", "EventFileLoader", ",", "self", ")", ".", "Load", "(", ")", ":", "yield", "event_pb2", ".", "Event", ".", "FromString", "(", "record", ")" ]
Loads all new events from disk. Calling Load multiple times in a row will not 'drop' events as long as the return value is not iterated over. Yields: All events in the file that have not been yielded yet.
[ "Loads", "all", "new", "events", "from", "disk", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/event_file_loader.py#L85-L95
train
tensorflow/tensorboard
tensorboard/plugins/beholder/im_util.py
scale_sections
def scale_sections(sections, scaling_scope): ''' input: unscaled sections. returns: sections scaled to [0, 255] ''' new_sections = [] if scaling_scope == 'layer': for section in sections: new_sections.append(scale_image_for_display(section)) elif scaling_scope == 'network': global_min, glo...
python
def scale_sections(sections, scaling_scope): ''' input: unscaled sections. returns: sections scaled to [0, 255] ''' new_sections = [] if scaling_scope == 'layer': for section in sections: new_sections.append(scale_image_for_display(section)) elif scaling_scope == 'network': global_min, glo...
[ "def", "scale_sections", "(", "sections", ",", "scaling_scope", ")", ":", "new_sections", "=", "[", "]", "if", "scaling_scope", "==", "'layer'", ":", "for", "section", "in", "sections", ":", "new_sections", ".", "append", "(", "scale_image_for_display", "(", "...
input: unscaled sections. returns: sections scaled to [0, 255]
[ "input", ":", "unscaled", "sections", ".", "returns", ":", "sections", "scaled", "to", "[", "0", "255", "]" ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/im_util.py#L35-L53
train
tensorflow/tensorboard
tensorboard/plugins/debugger/debugger_server_lib.py
DebuggerDataStreamHandler.on_value_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: logger.warn("The summary of the event la...
python
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.warn("The summary of the event la...
[ "def", "on_value_event", "(", "self", ",", "event", ")", ":", "if", "not", "event", ".", "summary", ".", "value", ":", "logger", ".", "warn", "(", "\"The summary of the event lacks a value.\"", ")", "return", "# The node name property is actually a watch key, which is a...
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.
[ "Records", "the", "summary", "values", "based", "on", "an", "updated", "message", "from", "the", "debugger", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_server_lib.py#L112-L167
train
tensorflow/tensorboard
tensorboard/plugins/debugger/debugger_server_lib.py
DebuggerDataStreamHandler._parse_session_run_index
def _parse_session_run_index(self, event): """Parses the session_run_index value from the event proto. Args: event: The event with metadata that contains the session_run_index. Returns: The int session_run_index value. Or constants.SENTINEL_FOR_UNDETERMINED_STEP if it could not be determ...
python
def _parse_session_run_index(self, event): """Parses the session_run_index value from the event proto. Args: event: The event with metadata that contains the session_run_index. Returns: The int session_run_index value. Or constants.SENTINEL_FOR_UNDETERMINED_STEP if it could not be determ...
[ "def", "_parse_session_run_index", "(", "self", ",", "event", ")", ":", "metadata_string", "=", "event", ".", "log_message", ".", "message", "try", ":", "metadata", "=", "json", ".", "loads", "(", "metadata_string", ")", "except", "ValueError", "as", "e", ":...
Parses the session_run_index value from the event proto. Args: event: The event with metadata that contains the session_run_index. Returns: The int session_run_index value. Or constants.SENTINEL_FOR_UNDETERMINED_STEP if it could not be determined.
[ "Parses", "the", "session_run_index", "value", "from", "the", "event", "proto", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/debugger/debugger_server_lib.py#L169-L194
train
tensorflow/tensorboard
tensorboard/plugins/distribution/compressor.py
compress_histogram_proto
def compress_histogram_proto(histo, bps=NORMAL_HISTOGRAM_BPS): """Creates fixed size histogram by adding compression to accumulated state. This routine transforms a histogram at a particular step by interpolating its variable number of buckets to represent their cumulative weight at a constant number of compre...
python
def compress_histogram_proto(histo, bps=NORMAL_HISTOGRAM_BPS): """Creates fixed size histogram by adding compression to accumulated state. This routine transforms a histogram at a particular step by interpolating its variable number of buckets to represent their cumulative weight at a constant number of compre...
[ "def", "compress_histogram_proto", "(", "histo", ",", "bps", "=", "NORMAL_HISTOGRAM_BPS", ")", ":", "# See also: Histogram::Percentile() in core/lib/histogram/histogram.cc", "if", "not", "histo", ".", "num", ":", "return", "[", "CompressedHistogramValue", "(", "b", ",", ...
Creates fixed size histogram by adding compression to accumulated state. This routine transforms a histogram at a particular step by interpolating its variable number of buckets to represent their cumulative weight at a constant number of compression points. This significantly reduces the size of the histogram...
[ "Creates", "fixed", "size", "histogram", "by", "adding", "compression", "to", "accumulated", "state", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/distribution/compressor.py#L36-L83
train
tensorflow/tensorboard
tensorboard/plugins/distribution/compressor.py
compress_histogram
def compress_histogram(buckets, bps=NORMAL_HISTOGRAM_BPS): """Creates fixed size histogram by adding compression to accumulated state. This routine transforms a histogram at a particular step by linearly interpolating its variable number of buckets to represent their cumulative weight at a constant number of c...
python
def compress_histogram(buckets, bps=NORMAL_HISTOGRAM_BPS): """Creates fixed size histogram by adding compression to accumulated state. This routine transforms a histogram at a particular step by linearly interpolating its variable number of buckets to represent their cumulative weight at a constant number of c...
[ "def", "compress_histogram", "(", "buckets", ",", "bps", "=", "NORMAL_HISTOGRAM_BPS", ")", ":", "# See also: Histogram::Percentile() in core/lib/histogram/histogram.cc", "buckets", "=", "np", ".", "array", "(", "buckets", ")", "if", "not", "buckets", ".", "size", ":",...
Creates fixed size histogram by adding compression to accumulated state. This routine transforms a histogram at a particular step by linearly interpolating its variable number of buckets to represent their cumulative weight at a constant number of compression points. This significantly reduces the size of the ...
[ "Creates", "fixed", "size", "histogram", "by", "adding", "compression", "to", "accumulated", "state", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/distribution/compressor.py#L86-L138
train
tensorflow/tensorboard
tensorboard/plugins/distribution/compressor.py
_lerp
def _lerp(x, x0, x1, y0, y1): """Affinely map from [x0, x1] onto [y0, y1].""" return y0 + (x - x0) * float(y1 - y0) / (x1 - x0)
python
def _lerp(x, x0, x1, y0, y1): """Affinely map from [x0, x1] onto [y0, y1].""" return y0 + (x - x0) * float(y1 - y0) / (x1 - x0)
[ "def", "_lerp", "(", "x", ",", "x0", ",", "x1", ",", "y0", ",", "y1", ")", ":", "return", "y0", "+", "(", "x", "-", "x0", ")", "*", "float", "(", "y1", "-", "y0", ")", "/", "(", "x1", "-", "x0", ")" ]
Affinely map from [x0, x1] onto [y0, y1].
[ "Affinely", "map", "from", "[", "x0", "x1", "]", "onto", "[", "y0", "y1", "]", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/distribution/compressor.py#L141-L143
train
tensorflow/tensorboard
tensorboard/plugins/image/images_plugin.py
ImagesPlugin.is_active
def is_active(self): """The images plugin is active iff any run has at least one relevant tag.""" if self._db_connection_provider: # The plugin is active if one relevant tag can be found in the database. db = self._db_connection_provider() cursor = db.execute( ''' SELECT 1 ...
python
def is_active(self): """The images plugin is active iff any run has at least one relevant tag.""" if self._db_connection_provider: # The plugin is active if one relevant tag can be found in the database. db = self._db_connection_provider() cursor = db.execute( ''' SELECT 1 ...
[ "def", "is_active", "(", "self", ")", ":", "if", "self", ".", "_db_connection_provider", ":", "# The plugin is active if one relevant tag can be found in the database.", "db", "=", "self", ".", "_db_connection_provider", "(", ")", "cursor", "=", "db", ".", "execute", ...
The images plugin is active iff any run has at least one relevant tag.
[ "The", "images", "plugin", "is", "active", "iff", "any", "run", "has", "at", "least", "one", "relevant", "tag", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L77-L93
train
tensorflow/tensorboard
tensorboard/plugins/image/images_plugin.py
ImagesPlugin._serve_image_metadata
def _serve_image_metadata(self, request): """Given a tag and list of runs, serve a list of metadata for images. Note that the images themselves are not sent; instead, we respond with URLs to the images. The frontend should treat these URLs as opaque and should not try to parse information about them or...
python
def _serve_image_metadata(self, request): """Given a tag and list of runs, serve a list of metadata for images. Note that the images themselves are not sent; instead, we respond with URLs to the images. The frontend should treat these URLs as opaque and should not try to parse information about them or...
[ "def", "_serve_image_metadata", "(", "self", ",", "request", ")", ":", "tag", "=", "request", ".", "args", ".", "get", "(", "'tag'", ")", "run", "=", "request", ".", "args", ".", "get", "(", "'run'", ")", "sample", "=", "int", "(", "request", ".", ...
Given a tag and list of runs, serve a list of metadata for images. Note that the images themselves are not sent; instead, we respond with URLs to the images. The frontend should treat these URLs as opaque and should not try to parse information about them or generate them itself, as the format may chan...
[ "Given", "a", "tag", "and", "list", "of", "runs", "serve", "a", "list", "of", "metadata", "for", "images", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L147-L165
train
tensorflow/tensorboard
tensorboard/plugins/image/images_plugin.py
ImagesPlugin._image_response_for_run
def _image_response_for_run(self, run, tag, sample): """Builds a JSON-serializable object with information about images. Args: run: The name of the run. tag: The name of the tag the images all belong to. sample: The zero-indexed sample of the image for which to retrieve information. F...
python
def _image_response_for_run(self, run, tag, sample): """Builds a JSON-serializable object with information about images. Args: run: The name of the run. tag: The name of the tag the images all belong to. sample: The zero-indexed sample of the image for which to retrieve information. F...
[ "def", "_image_response_for_run", "(", "self", ",", "run", ",", "tag", ",", "sample", ")", ":", "if", "self", ".", "_db_connection_provider", ":", "db", "=", "self", ".", "_db_connection_provider", "(", ")", "cursor", "=", "db", ".", "execute", "(", "'''\n...
Builds a JSON-serializable object with information about images. Args: run: The name of the run. tag: The name of the tag the images all belong to. sample: The zero-indexed sample of the image for which to retrieve information. For instance, setting `sample` to `2` will fetch info...
[ "Builds", "a", "JSON", "-", "serializable", "object", "with", "information", "about", "images", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L167-L233
train
tensorflow/tensorboard
tensorboard/plugins/image/images_plugin.py
ImagesPlugin._get_individual_image
def _get_individual_image(self, run, tag, index, sample): """ Returns the actual image bytes for a given image. Args: run: The name of the run the image belongs to. tag: The name of the tag the images belongs to. index: The index of the image in the current reservoir. sample: The ze...
python
def _get_individual_image(self, run, tag, index, sample): """ Returns the actual image bytes for a given image. Args: run: The name of the run the image belongs to. tag: The name of the tag the images belongs to. index: The index of the image in the current reservoir. sample: The ze...
[ "def", "_get_individual_image", "(", "self", ",", "run", ",", "tag", ",", "index", ",", "sample", ")", ":", "if", "self", ".", "_db_connection_provider", ":", "db", "=", "self", ".", "_db_connection_provider", "(", ")", "cursor", "=", "db", ".", "execute",...
Returns the actual image bytes for a given image. Args: run: The name of the run the image belongs to. tag: The name of the tag the images belongs to. index: The index of the image in the current reservoir. sample: The zero-indexed sample of the image to retrieve (for example, setti...
[ "Returns", "the", "actual", "image", "bytes", "for", "a", "given", "image", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L266-L318
train
tensorflow/tensorboard
tensorboard/plugins/image/images_plugin.py
ImagesPlugin._serve_individual_image
def _serve_individual_image(self, request): """Serves an individual image.""" run = request.args.get('run') tag = request.args.get('tag') index = int(request.args.get('index')) sample = int(request.args.get('sample', 0)) data = self._get_individual_image(run, tag, index, sample) image_type =...
python
def _serve_individual_image(self, request): """Serves an individual image.""" run = request.args.get('run') tag = request.args.get('tag') index = int(request.args.get('index')) sample = int(request.args.get('sample', 0)) data = self._get_individual_image(run, tag, index, sample) image_type =...
[ "def", "_serve_individual_image", "(", "self", ",", "request", ")", ":", "run", "=", "request", ".", "args", ".", "get", "(", "'run'", ")", "tag", "=", "request", ".", "args", ".", "get", "(", "'tag'", ")", "index", "=", "int", "(", "request", ".", ...
Serves an individual image.
[ "Serves", "an", "individual", "image", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/images_plugin.py#L321-L330
train
tensorflow/tensorboard
tensorboard/plugins/pr_curve/pr_curve_demo.py
start_runs
def start_runs( logdir, steps, run_name, thresholds, mask_every_other_prediction=False): """Generate a PR curve with precision and recall evenly weighted. Arguments: logdir: The directory into which to store all the runs' data. steps: The number of steps to run for. run_name: The na...
python
def start_runs( logdir, steps, run_name, thresholds, mask_every_other_prediction=False): """Generate a PR curve with precision and recall evenly weighted. Arguments: logdir: The directory into which to store all the runs' data. steps: The number of steps to run for. run_name: The na...
[ "def", "start_runs", "(", "logdir", ",", "steps", ",", "run_name", ",", "thresholds", ",", "mask_every_other_prediction", "=", "False", ")", ":", "tf", ".", "compat", ".", "v1", ".", "reset_default_graph", "(", ")", "tf", ".", "compat", ".", "v1", ".", "...
Generate a PR curve with precision and recall evenly weighted. Arguments: logdir: The directory into which to store all the runs' data. steps: The number of steps to run for. run_name: The name of the run. thresholds: The number of thresholds to use for PR curves. mask_every_other_prediction: Whe...
[ "Generate", "a", "PR", "curve", "with", "precision", "and", "recall", "evenly", "weighted", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/pr_curve/pr_curve_demo.py#L51-L195
train
tensorflow/tensorboard
tensorboard/plugins/pr_curve/pr_curve_demo.py
run_all
def run_all(logdir, steps, thresholds, verbose=False): """Generate PR curve summaries. Arguments: logdir: The directory into which to store all the runs' data. steps: The number of steps to run for. verbose: Whether to print the names of runs into stdout during execution. thresholds: The number of ...
python
def run_all(logdir, steps, thresholds, verbose=False): """Generate PR curve summaries. Arguments: logdir: The directory into which to store all the runs' data. steps: The number of steps to run for. verbose: Whether to print the names of runs into stdout during execution. thresholds: The number of ...
[ "def", "run_all", "(", "logdir", ",", "steps", ",", "thresholds", ",", "verbose", "=", "False", ")", ":", "# First, we generate data for a PR curve that assigns even weights for", "# predictions of all classes.", "run_name", "=", "'colors'", "if", "verbose", ":", "print",...
Generate PR curve summaries. Arguments: logdir: The directory into which to store all the runs' data. steps: The number of steps to run for. verbose: Whether to print the names of runs into stdout during execution. thresholds: The number of thresholds to use for PR curves.
[ "Generate", "PR", "curve", "summaries", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/pr_curve/pr_curve_demo.py#L197-L227
train
tensorflow/tensorboard
tensorboard/plugins/image/summary_v2.py
image
def image(name, data, step=None, max_outputs=3, description=None): """Write an image summary. Arguments: name: A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes. data: A `Tensor` representing pixe...
python
def image(name, data, step=None, max_outputs=3, description=None): """Write an image summary. Arguments: name: A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes. data: A `Tensor` representing pixe...
[ "def", "image", "(", "name", ",", "data", ",", "step", "=", "None", ",", "max_outputs", "=", "3", ",", "description", "=", "None", ")", ":", "summary_metadata", "=", "metadata", ".", "create_summary_metadata", "(", "display_name", "=", "None", ",", "descri...
Write an image summary. Arguments: name: A name for this summary. The summary tag used for TensorBoard will be this name prefixed by any active name scopes. data: A `Tensor` representing pixel data with shape `[k, h, w, c]`, where `k` is the number of images, `h` and `w` are the height and ...
[ "Write", "an", "image", "summary", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/image/summary_v2.py#L29-L88
train
tensorflow/tensorboard
tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py
WitConfigBuilder.set_examples
def set_examples(self, examples): """Sets the examples to be displayed in WIT. Args: examples: List of example protos. Returns: self, in order to enabled method chaining. """ self.store('examples', examples) if len(examples) > 0: self.store('are_sequence_examples', ...
python
def set_examples(self, examples): """Sets the examples to be displayed in WIT. Args: examples: List of example protos. Returns: self, in order to enabled method chaining. """ self.store('examples', examples) if len(examples) > 0: self.store('are_sequence_examples', ...
[ "def", "set_examples", "(", "self", ",", "examples", ")", ":", "self", ".", "store", "(", "'examples'", ",", "examples", ")", "if", "len", "(", "examples", ")", ">", "0", ":", "self", ".", "store", "(", "'are_sequence_examples'", ",", "isinstance", "(", ...
Sets the examples to be displayed in WIT. Args: examples: List of example protos. Returns: self, in order to enabled method chaining.
[ "Sets", "the", "examples", "to", "be", "displayed", "in", "WIT", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L62-L75
train
tensorflow/tensorboard
tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py
WitConfigBuilder.set_estimator_and_feature_spec
def set_estimator_and_feature_spec(self, estimator, feature_spec): """Sets the model for inference as a TF Estimator. Instead of using TF Serving to host a model for WIT to query, WIT can directly use a TF Estimator object as the model to query. In order to accomplish this, a feature_spec must also be ...
python
def set_estimator_and_feature_spec(self, estimator, feature_spec): """Sets the model for inference as a TF Estimator. Instead of using TF Serving to host a model for WIT to query, WIT can directly use a TF Estimator object as the model to query. In order to accomplish this, a feature_spec must also be ...
[ "def", "set_estimator_and_feature_spec", "(", "self", ",", "estimator", ",", "feature_spec", ")", ":", "# If custom function is set, remove it before setting estimator", "self", ".", "delete", "(", "'custom_predict_fn'", ")", "self", ".", "store", "(", "'estimator_and_spec'...
Sets the model for inference as a TF Estimator. Instead of using TF Serving to host a model for WIT to query, WIT can directly use a TF Estimator object as the model to query. In order to accomplish this, a feature_spec must also be provided to parse the example protos for input into the estimator. ...
[ "Sets", "the", "model", "for", "inference", "as", "a", "TF", "Estimator", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L327-L352
train
tensorflow/tensorboard
tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py
WitConfigBuilder.set_compare_estimator_and_feature_spec
def set_compare_estimator_and_feature_spec(self, estimator, feature_spec): """Sets a second model for inference as a TF Estimator. If you wish to compare the results of two models in WIT, use this method to setup the details of the second model. Instead of using TF Serving to host a model for WIT to q...
python
def set_compare_estimator_and_feature_spec(self, estimator, feature_spec): """Sets a second model for inference as a TF Estimator. If you wish to compare the results of two models in WIT, use this method to setup the details of the second model. Instead of using TF Serving to host a model for WIT to q...
[ "def", "set_compare_estimator_and_feature_spec", "(", "self", ",", "estimator", ",", "feature_spec", ")", ":", "# If custom function is set, remove it before setting estimator", "self", ".", "delete", "(", "'compare_custom_predict_fn'", ")", "self", ".", "store", "(", "'com...
Sets a second model for inference as a TF Estimator. If you wish to compare the results of two models in WIT, use this method to setup the details of the second model. Instead of using TF Serving to host a model for WIT to query, WIT can directly use a TF Estimator object as the model to query. In ord...
[ "Sets", "a", "second", "model", "for", "inference", "as", "a", "TF", "Estimator", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L354-L382
train
tensorflow/tensorboard
tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py
WitConfigBuilder.set_custom_predict_fn
def set_custom_predict_fn(self, predict_fn): """Sets a custom function for inference. Instead of using TF Serving to host a model for WIT to query, WIT can directly use a custom function as the model to query. In this case, the provided function should accept example protos and return: - For clas...
python
def set_custom_predict_fn(self, predict_fn): """Sets a custom function for inference. Instead of using TF Serving to host a model for WIT to query, WIT can directly use a custom function as the model to query. In this case, the provided function should accept example protos and return: - For clas...
[ "def", "set_custom_predict_fn", "(", "self", ",", "predict_fn", ")", ":", "# If estimator is set, remove it before setting predict_fn", "self", ".", "delete", "(", "'estimator_and_spec'", ")", "self", ".", "store", "(", "'custom_predict_fn'", ",", "predict_fn", ")", "se...
Sets a custom function for inference. Instead of using TF Serving to host a model for WIT to query, WIT can directly use a custom function as the model to query. In this case, the provided function should accept example protos and return: - For classification: A 2D list of numbers. The first dimensio...
[ "Sets", "a", "custom", "function", "for", "inference", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L384-L411
train
tensorflow/tensorboard
tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py
WitConfigBuilder.set_compare_custom_predict_fn
def set_compare_custom_predict_fn(self, predict_fn): """Sets a second custom function for inference. If you wish to compare the results of two models in WIT, use this method to setup the details of the second model. Instead of using TF Serving to host a model for WIT to query, WIT can directly use...
python
def set_compare_custom_predict_fn(self, predict_fn): """Sets a second custom function for inference. If you wish to compare the results of two models in WIT, use this method to setup the details of the second model. Instead of using TF Serving to host a model for WIT to query, WIT can directly use...
[ "def", "set_compare_custom_predict_fn", "(", "self", ",", "predict_fn", ")", ":", "# If estimator is set, remove it before setting predict_fn", "self", ".", "delete", "(", "'compare_estimator_and_spec'", ")", "self", ".", "store", "(", "'compare_custom_predict_fn'", ",", "p...
Sets a second custom function for inference. If you wish to compare the results of two models in WIT, use this method to setup the details of the second model. Instead of using TF Serving to host a model for WIT to query, WIT can directly use a custom function as the model to query. In this case, the ...
[ "Sets", "a", "second", "custom", "function", "for", "inference", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/interactive_inference/witwidget/notebook/visualization.py#L413-L443
train
tensorflow/tensorboard
tensorboard/plugins/beholder/visualizer.py
Visualizer._reshape_conv_array
def _reshape_conv_array(self, array, section_height, image_width): '''Reshape a rank 4 array to be rank 2, where each column of block_width is a filter, and each row of block height is an input channel. For example: [[[[ 11, 21, 31, 41], [ 51, 61, 71, 81], [ 91, 101, 111, 121]], [...
python
def _reshape_conv_array(self, array, section_height, image_width): '''Reshape a rank 4 array to be rank 2, where each column of block_width is a filter, and each row of block height is an input channel. For example: [[[[ 11, 21, 31, 41], [ 51, 61, 71, 81], [ 91, 101, 111, 121]], [...
[ "def", "_reshape_conv_array", "(", "self", ",", "array", ",", "section_height", ",", "image_width", ")", ":", "# E.g. [100, 24, 24, 10]: this shouldn't be reshaped like normal.", "if", "array", ".", "shape", "[", "1", "]", "==", "array", ".", "shape", "[", "2", "]...
Reshape a rank 4 array to be rank 2, where each column of block_width is a filter, and each row of block height is an input channel. For example: [[[[ 11, 21, 31, 41], [ 51, 61, 71, 81], [ 91, 101, 111, 121]], [[ 12, 22, 32, 42], [ 52, 62, 72, 82], [ 92, 102, 112, ...
[ "Reshape", "a", "rank", "4", "array", "to", "be", "rank", "2", "where", "each", "column", "of", "block_width", "is", "a", "filter", "and", "each", "row", "of", "block", "height", "is", "an", "input", "channel", ".", "For", "example", ":" ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L42-L106
train
tensorflow/tensorboard
tensorboard/plugins/beholder/visualizer.py
Visualizer._reshape_irregular_array
def _reshape_irregular_array(self, array, section_height, image_width): '''Reshapes arrays of ranks not in {1, 2, 4} ''' section_area = section_height * image_width flattened_array = np.ravel(array) if not self.config['show_all']: flattened_array = flattened_array[:int(section_area/MIN_SQUARE...
python
def _reshape_irregular_array(self, array, section_height, image_width): '''Reshapes arrays of ranks not in {1, 2, 4} ''' section_area = section_height * image_width flattened_array = np.ravel(array) if not self.config['show_all']: flattened_array = flattened_array[:int(section_area/MIN_SQUARE...
[ "def", "_reshape_irregular_array", "(", "self", ",", "array", ",", "section_height", ",", "image_width", ")", ":", "section_area", "=", "section_height", "*", "image_width", "flattened_array", "=", "np", ".", "ravel", "(", "array", ")", "if", "not", "self", "....
Reshapes arrays of ranks not in {1, 2, 4}
[ "Reshapes", "arrays", "of", "ranks", "not", "in", "{", "1", "2", "4", "}" ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L109-L133
train
tensorflow/tensorboard
tensorboard/plugins/beholder/visualizer.py
Visualizer._arrays_to_sections
def _arrays_to_sections(self, arrays): ''' input: unprocessed numpy arrays. returns: columns of the size that they will appear in the image, not scaled for display. That needs to wait until after variance is computed. ''' sections = [] sections_to_resize_later = {} show_all = se...
python
def _arrays_to_sections(self, arrays): ''' input: unprocessed numpy arrays. returns: columns of the size that they will appear in the image, not scaled for display. That needs to wait until after variance is computed. ''' sections = [] sections_to_resize_later = {} show_all = se...
[ "def", "_arrays_to_sections", "(", "self", ",", "arrays", ")", ":", "sections", "=", "[", "]", "sections_to_resize_later", "=", "{", "}", "show_all", "=", "self", ".", "config", "[", "'show_all'", "]", "image_width", "=", "self", ".", "_determine_image_width",...
input: unprocessed numpy arrays. returns: columns of the size that they will appear in the image, not scaled for display. That needs to wait until after variance is computed.
[ "input", ":", "unprocessed", "numpy", "arrays", ".", "returns", ":", "columns", "of", "the", "size", "that", "they", "will", "appear", "in", "the", "image", "not", "scaled", "for", "display", ".", "That", "needs", "to", "wait", "until", "after", "variance"...
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L175-L222
train
tensorflow/tensorboard
tensorboard/plugins/beholder/visualizer.py
Visualizer._sections_to_variance_sections
def _sections_to_variance_sections(self, sections_over_time): '''Computes the variance of corresponding sections over time. Returns: a list of np arrays. ''' variance_sections = [] for i in range(len(sections_over_time[0])): time_sections = [sections[i] for sections in sections_over_ti...
python
def _sections_to_variance_sections(self, sections_over_time): '''Computes the variance of corresponding sections over time. Returns: a list of np arrays. ''' variance_sections = [] for i in range(len(sections_over_time[0])): time_sections = [sections[i] for sections in sections_over_ti...
[ "def", "_sections_to_variance_sections", "(", "self", ",", "sections_over_time", ")", ":", "variance_sections", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "sections_over_time", "[", "0", "]", ")", ")", ":", "time_sections", "=", "[", "section...
Computes the variance of corresponding sections over time. Returns: a list of np arrays.
[ "Computes", "the", "variance", "of", "corresponding", "sections", "over", "time", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L225-L238
train
tensorflow/tensorboard
tensorboard/plugins/beholder/visualizer.py
Visualizer._maybe_clear_deque
def _maybe_clear_deque(self): '''Clears the deque if certain parts of the config have changed.''' for config_item in ['values', 'mode', 'show_all']: if self.config[config_item] != self.old_config[config_item]: self.sections_over_time.clear() break self.old_config = self.config w...
python
def _maybe_clear_deque(self): '''Clears the deque if certain parts of the config have changed.''' for config_item in ['values', 'mode', 'show_all']: if self.config[config_item] != self.old_config[config_item]: self.sections_over_time.clear() break self.old_config = self.config w...
[ "def", "_maybe_clear_deque", "(", "self", ")", ":", "for", "config_item", "in", "[", "'values'", ",", "'mode'", ",", "'show_all'", "]", ":", "if", "self", ".", "config", "[", "config_item", "]", "!=", "self", ".", "old_config", "[", "config_item", "]", "...
Clears the deque if certain parts of the config have changed.
[ "Clears", "the", "deque", "if", "certain", "parts", "of", "the", "config", "have", "changed", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/beholder/visualizer.py#L256-L268
train
tensorflow/tensorboard
tensorboard/lazy.py
lazy_load
def lazy_load(name): """Decorator to define a function that lazily loads the module 'name'. This can be used to defer importing troublesome dependencies - e.g. ones that are large and infrequently used, or that cause a dependency cycle - until they are actually used. Args: name: the fully-qualified name...
python
def lazy_load(name): """Decorator to define a function that lazily loads the module 'name'. This can be used to defer importing troublesome dependencies - e.g. ones that are large and infrequently used, or that cause a dependency cycle - until they are actually used. Args: name: the fully-qualified name...
[ "def", "lazy_load", "(", "name", ")", ":", "def", "wrapper", "(", "load_fn", ")", ":", "# Wrap load_fn to call it exactly once and update __dict__ afterwards to", "# make future lookups efficient (only failed lookups call __getattr__).", "@", "_memoize", "def", "load_once", "(", ...
Decorator to define a function that lazily loads the module 'name'. This can be used to defer importing troublesome dependencies - e.g. ones that are large and infrequently used, or that cause a dependency cycle - until they are actually used. Args: name: the fully-qualified name of the module; typically ...
[ "Decorator", "to", "define", "a", "function", "that", "lazily", "loads", "the", "module", "name", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/lazy.py#L27-L76
train
tensorflow/tensorboard
tensorboard/lazy.py
_memoize
def _memoize(f): """Memoizing decorator for f, which must have exactly 1 hashable argument.""" nothing = object() # Unique "no value" sentinel object. cache = {} # Use a reentrant lock so that if f references the resulting wrapper we die # with recursion depth exceeded instead of deadlocking. lock = thread...
python
def _memoize(f): """Memoizing decorator for f, which must have exactly 1 hashable argument.""" nothing = object() # Unique "no value" sentinel object. cache = {} # Use a reentrant lock so that if f references the resulting wrapper we die # with recursion depth exceeded instead of deadlocking. lock = thread...
[ "def", "_memoize", "(", "f", ")", ":", "nothing", "=", "object", "(", ")", "# Unique \"no value\" sentinel object.", "cache", "=", "{", "}", "# Use a reentrant lock so that if f references the resulting wrapper we die", "# with recursion depth exceeded instead of deadlocking.", "...
Memoizing decorator for f, which must have exactly 1 hashable argument.
[ "Memoizing", "decorator", "for", "f", "which", "must", "have", "exactly", "1", "hashable", "argument", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/lazy.py#L79-L93
train
tensorflow/tensorboard
tensorboard/compat/__init__.py
tf
def tf(): """Provide the root module of a TF-like API for use within TensorBoard. By default this is equivalent to `import tensorflow as tf`, but it can be used in combination with //tensorboard/compat:tensorflow (to fall back to a stub TF API implementation if the real one is not available) or with //tensor...
python
def tf(): """Provide the root module of a TF-like API for use within TensorBoard. By default this is equivalent to `import tensorflow as tf`, but it can be used in combination with //tensorboard/compat:tensorflow (to fall back to a stub TF API implementation if the real one is not available) or with //tensor...
[ "def", "tf", "(", ")", ":", "try", ":", "from", "tensorboard", ".", "compat", "import", "notf", "# pylint: disable=g-import-not-at-top", "except", "ImportError", ":", "try", ":", "import", "tensorflow", "# pylint: disable=g-import-not-at-top", "return", "tensorflow", ...
Provide the root module of a TF-like API for use within TensorBoard. By default this is equivalent to `import tensorflow as tf`, but it can be used in combination with //tensorboard/compat:tensorflow (to fall back to a stub TF API implementation if the real one is not available) or with //tensorboard/compat:no...
[ "Provide", "the", "root", "module", "of", "a", "TF", "-", "like", "API", "for", "use", "within", "TensorBoard", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/__init__.py#L32-L55
train
tensorflow/tensorboard
tensorboard/compat/__init__.py
tf2
def tf2(): """Provide the root module of a TF-2.0 API for use within TensorBoard. Returns: The root module of a TF-2.0 API, if available. Raises: ImportError: if a TF-2.0 API is not available. """ # Import the `tf` compat API from this file and check if it's already TF 2.0. if tf.__version__.start...
python
def tf2(): """Provide the root module of a TF-2.0 API for use within TensorBoard. Returns: The root module of a TF-2.0 API, if available. Raises: ImportError: if a TF-2.0 API is not available. """ # Import the `tf` compat API from this file and check if it's already TF 2.0. if tf.__version__.start...
[ "def", "tf2", "(", ")", ":", "# Import the `tf` compat API from this file and check if it's already TF 2.0.", "if", "tf", ".", "__version__", ".", "startswith", "(", "'2.'", ")", ":", "return", "tf", "elif", "hasattr", "(", "tf", ",", "'compat'", ")", "and", "hasa...
Provide the root module of a TF-2.0 API for use within TensorBoard. Returns: The root module of a TF-2.0 API, if available. Raises: ImportError: if a TF-2.0 API is not available.
[ "Provide", "the", "root", "module", "of", "a", "TF", "-", "2", ".", "0", "API", "for", "use", "within", "TensorBoard", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/__init__.py#L59-L74
train
tensorflow/tensorboard
tensorboard/compat/__init__.py
_pywrap_tensorflow
def _pywrap_tensorflow(): """Provide pywrap_tensorflow access in TensorBoard. pywrap_tensorflow cannot be accessed from tf.python.pywrap_tensorflow and needs to be imported using `from tensorflow.python import pywrap_tensorflow`. Therefore, we provide a separate accessor function for it here. NOTE: pywrap...
python
def _pywrap_tensorflow(): """Provide pywrap_tensorflow access in TensorBoard. pywrap_tensorflow cannot be accessed from tf.python.pywrap_tensorflow and needs to be imported using `from tensorflow.python import pywrap_tensorflow`. Therefore, we provide a separate accessor function for it here. NOTE: pywrap...
[ "def", "_pywrap_tensorflow", "(", ")", ":", "try", ":", "from", "tensorboard", ".", "compat", "import", "notf", "# pylint: disable=g-import-not-at-top", "except", "ImportError", ":", "try", ":", "from", "tensorflow", ".", "python", "import", "pywrap_tensorflow", "# ...
Provide pywrap_tensorflow access in TensorBoard. pywrap_tensorflow cannot be accessed from tf.python.pywrap_tensorflow and needs to be imported using `from tensorflow.python import pywrap_tensorflow`. Therefore, we provide a separate accessor function for it here. NOTE: pywrap_tensorflow is not part of Tens...
[ "Provide", "pywrap_tensorflow", "access", "in", "TensorBoard", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/__init__.py#L79-L105
train
tensorflow/tensorboard
tensorboard/plugins/hparams/hparams_minimal_demo.py
create_experiment_summary
def create_experiment_summary(): """Returns a summary proto buffer holding this experiment.""" # Convert TEMPERATURE_LIST to google.protobuf.ListValue temperature_list = struct_pb2.ListValue() temperature_list.extend(TEMPERATURE_LIST) materials = struct_pb2.ListValue() materials.extend(HEAT_COEFFICIENTS.ke...
python
def create_experiment_summary(): """Returns a summary proto buffer holding this experiment.""" # Convert TEMPERATURE_LIST to google.protobuf.ListValue temperature_list = struct_pb2.ListValue() temperature_list.extend(TEMPERATURE_LIST) materials = struct_pb2.ListValue() materials.extend(HEAT_COEFFICIENTS.ke...
[ "def", "create_experiment_summary", "(", ")", ":", "# Convert TEMPERATURE_LIST to google.protobuf.ListValue", "temperature_list", "=", "struct_pb2", ".", "ListValue", "(", ")", "temperature_list", ".", "extend", "(", "TEMPERATURE_LIST", ")", "materials", "=", "struct_pb2", ...
Returns a summary proto buffer holding this experiment.
[ "Returns", "a", "summary", "proto", "buffer", "holding", "this", "experiment", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_minimal_demo.py#L95-L132
train
tensorflow/tensorboard
tensorboard/plugins/hparams/hparams_minimal_demo.py
run
def run(logdir, session_id, hparams, group_name): """Runs a temperature simulation. This will simulate an object at temperature `initial_temperature` sitting at rest in a large room at temperature `ambient_temperature`. The object has some intrinsic `heat_coefficient`, which indicates how much thermal conduc...
python
def run(logdir, session_id, hparams, group_name): """Runs a temperature simulation. This will simulate an object at temperature `initial_temperature` sitting at rest in a large room at temperature `ambient_temperature`. The object has some intrinsic `heat_coefficient`, which indicates how much thermal conduc...
[ "def", "run", "(", "logdir", ",", "session_id", ",", "hparams", ",", "group_name", ")", ":", "tf", ".", "reset_default_graph", "(", ")", "tf", ".", "set_random_seed", "(", "0", ")", "initial_temperature", "=", "hparams", "[", "'initial_temperature'", "]", "a...
Runs a temperature simulation. This will simulate an object at temperature `initial_temperature` sitting at rest in a large room at temperature `ambient_temperature`. The object has some intrinsic `heat_coefficient`, which indicates how much thermal conductivity it has: for instance, metals have high thermal...
[ "Runs", "a", "temperature", "simulation", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_minimal_demo.py#L135-L221
train
tensorflow/tensorboard
tensorboard/plugins/hparams/hparams_minimal_demo.py
run_all
def run_all(logdir, verbose=False): """Run simulations on a reasonable set of parameters. Arguments: logdir: the directory into which to store all the runs' data verbose: if true, print out each run's name as it begins. """ writer = tf.summary.FileWriter(logdir) writer.add_summary(create_experiment_s...
python
def run_all(logdir, verbose=False): """Run simulations on a reasonable set of parameters. Arguments: logdir: the directory into which to store all the runs' data verbose: if true, print out each run's name as it begins. """ writer = tf.summary.FileWriter(logdir) writer.add_summary(create_experiment_s...
[ "def", "run_all", "(", "logdir", ",", "verbose", "=", "False", ")", ":", "writer", "=", "tf", ".", "summary", ".", "FileWriter", "(", "logdir", ")", "writer", ".", "add_summary", "(", "create_experiment_summary", "(", ")", ")", "writer", ".", "close", "(...
Run simulations on a reasonable set of parameters. Arguments: logdir: the directory into which to store all the runs' data verbose: if true, print out each run's name as it begins.
[ "Run", "simulations", "on", "a", "reasonable", "set", "of", "parameters", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/plugins/hparams/hparams_minimal_demo.py#L224-L253
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
get_filesystem
def get_filesystem(filename): """Return the registered filesystem for the given file.""" filename = compat.as_str_any(filename) prefix = "" index = filename.find("://") if index >= 0: prefix = filename[:index] fs = _REGISTERED_FILESYSTEMS.get(prefix, None) if fs is None: rais...
python
def get_filesystem(filename): """Return the registered filesystem for the given file.""" filename = compat.as_str_any(filename) prefix = "" index = filename.find("://") if index >= 0: prefix = filename[:index] fs = _REGISTERED_FILESYSTEMS.get(prefix, None) if fs is None: rais...
[ "def", "get_filesystem", "(", "filename", ")", ":", "filename", "=", "compat", ".", "as_str_any", "(", "filename", ")", "prefix", "=", "\"\"", "index", "=", "filename", ".", "find", "(", "\"://\"", ")", "if", "index", ">=", "0", ":", "prefix", "=", "fi...
Return the registered filesystem for the given file.
[ "Return", "the", "registered", "filesystem", "for", "the", "given", "file", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L61-L71
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
walk
def walk(top, topdown=True, onerror=None): """Recursive directory tree generator for directories. Args: top: string, a Directory name topdown: bool, Traverse pre order if True, post order if False. onerror: optional handler for errors. Should be a function, it will be called with the ...
python
def walk(top, topdown=True, onerror=None): """Recursive directory tree generator for directories. Args: top: string, a Directory name topdown: bool, Traverse pre order if True, post order if False. onerror: optional handler for errors. Should be a function, it will be called with the ...
[ "def", "walk", "(", "top", ",", "topdown", "=", "True", ",", "onerror", "=", "None", ")", ":", "top", "=", "compat", ".", "as_str_any", "(", "top", ")", "fs", "=", "get_filesystem", "(", "top", ")", "try", ":", "listing", "=", "listdir", "(", "top"...
Recursive directory tree generator for directories. Args: top: string, a Directory name topdown: bool, Traverse pre order if True, post order if False. onerror: optional handler for errors. Should be a function, it will be called with the error as argument. Rethrowing the error aborts the...
[ "Recursive", "directory", "tree", "generator", "for", "directories", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L463-L510
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
LocalFileSystem.read
def read(self, filename, binary_mode=False, size=None, offset=None): """Reads contents of a file to a string. Args: filename: string, a path binary_mode: bool, read as binary if True, otherwise text size: int, number of bytes or characters to read, otherwise ...
python
def read(self, filename, binary_mode=False, size=None, offset=None): """Reads contents of a file to a string. Args: filename: string, a path binary_mode: bool, read as binary if True, otherwise text size: int, number of bytes or characters to read, otherwise ...
[ "def", "read", "(", "self", ",", "filename", ",", "binary_mode", "=", "False", ",", "size", "=", "None", ",", "offset", "=", "None", ")", ":", "mode", "=", "\"rb\"", "if", "binary_mode", "else", "\"r\"", "with", "io", ".", "open", "(", "filename", ",...
Reads contents of a file to a string. Args: filename: string, a path binary_mode: bool, read as binary if True, otherwise text size: int, number of bytes or characters to read, otherwise read all the contents of the file from the offset offset: in...
[ "Reads", "contents", "of", "a", "file", "to", "a", "string", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L89-L110
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
LocalFileSystem.glob
def glob(self, filename): """Returns a list of files that match the given pattern(s).""" if isinstance(filename, six.string_types): return [ # Convert the filenames to string from bytes. compat.as_str_any(matching_filename) for matching_filenam...
python
def glob(self, filename): """Returns a list of files that match the given pattern(s).""" if isinstance(filename, six.string_types): return [ # Convert the filenames to string from bytes. compat.as_str_any(matching_filename) for matching_filenam...
[ "def", "glob", "(", "self", ",", "filename", ")", ":", "if", "isinstance", "(", "filename", ",", "six", ".", "string_types", ")", ":", "return", "[", "# Convert the filenames to string from bytes.", "compat", ".", "as_str_any", "(", "matching_filename", ")", "fo...
Returns a list of files that match the given pattern(s).
[ "Returns", "a", "list", "of", "files", "that", "match", "the", "given", "pattern", "(", "s", ")", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L112-L128
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
LocalFileSystem.listdir
def listdir(self, dirname): """Returns a list of entries contained within a directory.""" if not self.isdir(dirname): raise errors.NotFoundError(None, None, "Could not find directory") entries = os.listdir(compat.as_str_any(dirname)) entries = [compat.as_str_any(item) for it...
python
def listdir(self, dirname): """Returns a list of entries contained within a directory.""" if not self.isdir(dirname): raise errors.NotFoundError(None, None, "Could not find directory") entries = os.listdir(compat.as_str_any(dirname)) entries = [compat.as_str_any(item) for it...
[ "def", "listdir", "(", "self", ",", "dirname", ")", ":", "if", "not", "self", ".", "isdir", "(", "dirname", ")", ":", "raise", "errors", ".", "NotFoundError", "(", "None", ",", "None", ",", "\"Could not find directory\"", ")", "entries", "=", "os", ".", ...
Returns a list of entries contained within a directory.
[ "Returns", "a", "list", "of", "entries", "contained", "within", "a", "directory", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L134-L141
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
LocalFileSystem.stat
def stat(self, filename): """Returns file statistics for a given path.""" # NOTE: Size of the file is given by .st_size as returned from # os.stat(), but we convert to .length try: len = os.stat(compat.as_bytes(filename)).st_size except OSError: raise erro...
python
def stat(self, filename): """Returns file statistics for a given path.""" # NOTE: Size of the file is given by .st_size as returned from # os.stat(), but we convert to .length try: len = os.stat(compat.as_bytes(filename)).st_size except OSError: raise erro...
[ "def", "stat", "(", "self", ",", "filename", ")", ":", "# NOTE: Size of the file is given by .st_size as returned from", "# os.stat(), but we convert to .length", "try", ":", "len", "=", "os", ".", "stat", "(", "compat", ".", "as_bytes", "(", "filename", ")", ")", "...
Returns file statistics for a given path.
[ "Returns", "file", "statistics", "for", "a", "given", "path", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L143-L151
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
S3FileSystem.bucket_and_path
def bucket_and_path(self, url): """Split an S3-prefixed URL into bucket and path.""" url = compat.as_str_any(url) if url.startswith("s3://"): url = url[len("s3://"):] idx = url.index("/") bucket = url[:idx] path = url[(idx + 1):] return bucket, path
python
def bucket_and_path(self, url): """Split an S3-prefixed URL into bucket and path.""" url = compat.as_str_any(url) if url.startswith("s3://"): url = url[len("s3://"):] idx = url.index("/") bucket = url[:idx] path = url[(idx + 1):] return bucket, path
[ "def", "bucket_and_path", "(", "self", ",", "url", ")", ":", "url", "=", "compat", ".", "as_str_any", "(", "url", ")", "if", "url", ".", "startswith", "(", "\"s3://\"", ")", ":", "url", "=", "url", "[", "len", "(", "\"s3://\"", ")", ":", "]", "idx"...
Split an S3-prefixed URL into bucket and path.
[ "Split", "an", "S3", "-", "prefixed", "URL", "into", "bucket", "and", "path", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L161-L169
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
S3FileSystem.exists
def exists(self, filename): """Determines whether a path exists or not.""" client = boto3.client("s3") bucket, path = self.bucket_and_path(filename) r = client.list_objects(Bucket=bucket, Prefix=path, Delimiter="/") if r.get("Contents") or r.get("CommonPrefixes"): ret...
python
def exists(self, filename): """Determines whether a path exists or not.""" client = boto3.client("s3") bucket, path = self.bucket_and_path(filename) r = client.list_objects(Bucket=bucket, Prefix=path, Delimiter="/") if r.get("Contents") or r.get("CommonPrefixes"): ret...
[ "def", "exists", "(", "self", ",", "filename", ")", ":", "client", "=", "boto3", ".", "client", "(", "\"s3\"", ")", "bucket", ",", "path", "=", "self", ".", "bucket_and_path", "(", "filename", ")", "r", "=", "client", ".", "list_objects", "(", "Bucket"...
Determines whether a path exists or not.
[ "Determines", "whether", "a", "path", "exists", "or", "not", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L171-L178
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
S3FileSystem.read
def read(self, filename, binary_mode=False, size=None, offset=None): """Reads contents of a file to a string. Args: filename: string, a path binary_mode: bool, read as binary if True, otherwise text size: int, number of bytes or characters to read, otherwise ...
python
def read(self, filename, binary_mode=False, size=None, offset=None): """Reads contents of a file to a string. Args: filename: string, a path binary_mode: bool, read as binary if True, otherwise text size: int, number of bytes or characters to read, otherwise ...
[ "def", "read", "(", "self", ",", "filename", ",", "binary_mode", "=", "False", ",", "size", "=", "None", ",", "offset", "=", "None", ")", ":", "s3", "=", "boto3", ".", "resource", "(", "\"s3\"", ")", "bucket", ",", "path", "=", "self", ".", "bucket...
Reads contents of a file to a string. Args: filename: string, a path binary_mode: bool, read as binary if True, otherwise text size: int, number of bytes or characters to read, otherwise read all the contents of the file from the offset offset: in...
[ "Reads", "contents", "of", "a", "file", "to", "a", "string", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L184-L229
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
S3FileSystem.glob
def glob(self, filename): """Returns a list of files that match the given pattern(s).""" # Only support prefix with * at the end and no ? in the string star_i = filename.find('*') quest_i = filename.find('?') if quest_i >= 0: raise NotImplementedError( ...
python
def glob(self, filename): """Returns a list of files that match the given pattern(s).""" # Only support prefix with * at the end and no ? in the string star_i = filename.find('*') quest_i = filename.find('?') if quest_i >= 0: raise NotImplementedError( ...
[ "def", "glob", "(", "self", ",", "filename", ")", ":", "# Only support prefix with * at the end and no ? in the string", "star_i", "=", "filename", ".", "find", "(", "'*'", ")", "quest_i", "=", "filename", ".", "find", "(", "'?'", ")", "if", "quest_i", ">=", "...
Returns a list of files that match the given pattern(s).
[ "Returns", "a", "list", "of", "files", "that", "match", "the", "given", "pattern", "(", "s", ")", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L231-L256
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
S3FileSystem.isdir
def isdir(self, dirname): """Returns whether the path is a directory or not.""" client = boto3.client("s3") bucket, path = self.bucket_and_path(dirname) if not path.endswith("/"): path += "/" # This will now only retrieve subdir content r = client.list_objects(Bucket...
python
def isdir(self, dirname): """Returns whether the path is a directory or not.""" client = boto3.client("s3") bucket, path = self.bucket_and_path(dirname) if not path.endswith("/"): path += "/" # This will now only retrieve subdir content r = client.list_objects(Bucket...
[ "def", "isdir", "(", "self", ",", "dirname", ")", ":", "client", "=", "boto3", ".", "client", "(", "\"s3\"", ")", "bucket", ",", "path", "=", "self", ".", "bucket_and_path", "(", "dirname", ")", "if", "not", "path", ".", "endswith", "(", "\"/\"", ")"...
Returns whether the path is a directory or not.
[ "Returns", "whether", "the", "path", "is", "a", "directory", "or", "not", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L258-L267
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
S3FileSystem.listdir
def listdir(self, dirname): """Returns a list of entries contained within a directory.""" client = boto3.client("s3") bucket, path = self.bucket_and_path(dirname) p = client.get_paginator("list_objects") if not path.endswith("/"): path += "/" # This will now only ret...
python
def listdir(self, dirname): """Returns a list of entries contained within a directory.""" client = boto3.client("s3") bucket, path = self.bucket_and_path(dirname) p = client.get_paginator("list_objects") if not path.endswith("/"): path += "/" # This will now only ret...
[ "def", "listdir", "(", "self", ",", "dirname", ")", ":", "client", "=", "boto3", ".", "client", "(", "\"s3\"", ")", "bucket", ",", "path", "=", "self", ".", "bucket_and_path", "(", "dirname", ")", "p", "=", "client", ".", "get_paginator", "(", "\"list_...
Returns a list of entries contained within a directory.
[ "Returns", "a", "list", "of", "entries", "contained", "within", "a", "directory", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L269-L283
train
tensorflow/tensorboard
tensorboard/compat/tensorflow_stub/io/gfile.py
S3FileSystem.stat
def stat(self, filename): """Returns file statistics for a given path.""" # NOTE: Size of the file is given by ContentLength from S3, # but we convert to .length client = boto3.client("s3") bucket, path = self.bucket_and_path(filename) try: obj = client.head_o...
python
def stat(self, filename): """Returns file statistics for a given path.""" # NOTE: Size of the file is given by ContentLength from S3, # but we convert to .length client = boto3.client("s3") bucket, path = self.bucket_and_path(filename) try: obj = client.head_o...
[ "def", "stat", "(", "self", ",", "filename", ")", ":", "# NOTE: Size of the file is given by ContentLength from S3,", "# but we convert to .length", "client", "=", "boto3", ".", "client", "(", "\"s3\"", ")", "bucket", ",", "path", "=", "self", ".", "bucket_and_path", ...
Returns file statistics for a given path.
[ "Returns", "file", "statistics", "for", "a", "given", "path", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/compat/tensorflow_stub/io/gfile.py#L285-L298
train
tensorflow/tensorboard
tensorboard/notebook.py
_get_context
def _get_context(): """Determine the most specific context that we're in. Returns: _CONTEXT_COLAB: If in Colab with an IPython notebook context. _CONTEXT_IPYTHON: If not in Colab, but we are in an IPython notebook context (e.g., from running `jupyter notebook` at the command line). _CONTEXT...
python
def _get_context(): """Determine the most specific context that we're in. Returns: _CONTEXT_COLAB: If in Colab with an IPython notebook context. _CONTEXT_IPYTHON: If not in Colab, but we are in an IPython notebook context (e.g., from running `jupyter notebook` at the command line). _CONTEXT...
[ "def", "_get_context", "(", ")", ":", "# In Colab, the `google.colab` module is available, but the shell", "# returned by `IPython.get_ipython` does not have a `get_trait`", "# method.", "try", ":", "import", "google", ".", "colab", "import", "IPython", "except", "ImportError", "...
Determine the most specific context that we're in. Returns: _CONTEXT_COLAB: If in Colab with an IPython notebook context. _CONTEXT_IPYTHON: If not in Colab, but we are in an IPython notebook context (e.g., from running `jupyter notebook` at the command line). _CONTEXT_NONE: Otherwise (e.g., b...
[ "Determine", "the", "most", "specific", "context", "that", "we", "re", "in", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L38-L74
train
tensorflow/tensorboard
tensorboard/notebook.py
start
def start(args_string): """Launch and display a TensorBoard instance as if at the command line. Args: args_string: Command-line arguments to TensorBoard, to be interpreted by `shlex.split`: e.g., "--logdir ./logs --port 0". Shell metacharacters are not supported: e.g., "--logdir 2>&1" will po...
python
def start(args_string): """Launch and display a TensorBoard instance as if at the command line. Args: args_string: Command-line arguments to TensorBoard, to be interpreted by `shlex.split`: e.g., "--logdir ./logs --port 0". Shell metacharacters are not supported: e.g., "--logdir 2>&1" will po...
[ "def", "start", "(", "args_string", ")", ":", "context", "=", "_get_context", "(", ")", "try", ":", "import", "IPython", "import", "IPython", ".", "display", "except", "ImportError", ":", "IPython", "=", "None", "if", "context", "==", "_CONTEXT_NONE", ":", ...
Launch and display a TensorBoard instance as if at the command line. Args: args_string: Command-line arguments to TensorBoard, to be interpreted by `shlex.split`: e.g., "--logdir ./logs --port 0". Shell metacharacters are not supported: e.g., "--logdir 2>&1" will point the logdir at the literal...
[ "Launch", "and", "display", "a", "TensorBoard", "instance", "as", "if", "at", "the", "command", "line", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L118-L207
train
tensorflow/tensorboard
tensorboard/notebook.py
_time_delta_from_info
def _time_delta_from_info(info): """Format the elapsed time for the given TensorBoardInfo. Args: info: A TensorBoardInfo value. Returns: A human-readable string describing the time since the server described by `info` started: e.g., "2 days, 0:48:58". """ delta_seconds = int(time.time()) - info....
python
def _time_delta_from_info(info): """Format the elapsed time for the given TensorBoardInfo. Args: info: A TensorBoardInfo value. Returns: A human-readable string describing the time since the server described by `info` started: e.g., "2 days, 0:48:58". """ delta_seconds = int(time.time()) - info....
[ "def", "_time_delta_from_info", "(", "info", ")", ":", "delta_seconds", "=", "int", "(", "time", ".", "time", "(", ")", ")", "-", "info", ".", "start_time", "return", "str", "(", "datetime", ".", "timedelta", "(", "seconds", "=", "delta_seconds", ")", ")...
Format the elapsed time for the given TensorBoardInfo. Args: info: A TensorBoardInfo value. Returns: A human-readable string describing the time since the server described by `info` started: e.g., "2 days, 0:48:58".
[ "Format", "the", "elapsed", "time", "for", "the", "given", "TensorBoardInfo", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L210-L221
train
tensorflow/tensorboard
tensorboard/notebook.py
display
def display(port=None, height=None): """Display a TensorBoard instance already running on this machine. Args: port: The port on which the TensorBoard server is listening, as an `int`, or `None` to automatically select the most recently launched TensorBoard. height: The height of the frame into ...
python
def display(port=None, height=None): """Display a TensorBoard instance already running on this machine. Args: port: The port on which the TensorBoard server is listening, as an `int`, or `None` to automatically select the most recently launched TensorBoard. height: The height of the frame into ...
[ "def", "display", "(", "port", "=", "None", ",", "height", "=", "None", ")", ":", "_display", "(", "port", "=", "port", ",", "height", "=", "height", ",", "print_message", "=", "True", ",", "display_handle", "=", "None", ")" ]
Display a TensorBoard instance already running on this machine. Args: port: The port on which the TensorBoard server is listening, as an `int`, or `None` to automatically select the most recently launched TensorBoard. height: The height of the frame into which to render the TensorBoard UI, ...
[ "Display", "a", "TensorBoard", "instance", "already", "running", "on", "this", "machine", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L224-L235
train
tensorflow/tensorboard
tensorboard/notebook.py
_display
def _display(port=None, height=None, print_message=False, display_handle=None): """Internal version of `display`. Args: port: As with `display`. height: As with `display`. print_message: True to print which TensorBoard instance was selected for display (if applicable), or False otherwise. dis...
python
def _display(port=None, height=None, print_message=False, display_handle=None): """Internal version of `display`. Args: port: As with `display`. height: As with `display`. print_message: True to print which TensorBoard instance was selected for display (if applicable), or False otherwise. dis...
[ "def", "_display", "(", "port", "=", "None", ",", "height", "=", "None", ",", "print_message", "=", "False", ",", "display_handle", "=", "None", ")", ":", "if", "height", "is", "None", ":", "height", "=", "800", "if", "port", "is", "None", ":", "info...
Internal version of `display`. Args: port: As with `display`. height: As with `display`. print_message: True to print which TensorBoard instance was selected for display (if applicable), or False otherwise. display_handle: If not None, an IPython display handle into which to render Tensor...
[ "Internal", "version", "of", "display", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L238-L289
train
tensorflow/tensorboard
tensorboard/notebook.py
_display_colab
def _display_colab(port, height, display_handle): """Display a TensorBoard instance in a Colab output frame. The Colab VM is not directly exposed to the network, so the Colab runtime provides a service worker tunnel to proxy requests from the end user's browser through to servers running on the Colab VM: the ...
python
def _display_colab(port, height, display_handle): """Display a TensorBoard instance in a Colab output frame. The Colab VM is not directly exposed to the network, so the Colab runtime provides a service worker tunnel to proxy requests from the end user's browser through to servers running on the Colab VM: the ...
[ "def", "_display_colab", "(", "port", ",", "height", ",", "display_handle", ")", ":", "import", "IPython", ".", "display", "shell", "=", "\"\"\"\n <div id=\"root\"></div>\n <script>\n (function() {\n window.TENSORBOARD_ENV = window.TENSORBOARD_ENV || {};\n wi...
Display a TensorBoard instance in a Colab output frame. The Colab VM is not directly exposed to the network, so the Colab runtime provides a service worker tunnel to proxy requests from the end user's browser through to servers running on the Colab VM: the output frame may issue requests to https://localhost:<...
[ "Display", "a", "TensorBoard", "instance", "in", "a", "Colab", "output", "frame", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L292-L369
train
tensorflow/tensorboard
tensorboard/notebook.py
list
def list(): """Print a listing of known running TensorBoard instances. TensorBoard instances that were killed uncleanly (e.g., with SIGKILL or SIGQUIT) may appear in this list even if they are no longer running. Conversely, this list may be missing some entries if your operating system's temporary directory ...
python
def list(): """Print a listing of known running TensorBoard instances. TensorBoard instances that were killed uncleanly (e.g., with SIGKILL or SIGQUIT) may appear in this list even if they are no longer running. Conversely, this list may be missing some entries if your operating system's temporary directory ...
[ "def", "list", "(", ")", ":", "infos", "=", "manager", ".", "get_all", "(", ")", "if", "not", "infos", ":", "print", "(", "\"No known TensorBoard instances running.\"", ")", "return", "print", "(", "\"Known TensorBoard instances:\"", ")", "for", "info", "in", ...
Print a listing of known running TensorBoard instances. TensorBoard instances that were killed uncleanly (e.g., with SIGKILL or SIGQUIT) may appear in this list even if they are no longer running. Conversely, this list may be missing some entries if your operating system's temporary directory has been cleared ...
[ "Print", "a", "listing", "of", "known", "running", "TensorBoard", "instances", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/notebook.py#L392-L414
train
tensorflow/tensorboard
tensorboard/backend/event_processing/io_wrapper.py
IsTensorFlowEventsFile
def IsTensorFlowEventsFile(path): """Check the path name to see if it is probably a TF Events file. Args: path: A file path to check if it is an event file. Raises: ValueError: If the path is an empty string. Returns: If path is formatted like a TensorFlowEventsFile. """ if not path: rais...
python
def IsTensorFlowEventsFile(path): """Check the path name to see if it is probably a TF Events file. Args: path: A file path to check if it is an event file. Raises: ValueError: If the path is an empty string. Returns: If path is formatted like a TensorFlowEventsFile. """ if not path: rais...
[ "def", "IsTensorFlowEventsFile", "(", "path", ")", ":", "if", "not", "path", ":", "raise", "ValueError", "(", "'Path must be a nonempty string'", ")", "return", "'tfevents'", "in", "tf", ".", "compat", ".", "as_str_any", "(", "os", ".", "path", ".", "basename"...
Check the path name to see if it is probably a TF Events file. Args: path: A file path to check if it is an event file. Raises: ValueError: If the path is an empty string. Returns: If path is formatted like a TensorFlowEventsFile.
[ "Check", "the", "path", "name", "to", "see", "if", "it", "is", "probably", "a", "TF", "Events", "file", "." ]
8e5f497b48e40f2a774f85416b8a35ac0693c35e
https://github.com/tensorflow/tensorboard/blob/8e5f497b48e40f2a774f85416b8a35ac0693c35e/tensorboard/backend/event_processing/io_wrapper.py#L45-L59
train