1 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #include "tensorflow/core/framework/common_shape_fns.h" 17 #include "tensorflow/core/framework/op.h" 18 19 namespace tensorflow { 20 21 // TODO(saeta): Add support for setting ClientOptions values. 22 REGISTER_OP("BigtableClient") 23 .Attr("project_id: string") 24 .Attr("instance_id: string") 25 .Attr("connection_pool_size: int") 26 .Attr("max_receive_message_size: int = -1") 27 .Attr("container: string = ''") 28 .Attr("shared_name: string = ''") 29 .Output("client: resource") 30 .SetShapeFn(shape_inference::ScalarShape); 31 32 // TODO(saeta): Add support for Application Profiles. 33 // See https://cloud.google.com/bigtable/docs/app-profiles for more info. 34 REGISTER_OP("BigtableTable") 35 .Input("client: resource") 36 .Attr("table_name: string") 37 .Attr("container: string = ''") 38 .Attr("shared_name: string = ''") 39 .Output("table: resource") 40 .SetShapeFn(shape_inference::ScalarShape); 41 42 REGISTER_OP("DatasetToBigtable") 43 .Input("table: resource") 44 .Input("input_dataset: variant") 45 .Input("column_families: string") 46 .Input("columns: string") 47 .Input("timestamp: int64") 48 .SetShapeFn(shape_inference::NoOutputs); 49 50 REGISTER_OP("BigtableLookupDataset") 51 .Input("keys_dataset: variant") 52 .Input("table: resource") 53 .Input("column_families: string") 54 .Input("columns: string") 55 .Output("handle: variant") 56 .SetShapeFn(shape_inference::ScalarShape); 57 58 REGISTER_OP("BigtablePrefixKeyDataset") 59 .Input("table: resource") 60 .Input("prefix: string") 61 .Output("handle: variant") 62 .SetIsStateful() // TODO(b/123753214): Source dataset ops must be marked 63 // stateful to inhibit constant folding. 64 .SetShapeFn(shape_inference::ScalarShape); 65 66 REGISTER_OP("BigtableRangeKeyDataset") 67 .Input("table: resource") 68 .Input("start_key: string") 69 .Input("end_key: string") 70 .Output("handle: variant") 71 .SetIsStateful() // TODO(b/123753214): Source dataset ops must be marked 72 // stateful to inhibit constant folding. 73 .SetShapeFn(shape_inference::ScalarShape); 74 75 REGISTER_OP("BigtableSampleKeysDataset") 76 .Input("table: resource") 77 .Output("handle: variant") 78 .SetIsStateful() // TODO(b/123753214): Source dataset ops must be marked 79 // stateful to inhibit constant folding. 80 .SetShapeFn(shape_inference::ScalarShape); 81 82 REGISTER_OP("BigtableSampleKeyPairsDataset") 83 .Input("table: resource") 84 .Input("prefix: string") 85 .Input("start_key: string") 86 .Input("end_key: string") 87 .Output("handle: variant") 88 .SetIsStateful() // TODO(b/123753214): Source dataset ops must be marked 89 // stateful to inhibit constant folding. 90 .SetShapeFn(shape_inference::ScalarShape); 91 92 // TODO(saeta): Support continuing despite bad data (e.g. empty string, or 93 // skip incomplete row.) 94 REGISTER_OP("BigtableScanDataset") 95 .Input("table: resource") 96 .Input("prefix: string") 97 .Input("start_key: string") 98 .Input("end_key: string") 99 .Input("column_families: string") 100 .Input("columns: string") 101 .Input("probability: float") 102 .Output("handle: variant") 103 .SetIsStateful() // TODO(b/123753214): Source dataset ops must be marked 104 // stateful to inhibit constant folding. 105 .SetShapeFn(shape_inference::ScalarShape); 106 107 } // namespace tensorflow 108