Repository: tensorflow/tensorboard-plugin-example
Branch: master
Commit: 11f53ef76894
Files: 22
Total size: 81.3 KB
Directory structure:
gitextract_isjblovi/
├── .gitignore
├── .pylintrc
├── .travis.yml
├── AUTHORS
├── CONTRIBUTING.md
├── CONTRIBUTORS
├── LICENSE
├── README.md
├── WORKSPACE
├── bazel_tips.md
├── greeter_plugin/
│ ├── BUILD
│ ├── __init__.py
│ ├── greeter-card.html
│ ├── greeter-dashboard.html
│ ├── greeter-plugin.html
│ ├── greeter_demo.py
│ ├── greeter_plugin.py
│ └── greeter_summary.py
└── greeter_tensorboard/
├── BUILD
├── __init__.py
├── index.html
└── main.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
/bazel-*
/.idea
*.pyc
*.egg-info/
================================================
FILE: .pylintrc
================================================
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS
# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
ignore-patterns=.*_pb2
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint.
jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# Specify a configuration file.
#rcfile=
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,duplicate-code,invalid-name,missing-docstring,fixme,no-member,protected-access,no-self-use,no-name-in-module,bad-option-value,no-else-return,too-few-public-methods,too-many-branches,too-many-arguments,too-many-public-methods,too-many-locals,too-many-return-statements,too-many-instance-attributes,not-context-manager,blacklisted-name
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=
[REPORTS]
# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio).You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
[BASIC]
# Naming hint for argument names
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for attribute names
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata
# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
# Naming hint for class names
class-name-hint=[A-Z_][a-zA-Z0-9]+$
# Regular expression matching correct class names
class-rgx=[A-Z_][a-zA-Z0-9]+$
# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=10
# Naming hint for function names
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Good variable names which should always be accepted, separated by a comma
good-names=i,j,k,ex,Run,_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=yes
# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Naming hint for method names
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty
# Naming hint for variable names
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
# Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager,tensorflow.python.util.tf_contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=six,six.moves,*_pb2
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,XXX,TODO
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,_cb
# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,future.builtins
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=80
# Maximum number of lines in a module
max-module-lines=10000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[SPELLING]
# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to indicated private dictionary in
# --spelling-private-dict-file option instead of raising a message.
spelling-store-unknown-words=no
[LOGGING]
# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=yes
# Minimum lines number of a similarity.
min-similarity-lines=4
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,_fields,_replace,_source,_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs
[IMPORTS]
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=regsub,TERMIOS,Bastion,rexec
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled)
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
[DESIGN]
# Maximum number of arguments for function / method
max-args=5
# Maximum number of attributes for a class (see R0902).
max-attributes=7
# Maximum number of boolean expressions in a if statement
max-bool-expr=5
# Maximum number of branch for function / method body
max-branches=12
# Maximum number of locals for function / method body
max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body
max-returns=6
# Maximum number of statements in function / method body
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=2
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
================================================
FILE: .travis.yml
================================================
dist: trusty
sudo: required
language: python
python:
- "2.7"
- "3.6"
os:
- linux
branches:
only:
- master
- /^\d+\.\d+(\.\d+)?(-\S*)?$/
env:
# Keep the BAZEL version in sync with one in
# https://github.com/tensorflow/tensorboard/blob/master/.travis.yml
- NAME=greeter_plugin BAZEL=0.16.1 TF=NIGHTLY
- NAME=greeter_tensorboard BAZEL=0.16.1 TF=NIGHTLY
cache:
directories:
- $HOME/.bazel-output-base
before_install:
- wget -t 3 -O bazel https://mirror.bazel.build/github.com/bazelbuild/bazel/releases/download/${BAZEL}/bazel-${BAZEL}-linux-x86_64
- chmod +x bazel
- sudo mv bazel /usr/local/bin
# Storing build artifacts in this directory helps Travis cache them. This
# will sometimes cut latency in half, when we're lucky.
- echo "startup --output_base=${HOME}/.bazel-output-base" >>~/.bazelrc
# Travis Trusty Sudo GCE VMs have 2 cores and 7.5 GB RAM. These settings
# help Bazel go faster and not OOM the system.
- echo "startup --host_jvm_args=-Xms500m" >>~/.bazelrc
- echo "startup --host_jvm_args=-Xmx500m" >>~/.bazelrc
- echo "startup --host_jvm_args=-XX:-UseParallelGC" >>~/.bazelrc
- echo "build --local_resources=400,2,1.0" >>~/.bazelrc
- echo "build --worker_max_instances=2" >>~/.bazelrc
# Make Bazel as strict as possible, so TensorBoard will build correctly
# for users, regardless of their Bazel configuration.
- echo "build --worker_verbose" >>~/.bazelrc
- echo "build --worker_sandboxing" >>~/.bazelrc
- echo "build --spawn_strategy=sandboxed" >>~/.bazelrc
- echo "build --genrule_strategy=sandboxed" >>~/.bazelrc
- echo "test --test_verbose_timeout_warnings" >>~/.bazelrc
# It's helpful to see the errors on failure.
- echo "build --verbose_failures" >>~/.bazelrc
- echo "test --test_output=errors" >>~/.bazelrc
install:
- pip install futures==3.1.1
- pip install grpcio==1.6.3
- pip install mock==2.0.0
- |
# Install TensorFlow
case "${TF}" in
RELEASE)
pip install -I tensorflow
;;
NIGHTLY)
pip install -I tf-nightly
;;
*)
pip install -I tensorflow=="${TF}"
;;
esac
script:
- |
bazel build "//${NAME}/..."
# TODO(@jart): Uncomment when tests are added.
# - |
# bazel test "//${NAME}/..."
before_cache:
- |
find "${HOME}/.bazel-output-base" \
-name \*.runfiles -print0 \
-or -name \*.tar.gz -print0 \
-or -name \*-execroot.json -print0 \
-or -name \*-tsc.json -print0 \
-or -name \*-params.pbtxt -print0 \
-or -name \*-args.txt -print0 \
-or -name \*.runfiles_manifest -print0 \
-or -name \*.server_params.pbtxt -print0 \
| xargs -0 rm -rf
notifications:
email: false
================================================
FILE: AUTHORS
================================================
# This the official list of Bazel rules_closure authors for copyright purposes.
# This file is distinct from the CONTRIBUTORS files.
# See the latter for an explanation.
# Names should be added to this file as:
# Name or Organization <email address>
# The email address is not required for organizations.
Google Inc.
================================================
FILE: CONTRIBUTING.md
================================================
Want to contribute? Great! First, read this page (including the small print at the end).
### Before you contribute
Before we can use your code, you must sign the
[Google Individual Contributor License Agreement]
(https://cla.developers.google.com/about/google-individual)
(CLA), which you can do online. The CLA is necessary mainly because you own the
copyright to your changes, even after your contribution becomes part of our
codebase, so we need your permission to use and distribute your code. We also
need to be sure of various other things—for instance that you'll tell us if you
know that your code infringes on other people's patents. You don't have to sign
the CLA until after you've submitted your code for review and a member has
approved it, but you must do it before we can put your code into our codebase.
Before you start working on a larger contribution, you should get in touch with
us first through the issue tracker with your idea so that we can help out and
possibly guide you. Coordinating up front makes it much easier to avoid
frustration later on.
### Code reviews
All submissions, including submissions by project members, require review. We
use Github pull requests for this purpose.
### The small print
Contributions made by corporations are covered by a different agreement than
the one above, the
[Software Grant and Corporate Contributor License Agreement]
(https://cla.developers.google.com/about/google-corporate).
================================================
FILE: CONTRIBUTORS
================================================
# People who have agreed to one of the CLAs and can contribute patches.
# The AUTHORS file lists the copyright holders; this file
# lists people. For example, Google employees are listed here
# but not in AUTHORS, because Google holds the copyright.
#
# https://developers.google.com/open-source/cla/individual
# https://developers.google.com/open-source/cla/corporate
#
# Names should be added to this file as:
# Name <email address>
Justine Tunney <jart@google.com>
Dandelion Mané <dandelion@google.com>
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# Example is deprecated. Please see [example at tensorflow/tensorboard](https://github.com/tensorflow/tensorboard/blob/javascript/tensorboard/examples/plugins/example_basic/README.md) for the latest example instead.
This repository has example that works with TensorBoard version 1.13 and prior.
================================================
FILE: WORKSPACE
================================================
workspace(name = "io_github_tensorflow_tensorboard_plugin_example")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Needed as a transitive dependency of rules_webtesting below.
http_archive(
name = "bazel_skylib",
sha256 = "2b9af2de004d67725c9985540811835389b229c27874f2e15f5e319622a53a3b",
strip_prefix = "bazel-skylib-e9fc4750d427196754bebb0e2e1e38d68893490a",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/archive/e9fc4750d427196754bebb0e2e1e38d68893490a.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/archive/e9fc4750d427196754bebb0e2e1e38d68893490a.tar.gz",
],
)
################################################################################
# CLOSURE RULES - Build rules and libraries for JavaScript development
#
# NOTE: SHA should match what's in TensorBoard's WORKSPACE file.
# NOTE: All the projects depended upon in this file use highly
# available redundant URLs. They are strongly recommended because
# they hedge against GitHub outages and allow Bazel's downloader
# to guarantee high performance and 99.9% reliability. That means
# practically zero build flakes on CI systems, without needing to
# configure an HTTP_PROXY.
http_archive(
name = "io_bazel_rules_closure",
sha256 = "b29a8bc2cb10513c864cb1084d6f38613ef14a143797cea0af0f91cd385f5e8c",
strip_prefix = "rules_closure-0.8.0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_closure/archive/0.8.0.tar.gz",
"https://github.com/bazelbuild/rules_closure/archive/0.8.0.tar.gz", # 2018-08-03
],
)
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
# Inherit external repositories defined by Closure Rules.
closure_repositories(
omit_com_google_protobuf = True,
omit_com_google_protobuf_js = True,
)
################################################################################
# GO RULES - Build rules and libraries for Go development
#
# NOTE: TensorBoard does not require Go rules; they are a transitive
# dependency of rules_webtesting.
# NOTE: SHA should match what's in TensorBoard's WORKSPACE file.
# Needed as a transitive dependency of rules_webtesting below.
http_archive(
name = "bazel_gazelle",
sha256 = "6e875ab4b6bf64a38c352887760f21203ab054676d9c1b274963907e0768740d",
urls = [
# tag 0.15.0 resolves to commit c728ce9f663e2bff26361ba5978ec5c9e6816a3c (2018-10-13 00:06:11 +0200)
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/0.15.0/bazel-gazelle-0.15.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/0.15.0/bazel-gazelle-0.15.0.tar.gz",
],
)
http_archive(
name = "io_bazel_rules_go",
sha256 = "b7a62250a3a73277ade0ce306d22f122365b513f5402222403e507f2f997d421",
urls = [
# tag 0.16.3 resolves to commit 01e5a9f8483167962eddd167f7689408bdeb4e76 (2018-11-28 16:28:45 -0500)
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/0.16.3/rules_go-0.16.3.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/0.16.3/rules_go-0.16.3.tar.gz",
],
)
# Needed as a transitive dependency of some rules_webtesting targets.
load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
go_register_toolchains()
# Needed as a transitive dependency of some rules_webtesting targets.
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()
################################################################################
# WEBTESTING RULES - Build rules and libraries for Go development
#
# NOTE: SHA should match what's in TensorBoard's WORKSPACE file.
# NOTE: Some external repositories are omitted because they were already
# defined by closure_repositories().
http_archive(
name = "io_bazel_rules_webtesting",
sha256 = "89f041028627d801ba3b4ea1ef2211994392d46e25c1fc3501b95d51698e4a1e",
strip_prefix = "rules_webtesting-0.2.2",
urls = [
# tag 0.2.2 resolves to commit 596d07c1f38486486969302158b9019418a5409e (2018-12-04 09:20:24 -0800)
"https://mirror.bazel.build/github.com/bazelbuild/rules_webtesting/archive/0.2.2.tar.gz",
"https://github.com/bazelbuild/rules_webtesting/archive/0.2.2.tar.gz",
],
)
load("@io_bazel_rules_webtesting//web:repositories.bzl", "browser_repositories", "web_test_repositories")
web_test_repositories(
omit_com_google_code_findbugs_jsr305 = True,
omit_com_google_code_gson = True,
omit_com_google_errorprone_error_prone_annotations = True,
omit_com_google_guava = True,
omit_junit = True,
omit_org_hamcrest_core = True,
)
################################################################################
# TENSORBOARD DEP RULES - Dependencies of TensorBoard
#
# NOTE: SHA should match what's in TensorBoard's WORKSPACE file.
# NOTE: Some external repositories are omitted because they were already
# defined by closure_repositories().
# TODO(stephanwlee): Remove this after ai_google_pair_facets move to
# third_party/workspace.bzl in tensorflow/tensorboard repo.
http_archive(
name = "ai_google_pair_facets",
sha256 = "e3f7b7b3c194c1772d16bdc8b348716c0da59a51daa03ef4503cf06c073caafc",
strip_prefix = "facets-0.2.1",
urls = [
"http://mirror.bazel.build/github.com/pair-code/facets/archive/0.2.1.tar.gz",
"https://github.com/pair-code/facets/archive/0.2.1.tar.gz",
],
)
http_archive(
name = "org_tensorflow",
sha256 = "88324ad9379eae4fdb2aefb8e0d6c7cd0dc748b44daa5cc96ffd9415705c00c3",
strip_prefix = "tensorflow-9752b117ff63f204c4975cad52b5aab5c1f5e9a9",
urls = [
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/9752b117ff63f204c4975cad52b5aab5c1f5e9a9.tar.gz", # 2018-04-16
"https://github.com/tensorflow/tensorflow/archive/9752b117ff63f204c4975cad52b5aab5c1f5e9a9.tar.gz",
],
)
load("@org_tensorflow//tensorflow:workspace.bzl", "tf_workspace")
tf_workspace()
################################################################################
# TENSORBOARD - Framework for visualizing machines learning
#
# NOTE: If the need should arise to patch TensorBoard's codebase, then
# git clone it to local disk and use local_repository() instead of
# http_archive(). This should be a temporary measure until a pull
# request can be merged upstream. It is an anti-pattern to
# check-in a WORKSPACE file that uses local_repository() since,
# unlike http_archive(), it isn't automated. If upstreaming a
# change takes too long, then consider checking in a change where
# http_archive() points to the forked repository.
http_archive(
name = "org_tensorflow_tensorboard",
sha256 = "e263f1ebeadaef246ebbd6d81faa02292ecf0193e5f0ecd279ee38416f2be4b3",
strip_prefix = "tensorboard-1.12.0",
urls = [
"http://mirror.bazel.build/github.com/tensorflow/tensorboard/archive/1.12.0.tar.gz",
"https://github.com/tensorflow/tensorboard/archive/1.12.0.tar.gz",
],
)
load("@org_tensorflow_tensorboard//third_party:workspace.bzl", "tensorboard_workspace")
# Inherit external repositories defined by Closure Rules.
tensorboard_workspace()
================================================
FILE: bazel_tips.md
================================================
# TensorBoard Build Reference
TensorBoard uses Bazel for building and testing. Since TensorBoard aims to
provide a framework for developers working in ML visualization, much work has
been done to provide robust build tooling that comes with third party
dependencies included.
## Bazel‽
Bazel is Google's build system. It was designed to scale to repositories with
gigabytes of code. It was only quite recently made available to the public in
2015. Before that happened, it was so highly sought after by external developers
that numerous open source clones were written, e.g. Buck, Pants, GN, etc.
These commands help one understand the great mystery of Bazel:
```sh
bazel build -s //greeter_tensorboard/tensorboard
ls $(bazel info output_base)/external
```
Bazel labels have the following semantics:
- `//foo:bar` means the rule named `bar` in `foo/BUILD`.
- `//foo` is shorthand for `//foo:foo`
- `@bar` is shorthand for `@bar//:bar`
- `:foo` means `//foo:foo` if specified in `foo/BUILD`
- `//bar` is sort of equivalent to `@foo//bar` if specified in a BUILD file
within the `foo` repository.
## Build Rules
The following build rules, which don't come included with Bazel, are defined by
the external repositories defined in the `WORKSPACE` file.
- `load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_binary")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "closure_css_library")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "closure_java_template_library")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_deps")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_proto_library")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_template_library")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "web_library")`
- `load("@io_bazel_rules_web//webtesting:web.bzl", "web_test_archive")`
- `load("@io_bazel_rules_webtesting//web:py.bzl", "py_web_test_suite")`
- `load("@io_bazel_rules_webtesting//web:web.bzl", "browser")`
- `load("@org_tensorflow_tensorboard//tensorboard/defs:protos.bzl", "tb_proto_library")`
- `load("@org_tensorflow_tensorboard//tensorboard/defs:vulcanize.bzl", "tensorboard_html_binary")`
- `load("@org_tensorflow_tensorboard//tensorboard/defs:web.bzl", "tf_web_library")`
- `load("@org_tensorflow_tensorboard//tensorboard/defs:zipper.bzl", "tensorboard_zip_file")`
- `load("@protobuf//:protobuf.bzl", "py_proto_library")`
## Workspace Rules
These are special kinds of build rules intended for `WORKSPACE` files. They
can be used to download third party code and generate a synthetic `BUILD` file
for their contents.
- `load("@io_bazel_rules_closure//closure/private:java_import_external.bzl", "java_import_external")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "filegroup_external")`
- `load("@io_bazel_rules_closure//closure:defs.bzl", "web_library_external")`
## Build Rule Targets
Here's a curated list of some of the many build rule targets defined by
TensorBoard and Closure Rules that plugin authors may wish to depend upon.
These dependencies are all automatically downloaded by Bazel, via highly
available redundant mirrors, per the `WORKSPACE` file definition.
### py_library() rules
- `@org_mozilla_bleach`
- `@org_pocoo_werkzeug`
- `@org_pythonhosted_markdown`
- `@org_tensorflow_tensorboard//tensorboard/backend/event_processing:event_accumulator`
- `@org_tensorflow_tensorboard//tensorboard/backend/event_processing:event_file_inspector`
- `@org_tensorflow_tensorboard//tensorboard/backend/event_processing:event_multiplexer`
- `@org_tensorflow_tensorboard//tensorboard/backend:application`
- `@org_tensorflow_tensorboard//tensorboard/backend:http_util`
- `@org_tensorflow_tensorboard//tensorboard/backend:process_graph`
- `@org_tensorflow_tensorboard//tensorboard/plugins/audio:audio_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/core:core_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/distribution:distributions_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/graph:graphs_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/histogram:histograms_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/image:images_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/profile:profile_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/projector:projector_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/scalar:scalars_plugin`
- `@org_tensorflow_tensorboard//tensorboard/plugins/text:text_plugin`
- `@org_tensorflow_tensorboard//tensorboard` (Note: Provides `tensorboard.main`)
- `@org_tensorflow_tensorboard//tensorboard:db`
- `@org_tensorflow_tensorboard//tensorboard:loader`
- `@org_tensorflow_tensorboard//tensorboard:test_util`
- `@org_tensorflow_tensorboard//tensorboard:util`
- `@org_pythonhosted_six`
### web_library() rules
The following labels can be added to the `deps` list of `web_library`,
`tf_web_library`, `tensorboard_html_binary`, and `tensorboard_zip_file` rules.
- `@org_polymer_font_roboto`
- `@org_polymer_iron_ajax`
- `@org_polymer_iron_collapse`
- `@org_polymer_iron_component_page`
- `@org_polymer_iron_demo_helpers`
- `@org_polymer_iron_flex_layout`
- `@org_polymer_iron_icon`
- `@org_polymer_iron_icons`
- `@org_polymer_iron_list`
- `@org_polymer_paper_button`
- `@org_polymer_paper_checkbox`
- `@org_polymer_paper_dialog_scrollable`
- `@org_polymer_paper_dialog`
- `@org_polymer_paper_dropdown_menu`
- `@org_polymer_paper_header_panel`
- `@org_polymer_paper_icon_button`
- `@org_polymer_paper_input`
- `@org_polymer_paper_item`
- `@org_polymer_paper_listbox`
- `@org_polymer_paper_material`
- `@org_polymer_paper_menu`
- `@org_polymer_paper_progress`
- `@org_polymer_paper_radio_group`
- `@org_polymer_paper_slider`
- `@org_polymer_paper_spinner`
- `@org_polymer_paper_styles`
- `@org_polymer_paper_tabs`
- `@org_polymer_paper_toast`
- `@org_polymer_paper_toggle_button`
- `@org_polymer_paper_toolbar`
- `@org_polymer_paper_tooltip`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_backend`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_card_heading`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_categorization_utils`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_color_scale`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_dashboard_common`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:d3`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:dagre`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:graphlib`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:lodash`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:numericjs`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:plottable`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:polymer`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:threejs`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:web_component_tester`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:webcomponentsjs`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_imports:weblas`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_paginated_view`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_runs_selector`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_storage`
- `@org_tensorflow_tensorboard//tensorboard/components/tf_tensorboard`
- `@org_tensorflow_tensorboard//tensorboard/components/vz_sorting`
- `@org_tensorflow_tensorboard//tensorboard/plugins/audio/tf_audio_dashboard`
- `@org_tensorflow_tensorboard//tensorboard/plugins/distribution/tf_distribution_dashboard`
- `@org_tensorflow_tensorboard//tensorboard/plugins/graph/tf_graph_dashboard`
- `@org_tensorflow_tensorboard//tensorboard/plugins/histogram/tf_histogram_dashboard`
- `@org_tensorflow_tensorboard//tensorboard/plugins/image/tf_image_dashboard`
- `@org_tensorflow_tensorboard//tensorboard/plugins/profile/tf_profile_dashboard`
- `@org_tensorflow_tensorboard//tensorboard/plugins/projector/vz_projector`
- `@org_tensorflow_tensorboard//tensorboard/plugins/scalar/tf_scalar_dashboard`
- `@org_tensorflow_tensorboard//tensorboard/plugins/scalar/vz_line_chart`
- `@org_tensorflow_tensorboard//tensorboard/plugins/text/tf_text_dashboard`
### java_library() rules
- `@args4j`
- `@com_google_auto_common`
- `@com_google_auto_factory`
- `@com_google_auto_value`
- `@com_google_closure_stylesheets`
- `@com_google_code_findbugs_jsr305`
- `@com_google_code_gson`
- `@com_google_dagger_producers`
- `@com_google_dagger`
- `@com_google_errorprone_error_prone_annotations`
- `@com_google_guava`
- `@com_google_inject_extensions_guice_assistedinject`
- `@com_google_inject_extensions_guice_multibindings`
- `@com_google_inject_guice`
- `@com_google_protobuf_java`
- `@com_ibm_icu_icu4j`
- `@com_squareup_javawriter`
- `@io_bazel_rules_closure//closure/compiler`
- `@io_bazel_rules_closure//closure/templates`
- `@io_bazel_rules_closure//closure/templates:safe_html_types`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure/http/filter`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure/http`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure/webfiles/compiler`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure/webfiles:build_info_java_proto`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure/webfiles`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure/worker`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure:build_info_java_proto`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure:tarjan`
- `@io_bazel_rules_closure//java/io/bazel/rules/closure:webpath`
- `@io_bazel_rules_closure//java/org/jsoup/nodes` (Note: Provides `Html5Printer`)
- `@javax_inject` (Note: Implied by `@com_google_dagger`)
- `@org_json`
- `@org_jsoup`
- `@org_ow2_asm_analysis`
- `@org_ow2_asm_commons`
- `@org_ow2_asm_tree`
- `@org_ow2_asm_util`
- `@org_ow2_asm`
### closure_js_library() rules
- `@io_bazel_rules_closure//closure/library`
- `@io_bazel_rules_closure//closure/library:testing`
- `@io_bazel_rules_closure//closure/protobuf:jspb`
- `@io_bazel_rules_closure//third_party/javascript/incremental_dom`
### filegroup() rules
- `@com_google_javascript_closure_compiler_externs`
- `@com_google_javascript_closure_compiler_externs_polymer`
### browser() rules
- `@org_tensorflow_tensorboard//tensorboard/functionaltests/browsers:chromium`
### Notes
Many of the recommended targets are delegates. For example,
`@org_tensorflow_tensorboard//tensorboard/components/tf_imports:polymer` is
roughly equivalent to `@org_polymer`. The `tf_imports` version is preferred
because it adds additional value, such as TypeScript typings and Closure
Compiler externs.
In certain cases, the recommended delegate targets may appear to be superfluous.
For example, `@io_bazel_rules_closure//closure/compiler` is equivalent to
`@com_google_javascript_closure_compiler`. Those labels exist to make life
easier for Googlers. In Google's internal repository, they export more than one
build targets. By using these delegates, Googlers can make the open source sync
process easier by regex replacing build labels.
================================================
FILE: greeter_plugin/BUILD
================================================
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package(default_visibility = ["//visibility:public"])
load("@org_tensorflow_tensorboard//tensorboard/defs:web.bzl", "tf_web_library")
licenses(["notice"]) # Apache 2.0
py_library(
name = "greeter_plugin",
srcs = ["greeter_plugin.py"],
srcs_version = "PY2AND3",
deps = [
"@org_pocoo_werkzeug",
"@org_pythonhosted_six",
"@org_tensorflow_tensorboard//tensorboard/backend:http_util",
"@org_tensorflow_tensorboard//tensorboard/backend/event_processing:event_accumulator",
"@org_tensorflow_tensorboard//tensorboard/plugins:base_plugin",
],
)
py_binary(
name = "greeter_demo",
srcs = ["greeter_demo.py"],
srcs_version = "PY2AND3",
deps = [":greeter_summary"],
)
py_library(
name = "greeter_summary",
srcs = ["greeter_summary.py"],
srcs_version = "PY2AND3",
)
tf_web_library(
name = "greeter_dashboard",
srcs = [
"greeter-card.html",
"greeter-dashboard.html",
],
path = "/greeter-plugin",
deps = [
"@org_polymer_iron_icon",
"@org_polymer_paper_icon_button",
"@org_polymer_paper_input",
"@org_tensorflow_tensorboard//tensorboard/components/tf_backend",
"@org_tensorflow_tensorboard//tensorboard/components/tf_card_heading",
"@org_tensorflow_tensorboard//tensorboard/components/tf_categorization_utils",
"@org_tensorflow_tensorboard//tensorboard/components/tf_color_scale",
"@org_tensorflow_tensorboard//tensorboard/components/tf_dashboard_common",
"@org_tensorflow_tensorboard//tensorboard/components/tf_imports:lodash",
"@org_tensorflow_tensorboard//tensorboard/components/tf_imports:polymer",
"@org_tensorflow_tensorboard//tensorboard/components/tf_paginated_view",
"@org_tensorflow_tensorboard//tensorboard/components/tf_runs_selector",
"@org_tensorflow_tensorboard//tensorboard/components/tf_tensorboard:registry",
],
)
================================================
FILE: greeter_plugin/__init__.py
================================================
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
================================================
FILE: greeter_plugin/greeter-card.html
================================================
<!--
@license
Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../tf-backend/tf-backend.html">
<link rel="import" href="../tf-card-heading/tf-card-heading.html">
<link rel="import" href="../tf-color-scale/tf-color-scale.html">
<link rel="import" href="../tf-imports/lodash.html">
<!--
greeter-card loads greeting data from the greeter_plugin backend, and renders it.
-->
<dom-module id="greeter-card">
<template>
<tf-card-heading title="[[tag]]" color="[[_runColor]]">
[[run]]
</tf-card-heading>
<template is="dom-repeat" items="[[greetings]]">
<div>[[item.text]]</div>
</template>
<style>
:host {
display: flex;
flex-direction: column;
width: 330px;
height: 235px;
margin-right: 10px;
margin-bottom: 15px;
}
:host[_expanded] {
width: 700px;
height: 500px;
}
</style>
</template>
<script>
"use strict";
Polymer({
is: "greeter-card",
properties: {
run: String,
tag: String,
/** @type {Function} */
_colorScaleFunction: {
type: Object, // function: string => string
value: () => tf_color_scale.runsColorScale,
},
_runColor: {
type: String,
computed: "_computeRunColor(run)",
},
requestManager: Object,
_canceller: {
type: Object,
value: () => new tf_backend.Canceller(),
},
},
observers: ["_fetchNewData(run, tag)"],
_computeRunColor(run) {
return this._colorScaleFunction(run);
},
attached() {
// Defer reloading until after we're attached, because that ensures that
// the requestManager has been set from above. (Polymer is tricky
// sometimes)
this._attached = true;
this.reload();
},
reload() {
this._fetchNewData(this.run, this.tag);
},
_fetchNewData(run, tag) {
if (!this._attached) {
return;
}
this._canceller.cancelAll();
const url = tf_backend.addParams(
tf_backend.getRouter().pluginRoute('greeter', '/greetings'), {tag, run});
const updateData = this._canceller.cancellable(result => {
if (result.cancelled) {
return;
}
const backendData = result.value;
this.greetings = backendData;
});
this.requestManager.request(url).then(updateData);
},
});
</script>
</dom-module>
================================================
FILE: greeter_plugin/greeter-dashboard.html
================================================
<!--
@license
Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../tf-backend/tf-backend.html">
<link rel="import" href="../tf-categorization-utils/tf-categorization-utils.html">
<link rel="import" href="../tf-categorization-utils/tf-category-pane.html">
<link rel="import" href="../tf-dashboard-common/dashboard-style.html">
<link rel="import" href="../tf-dashboard-common/tf-dashboard-layout.html">
<link rel="import" href="../tf-runs-selector/tf-runs-selector.html">
<link rel="import" href="../tf-tensorboard/registry.html">
<link rel="import" href="greeter-card.html">
<!--
A frontend that displays a set of greeter-cards.
-->
<dom-module id="greeter-dashboard">
<template>
<tf-dashboard-layout>
<div class="sidebar">
<div class="sidebar-section">
<tf-runs-selector selected-runs="{{_selectedRuns}}">
</tf-runs-selector>
</div>
</div>
</div>
<div class="center">
<template is="dom-if" if="[[_dataNotFound]]">
<div class="no-data-warning">
<h3>No greeter data was found.</h3>
<p>Probable causes:</p>
<ul>
<li>You haven’t written any greeter data to your event files.
<li>TensorBoard can’t find your event files.
</ul>
<p>
If you’re new to using TensorBoard, and want to find out how
to add data and set up your event files, check out the
<a href="https://github.com/tensorflow/tensorboard/blob/master/README.md">README</a>
and perhaps the <a href="https://www.tensorflow.org/get_started/summaries_and_tensorboard">TensorBoard tutorial</a>.
<p>
If you think TensorBoard is configured properly, please see
<a href="https://github.com/tensorflow/tensorboard/blob/master/README.md#my-tensorboard-isnt-showing-any-data-whats-wrong">the section of the README devoted to missing data problems</a>
and consider filing an issue on GitHub.
</div>
</template>
<template is="dom-if" if="[[!_dataNotFound]]">
<paper-input
no-label-float
label="Filter tags (regular expressions supported)"
value="{{_tagFilter}}"
class="search-input"
>
<iron-icon prefix icon="search"></iron-icon>
</paper-input>
<template is="dom-repeat" items="[[_categories]]" as="category">
<tf-category-pane category="[[category]]">
<tf-paginated-view
items="[[category.items]]"
pages="{{category._pages}}"
>
<template is="dom-repeat" items="[[category._pages]]" as="page">
<template is="dom-if" if="[[page.active]]">
<div class="layout horizontal wrap">
<template is="dom-repeat" items="[[page.items]]">
<greeter-card
run="[[item.run]]"
tag="[[item.tag]]"
request-manager="[[_requestManager]]"
></greeter-card>
</template>
</div>
</template>
</template>
</tf-paginated-view>
</tf-category-pane>
</template>
</template>
</div>
</tf-dashboard-layout>
<style include="dashboard-style"></style>
<style>
.no-data-warning {
max-width: 540px;
margin: 80px auto 0 auto;
}
</style>
</template>
<script>
"use strict";
Polymer({
is: "greeter-dashboard",
properties: {
_selectedRuns: Array,
_runToTag: Object, // map<run: string, tags: string[]>
_dataNotFound: Boolean,
_tagFilter: {
type: String, // upward bound from paper-input
value: '.*',
},
_categories: {
type: Array,
computed:
'_makeCategories(_runToTag, _selectedRuns, _tagFilter)',
},
_requestManager: {
type: Object,
value: () => new tf_backend.RequestManager(),
},
},
ready() {
this.reload();
},
reload() {
this._fetchTags().then(() => {
this._reloadCards();
});
},
_fetchTags() {
const url = tf_backend.getRouter().pluginRoute('greeter', '/tags');
return this._requestManager.request(url).then(runToTag => {
if (_.isEqual(runToTag, this._runToTag)) {
// No need to update anything if there are no changes.
return;
}
const tags = tf_backend.getTags(runToTag);
this.set('_dataNotFound', tags.length === 0);
this.set('_runToTag', runToTag);
});
},
_reloadCards() {
this.querySelectorAll('greeter-card').forEach(g => {
g.reload();
});
},
_makeCategories(runToTag, selectedRuns, tagFilter) {
return tf_categorization_utils.categorizeRunTagCombinations(runToTag, selectedRuns, tagFilter);
},
});
tf_tensorboard.registerDashboard({
plugin: 'greeter',
elementName: 'greeter-dashboard',
});
</script>
</dom-module>
================================================
FILE: greeter_plugin/greeter-plugin.html
================================================
<!--
@license
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../tf-backend/tf-backend.html">
<link rel="import" href="../tf-dashboard-common/dashboard-style.html">
<link rel="import" href="../tf-dashboard-common/tf-dashboard-layout.html">
<link rel="import" href="../tf-runs-selector/tf-runs-selector.html">
<!--
An example web component that shows up as the content for a TensorBoard tab.
@element my-plugin
-->
<dom-module id="my-plugin">
<template>
<tf-dashboard-layout>
<div class="sidebar">
<div class="sidebar-section">
<tf-runs-selector selected-runs="{{_selectedRuns}}">
</tf-runs-selector>
</div>
</div>
<div class="center">
<p>
Hello World.
<p>
The backend says the time is <span class="time">[[time]]</span>.
</div>
</tf-dashboard-layout>
<style include="dashboard-style"></style>
<style>
.time {
font-weight: bold;
}
</style>
</template>
<script>
Polymer({
is: 'my-plugin',
properties: {
/**
* Formatted string of current time.
*/
time: {
type: String,
value: 'unknown',
},
/**
* Indicates if reload button in tf-tensorboard should be shaded out.
*/
isReloadDisabled: {
type: Boolean,
value: false,
readOnly: true,
},
/**
* Request manager to communicate with Python code.
*
* @type {RequestManager}
*/
_requestManager: {
type: Object,
value: () => new tf_backend.RequestManager(),
},
/**
* Array of run names currently checked by the user.
*
* This field is updated by tf-runs-selector automatically.
*
* @type {!Array<string>}
*/
_selectedRuns: Array,
},
/**
* Initializes web component.
*
* @see https://www.polymer-project.org/1.0/docs/devguide/registering-elements#ready-method
*/
ready() {
this.reload();
},
/**
* Reloads data displayed by this web component.
*
* This method is called by tf-tensorboard when the reload timer fires.
*/
reload() {
const url = tf_backend.getRouter().pluginRoute('my-plugin', '/time');
this._requestManager.request(url).then(response => {
this.set('time', response['time']);
});
},
});
</script>
</dom-module>
================================================
FILE: greeter_plugin/greeter_demo.py
================================================
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Simple demo which greets several people."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import tensorflow as tf
# TODO(chihuahua): Figure out why pylint invalidates this import.
import greeter_summary # pylint: disable=import-error
# Directory into which to write tensorboard data.
LOGDIR = '/tmp/greeter_demo'
def run(logdir, run_name, characters, extra_character):
"""Greet several characters from a given cartoon."""
tf.reset_default_graph()
input_ = tf.placeholder(tf.string)
summary_op = greeter_summary.op("greetings", input_)
writer = tf.summary.FileWriter(os.path.join(logdir, run_name))
sess = tf.Session()
for character in characters:
summary = sess.run(summary_op, feed_dict={input_: character})
writer.add_summary(summary)
# Demonstrate that we can also add summaries without using the
# TensorFlow session or graph.
summary = greeter_summary.pb("greetings", extra_character)
writer.add_summary(summary)
writer.close()
def run_all(logdir, unused_verbose=False):
"""Run the simulation for every logdir.
"""
run(logdir, "steven_universe", ["Garnet", "Amethyst", "Pearl"], "Steven")
run(logdir, "futurama", ["Fry", "Bender", "Leela"],
"Lrrr, ruler of the planet Omicron Persei 8")
def main(unused_argv):
print('Saving output to %s.' % LOGDIR)
run_all(LOGDIR, unused_verbose=True)
print('Done. Output saved to %s.' % LOGDIR)
if __name__ == '__main__':
tf.app.run()
================================================
FILE: greeter_plugin/greeter_plugin.py
================================================
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
import six
from werkzeug import wrappers
from tensorboard.backend import http_util
from tensorboard.plugins import base_plugin
class GreeterPlugin(base_plugin.TBPlugin):
"""A plugin that serves greetings recorded during model runs."""
# This static property will also be included within routes (URL paths)
# offered by this plugin. This property must uniquely identify this plugin
# from all other plugins.
plugin_name = 'greeter'
def __init__(self, context):
"""Instantiates a GreeterPlugin.
Args:
context: A base_plugin.TBContext instance. A magic container that
TensorBoard uses to make objects available to the plugin.
"""
# We retrieve the multiplexer from the context and store a reference
# to it.
self._multiplexer = context.multiplexer
@wrappers.Request.application
def tags_route(self, request):
"""A route (HTTP handler) that returns a response with tags.
Returns:
A response that contains a JSON object. The keys of the object
are all the runs. Each run is mapped to a (potentially empty)
list of all tags that are relevant to this plugin.
"""
# This is a dictionary mapping from run to (tag to string content).
# To be clear, the values of the dictionary are dictionaries.
all_runs = self._multiplexer.PluginRunToTagToContent(
GreeterPlugin.plugin_name)
# tagToContent is itself a dictionary mapping tag name to string
# content. We retrieve the keys of that dictionary to obtain a
# list of tags associated with each run.
response = {
run: list(tagToContent.keys())
for (run, tagToContent) in all_runs.items()
}
return http_util.Respond(request, response, 'application/json')
def get_plugin_apps(self):
"""Gets all routes offered by the plugin.
This method is called by TensorBoard when retrieving all the
routes offered by the plugin.
Returns:
A dictionary mapping URL path to route that handles it.
"""
# Note that the methods handling routes are decorated with
# @wrappers.Request.application.
return {
'/tags': self.tags_route,
'/greetings': self.greetings_route,
}
def is_active(self):
"""Determines whether this plugin is active.
This plugin is only active if TensorBoard sampled any summaries
relevant to the greeter plugin.
Returns:
Whether this plugin is active.
"""
all_runs = self._multiplexer.PluginRunToTagToContent(
GreeterPlugin.plugin_name)
# The plugin is active if any of the runs has a tag relevant
# to the plugin.
return bool(self._multiplexer and any(six.itervalues(all_runs)))
def _process_string_tensor_event(self, event):
"""Convert a TensorEvent into a JSON-compatible response."""
string_arr = tf.make_ndarray(event.tensor_proto)
text = string_arr.astype(np.dtype(str)).tostring()
return {
'wall_time': event.wall_time,
'step': event.step,
'text': text,
}
@wrappers.Request.application
def greetings_route(self, request):
"""A route that returns the greetings associated with a tag.
Returns:
A JSON list of greetings associated with the run and tag
combination.
"""
run = request.args.get('run')
tag = request.args.get('tag')
# We fetch all the tensor events that contain greetings.
tensor_events = self._multiplexer.Tensors(run, tag)
# We convert the tensor data to text.
response = [self._process_string_tensor_event(ev) for
ev in tensor_events]
return http_util.Respond(request, response, 'application/json')
================================================
FILE: greeter_plugin/greeter_summary.py
================================================
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Simple demo which greets several people.
This module provides summaries for the Greeter plugin.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
PLUGIN_NAME = 'greeter'
def op(name,
guest,
display_name=None,
description=None,
collections=None):
"""Create a TensorFlow summary op to greet the given guest.
Arguments:
name: A name for this summary operation.
guest: A rank-0 string `Tensor`.
display_name: If set, will be used as the display name
in TensorBoard. Defaults to `name`.
description: A longform readable description of the summary data.
Markdown is supported.
collections: Which TensorFlow graph collections to add the summary
op to. Defaults to `['summaries']`. Can usually be ignored.
"""
# The `name` argument is used to generate the summary op node name.
# That node name will also involve the TensorFlow name scope.
# By having the display_name default to the name argument, we make
# the TensorBoard display clearer.
if display_name is None:
display_name = name
# We could pass additional metadata other than the PLUGIN_NAME within the
# plugin data by using the content parameter, but we don't need any metadata
# for this simple example.
summary_metadata = tf.SummaryMetadata(
display_name=display_name,
summary_description=description,
plugin_data=tf.SummaryMetadata.PluginData(
plugin_name=PLUGIN_NAME))
message = tf.string_join(['Hello, ', guest, '!'])
# Return a summary op that is properly configured.
return tf.summary.tensor_summary(
name,
message,
summary_metadata=summary_metadata,
collections=collections)
def pb(tag, guest, display_name=None, description=None):
"""Create a greeting summary for the given guest.
Arguments:
tag: The string tag associated with the summary.
guest: The string name of the guest to greet.
display_name: If set, will be used as the display name in
TensorBoard. Defaults to `tag`.
description: A longform readable description of the summary data.
Markdown is supported.
"""
message = 'Hello, %s!' % guest
tensor = tf.make_tensor_proto(message, dtype=tf.string)
# We have no metadata to store, but we do need to add a plugin_data entry
# so that we know this summary is associated with the greeter plugin.
# We could use this entry to pass additional metadata other than the
# PLUGIN_NAME by using the content parameter.
summary_metadata = tf.SummaryMetadata(
display_name=display_name,
summary_description=description,
plugin_data=tf.SummaryMetadata.PluginData(
plugin_name=PLUGIN_NAME))
summary = tf.Summary()
summary.value.add(tag=tag,
metadata=summary_metadata,
tensor=tensor)
return summary
================================================
FILE: greeter_tensorboard/BUILD
================================================
load("@org_tensorflow_tensorboard//tensorboard/defs:vulcanize.bzl", "tensorboard_html_binary")
load("@org_tensorflow_tensorboard//tensorboard/defs:web.bzl", "tf_web_library")
load("@org_tensorflow_tensorboard//tensorboard/defs:zipper.bzl", "tensorboard_zip_file")
licenses(["notice"]) # Apache 2.0
py_binary(
name = "greeter_tensorboard",
srcs = ["main.py"],
data = ["assets.zip"],
main = "main.py",
srcs_version = "PY2AND3",
deps = [
"//greeter_plugin",
"@org_pocoo_werkzeug",
"@org_tensorflow_tensorboard//tensorboard:default",
"@org_tensorflow_tensorboard//tensorboard:program",
],
)
tf_web_library(
name = "index",
srcs = ["index.html"],
path = "/",
deps = [
"//greeter_plugin:greeter_dashboard",
"@org_tensorflow_tensorboard//tensorboard/components/tf_imports:webcomponentsjs",
"@org_tensorflow_tensorboard//tensorboard/components/tf_tensorboard",
"@org_tensorflow_tensorboard//tensorboard/components/tf_tensorboard:default_plugins",
],
)
# TODO(stephanwlee): Either allow modular html binary or make the interactive
# inference plugin's asset public. Otherwise, we cannot correctly compile a
# using Closure compiler.
# Interactive inference plugin does not work without the compilation.
#
# tensorboard_html_binary(
# name = "index_bin",
# # TODO(stephanwlee): removed with having modular html binaries.
# compile = True,
# input_path = "/index.html",
# output_path = "/index_bin.html",
# deps = [":index"],
# )
#
# tf_web_library(
# name = "assets_lib",
# srcs = [
# ":index_bin.html",
# "@org_tensorflow_tensorboard//tensorboard/plugins/interactive_inference/tf_interactive_inference_dashboard:wit_assets",
# ],
# path = "/",
# )
tensorboard_zip_file(
name = "assets",
deps = [":index"],
)
================================================
FILE: greeter_tensorboard/__init__.py
================================================
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
================================================
FILE: greeter_tensorboard/index.html
================================================
<!doctype html>
<!--
@license
Copyright 2017 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<meta charset="utf-8">
<title>Greeter TensorBoard</title>
<link rel="shortcut icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMQAAADECAMAAAD3eH5ZAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAD/UExURfFlKfaELvFmKfNyK/67NvWALf68Nv69NvNxK/20NfyyNP22NfN0K/JrKvqhMv2zNf25Nf24Nf23NfeOL/yzNPyvNPJoKviWMPmeMfN1K/WBLfePL/FnKfeML/qlMvR7LPmcMfeLL/aJLvR5LPFoKfJuKvR3LP66NvywNPeNL/V/LfaILv21Nf26NfNzK/NvK/R6LPmaMfyxNPqfMvV+LfurM/iSMPmbMfJvKvmdMfumM/qiMvmZMfytNPJqKvysNPN2K/iYMPNwK/upM/JtKvJsKviVMPaHLvaGLvJpKvR8LPaKLvqkMvuqM/aFLvR4LPuoM/iTMPWDLfiRMPmYMXS0ngkAAALoSURBVHja7drnctpAFIbhFUISSKJ3MKYa0+y4xTW9937/15JkJhlTjhrSrHRmvuf/as6L0YLFCgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMBJ6njenqspzgnPrsrGX9Zpi2tCrmnc6+dYNthVY5WpMmxQLWPdMsOuYVwzNj3ei2t3mQwaV43BJPDCS2NbJ5aEeuX/+9qcjQOtfFIkIkrvY2g4MVcmOBsFWbowKO/kNyj62gRpJcDaPBlxLr1B0zdG0C/8LzbJiJrshuvy1gzlA9+rD8mIkuyIJjFE3/dqnYwoSm7IUEPoD/wut8iIguSIDjlFxe/yfXL5vuSI21BTZLLhXoOILMO8Hxwa/L8bI0LfmUdhGowb2ZvT0e57pFNDgB06IlVyjmmIBl2T/nl9Rw6SD9GgSG/Q0uQkaW3XhmovKQ3eFQ4N2Uo9OQ1eFZsNerf7vP+rO4rhmY1Lg3vFVoP8+8BXg1sFnwbnCk4NThW8GuiKBDdkVVtTNFvNelVsNqTbyWnIOM2oeTRoyWvwmpJHg/ucXBrcJuXT4DwrpwZi2vy0VCx8YtXg/D2bU4OfiuQ3eFfE2KD4bfCqiLNB993gXsGlwa2CT4NzBacGIVQ6YsipQdh0xEdODUKjIxrSp88onZ8zbbFLg1DoiFO5BXvDGv2My9/JhUT8JUZTI0yDaNHLBzIbvqTDNYhUiVw/kdjQ1kM2CHFDPjKW+KzyRTF0g/ga9w9y+fANQpxvX8CU+Ny7FUWDeF3Y+g3lROIf4k0UDX9eCyvO531PyYhHga9zvPZJU5b73Y/eXj8Hv9D48n6HaF5LbcjRt8TZTtda5M1DfXnbkX1C0SHCFKzQB5Fe8op4GNGNHavvZESbVwT5r6W1xyuCPBY3Y9YgDqzknH/e3YfNzzuL30l0IebrZ5kKtuDIXt1n868ET6kf3/49tLvrCcZyF8Pu215dAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcPIbNrBhOaBXucoAAAAASUVORK5CYII=">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="tf-tensorboard/style.html">
<script>
// It's required that Google Analytics be defined, or be faked in the
// following manner (which is the default behavior in the TensorBoard
// open source release.)
window['ga'] = function() {};
</script>
<!--
Load dashboards into UI for all first-party TensorBoard plugins.
Each dashboard calls the registerDashboard() function to tell
<tf-tensorboard> that it exists, so it can be loaded dynamically via
document.createElement().
Ordering matters. The order in which these lines appear determines the
ordering of tabs in TensorBoard's GUI.
-->
<link rel="import" href="greeter-plugin/greeter-dashboard.html">
<link rel="import" href="tf-tensorboard/default-plugins.html">
<!-- Now we load the TensorBoard UI. -->
<link rel="import" href="tf-tensorboard/tf-tensorboard.html">
<body>
<tf-tensorboard use-hash title="My Greeter TensorBoard"></tf-tensorboard>
================================================
FILE: greeter_tensorboard/main.py
================================================
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
from tensorboard import default
from tensorboard import program
import tensorflow as tf
from greeter_plugin import greeter_plugin
if __name__ == '__main__':
plugins = default.get_plugins() + [greeter_plugin.GreeterPlugin]
assets = os.path.join(tf.resource_loader.get_data_files_path(), 'assets.zip')
tensorboard = program.TensorBoard(plugins, lambda: open(assets, 'rb'))
tensorboard.configure(sys.argv)
sys.exit(tensorboard.main())
gitextract_isjblovi/
├── .gitignore
├── .pylintrc
├── .travis.yml
├── AUTHORS
├── CONTRIBUTING.md
├── CONTRIBUTORS
├── LICENSE
├── README.md
├── WORKSPACE
├── bazel_tips.md
├── greeter_plugin/
│ ├── BUILD
│ ├── __init__.py
│ ├── greeter-card.html
│ ├── greeter-dashboard.html
│ ├── greeter-plugin.html
│ ├── greeter_demo.py
│ ├── greeter_plugin.py
│ └── greeter_summary.py
└── greeter_tensorboard/
├── BUILD
├── __init__.py
├── index.html
└── main.py
SYMBOL INDEX (12 symbols across 3 files)
FILE: greeter_plugin/greeter_demo.py
function run (line 32) | def run(logdir, run_name, characters, extra_character):
function run_all (line 58) | def run_all(logdir, unused_verbose=False):
function main (line 66) | def main(unused_argv):
FILE: greeter_plugin/greeter_plugin.py
class GreeterPlugin (line 27) | class GreeterPlugin(base_plugin.TBPlugin):
method __init__ (line 35) | def __init__(self, context):
method tags_route (line 47) | def tags_route(self, request):
method get_plugin_apps (line 69) | def get_plugin_apps(self):
method is_active (line 85) | def is_active(self):
method _process_string_tensor_event (line 101) | def _process_string_tensor_event(self, event):
method greetings_route (line 112) | def greetings_route(self, request):
FILE: greeter_plugin/greeter_summary.py
function op (line 30) | def op(name,
function pb (line 74) | def pb(tag, guest, display_name=None, description=None):
Condensed preview — 22 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (87K chars).
[
{
"path": ".gitignore",
"chars": 35,
"preview": "/bazel-*\n/.idea\n*.pyc\n*.egg-info/\n\n"
},
{
"path": ".pylintrc",
"chars": 15156,
"preview": "[MASTER]\n\n# A comma-separated list of package or module names from where C extensions may\n# be loaded. Extensions are lo"
},
{
"path": ".travis.yml",
"chars": 2738,
"preview": "dist: trusty\nsudo: required\n\nlanguage: python\npython:\n - \"2.7\"\n - \"3.6\"\n\nos:\n - linux\n\nbranches:\n only:\n - master"
},
{
"path": "AUTHORS",
"chars": 319,
"preview": "# This the official list of Bazel rules_closure authors for copyright purposes.\n# This file is distinct from the CONTRIB"
},
{
"path": "CONTRIBUTING.md",
"chars": 1450,
"preview": "Want to contribute? Great! First, read this page (including the small print at the end).\n\n### Before you contribute\nBefo"
},
{
"path": "CONTRIBUTORS",
"chars": 512,
"preview": "# People who have agreed to one of the CLAs and can contribute patches.\n# The AUTHORS file lists the copyright holders; "
},
{
"path": "LICENSE",
"chars": 11358,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 298,
"preview": "# Example is deprecated. Please see [example at tensorflow/tensorboard](https://github.com/tensorflow/tensorboard/blob/j"
},
{
"path": "WORKSPACE",
"chars": 7356,
"preview": "workspace(name = \"io_github_tensorflow_tensorboard_plugin_example\")\n\nload(\"@bazel_tools//tools/build_defs/repo:http.bzl\""
},
{
"path": "bazel_tips.md",
"chars": 11384,
"preview": "# TensorBoard Build Reference\n\nTensorBoard uses Bazel for building and testing. Since TensorBoard aims to\nprovide a fram"
},
{
"path": "greeter_plugin/BUILD",
"chars": 2563,
"preview": "# Copyright 2017 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"L"
},
{
"path": "greeter_plugin/__init__.py",
"chars": 596,
"preview": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# "
},
{
"path": "greeter_plugin/greeter-card.html",
"chars": 3217,
"preview": "<!--\n@license\nCopyright 2017 The TensorFlow Authors. All Rights Reserved.\n\nLicensed under the Apache License, Version 2."
},
{
"path": "greeter_plugin/greeter-dashboard.html",
"chars": 6023,
"preview": "<!--\n@license\nCopyright 2016 The TensorFlow Authors. All Rights Reserved.\nLicensed under the Apache License, Version 2.0"
},
{
"path": "greeter_plugin/greeter-plugin.html",
"chars": 3162,
"preview": "<!--\n@license\nCopyright 2017 Google Inc. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "greeter_plugin/greeter_demo.py",
"chars": 2222,
"preview": "# Copyright 2017 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"L"
},
{
"path": "greeter_plugin/greeter_plugin.py",
"chars": 4397,
"preview": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# "
},
{
"path": "greeter_plugin/greeter_summary.py",
"chars": 3624,
"preview": "# Copyright 2017 The TensorFlow Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"L"
},
{
"path": "greeter_tensorboard/BUILD",
"chars": 1881,
"preview": "load(\"@org_tensorflow_tensorboard//tensorboard/defs:vulcanize.bzl\", \"tensorboard_html_binary\")\nload(\"@org_tensorflow_ten"
},
{
"path": "greeter_tensorboard/__init__.py",
"chars": 596,
"preview": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# "
},
{
"path": "greeter_tensorboard/index.html",
"chars": 3198,
"preview": "<!doctype html>\n<!--\n@license\nCopyright 2017 Google Inc. All Rights Reserved.\n\nLicensed under the Apache License, Versio"
},
{
"path": "greeter_tensorboard/main.py",
"chars": 1174,
"preview": "# Copyright 2017 Google Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# "
}
]
About this extraction
This page contains the full source code of the tensorflow/tensorboard-plugin-example GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 22 files (81.3 KB), approximately 21.2k tokens, and a symbol index with 12 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.