| 22 | namespace tensorflow { |
| 23 | |
| 24 | TEST(StateOpsTest, Assign_ShapeFn) { |
| 25 | ShapeInferenceTestOp op("Assign"); |
| 26 | |
| 27 | TF_ASSERT_OK(NodeDefBuilder("test", "Assign") |
| 28 | .Input("ref", 0, DT_FLOAT_REF) |
| 29 | .Input("value", 1, DT_FLOAT) |
| 30 | .Attr("validate_shape", true) |
| 31 | .Finalize(&op.node_def)); |
| 32 | INFER_OK(op, "[1,2];[1,2]", "in0"); |
| 33 | |
| 34 | // Resolves shapes when validate_shape is True. |
| 35 | INFER_OK(op, "[1,?];[?,2]", "[d0_0,d1_1]"); |
| 36 | |
| 37 | // validate_shape=True, fails when the shapes are not compatible. |
| 38 | INFER_ERROR("Dimension 0 in both shapes must be equal, but are 1 and 3", op, |
| 39 | "[1,?];[3,2]"); |
| 40 | |
| 41 | // Test for validate_shape=False |
| 42 | TF_ASSERT_OK(NodeDefBuilder("test", "Assign") |
| 43 | .Input("ref", 0, DT_FLOAT_REF) |
| 44 | .Input("value", 1, DT_FLOAT) |
| 45 | .Attr("validate_shape", false) |
| 46 | .Finalize(&op.node_def)); |
| 47 | INFER_OK(op, "[1,2];[1,2,3,4]", "in1"); |
| 48 | } |
| 49 | |
| 50 | TEST(StateOpsTest, ScatterUpdate_ShapeFn) { |
| 51 | ShapeInferenceTestOp op("ScatterUpdate"); |
nothing calls this directly
no test coverage detected