MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / CreateConstSizesOp

Function CreateConstSizesOp

tensorflow/core/grappler/costs/utils_test.cc:42–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void 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.
56OpInfo::TensorProperties ShapeToTensorProperty(const std::vector<int>& shapes,

Callers 1

TESTFunction · 0.85

Calls 6

NodeDefBuilderClass · 0.85
AddDimMethod · 0.45
sizeMethod · 0.45
NumElementsMethod · 0.45
FinalizeMethod · 0.45
AttrMethod · 0.45

Tested by

no test coverage detected