1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef FCP_AGGREGATION_CORE_TENSOR_SPEC_H_ 18 #define FCP_AGGREGATION_CORE_TENSOR_SPEC_H_ 19 20 #include <string> 21 #include <utility> 22 23 #include "fcp/aggregation/core/datatype.h" 24 #include "fcp/aggregation/core/tensor_shape.h" 25 26 namespace fcp { 27 namespace aggregation { 28 29 // A tuple representing tensor name, data type, and shape. 30 class TensorSpec final { 31 public: TensorSpec(std::string name,DataType dtype,TensorShape shape)32 TensorSpec(std::string name, DataType dtype, TensorShape shape) 33 : name_(std::move(name)), dtype_(dtype), shape_(std::move(shape)) {} 34 name()35 const std::string& name() const { return name_; } dtype()36 DataType dtype() const { return dtype_; } shape()37 const TensorShape& shape() const { return shape_; } 38 39 private: 40 const std::string name_; 41 const DataType dtype_; 42 const TensorShape shape_; 43 }; 44 45 } // namespace aggregation 46 } // namespace fcp 47 48 #endif // FCP_AGGREGATION_CORE_TENSOR_SPEC_H_ 49