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

Method Compute

tensorflow/core/kernels/summary_tensor_op.cc:33–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 : OpKernel(context) {}
32
33 void Compute(OpKernelContext* c) override {
34 const Tensor& tag = c->input(0);
35 OP_REQUIRES(c, IsLegacyScalar(tag.shape()),
36 errors::InvalidArgument("tag must be scalar"));
37 const Tensor& tensor = c->input(1);
38 const Tensor& serialized_summary_metadata_tensor = c->input(2);
39
40 Summary s;
41 Summary::Value* v = s.add_value();
42 v->set_tag(string(tag.scalar<tstring>()())); // NOLINT
43
44 if (tensor.dtype() == DT_STRING) {
45 // tensor_util.makeNdarray doesn't work for strings in tensor_content
46 tensor.AsProtoField(v->mutable_tensor());
47 } else {
48 tensor.AsProtoTensorContent(v->mutable_tensor());
49 }
50
51 v->mutable_metadata()->ParseFromString(
52 serialized_summary_metadata_tensor.scalar<tstring>()());
53
54 Tensor* summary_tensor = nullptr;
55 OP_REQUIRES_OK(c, c->allocate_output(0, TensorShape({}), &summary_tensor));
56 CHECK(SerializeToTString(s, &summary_tensor->scalar<tstring>()()));
57 }
58};
59
60#define REGISTER(T) \

Callers

nothing calls this directly

Calls 12

InvalidArgumentFunction · 0.85
SerializeToTStringFunction · 0.85
set_tagMethod · 0.80
AsProtoFieldMethod · 0.80
AsProtoTensorContentMethod · 0.80
allocate_outputMethod · 0.80
TensorShapeClass · 0.50
inputMethod · 0.45
shapeMethod · 0.45
dtypeMethod · 0.45
ParseFromStringMethod · 0.45
mutable_metadataMethod · 0.45

Tested by

no test coverage detected