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

Method Compute

tensorflow/core/framework/dataset.cc:151–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149 explicit UnwrapDatasetVariantOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
150
151 void Compute(OpKernelContext* ctx) override {
152 const Tensor& tensor = ctx->input(0);
153 OP_REQUIRES(ctx,
154 tensor.dtype() == DT_VARIANT &&
155 TensorShapeUtils::IsScalar(tensor.shape()),
156 errors::InvalidArgument(
157 "Dataset tensor must be a scalar of dtype DT_VARIANT."));
158 Variant variant = tensor.scalar<Variant>()();
159 const WrappedDatasetVariantWrapper* wrapper =
160 variant.get<WrappedDatasetVariantWrapper>();
161 OP_REQUIRES(ctx, wrapper != nullptr,
162 errors::InvalidArgument(
163 "Tensor must be a WrappedDataset variant object."));
164 Tensor ds_tensor = wrapper->get();
165 OP_REQUIRES_OK(ctx, ctx->set_output("output_handle", ds_tensor));
166 }
167};
168
169REGISTER_KERNEL_BUILDER(Name("UnwrapDatasetVariant").Device(DEVICE_CPU),

Callers

nothing calls this directly

Calls 7

InvalidArgumentFunction · 0.85
IsScalarFunction · 0.50
inputMethod · 0.45
dtypeMethod · 0.45
shapeMethod · 0.45
getMethod · 0.45
set_outputMethod · 0.45

Tested by

no test coverage detected