Skip to content

Commit c61c396

Browse files
author
Vijay Vasudevan
committed
TensorFlow: upstream changes to git (doc fixes).
Changes: - Fix typos across several files contributed by Erik Erwitt, and Michael R. Berstein - Fix bug in translate example (fr->en typo) by schuster - Updates to some documentation (mcoram,shlens,vrv,joshl) - Fix to Android camera demo app window size detection (andrewharp) - Fix to support lookup table of high rank tensors (yleon) - Fix invalid op names for parse_example (dga) Base CL: 107531031
1 parent 9274f5a commit c61c396

File tree

25 files changed

+218
-281
lines changed

25 files changed

+218
-281
lines changed

tensorflow/core/kernels/lookup_table_op.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,14 @@ class LookupTableFindOp : public OpKernel {
109109
OP_REQUIRES_OK(ctx, ctx->MatchSignature(expected_inputs, expected_outputs));
110110

111111
const Tensor& input = ctx->input(1);
112-
OP_REQUIRES(ctx, TensorShapeUtils::IsVector(input.shape()),
113-
errors::InvalidArgument("Input must be a vector, not ",
114-
input.shape().DebugString()));
115112

116113
const Tensor& default_value = ctx->input(2);
117114
OP_REQUIRES(ctx, TensorShapeUtils::IsScalar(default_value.shape()),
118115
errors::InvalidArgument("Default value must be a scalar, not ",
119116
default_value.shape().DebugString()));
120117

121118
Tensor* out;
122-
OP_REQUIRES_OK(ctx,
123-
ctx->allocate_output("output_values", input.shape(), &out));
119+
OP_REQUIRES_OK(ctx, ctx->allocate_output("values", input.shape(), &out));
124120

125121
OP_REQUIRES_OK(ctx, table->Find(input, out, default_value));
126122
}

tensorflow/core/ops/data_flow_ops.cc

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -284,29 +284,28 @@ handle: The handle to a queue.
284284
size: The number of elements in the given queue.
285285
)doc");
286286

287-
288287
// --------------------------------------------------------------------------
289288

290289
REGISTER_OP("LookupTableFind")
291290
.Input("table_handle: Ref(string)")
292-
.Input("input_values: Tin")
291+
.Input("keys: Tin")
293292
.Input("default_value: Tout")
294-
.Output("output_values: Tout")
293+
.Output("values: Tout")
295294
.Attr("Tin: type")
296295
.Attr("Tout: type")
297296
.Doc(R"doc(
298-
Maps elements of a tensor into associated values given a lookup table.
297+
Looks up keys in a table, outputs the corresponding values.
299298
300-
If an element of the input_values is not present in the table, the
301-
specified default_value is used.
299+
The tensor `keys` must of the same type as the keys of the table.
300+
The output `values` is of the type of the table values.
302301
303-
The table needs to be initialized and the input and output types correspond
304-
to the table key and value types.
302+
The scalar `default_value` is the value output for keys not present in the
303+
table. It must also be of the same type as the table values.
305304
306-
table_handle: A handle for a lookup table.
307-
input_values: A vector of key values.
308-
default_value: A scalar to return if the input is not found in the table.
309-
output_values: A vector of values associated to the inputs.
305+
table_handle: Handle to the table.
306+
keys: Any shape. Keys to look up.
307+
values: Same shape as `keys`. Values found in the table, or `default_values`
308+
for missing keys.
310309
)doc");
311310

312311
REGISTER_OP("LookupTableSize")
@@ -315,8 +314,8 @@ REGISTER_OP("LookupTableSize")
315314
.Doc(R"doc(
316315
Computes the number of elements in the given table.
317316
318-
table_handle: The handle to a lookup table.
319-
size: The number of elements in the given table.
317+
table_handle: Handle to the table.
318+
size: Scalar that contains number of elements in the table.
320319
)doc");
321320

322321
REGISTER_OP("HashTable")
@@ -326,18 +325,19 @@ REGISTER_OP("HashTable")
326325
.Attr("key_dtype: type")
327326
.Attr("value_dtype: type")
328327
.Doc(R"doc(
329-
Creates and holds an immutable hash table.
328+
Creates a non-initialized hash table.
330329
331-
The key and value types can be specified. After initialization, the table
332-
becomes immutable.
330+
This op creates a hash table, specifying the type of its keys and values.
331+
Before using the table you will have to initialize it. After initialization the
332+
table will be immutable.
333333
334-
table_handle: a handle of a the lookup table.
335-
container: If non-empty, this hash table is placed in the given container.
336-
Otherwise, a default container is used.
337-
shared_name: If non-empty, this hash table is shared under the given name across
334+
table_handle: Handle to a table.
335+
container: If non-empty, this table is placed in the given container.
336+
Otherwise, a default container is used.
337+
shared_name: If non-empty, this table is shared under the given name across
338338
multiple sessions.
339-
key_dtype: the type of the table key.
340-
value_dtype: the type of the table value.
339+
key_dtype: Type of the table keys.
340+
value_dtype: Type of the table values.
341341
)doc");
342342

343343
REGISTER_OP("InitializeTable")
@@ -349,9 +349,9 @@ REGISTER_OP("InitializeTable")
349349
.Doc(R"doc(
350350
Table initializer that takes two tensors for keys and values respectively.
351351
352-
table_handle: a handle of the lookup table to be initialized.
353-
keys: a vector of keys of type Tkey.
354-
values: a vector of values of type Tval.
352+
table_handle: Handle to a table which will be initialized.
353+
keys: Keys of type Tkey.
354+
values: Values of type Tval. Same shape as `keys`.
355355
)doc");
356356

357357
} // namespace tensorflow

tensorflow/core/public/tensor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class Tensor {
9393

9494
/// \brief Slice this tensor along the 1st dimension.
9595

96-
/// I.e., the returned tensor satisifies
96+
/// I.e., the returned tensor satisfies
9797
/// returned[i, ...] == this[dim0_start + i, ...].
9898
/// The returned tensor shares the underlying tensor buffer with this
9999
/// tensor.

tensorflow/core/util/events_writer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ bool EventsWriter::Init() {
2525
if (FileHasDisappeared()) {
2626
// Warn user of data loss and let .reset() below do basic cleanup.
2727
if (num_outstanding_events_ > 0) {
28-
LOG(WARNING) << "Re-intialization, attempting to open a new file, "
28+
LOG(WARNING) << "Re-initialization, attempting to open a new file, "
2929
<< num_outstanding_events_ << " events will be lost.";
3030
}
3131
} else {

tensorflow/examples/android/README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,46 @@ This folder contains a simple camera-based demo application utilizing Tensorflow
66

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

1112
## To build/install/run
1213

13-
As a pre-requisite, Bazel, the Android NDK, and the Android SDK must all be
14+
As a prerequisite, Bazel, the Android NDK, and the Android SDK must all be
1415
installed on your system. The Android build tools may be obtained from:
1516
https://developer.android.com/tools/revisions/build-tools.html
1617

17-
The Android entries in [<workspace_root>/WORKSPACE](../../WORKSPACE) must be
18+
The Android entries in [`<workspace_root>/WORKSPACE`](../../WORKSPACE) must be
1819
uncommented with the paths filled in appropriately depending on where you
1920
installed the NDK and SDK. Otherwise an error such as:
2021
"The external label '//external:android/sdk' is not bound to anything" will
2122
be reported.
2223

2324
To build the APK, run this from your workspace root:
25+
26+
```bash
27+
$ bazel build //tensorflow/examples/android:tensorflow_demo -c opt --copt=-mfpu=neon
2428
```
25-
bazel build //tensorflow/examples/android:tensorflow_demo -c opt --copt=-mfpu=neon
26-
```
27-
Note that "-c opt" is currently required; if not set, an assert (for an
29+
30+
Note that `-c opt` is currently required; if not set, an assert (for an
2831
otherwise non-problematic issue) in Eigen will halt the application during
2932
execution. This issue will be corrected in an upcoming release.
3033

3134
If adb debugging is enabled on your Android 5.0 or later device, you may then
3235
use the following command from your workspace root to install the APK once
3336
built:
34-
'''
35-
adb install -r -g bazel-bin/tensorflow/examples/android/tensorflow_demo_incremental.apk
36-
'''
37+
38+
```bash
39+
$ adb install -r -g bazel-bin/tensorflow/examples/android/tensorflow_demo_incremental.apk
40+
```
3741

3842
Alternatively, a streamlined means of building, installing and running in one
3943
command is:
40-
```
41-
bazel mobile-install //tensorflow/examples/android:tensorflow_demo -c opt --start_app --copt=-mfpu=neon
44+
45+
```bash
46+
$ bazel mobile-install //tensorflow/examples/android:tensorflow_demo -c opt --start_app --copt=-mfpu=neon
4247
```
4348

4449
If camera permission errors are encountered (possible on Android Marshmallow or
45-
above), then the adb install command above should be used instead, as it
46-
automatically grants the required camera permissions with '-g'.
50+
above), then the `adb install` command above should be used instead, as it
51+
automatically grants the required camera permissions with `-g`.

tensorflow/examples/android/src/org/tensorflow/demo/CameraConnectionFragment.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
public class CameraConnectionFragment extends Fragment {
6464
private static final Logger LOGGER = new Logger();
6565

66+
/**
67+
* The camera preview size will be chosen to be the smallest frame by pixel size capable of
68+
* containing a DESIRED_SIZE x DESIRED_SIZE square.
69+
*/
70+
private static final int MINIMUM_PREVIEW_SIZE = 320;
71+
6672
private RecognitionScoreView scoreView;
6773

6874
/**
@@ -227,8 +233,7 @@ private static Size chooseOptimalSize(
227233
// Collect the supported resolutions that are at least as big as the preview Surface
228234
final List<Size> bigEnough = new ArrayList<>();
229235
for (final Size option : choices) {
230-
// TODO(andrewharp): Choose size intelligently.
231-
if (option.getHeight() == 320 && option.getWidth() == 480) {
236+
if (option.getHeight() >= MINIMUM_PREVIEW_SIZE && option.getWidth() >= MINIMUM_PREVIEW_SIZE) {
232237
LOGGER.i("Adding size: " + option.getWidth() + "x" + option.getHeight());
233238
bigEnough.add(option);
234239
} else {

tensorflow/g3doc/api_docs/cc/ClassTensor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ This tensor shares other&apos;s underlying storage. Returns `true` iff `other.sh
178178

179179
Slice this tensor along the 1st dimension.
180180

181-
I.e., the returned tensor satisifies returned[i, ...] == this[dim0_start + i, ...]. The returned tensor shares the underlying tensor buffer with this tensor.
181+
I.e., the returned tensor satisfies returned[i, ...] == this[dim0_start + i, ...]. The returned tensor shares the underlying tensor buffer with this tensor.
182182

183183
NOTE: The returned tensor may not satisfies the same alignment requirement as this tensor depending on the shape. The caller must check the returned tensor&apos;s alignment before calling certain methods that have alignment requirement (e.g., ` flat() `, `tensor()`).
184184

tensorflow/g3doc/api_docs/cc/ClassTensorBuffer.md

Lines changed: 0 additions & 52 deletions
This file was deleted.

tensorflow/g3doc/api_docs/cc/ClassTensorShapeIter.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

tensorflow/g3doc/api_docs/cc/index.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ write the graph to a file.
2727
##Classes <a class="md-anchor" id="AUTOGENERATED-classes"></a>
2828
2929
* [tensorflow::Env](../../api_docs/cc/ClassEnv.md)
30-
* [tensorflow::EnvWrapper](../../api_docs/cc/ClassEnvWrapper.md)
3130
* [tensorflow::RandomAccessFile](../../api_docs/cc/ClassRandomAccessFile.md)
31+
* [tensorflow::WritableFile](../../api_docs/cc/ClassWritableFile.md)
32+
* [tensorflow::EnvWrapper](../../api_docs/cc/ClassEnvWrapper.md)
3233
* [tensorflow::Session](../../api_docs/cc/ClassSession.md)
3334
* [tensorflow::Status](../../api_docs/cc/ClassStatus.md)
3435
* [tensorflow::Tensor](../../api_docs/cc/ClassTensor.md)
35-
* [tensorflow::TensorBuffer](../../api_docs/cc/ClassTensorBuffer.md)
3636
* [tensorflow::TensorShape](../../api_docs/cc/ClassTensorShape.md)
37-
* [tensorflow::TensorShapeIter](../../api_docs/cc/ClassTensorShapeIter.md)
3837
* [tensorflow::TensorShapeUtils](../../api_docs/cc/ClassTensorShapeUtils.md)
3938
* [tensorflow::Thread](../../api_docs/cc/ClassThread.md)
40-
* [tensorflow::WritableFile](../../api_docs/cc/ClassWritableFile.md)
4139
4240
##Structs <a class="md-anchor" id="AUTOGENERATED-structs"></a>
4341
@@ -50,17 +48,15 @@ write the graph to a file.
5048
<div class='sections-order' style="display: none;">
5149
<!--
5250
<!-- ClassEnv.md -->
53-
<!-- ClassEnvWrapper.md -->
5451
<!-- ClassRandomAccessFile.md -->
52+
<!-- ClassWritableFile.md -->
53+
<!-- ClassEnvWrapper.md -->
5554
<!-- ClassSession.md -->
5655
<!-- ClassStatus.md -->
5756
<!-- ClassTensor.md -->
58-
<!-- ClassTensorBuffer.md -->
5957
<!-- ClassTensorShape.md -->
60-
<!-- ClassTensorShapeIter.md -->
6158
<!-- ClassTensorShapeUtils.md -->
6259
<!-- ClassThread.md -->
63-
<!-- ClassWritableFile.md -->
6460
<!-- StructSessionOptions.md -->
6561
<!-- StructState.md -->
6662
<!-- StructTensorShapeDim.md -->

0 commit comments

Comments
 (0)