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

Function GetDatasetFromVariantTensor

tensorflow/core/framework/dataset.cc:340–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340Status GetDatasetFromVariantTensor(const Tensor& tensor,
341 DatasetBase** out_dataset) {
342 if (!(tensor.dtype() == DT_VARIANT &&
343 TensorShapeUtils::IsScalar(tensor.shape()))) {
344 return errors::InvalidArgument(
345 "Dataset tensor must be a scalar of dtype DT_VARIANT.");
346 }
347 const Variant& variant = tensor.scalar<Variant>()();
348 const DatasetVariantWrapper* wrapper = variant.get<DatasetVariantWrapper>();
349 if (wrapper == nullptr) {
350 return errors::InvalidArgument("Tensor must be a Dataset object.");
351 }
352 *out_dataset = wrapper->get();
353 if (*out_dataset == nullptr) {
354 return errors::Internal("Read uninitialized Dataset variant.");
355 }
356 return Status::OK();
357}
358
359Status StoreDatasetInVariantTensor(DatasetBase* dataset, Tensor* tensor) {
360 if (!(tensor->dtype() == DT_VARIANT &&

Callers 15

ComputeAsyncMethod · 0.85
ComputeMethod · 0.85
GetAllocatedBytesFunction · 0.85
MakeDatasetMethod · 0.85
FromGraphMethod · 0.85
TEST_PFunction · 0.85
ComputeAsyncMethod · 0.85
ComputeAsyncMethod · 0.85
ComputeAsyncMethod · 0.85
TryInitMethod · 0.85
ComputeMethod · 0.85
GetDatasetFromContextMethod · 0.85

Calls 6

InvalidArgumentFunction · 0.85
InternalFunction · 0.85
IsScalarFunction · 0.50
dtypeMethod · 0.45
shapeMethod · 0.45
getMethod · 0.45

Tested by 3

TEST_PFunction · 0.68
GetDatasetFromContextMethod · 0.68
MakeDatasetMethod · 0.68