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

Method Compute

tensorflow/core/kernels/control_flow_ops.cc:26–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24namespace tensorflow {
25
26void SwitchOp::Compute(OpKernelContext* context) {
27 const Tensor& outputPorts = context->input(1);
28 OP_REQUIRES(context, TensorShapeUtils::IsScalar(outputPorts.shape()),
29 errors::InvalidArgument("The second input must be a scalar, "
30 "but it has shape ",
31 outputPorts.shape().DebugString()));
32
33 bool pred = outputPorts.scalar<bool>()();
34 int port = (pred) ? 1 : 0;
35 if (context->input_is_ref(0)) {
36 context->forward_ref_input_to_ref_output(0, port);
37 } else {
38 context->set_output(port, context->input(0));
39 }
40}
41
42void SwitchNOp::Compute(OpKernelContext* context) {
43 const Tensor& output_index_t = context->input(1);

Callers

nothing calls this directly

Calls 15

InvalidArgumentFunction · 0.85
InternalFunction · 0.85
IsRefTypeFunction · 0.85
CancelledFunction · 0.85
input_is_refMethod · 0.80
has_inputMethod · 0.80
allocate_outputMethod · 0.80
IsCancelledMethod · 0.80
IsScalarFunction · 0.50
TensorShapeClass · 0.50
inputMethod · 0.45

Tested by

no test coverage detected