Skip to content

Commit f7918e1

Browse files
author
Vijay Vasudevan
committed
TensorFlow: Removal of large assets and small other fixes.
Changes: - Remove all large assets from the repoistory, incuding the other 50MiB model protobuf and a lot of images in our g3doc directory. We will maintain these assets externally for now. g3doc images may be broken for a little bit, but the website will be fine, which is the important resource. By @vrv and @petewarden. Updates READMES to reflect the external model resources. - Fix to saver's latest_checkpoint function by Zhifeng - Made protos visibility public by @vrv - Updates to docs by @mrry, Andy - Embed tensorboard resource for summary icon by Daniel - More updates to backwars compat by @josh11b Base CL: 108194981
1 parent ab34d55 commit f7918e1

File tree

22 files changed

+184
-2066
lines changed

22 files changed

+184
-2066
lines changed

tensorflow/core/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ tf_proto_library(
301301
go_api_version = 2,
302302
java_api_version = 2,
303303
py_api_version = 2, # TODO(irving): Handle 3
304-
visibility = ["//tensorflow:internal"],
304+
visibility = ["//visibility:public"],
305305
)
306306

307307
cc_library(

tensorflow/core/framework/op_def_util.cc

+39
Original file line numberDiff line numberDiff line change
@@ -499,4 +499,43 @@ Status OpDefCompatible(const OpDef& old_op, const OpDef& new_op) {
499499
return Status::OK();
500500
}
501501

502+
Status OpDefAddedDefaultsUnchanged(const OpDef& old_op,
503+
const OpDef& penultimate_op,
504+
const OpDef& new_op) {
505+
AttrMap new_attrs, old_attrs;
506+
FillAttrMap(old_op, &old_attrs);
507+
FillAttrMap(new_op, &new_attrs);
508+
509+
for (const auto& penultimate_attr : penultimate_op.attr()) {
510+
const OpDef::AttrDef* old_attr =
511+
gtl::FindPtrOrNull(old_attrs, penultimate_attr.name());
512+
if (old_attr != nullptr) continue; // attr wasn't added
513+
const OpDef::AttrDef* new_attr =
514+
gtl::FindPtrOrNull(new_attrs, penultimate_attr.name());
515+
516+
// These shouldn't happen if the op passed OpDefCompatible().
517+
if (new_attr == nullptr) {
518+
return errors::InvalidArgument("Missing attr '", penultimate_attr.name(),
519+
"' in op: ", SummarizeOpDef(new_op));
520+
}
521+
if (!penultimate_attr.has_default_value() ||
522+
!new_attr->has_default_value()) {
523+
return errors::InvalidArgument("Missing default for attr '",
524+
penultimate_attr.name(), "' in op: ",
525+
SummarizeOpDef(new_op));
526+
}
527+
528+
// Actually test that the attr's default value hasn't changed.
529+
if (!AreAttrValuesEqual(penultimate_attr.default_value(),
530+
new_attr->default_value())) {
531+
return errors::InvalidArgument(
532+
"Can't change default value for attr '", penultimate_attr.name(),
533+
"' from ", SummarizeAttrValue(penultimate_attr.default_value()),
534+
" in op: ", SummarizeOpDef(new_op));
535+
}
536+
}
537+
538+
return Status::OK();
539+
}
540+
502541
} // namespace tensorflow

tensorflow/core/framework/op_def_util.h

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ string SummarizeOpDef(const OpDef& op_def);
3232
// REQUIRES: old_op and new_op must pass validation.
3333
Status OpDefCompatible(const OpDef& old_op, const OpDef& new_op);
3434

35+
// Returns an error if any attr in penultimate_op that is not in old_op
36+
// has a different default value in new_op. In general it is not safe
37+
// to change the default for an attr that has been added to an op.
38+
Status OpDefAddedDefaultsUnchanged(const OpDef& old_op,
39+
const OpDef& penultimate_op,
40+
const OpDef& new_op);
41+
3542
} // namespace tensorflow
3643

3744
#endif // TENSORFLOW_FRAMEWORK_OP_DEF_UTIL_H_

tensorflow/core/graph/graph_partition.cc

+4
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,10 @@ Status Partition(const PartitionOptions& opts, Graph* g,
996996

997997
if (!edge->IsControlEdge() &&
998998
IsRefType(src->output_type(edge->src_output()))) {
999+
AddNodeAttr("_start_time", recv_start_time, recv);
1000+
if (real_recv != recv) {
1001+
AddNodeAttr("_start_time", recv_start_time, real_recv);
1002+
}
9991003
// If src is of ref type and the edge is not a control edge, dst has
10001004
// read semantics and therefore we must control the recv.
10011005
ref_recvs.push_back(real_recv);

tensorflow/examples/android/README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ This folder contains a simple camera-based demo application utilizing Tensorflow
55
## Description
66

77
This demo uses a Google Inception model to classify camera frames in real-time,
8-
displaying the top results in an overlay on the camera image. See
9-
[`assets/imagenet_comp_graph_label_strings.txt`](assets/imagenet_comp_graph_label_strings.txt)
10-
for the possible classifications.
8+
displaying the top results in an overlay on the camera image.
119

1210
## To build/install/run
1311

@@ -21,7 +19,21 @@ installed the NDK and SDK. Otherwise an error such as:
2119
"The external label '//external:android/sdk' is not bound to anything" will
2220
be reported.
2321

24-
To build the APK, run this from your workspace root:
22+
The TensorFlow `GraphDef` that contains the model definition and weights
23+
is not packaged in the repo because of its size. Instead, you must
24+
first download the file to the `assets` directory in the source tree:
25+
26+
```bash
27+
$ wget https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip -O tensorflow/examples/android/assets/inception5h.zip
28+
29+
$ unzip tensorflow/examples/android/assets/inception5h.zip -d tensorflow/examples/android/assets/
30+
```
31+
32+
The labels file describing the possible classification will also be in the
33+
assets directory.
34+
35+
Then, after editing your WORKSPACE file, you must build the APK. Run this from
36+
your workspace root:
2537

2638
```bash
2739
$ bazel build //tensorflow/examples/android:tensorflow_demo -c opt --copt=-mfpu=neon

0 commit comments

Comments
 (0)