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

Method Compute

tensorflow/core/framework/dataset.cc:124–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122 explicit WrapDatasetVariantOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
123
124 void Compute(OpKernelContext* ctx) override {
125 const Tensor& tensor = ctx->input(0);
126 OP_REQUIRES(ctx,
127 tensor.dtype() == DT_VARIANT &&
128 TensorShapeUtils::IsScalar(tensor.shape()),
129 errors::InvalidArgument(
130 "Dataset tensor must be a scalar of dtype DT_VARIANT."));
131 DatasetBase* unused;
132 OP_REQUIRES_OK(ctx, GetDatasetFromVariantTensor(tensor, &unused));
133 Tensor* output = nullptr;
134 OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &output));
135 output->scalar<Variant>()() = WrappedDatasetVariantWrapper(tensor);
136 }
137};
138
139REGISTER_KERNEL_BUILDER(Name("WrapDatasetVariant").Device(DEVICE_CPU),

Callers

nothing calls this directly

Calls 9

InvalidArgumentFunction · 0.85
allocate_outputMethod · 0.80
TensorShapeClass · 0.70
IsScalarFunction · 0.50
inputMethod · 0.45
dtypeMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected