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

Method Compute

tensorflow/core/kernels/shape_ops.h:100–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 explicit RankOp(OpKernelConstruction* ctx) : OpKernel(ctx) {}
99
100 void Compute(OpKernelContext* ctx) override {
101 TensorShape shape;
102 OP_REQUIRES_OK(ctx, shape_op_helpers::GetShape(ctx, 0, &shape));
103 const int rank = shape.dims();
104 Tensor* out = nullptr;
105 OP_REQUIRES_OK(ctx, ctx->allocate_output(0, TensorShape({}), &out));
106 out->scalar<int32>()() = rank;
107 }
108
109 bool IsExpensive() override { return false; }
110};

Callers

nothing calls this directly

Calls 4

allocate_outputMethod · 0.80
GetShapeFunction · 0.70
TensorShapeClass · 0.50
dimsMethod · 0.45

Tested by

no test coverage detected