| 1456 | } |
| 1457 | |
| 1458 | void MakeArrayDims(int num_dims, int batch, int height, int width, int depth, |
| 1459 | std::vector<int>* out_dims) { |
| 1460 | CHECK(out_dims->empty()); |
| 1461 | if (num_dims == 0) { |
| 1462 | return; |
| 1463 | } else if (num_dims == 1) { |
| 1464 | CHECK_EQ(batch, 1); |
| 1465 | *out_dims = {depth}; |
| 1466 | } else if (num_dims == 2) { |
| 1467 | *out_dims = {batch, depth}; |
| 1468 | } else if (num_dims == 3) { |
| 1469 | CHECK_EQ(batch, 1); |
| 1470 | *out_dims = {height, width, depth}; |
| 1471 | } else if (num_dims == 4) { |
| 1472 | *out_dims = {batch, height, width, depth}; |
| 1473 | } else { |
| 1474 | LOG(FATAL) << "Should not get here: " << num_dims; |
| 1475 | } |
| 1476 | } |
| 1477 | |
| 1478 | void CreateOrCheckRnnStateArray(const string& name, int size, |
| 1479 | int state_num_dims, Model* model) { |
no test coverage detected