16b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 26b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 36b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerLicensed under the Apache License, Version 2.0 (the "License"); 46b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 56b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerYou may obtain a copy of the License at 66b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 76b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower http://www.apache.org/licenses/LICENSE-2.0 86b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 96b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerUnless required by applicable law or agreed to in writing, software 106b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerdistributed under the License is distributed on an "AS IS" BASIS, 116b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 126b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerSee the License for the specific language governing permissions and 136b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerlimitations under the License. 146b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower==============================================================================*/ 156b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 166b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower#include "tensorflow/c/c_api.h" 176b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower#include "tensorflow/core/framework/op.h" 186b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower#include "tensorflow/core/framework/shape_inference_testutil.h" 196b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower#include "tensorflow/core/lib/core/status_test_util.h" 206b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower#include "tensorflow/core/platform/test.h" 216b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 226b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowernamespace tensorflow { 236b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 246b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerclass GruOpsTest : public ::testing::Test { 256b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower public: 266b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower static void SetUpTestCase() { 276b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower TF_Status* status = TF_NewStatus(); 286b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower auto* lib = TF_LoadLibrary( 296b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower "tensorflow/contrib/rnn/python/ops/_gru_ops.so", status); 30d9ae30a17a0fea8666db00e13bcfb760be998988Suharsh Sivakumar TF_Code code = TF_GetCode(status); 31d9ae30a17a0fea8666db00e13bcfb760be998988Suharsh Sivakumar string status_msg(TF_Message(status)); 326b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower TF_DeleteStatus(status); 33d9ae30a17a0fea8666db00e13bcfb760be998988Suharsh Sivakumar ASSERT_EQ(TF_OK, code) << status_msg; 346b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower TF_DeleteLibraryHandle(lib); 356b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower } 366b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower}; 376b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 386b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerTEST_F(GruOpsTest, GRUBlockCell_ShapeFn) { 396b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower ShapeInferenceTestOp op("GRUBlockCell"); 406b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 416b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower // Rank checks. 426b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_ERROR("must be rank 2", op, "[?];?;?;?;?;?"); 436b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_ERROR("must be rank 2", op, "?;[?];?;?;?;?"); 446b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 456b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower // Output 466b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_OK(op, "?;?;?;?;?;?", "[?,?];[?,?];[?,?];[?,?]"); 476b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_OK(op, "[?,?];[?,?];?;?;?;?", 486b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower "[d0_0,d1_1];[d0_0,d1_1];[d0_0,d1_1];[d0_0,d1_1]"); 496b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower} 506b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 516b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlowerTEST_F(GruOpsTest, GRUBlockCellGrad_ShapeFn) { 526b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower ShapeInferenceTestOp op("GRUBlockCellGrad"); 536b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 546b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower // Rank checks. 556b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_ERROR("must be rank 2", op, "[?];?;?;?;?;?;?;?;?;?"); 566b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_ERROR("must be rank 2", op, "?;[?];?;?;?;?;?;?;?;?"); 576b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_ERROR("must be rank 2", op, "?;?;[?];?;?;?;?;?;?;?"); 586b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 596b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower // Output 606b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_OK(op, "?;?;?;?;?;?;?;?;?;?", "[?,?];[?,?];[?,?];[?,?]"); 616b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower INFER_OK(op, "[?,?];[?,?];[?,?];?;?;?;?;?;?;?", 626b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower "in0;[d0_0,d1_1];[d0_0,d1_1];[d0_0,d2_1]"); 636b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower} 646b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower 656b104af2a4b01f034632cb25ef30851c30d92ef9A. Unique TensorFlower} // namespace tensorflow 66