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

Method Multiply

tensorflow/core/framework/shape_inference.cc:1101–1128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1099}
1100
1101Status InferenceContext::Multiply(DimensionHandle first,
1102 DimensionOrConstant second,
1103 DimensionHandle* out) {
1104 const int64 first_value = Value(first);
1105 const int64 second_value = Value(second);
1106 // Special cases.
1107 if (first_value == 0) {
1108 *out = first;
1109 } else if (second_value == 0) {
1110 *out = MakeDim(second);
1111 } else if (first_value == 1) {
1112 *out = MakeDim(second);
1113 } else if (second_value == 1) {
1114 *out = first;
1115 } else if (first_value == kUnknownDim || second_value == kUnknownDim) {
1116 *out = UnknownDim();
1117 } else {
1118 // Invariant: Both values are known and greater than 1.
1119 const int64 product = first_value * second_value;
1120 if (product < 0) {
1121 return errors::InvalidArgument(
1122 "Negative dimension size caused by overflow when multiplying ",
1123 first_value, " and ", second_value);
1124 }
1125 *out = MakeDim(product);
1126 }
1127 return Status::OK();
1128}
1129
1130Status InferenceContext::Min(DimensionHandle first, DimensionOrConstant second,
1131 DimensionHandle* out) {

Callers 14

rnn_ops.ccFile · 0.80
SetOutputShapeForReshapeFunction · 0.80
array_ops.ccFile · 0.80
SpaceToBatchShapeHelperFunction · 0.80
BatchToSpaceShapeHelperFunction · 0.80
cudnn_rnn_ops.ccFile · 0.80
DimensionsFromShapeFunction · 0.80
Conv2DShapeImplFunction · 0.80

Calls 2

InvalidArgumentFunction · 0.85
ValueClass · 0.70

Tested by 3

TEST_FFunction · 0.64