Commit Graph

29 Commits

Author SHA1 Message Date
Sergei Lebedev
205bf5260c Removed internal calls to @RegisterShape and related APIs
All of that code is effectively dead since shape inference happens in C++.

PiperOrigin-RevId: 269904930
2019-09-18 15:44:15 -07:00
Sergei Lebedev
bca5e7385f Inlined tensor_shape.{scalar,vector,matrix}
Explicit constructor call is no less clear and match what we export via
the public API.

The functions will be removed once all the internal users are migrated.

PiperOrigin-RevId: 259620054
2019-07-23 15:33:44 -07:00
Gaurav Jain
3afb32ce1f Use TF_Status* SWIG typemap
This avoids the need to use raise_exception_on_not_ok_status
which has been removed from the v2 API.

PiperOrigin-RevId: 244049607
2019-04-17 13:06:01 -07:00
Akshay Modi
dd1ce0fd8f Minor eager mode improvements
Mainly doesn't get shape when getting rank will suffice.

Before:
entry {
  name: "EagerLinearRegressionBenchmark.eager_train_cpu"
  iters: 2000
  wall_time: 1.54617094994
  extras {
    key: "examples_per_sec"
    value {
      double_value: 82785.1538701
    }
  }
}

After:
entry {
  name: "EagerLinearRegressionBenchmark.eager_train_cpu"
  iters: 2000
  wall_time: 1.38547611237
  extras {
    key: "examples_per_sec"
    value {
      double_value: 92387.0132856
    }
  }
}
PiperOrigin-RevId: 204001196
2018-07-10 13:29:29 -07:00
Naman Kamra
df803bd35b
fixed typo in docstring for unchanged shape method 2018-02-15 17:51:49 +04:00
Asim Shankar
e3441ac3bf eager: Add tests for backprop.py
This includes some changes to operator overloading:
(a) TensorNode is more consistent with the operator overloads in Tensor
(b) Additionally, it has __eq__ and __ne__ overloads which were needed
    to make the transition from ops.embedding_lookup to tf.nn.embedding_lookup
    possible. However, this is inconsistent with overloads for Tensor
    so is something that will be looked at in a follow up.

PiperOrigin-RevId: 165816199
2017-08-19 11:21:27 -07:00
Jonathan Hseu
9cc871e81c Merge changes from github.
END_PUBLIC

---
Commit daa67ad17 authored by Jonathan Hseu<vomjom@vomjom.net>
Committed by Frank Chen<frankchn@gmail.com>:
Remove unittest import ()

---
Commit 491beb74c authored by A. Unique TensorFlower<gardener@tensorflow.org>
Committed by TensorFlower Gardener<gardener@tensorflow.org>:
BEGIN_PUBLIC
Automated g4 rollback of changelist 162423171

PiperOrigin-RevId: 162541442
2017-07-19 15:12:25 -07:00
A. Unique TensorFlower
8e868cf6a1 Remove unused arguments to call_cpp_shape_fn.
PiperOrigin-RevId: 157640125
2017-05-31 15:04:53 -07:00
A. Unique TensorFlower
eae7e833f1 Change shape inference so that a single resource tensor can carry
shape and type information for multiple tensors.

Apply this to QueueDequeueV2 handled by grappler.

PiperOrigin-RevId: 157163757
2017-05-25 15:49:45 -07:00
A. Unique TensorFlower
b177e37207 Add the graphdef version to InferenceContext and to ShapeRefiner::AddNode.
Use this to allow loading reductions saved with older graphdefs.

Change GraphConstructor to not increase the version when importing, but instead take the min of all versions.
Change: 149152437
2017-03-03 14:26:26 -08:00
A. Unique TensorFlower
3b145acb49 In call_cpp_shape_fn, use whether the shape inference fn requested input tensor
values to rerun the shape inference function. This removes the need to pass
input_tensors_needed and input_tensor_as_shapes_needed.

Remove calls to call_cpp_shape_fn that pass input_tensors_needed or
inptu_tensor_as_shapes_needed.
Change: 139228180
2016-11-15 12:02:55 -08:00
A. Unique TensorFlower
897c3e2dd6 Make the python default for shape fn be call_cpp_shape_fn.
Remove explicit RegisterShape calls that used call_cpp_shape_fn without
input_tensors_needed arguments.

Remove requirement that C++ shape functions be specified.
Change: 139089667
2016-11-14 10:44:25 -08:00
Vijay Vasudevan
7e3608db28 Switch Const to call_cpp_shape_fn, but still do work in python to avoid serializing
large constants for now.
Change: 138922651
2016-11-11 15:07:50 -08:00
A. Unique TensorFlower
f86d96d2b2 Fix call_cpp_shape_fn's option for comparing to python (needs to convert result
from proto TensorShape before comparison).
Change: 138668146
2016-11-09 12:22:07 -08:00
A. Unique TensorFlower
6d4956edb0 Allow passing constant_value_as_shape from call_cpp_shape_fn to the C++ shape
inference. Delegate to C++ shape function for Reshape.

Fix reshape to handle attempting to infer unknown dim when product of known
elements is 0.
Change: 137837591
2016-11-01 10:19:48 -07:00
A. Unique TensorFlower
41734d78d3 Automated rollback of change 137740850
Change: 137747341
2016-10-31 14:19:03 -07:00
A. Unique TensorFlower
2940b6c9ac Automated rollback of change 137731142
Change: 137740850
2016-10-31 13:38:39 -07:00
A. Unique TensorFlower
0d616c4565 Adds functionality for shape inference and dtype checking of variable-based resources.
Does not implement these resources yet as this change is big enough already.
Change: 137731142
2016-10-31 12:18:22 -07:00
A. Unique TensorFlower
edaf3b342d Merge changes from github.
Change: 135698415
2016-10-10 11:35:00 -07:00
A. Unique TensorFlower
df929330cf Switch ops in array_ops to use C++ shape functions.
Also:
- Fix output depth dimension computation for C++ ExtractImagePatches function.
- Add dim range check to ExpandDims.
- Make debug_python_shape_fn error if python shape fn returns an error when
  C++ does not.
- Add C++ implementations for StridedSliceGrad; this gives slightly more
  accurate output when input shape but not constant values is known.
Change: 132910226
2016-09-12 13:32:46 -07:00
A. Unique TensorFlower
c3a30a230f Switch nn_ops shape fns to delegate to C++, for all that have a C++
implementation (fractional pool ones don't yet).

Change BiasAdd functions to require only rank 3, not 4, for NHWC. This matches
the behavior of GetBiasValueDims in bias_op.cc.

Removed unused functions common_shapes.bias_add_shape and
common_shapes.bias_add_grad_shape.
Change: 132597521
2016-09-08 14:17:40 -07:00
A. Unique TensorFlower
9205b55c6b Switch several ops in array_ops.py to use C++ shape functions.
Change C++ shape function for ExpandDims to be more permissive - it now allows
'dim' to be any tensor with 1 element, although that is not currently
converted to use C++ because of a separate issue to fix first (later change).

Change C++ shape functions for SpaceToBatch and BatchToSpace to output rank-4
unknown shapes.
Change: 132578764
2016-09-08 11:32:57 -07:00
A. Unique TensorFlower
7e538db04d When calling C++ shape functions from python shape functions,
allow passing the result of python's constant_value for some input tensors.

Use this on some existing math ops to delegate to python.

This updates Pack to merge all inputs before checking ndims is None, which
allows more merging possibilities.

Changes to Reduction C++ shape function to match python version.
Change: 132434990
2016-09-07 07:47:52 -07:00
A. Unique TensorFlower
9500a23ae1 Add debug_python_shape_fn to call_cpp_shape_fn.
Change: 132026995
2016-09-01 21:47:56 -07:00
A. Unique TensorFlower
e11b99749d Automated rollback of change 131739513
Change: 131887027
2016-08-31 16:33:37 -07:00
A. Unique TensorFlower
a7fc9f53fa Enable C++ shape function for math_ops.py and array_ops.cc shape functions that
don't require access to the input constant tensor, and for which the C++
function's behavior matches python.

Fix rank check in C++ BatchMatMul shape function.
Fix rank check in C++ sparse cwise shape function.

Add an option on common_shapes.call_cpp_shape_fn to verify against the python
shape function. This is meant to be called only when preparing a change to
switch shape functions over.
Change: 131739513
2016-08-30 12:17:55 -07:00
A. Unique TensorFlower
011402d898 Allow a python shape inference fn to delegate to the cpp shape
inference function. Enable this for MatMul and SparseMatMul.
Change: 131097313
2016-08-23 14:46:32 -07:00
A. Unique TensorFlower
fddaa6b035 Move _BroadcastShape to a separate function in tensor_shape.
Change: 129887373
2016-08-10 11:18:48 -07:00
Olivia Nordquist
a558c6e3b3 Execute TODOs to
move client/graph_util.py
ops/common_shapes.py
ops/constant_op.py
ops/op_def_library.py to framework/.
Also moved 2 corresponding test files and fixed some linting errors
Change: 124885409
2016-06-14 15:03:59 -07:00