aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/framework
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/python/framework')
-rw-r--r--tensorflow/python/framework/device.py15
-rw-r--r--tensorflow/python/framework/device_test.py15
-rw-r--r--tensorflow/python/framework/docs.py15
-rw-r--r--tensorflow/python/framework/errors.py31
-rw-r--r--tensorflow/python/framework/errors_test.py15
-rw-r--r--tensorflow/python/framework/framework_lib.py15
-rw-r--r--tensorflow/python/framework/gen_docs_combined.py30
-rwxr-xr-xtensorflow/python/framework/gen_docs_test.sh15
-rw-r--r--tensorflow/python/framework/importer.py15
-rw-r--r--tensorflow/python/framework/importer_test.py15
-rw-r--r--tensorflow/python/framework/op_def_registry.py15
-rw-r--r--tensorflow/python/framework/ops.py86
-rw-r--r--tensorflow/python/framework/ops_test.py15
-rw-r--r--tensorflow/python/framework/python_op_gen.cc15
-rw-r--r--tensorflow/python/framework/python_op_gen.h15
-rw-r--r--tensorflow/python/framework/python_op_gen_main.cc15
-rw-r--r--tensorflow/python/framework/random_seed.py15
-rw-r--r--tensorflow/python/framework/registry.py15
-rw-r--r--tensorflow/python/framework/registry_test.py15
-rw-r--r--tensorflow/python/framework/tensor_shape.py25
-rw-r--r--tensorflow/python/framework/tensor_shape_div_test.py15
-rw-r--r--tensorflow/python/framework/tensor_shape_test.py15
-rw-r--r--tensorflow/python/framework/tensor_util.py15
-rw-r--r--tensorflow/python/framework/tensor_util_test.py15
-rw-r--r--tensorflow/python/framework/test_kernel_label_op.cc15
-rw-r--r--tensorflow/python/framework/test_util.py23
-rw-r--r--tensorflow/python/framework/test_util_test.py15
-rw-r--r--tensorflow/python/framework/types.py15
-rw-r--r--tensorflow/python/framework/types_test.py15
29 files changed, 498 insertions, 57 deletions
diff --git a/tensorflow/python/framework/device.py b/tensorflow/python/framework/device.py
index 9870c109af..557b9544fb 100644
--- a/tensorflow/python/framework/device.py
+++ b/tensorflow/python/framework/device.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Class to represent a device."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/device_test.py b/tensorflow/python/framework/device_test.py
index aaf57a406c..ded5bec1d6 100644
--- a/tensorflow/python/framework/device_test.py
+++ b/tensorflow/python/framework/device_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Tests for tensorflow.python.framework.device."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/docs.py b/tensorflow/python/framework/docs.py
index abcfe7ca5e..5aefc0d120 100644
--- a/tensorflow/python/framework/docs.py
+++ b/tensorflow/python/framework/docs.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Updates generated docs from Python doc comments.
Both updates the files in the file-system and executes g4 commands to
diff --git a/tensorflow/python/framework/errors.py b/tensorflow/python/framework/errors.py
index 68c656da85..92acc8f379 100644
--- a/tensorflow/python/framework/errors.py
+++ b/tensorflow/python/framework/errors.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Exception types for TensorFlow errors."""
from __future__ import absolute_import
from __future__ import division
@@ -20,13 +35,13 @@ class OpError(Exception):
"""
def __init__(self, node_def, op, message, error_code):
- """Creates a new OpError indicating that a particular op failed.
+ """Creates a new `OpError` indicating that a particular op failed.
Args:
- node_def: The graph_pb2.NodeDef proto representing the op that failed.
- op: The ops.Operation that failed, if known; otherwise None.
+ node_def: The `graph_pb2.NodeDef` proto representing the op that failed.
+ op: The `ops.Operation` that failed, if known; otherwise None.
message: The message string describing the failure.
- error_code: The error_codes_pb2.Code describing the error.
+ error_code: The `error_codes_pb2.Code` describing the error.
"""
super(OpError, self).__init__()
self._message = message
@@ -45,10 +60,10 @@ class OpError(Exception):
*N.B.* If the failed op was synthesized at runtime, e.g. a `Send`
or `Recv` op, there will be no corresponding
- [`Operation`](../../api_docs/python/framework.md#Operation) object. In that case, this
- will return `None`, and you should instead use the
- [`OpError.node_def`](#OpError.node_def) to discover information about the
- op.
+ [`Operation`](../../api_docs/python/framework.md#Operation)
+ object. In that case, this will return `None`, and you should
+ instead use the [`OpError.node_def`](#OpError.node_def) to
+ discover information about the op.
Returns:
The `Operation` that failed, or None.
diff --git a/tensorflow/python/framework/errors_test.py b/tensorflow/python/framework/errors_test.py
index 23bb5d7f66..83eca5848d 100644
--- a/tensorflow/python/framework/errors_test.py
+++ b/tensorflow/python/framework/errors_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Tests for tensorflow.python.framework.errors."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/framework_lib.py b/tensorflow/python/framework/framework_lib.py
index 3c9d941a35..9803401e2c 100644
--- a/tensorflow/python/framework/framework_lib.py
+++ b/tensorflow/python/framework/framework_lib.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
# pylint: disable=wildcard-import,unused-import,g-bad-import-order,line-too-long
"""Classes and functions for building TensorFlow graphs.
diff --git a/tensorflow/python/framework/gen_docs_combined.py b/tensorflow/python/framework/gen_docs_combined.py
index 1f426e00b5..9646ef6673 100644
--- a/tensorflow/python/framework/gen_docs_combined.py
+++ b/tensorflow/python/framework/gen_docs_combined.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Updates generated docs from Python doc comments."""
from __future__ import absolute_import
from __future__ import division
@@ -91,7 +106,7 @@ def all_libraries(module_to_name, members, documented):
"RankingExample", "SequenceExample"]),
]
-_hidden_symbols = ["Event", "Summary",
+_hidden_symbols = ["Event", "Summary", "xrange",
"HistogramProto", "ConfigProto", "NodeDef", "GraphDef",
"GPUOptions", "SessionInterface", "BaseSession"]
@@ -105,6 +120,15 @@ def main(unused_argv):
module_to_name = get_module_to_name()
members = docs.collect_members(module_to_name)
libraries = all_libraries(module_to_name, members, documented)
+
+ # Define catch_all library before calling write_libraries to avoid complaining
+ # about generically hidden symbols.
+ catch_all = docs.Library(title="Catch All", module=None,
+ exclude_symbols=_hidden_symbols,
+ module_to_name=module_to_name, members=members,
+ documented=documented)
+
+ # Write docs to files
docs.write_libraries(FLAGS.out_dir, libraries)
# Make it easy to search for hidden symbols
@@ -115,10 +139,6 @@ def main(unused_argv):
print(r"hidden symbols regex = r'\b(%s)\b'" % "|".join(sorted(hidden)))
# Verify that all symbols are mentioned in some library doc.
- catch_all = docs.Library(title="Catch All", module=None,
- exclude_symbols=_hidden_symbols,
- module_to_name=module_to_name, members=members,
- documented=documented)
catch_all.assert_no_leftovers()
# Generate index
diff --git a/tensorflow/python/framework/gen_docs_test.sh b/tensorflow/python/framework/gen_docs_test.sh
index fda214d93c..06616bb490 100755
--- a/tensorflow/python/framework/gen_docs_test.sh
+++ b/tensorflow/python/framework/gen_docs_test.sh
@@ -1,4 +1,19 @@
#!/bin/bash -eux
+# Copyright 2015 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.
+# ==============================================================================
+
DIR=$TEST_SRCDIR/tensorflow/python
$DIR/gen_docs_combined --out_dir $TEST_TMPDIR
echo "PASS"
diff --git a/tensorflow/python/framework/importer.py b/tensorflow/python/framework/importer.py
index 25befa6dc3..ee3d130f62 100644
--- a/tensorflow/python/framework/importer.py
+++ b/tensorflow/python/framework/importer.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""A utility function for importing TensorFlow graphs."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/importer_test.py b/tensorflow/python/framework/importer_test.py
index c5eb23f05b..95059b17d7 100644
--- a/tensorflow/python/framework/importer_test.py
+++ b/tensorflow/python/framework/importer_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Tests for tensorflow.python.framework.importer."""
from __future__ import absolute_import
diff --git a/tensorflow/python/framework/op_def_registry.py b/tensorflow/python/framework/op_def_registry.py
index 28e55a47a4..5ca0bb9078 100644
--- a/tensorflow/python/framework/op_def_registry.py
+++ b/tensorflow/python/framework/op_def_registry.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Global registry for OpDefs."""
from __future__ import absolute_import
diff --git a/tensorflow/python/framework/ops.py b/tensorflow/python/framework/ops.py
index 1dc98d4298..00bd776fad 100644
--- a/tensorflow/python/framework/ops.py
+++ b/tensorflow/python/framework/ops.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Classes and functions used to construct graphs."""
# pylint: disable=g-bad-name
from __future__ import absolute_import
@@ -171,7 +186,7 @@ class Tensor(object):
op: An `Operation`. `Operation` that computes this tensor.
value_index: An `int`. Index of the operation's endpoint that produces
this tensor.
- dtype: A `types.DType`. Type of data stored in this tensor.
+ dtype: A `DType`. Type of elements stored in this tensor.
Raises:
TypeError: If the op is not an `Operation`.
@@ -921,39 +936,39 @@ class Operation(object):
op_def=None):
"""Creates an `Operation`.
- NOTE: This constructor validates the name of the Operation (passed
- as "node_def.name"). Valid Operation names match the following
+ NOTE: This constructor validates the name of the `Operation` (passed
+ as `node_def.name`). Valid `Operation` names match the following
regular expression:
- [A-Za-z0-9.][A-Za-z0-9_.\\-/]*
+ [A-Za-z0-9.][A-Za-z0-9_.\\-/]*
Args:
- node_def: graph_pb2.NodeDef. NodeDef for the Operation.
- Used for attributes of graph_pb2.NodeDef, typically "name",
- "op", and "device". The "input" attribute is irrelevant here
+ node_def: `graph_pb2.NodeDef`. `NodeDef` for the `Operation`.
+ Used for attributes of `graph_pb2.NodeDef`, typically `name`,
+ `op`, and `device`. The `input` attribute is irrelevant here
as it will be computed when generating the model.
- g: Graph. The parent graph.
- inputs: list of Tensor objects. The inputs to this Operation.
- output_types: list of types_pb2.DataType. List of the types of the
- Tensors computed by this operation. The length of this list indicates
- the number of output endpoints of the Operation.
+ g: `Graph`. The parent graph.
+ inputs: list of `Tensor` objects. The inputs to this `Operation`.
+ output_types: list of `DType` objects. List of the types of the
+ `Tensors` computed by this operation. The length of this list indicates
+ the number of output endpoints of the `Operation`.
control_inputs: list of operations or tensors from which to have a
control dependency.
- input_types: List of types_pb2.DataType representing the
- types of the Tensors accepted by the Operation. By default
- uses [x.dtype.base_dtype for x in inputs]. Operations that expect
+ input_types: List of `DType` objects representing the
+ types of the tensors accepted by the `Operation`. By default
+ uses `[x.dtype.base_dtype for x in inputs]`. Operations that expect
reference-typed inputs must specify these explicitly.
- original_op: Optional. Used to associate the new Operation with an
- existing Operation (for example, a replica with the op that was
+ original_op: Optional. Used to associate the new `Operation` with an
+ existing `Operation` (for example, a replica with the op that was
replicated).
- op_def: Optional. The op_def_pb2.OpDef proto that describes the
- op type that this Operation represents.
+ op_def: Optional. The `op_def_pb2.OpDef` proto that describes the
+ op type that this `Operation` represents.
Raises:
TypeError: if control inputs are not Operations or Tensors,
- or if node_def is not a NodeDef,
- or if g is not a Graph,
- or if inputs are not Tensors,
+ or if node_def is not a `NodeDef`,
+ or if g is not a `Graph`,
+ or if inputs are not tensors,
or if inputs and input_types are incompatible.
ValueError: if the node_def name is not valid.
"""
@@ -2149,19 +2164,20 @@ class Graph(object):
# pylint: enable=g-doc-return-or-yield
def unique_name(self, name):
- """Return a unique Operation name for "name".
+ """Return a unique operation name for `name`.
- Note: You rarely need to call unique_name() directly. Most of the time you
- just need to create "with g.name_scope()" blocks to generate structured
- names.
+ Note: You rarely need to call `unique_name()` directly. Most of
+ the time you just need to create `with g.name_scope()` blocks to
+ generate structured names.
- `unique_name` is used to generate structured names, separated by "/",
- to help identify Operations when debugging a Graph. Operation names
- are displayed in error messages reported by the TensorFlow runtime,
- and in various visualization tools such as TensorBoard.
+ `unique_name` is used to generate structured names, separated by
+ `"/"`, to help identify operations when debugging a graph.
+ Operation names are displayed in error messages reported by the
+ TensorFlow runtime, and in various visualization tools such as
+ TensorBoard.
Args:
- name: The name for an `Operation`.
+ name: The name for an operation.
Returns:
A string to be passed to `create_op()` that will be used
@@ -2218,7 +2234,7 @@ class Graph(object):
def _push_default_device_function(self, device_function):
"""Pushes the given function onto the stack of device functions.
- See Graph.device for more details.
+ See `Graph.device` for more details.
Args:
device_function: The function to be pushed onto the stack of device
@@ -2229,7 +2245,7 @@ class Graph(object):
def _pop_default_device_function(self, device_function):
"""Pops the given function from the stack of device functions.
- See Graph.device for more details.
+ See `Graph.device` for more details.
Args:
device_function: The function to be popped from the stack of device
@@ -2773,8 +2789,8 @@ def _eval_using_default_session(tensors, feed_dict, graph, session=None):
session = get_default_session()
if session is None:
raise ValueError("Cannot evaluate tensor using eval(): No default "
- "session is registered. Use 'with "
- "DefaultSession(sess)' or pass an explicit session to "
+ "session is registered. Use `with "
+ "sess.as_default()` or pass an explicit session to "
"eval(session=sess)")
if session.graph is not graph:
raise ValueError("Cannot use the default session to evaluate tensor: "
diff --git a/tensorflow/python/framework/ops_test.py b/tensorflow/python/framework/ops_test.py
index 3ade3ee228..d9dbd99b29 100644
--- a/tensorflow/python/framework/ops_test.py
+++ b/tensorflow/python/framework/ops_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Tests for tensorflow.python.framework.ops."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/python_op_gen.cc b/tensorflow/python/framework/python_op_gen.cc
index 5c1b4462d5..ae28319a38 100644
--- a/tensorflow/python/framework/python_op_gen.cc
+++ b/tensorflow/python/framework/python_op_gen.cc
@@ -1,3 +1,18 @@
+/* Copyright 2015 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.
+==============================================================================*/
+
#include "tensorflow/python/framework/python_op_gen.h"
#include <stdio.h>
diff --git a/tensorflow/python/framework/python_op_gen.h b/tensorflow/python/framework/python_op_gen.h
index 488f7431e0..b998f2247b 100644
--- a/tensorflow/python/framework/python_op_gen.h
+++ b/tensorflow/python/framework/python_op_gen.h
@@ -1,3 +1,18 @@
+/* Copyright 2015 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.
+==============================================================================*/
+
#ifndef TENSORFLOW_PYTHON_FRAMEWORK_PYTHON_OP_GEN_H_
#define TENSORFLOW_PYTHON_FRAMEWORK_PYTHON_OP_GEN_H_
diff --git a/tensorflow/python/framework/python_op_gen_main.cc b/tensorflow/python/framework/python_op_gen_main.cc
index 29afe35598..55c4c22685 100644
--- a/tensorflow/python/framework/python_op_gen_main.cc
+++ b/tensorflow/python/framework/python_op_gen_main.cc
@@ -1,3 +1,18 @@
+/* Copyright 2015 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.
+==============================================================================*/
+
#include "tensorflow/python/framework/python_op_gen.h"
#include "tensorflow/core/framework/op.h"
diff --git a/tensorflow/python/framework/random_seed.py b/tensorflow/python/framework/random_seed.py
index 96e599e1c7..dd0ef53c93 100644
--- a/tensorflow/python/framework/random_seed.py
+++ b/tensorflow/python/framework/random_seed.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""For seeding individual ops based on a graph-level seed.
"""
diff --git a/tensorflow/python/framework/registry.py b/tensorflow/python/framework/registry.py
index ec914c37aa..de91cc2511 100644
--- a/tensorflow/python/framework/registry.py
+++ b/tensorflow/python/framework/registry.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Registry mechanism for "registering" classes/functions for general use.
This is typically used with a decorator that calls Register for adding
diff --git a/tensorflow/python/framework/registry_test.py b/tensorflow/python/framework/registry_test.py
index 702f20c7eb..c173994c6c 100644
--- a/tensorflow/python/framework/registry_test.py
+++ b/tensorflow/python/framework/registry_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Tests for tensorflow.ops.registry."""
from __future__ import absolute_import
diff --git a/tensorflow/python/framework/tensor_shape.py b/tensorflow/python/framework/tensor_shape.py
index 865533cf92..83d27de004 100644
--- a/tensorflow/python/framework/tensor_shape.py
+++ b/tensorflow/python/framework/tensor_shape.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Helper classes for tensor shape inference."""
from __future__ import absolute_import
from __future__ import division
@@ -77,11 +92,11 @@ class Dimension(object):
Dimensions are combined as follows:
- Dimension(n) .merge_with(Dimension(n)) == Dimension(n)
- Dimension(n) .merge_with(Dimension(None)) == Dimension(n)
- Dimension(None).merge_with(Dimension(n)) == Dimension(n)
- Dimension(None).merge_with(Dimension(None)) == Dimension(None)
- Dimension(n) .merge_with(Dimension(m)) raises ValueError for n != m
+ Dimension(n) .merge_with(Dimension(n)) == Dimension(n)
+ Dimension(n) .merge_with(Dimension(None)) == Dimension(n)
+ Dimension(None).merge_with(Dimension(n)) == Dimension(n)
+ Dimension(None).merge_with(Dimension(None)) == Dimension(None)
+ Dimension(n) .merge_with(Dimension(m)) raises ValueError for n != m
Args:
other: Another Dimension.
diff --git a/tensorflow/python/framework/tensor_shape_div_test.py b/tensorflow/python/framework/tensor_shape_div_test.py
index 27219dbb9a..4a0e39ec86 100644
--- a/tensorflow/python/framework/tensor_shape_div_test.py
+++ b/tensorflow/python/framework/tensor_shape_div_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Test that old style division works for Dimension."""
from __future__ import absolute_import
# from __future__ import division # Intentionally skip this import
diff --git a/tensorflow/python/framework/tensor_shape_test.py b/tensorflow/python/framework/tensor_shape_test.py
index 43cadc7b13..05681c4b16 100644
--- a/tensorflow/python/framework/tensor_shape_test.py
+++ b/tensorflow/python/framework/tensor_shape_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Functional tests for shape inference helper classes."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/tensor_util.py b/tensorflow/python/framework/tensor_util.py
index c872223b39..b904912da7 100644
--- a/tensorflow/python/framework/tensor_util.py
+++ b/tensorflow/python/framework/tensor_util.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Utilities to create TensorProtos."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/tensor_util_test.py b/tensorflow/python/framework/tensor_util_test.py
index 6f5c34d185..6a05d2d54b 100644
--- a/tensorflow/python/framework/tensor_util_test.py
+++ b/tensorflow/python/framework/tensor_util_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Functional tests for tensor_util."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/test_kernel_label_op.cc b/tensorflow/python/framework/test_kernel_label_op.cc
index 50f8522e1b..2477232e73 100644
--- a/tensorflow/python/framework/test_kernel_label_op.cc
+++ b/tensorflow/python/framework/test_kernel_label_op.cc
@@ -1,3 +1,18 @@
+/* Copyright 2015 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.
+==============================================================================*/
+
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/public/status.h"
diff --git a/tensorflow/python/framework/test_util.py b/tensorflow/python/framework/test_util.py
index e645d772e9..c8a6fcacbc 100644
--- a/tensorflow/python/framework/test_util.py
+++ b/tensorflow/python/framework/test_util.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
# pylint: disable=invalid-name
"""Test utils for tensorflow."""
from __future__ import absolute_import
@@ -62,16 +77,16 @@ class TensorFlowTestCase(googletest.TestCase):
def _AssertProtoEquals(self, a, b):
"""Asserts that a and b are the same proto.
- Uses Proto2Cmp() first, as it returns correct results
- for floating point attributes, and then use assertProto2Equal()
+ Uses ProtoEq() first, as it returns correct results
+ for floating point attributes, and then use assertProtoEqual()
in case of failure as it provides good error messages.
Args:
a: a proto.
b: another proto.
"""
- if compare.Proto2Cmp(a, b) != 0:
- compare.assertProto2Equal(self, a, b, normalize_numbers=True)
+ if not compare.ProtoEq(a, b):
+ compare.assertProtoEqual(self, a, b, normalize_numbers=True)
def assertProtoEquals(self, expected_message_maybe_ascii, message):
"""Asserts that message is same as parsed expected_message_ascii.
diff --git a/tensorflow/python/framework/test_util_test.py b/tensorflow/python/framework/test_util_test.py
index fc84797501..4a61c65a27 100644
--- a/tensorflow/python/framework/test_util_test.py
+++ b/tensorflow/python/framework/test_util_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Tests for tensorflow.ops.test_util."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/types.py b/tensorflow/python/framework/types.py
index ffb9d0f213..123dba558f 100644
--- a/tensorflow/python/framework/types.py
+++ b/tensorflow/python/framework/types.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Library of dtypes (Tensor element types)."""
from __future__ import absolute_import
from __future__ import division
diff --git a/tensorflow/python/framework/types_test.py b/tensorflow/python/framework/types_test.py
index 8686942baf..90b11f3f00 100644
--- a/tensorflow/python/framework/types_test.py
+++ b/tensorflow/python/framework/types_test.py
@@ -1,3 +1,18 @@
+# Copyright 2015 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.
+# ==============================================================================
+
"""Tests for tensorflow.python.framework.importer."""
from __future__ import absolute_import
from __future__ import division