• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/contrib/ignite/kernels/dataset/ignite_dataset_iterator.h"
17 #include "tensorflow/core/platform/logging.h"
18 
19 namespace tensorflow {
20 
IgniteDataset(OpKernelContext * ctx,string cache_name,string host,int32 port,bool local,int32 part,int32 page_size,string username,string password,string certfile,string keyfile,string cert_password,std::vector<int32> schema,std::vector<int32> permutation,DataTypeVector dtypes,std::vector<PartialTensorShape> shapes)21 IgniteDataset::IgniteDataset(OpKernelContext* ctx, string cache_name,
22                              string host, int32 port, bool local, int32 part,
23                              int32 page_size, string username, string password,
24                              string certfile, string keyfile,
25                              string cert_password, std::vector<int32> schema,
26                              std::vector<int32> permutation,
27                              DataTypeVector dtypes,
28                              std::vector<PartialTensorShape> shapes)
29     : DatasetBase(DatasetContext(ctx)),
30       cache_name_(std::move(cache_name)),
31       host_(std::move(host)),
32       port_(port),
33       local_(local),
34       part_(part),
35       page_size_(page_size),
36       username_(std::move(username)),
37       password_(std::move(password)),
38       certfile_(std::move(certfile)),
39       keyfile_(std::move(keyfile)),
40       cert_password_(std::move(cert_password)),
41       schema_(std::move(schema)),
42       permutation_(std::move(permutation)),
43       dtypes_(dtypes),
44       shapes_(shapes) {
45   LOG(INFO) << "Ignite Dataset created [cache_name='" << cache_name_
46             << "', host='" << host_ << "', port=" << port_
47             << ", local=" << local_ << ", part=" << part_
48             << ", page_size=" << page_size_ << ", username='" << username_
49             << "', certfile='" << certfile_ << "', keyfile='"
50             << keyfile_ + "']";
51 }
52 
~IgniteDataset()53 IgniteDataset::~IgniteDataset() { LOG(INFO) << "Ignite Dataset destroyed"; }
54 
MakeIteratorInternal(const string & prefix) const55 std::unique_ptr<IteratorBase> IgniteDataset::MakeIteratorInternal(
56     const string& prefix) const {
57   return std::unique_ptr<IteratorBase>(new IgniteDatasetIterator(
58       {this, strings::StrCat(prefix, "::Ignite")}, std::move(this->host_),
59       this->port_, std::move(this->cache_name_), this->local_, this->part_,
60       this->page_size_, std::move(this->username_), std::move(this->password_),
61       std::move(this->certfile_), std::move(this->keyfile_),
62       std::move(this->cert_password_), std::move(this->schema_),
63       std::move(this->permutation_)));
64 }
65 
output_dtypes() const66 const DataTypeVector& IgniteDataset::output_dtypes() const { return dtypes_; }
67 
output_shapes() const68 const std::vector<PartialTensorShape>& IgniteDataset::output_shapes() const {
69   return shapes_;
70 }
71 
DebugString() const72 string IgniteDataset::DebugString() const { return "IgniteDatasetOp::Dataset"; }
73 
AsGraphDefInternal(SerializationContext * ctx,DatasetGraphDefBuilder * b,Node ** output) const74 Status IgniteDataset::AsGraphDefInternal(SerializationContext* ctx,
75                                          DatasetGraphDefBuilder* b,
76                                          Node** output) const {
77   return errors::Unimplemented(
78       "IgniteDataset does not support 'AsGraphDefInternal'");
79 }
80 
81 }  // namespace tensorflow
82