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

Method Divide

tensorflow/core/framework/shape_inference.cc:1027–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1025}
1026
1027Status InferenceContext::Divide(DimensionHandle dividend,
1028 DimensionOrConstant divisor,
1029 bool evenly_divisible, DimensionHandle* out) {
1030 const int64 divisor_value = Value(divisor);
1031 if (divisor_value == 1) {
1032 *out = dividend;
1033 } else if (!ValueKnown(dividend) ||
1034 (divisor.dim.IsSet() && !ValueKnown(divisor.dim))) {
1035 *out = UnknownDim();
1036 } else {
1037 const int64 v = Value(dividend);
1038 if (divisor_value <= 0) {
1039 return errors::InvalidArgument("Divisor must be positive but is ",
1040 divisor_value);
1041 }
1042 if (evenly_divisible && (v % divisor_value) != 0) {
1043 return errors::InvalidArgument(
1044 "Dimension size must be evenly divisible by ", divisor_value,
1045 " but is ", v);
1046 }
1047 *out = MakeDim(v / divisor_value);
1048 }
1049 return Status::OK();
1050}
1051
1052Status InferenceContext::Add(DimensionHandle first, DimensionOrConstant second,
1053 DimensionHandle* out) {

Callers 11

rnn_ops.ccFile · 0.45
SetOutputShapeForReshapeFunction · 0.45
array_ops.ccFile · 0.45
SpaceToBatchShapeHelperFunction · 0.45
BatchToSpaceShapeHelperFunction · 0.45
math_ops.ccFile · 0.45
parsing_ops.ccFile · 0.45
ShapeFromDimensionsFunction · 0.45
TEST_FFunction · 0.45

Calls 3

InvalidArgumentFunction · 0.85
ValueClass · 0.70
IsSetMethod · 0.45

Tested by 1

TEST_FFunction · 0.36