| 40 | } |
| 41 | |
| 42 | void CreateConstSizesOp(const string& name, const std::vector<int32>& sizes, |
| 43 | NodeDef* node) { |
| 44 | TensorShape shape; |
| 45 | shape.AddDim(sizes.size()); |
| 46 | Tensor tensor(DT_INT32, shape); |
| 47 | for (int64 i = 0; i < tensor.NumElements(); ++i) |
| 48 | tensor.flat<int32>()(i) = sizes[i]; |
| 49 | TF_CHECK_OK(NodeDefBuilder(name, "Const") |
| 50 | .Attr("dtype", DT_INT32) |
| 51 | .Attr("value", tensor) |
| 52 | .Finalize(node)); |
| 53 | } |
| 54 | |
| 55 | // Helper method for converting shapes vector to TensorProperty. |
| 56 | OpInfo::TensorProperties ShapeToTensorProperty(const std::vector<int>& shapes, |
no test coverage detected