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

Method Subtract

tensorflow/core/framework/shape_inference.cc:1078–1099  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1076}
1077
1078Status InferenceContext::Subtract(DimensionHandle first,
1079 DimensionOrConstant second,
1080 DimensionHandle* out) {
1081 const int64 first_value = Value(first);
1082 const int64 second_value = Value(second);
1083 // Special cases.
1084 if (second_value == 0) {
1085 *out = first;
1086 } else if (first_value == kUnknownDim || second_value == kUnknownDim) {
1087 *out = UnknownDim();
1088 } else {
1089 // Invariant: Both values are known, first_value is non-negative, and
1090 // second_value is positive.
1091 if (first_value < second_value) {
1092 return errors::InvalidArgument(
1093 "Negative dimension size caused by subtracting ", second_value,
1094 " from ", first_value);
1095 }
1096 *out = MakeDim(first_value - second_value);
1097 }
1098 return Status::OK();
1099}
1100
1101Status InferenceContext::Multiply(DimensionHandle first,
1102 DimensionOrConstant second,

Callers 10

ReduceSliceShapeFnFunction · 0.80
test_merge_subtractMethod · 0.80
string_ops.ccFile · 0.80
MirrorPadKnownFunction · 0.80
BatchToSpaceShapeHelperFunction · 0.80
SliceHelperFunction · 0.80
TEST_FFunction · 0.80

Calls 2

InvalidArgumentFunction · 0.85
ValueClass · 0.70

Tested by 2

test_merge_subtractMethod · 0.64
TEST_FFunction · 0.64