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

Method MakeDimForScalarInput

tensorflow/core/framework/shape_inference.cc:982–996  ·  view source on GitHub ↗

Returns a new dimension whose value is given by a scalar input tensor.

Source from the content-addressed store, hash-verified

980
981// Returns a new dimension whose value is given by a scalar input tensor.
982Status InferenceContext::MakeDimForScalarInput(int idx, DimensionHandle* out) {
983 int64 val;
984 const Tensor* t = input_tensor(idx);
985 if (t == nullptr) {
986 *out = UnknownDim();
987 return Status::OK();
988 }
989 TF_RETURN_IF_ERROR(GetScalarFromTensor(t, &val));
990 if (val < 0) {
991 return errors::InvalidArgument("Dimension size, given by scalar input ",
992 idx, ", must be non-negative but is ", val);
993 }
994 *out = MakeDim(val);
995 return Status::OK();
996}
997
998Status InferenceContext::MakeDimForScalarInputWithNegativeIndexing(
999 int idx, int input_rank, DimensionHandle* out) {

Callers 10

TopKShapeFnFunction · 0.80
nn_ops.ccFile · 0.80
array_ops.ccFile · 0.80
random_ops.ccFile · 0.80
CombinedNMSShapeFnFunction · 0.80
image_ops.ccFile · 0.80
parsing_ops.ccFile · 0.80
TEST_FFunction · 0.80

Calls 1

InvalidArgumentFunction · 0.85

Tested by 1

TEST_FFunction · 0.64