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

Method Compute

tensorflow/core/kernels/whole_file_read_ops.cc:103–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 public:
102 using OpKernel::OpKernel;
103 void Compute(OpKernelContext* context) override {
104 const Tensor* input;
105 OP_REQUIRES_OK(context, context->input("filename", &input));
106 OP_REQUIRES(context, TensorShapeUtils::IsScalar(input->shape()),
107 errors::InvalidArgument(
108 "Input filename tensor must be scalar, but had shape: ",
109 input->shape().DebugString()));
110
111 Tensor* output = nullptr;
112 OP_REQUIRES_OK(context, context->allocate_output("contents",
113 TensorShape({}), &output));
114 OP_REQUIRES_OK(context,
115 ReadEntireFile(context->env(), input->scalar<string>()(),
116 &output->scalar<string>()()));
117 }
118};
119
120REGISTER_KERNEL_BUILDER(Name("ReadFile").Device(DEVICE_CPU), ReadFileOp);

Callers

nothing calls this directly

Calls 9

InvalidArgumentFunction · 0.85
allocate_outputMethod · 0.80
ReadEntireFileFunction · 0.70
IsScalarFunction · 0.50
TensorShapeClass · 0.50
inputMethod · 0.45
shapeMethod · 0.45
DebugStringMethod · 0.45
envMethod · 0.45

Tested by

no test coverage detected