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

Method Compute

tensorflow/core/kernels/data/dataset_ops.cc:44–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void DatasetToGraphOp::Compute(OpKernelContext* ctx) {
45 DatasetBase* dataset;
46 OP_REQUIRES_OK(ctx, GetDatasetFromVariantTensor(ctx->input(0), &dataset));
47 std::vector<int> whitelist_indices_to_remove;
48 for (int i = 0; i < whitelisted_stateful_ops_.size(); ++i) {
49 const string stateful_op = whitelisted_stateful_ops_[i];
50 if (!WhitelistedStatefulOpRegistry::Global()->Contains(stateful_op)) {
51 whitelist_indices_to_remove.push_back(i);
52 // Make sure op is registered first. We maybe don't need this check?
53 const OpDef* op_def;
54 OP_REQUIRES_OK(ctx,
55 OpRegistry::Global()->LookUpOpDef(stateful_op, &op_def));
56 OP_REQUIRES_OK(ctx,
57 WhitelistedStatefulOpRegistry::Global()->Add(stateful_op));
58 }
59 }
60 GraphDef graph_def;
61 OP_REQUIRES_OK(
62 ctx, AsGraphDef(ctx, dataset, SerializationContext({}), &graph_def));
63 Tensor* result;
64 OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &result));
65 result->scalar<tstring>()() = graph_def.SerializeAsString();
66 for (int index : whitelist_indices_to_remove) {
67 OP_REQUIRES_OK(ctx, WhitelistedStatefulOpRegistry::Global()->Remove(
68 whitelisted_stateful_ops_[index]));
69 }
70}
71
72void DatasetCardinalityOp::Compute(OpKernelContext* ctx) {
73 DatasetBase* dataset;

Callers

nothing calls this directly

Calls 15

AsGraphDefFunction · 0.85
InvalidArgumentFunction · 0.85
AddToFunctionLibraryFunction · 0.85
LookUpOpDefMethod · 0.80
allocate_outputMethod · 0.80
TensorShapeClass · 0.50
ParseScalarArgumentFunction · 0.50
ImportGraphDefFunction · 0.50
inputMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected