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

Function CreateConstOp

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

Source from the content-addressed store, hash-verified

29namespace {
30
31void CreateConstOp(const string& name, std::initializer_list<int64> dims,
32 NodeDef* node) {
33 Tensor tensor(DT_FLOAT, TensorShape(dims));
34 for (int64 i = 0; i < tensor.NumElements(); ++i)
35 tensor.flat<float>()(i) = i / 10.0f;
36 TF_CHECK_OK(NodeDefBuilder(name, "Const")
37 .Attr("dtype", DT_FLOAT)
38 .Attr("value", tensor)
39 .Finalize(node));
40}
41
42void CreateConstSizesOp(const string& name, const std::vector<int32>& sizes,
43 NodeDef* node) {

Callers 1

TESTFunction · 0.85

Calls 5

NodeDefBuilderClass · 0.85
TensorShapeClass · 0.50
NumElementsMethod · 0.45
FinalizeMethod · 0.45
AttrMethod · 0.45

Tested by

no test coverage detected