1 /* Copyright 2016 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 #ifndef TENSORFLOW_KERNELS_IMMUTABLE_CONSTANT_OP_H_ 16 #define TENSORFLOW_KERNELS_IMMUTABLE_CONSTANT_OP_H_ 17 18 #include <memory> 19 20 #include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor" 21 #include "tensorflow/core/framework/op_kernel.h" 22 #include "tensorflow/core/framework/tensor_types.h" 23 #include "tensorflow/core/platform/env.h" 24 #include "tensorflow/core/platform/macros.h" 25 26 namespace tensorflow { 27 28 class ImmutableConstantOp : public OpKernel { 29 public: 30 explicit ImmutableConstantOp(OpKernelConstruction* context); 31 void Compute(OpKernelContext* ctx) override; 32 bool IsExpensive() override { return false; } 33 ~ImmutableConstantOp() override; 34 35 // Names of attributes that are used by this op 36 static constexpr char const* kDTypeAttr = "dtype"; 37 static constexpr char const* kShapeAttr = "shape"; 38 static constexpr char const* kMemoryRegionNameAttr = "memory_region_name"; 39 40 private: 41 string region_name_; 42 DataType dtype_; 43 TensorShape shape_; 44 TF_DISALLOW_COPY_AND_ASSIGN(ImmutableConstantOp); 45 }; 46 47 } // namespace tensorflow 48 49 #endif // TENSORFLOW_KERNELS_IMMUTABLE_CONSTANT_OP_H_ 50