We don't create primitive_descriptor for TensorFlow layout now. We use lazy evaluation and create it only when needed. Input format can also be Blocked format.
| 439 | /// We use lazy evaluation and create it only when needed. Input format can |
| 440 | /// also be Blocked format. |
| 441 | inline void SetTfLayout(size_t dims, const memory::dims& sizes, |
| 442 | MklTensorFormat format) { |
| 443 | DCHECK_EQ(dims, sizes.size()) |
| 444 | << "SetTfLayout: Number of dimensions does not" |
| 445 | "match with dimension array"; |
| 446 | data_.dimension_ = dims; |
| 447 | for (size_t ii = 0; ii < dims; ++ii) { |
| 448 | data_.sizes_[ii] = sizes[ii]; |
| 449 | } |
| 450 | data_.tf_data_format_ = format; |
| 451 | if (format != MklTensorFormat::FORMAT_BLOCKED) { |
| 452 | if (dims == 2) { |
| 453 | data_.map_[0] = MklDnnDims::Dim_N; |
| 454 | data_.map_[1] = MklDnnDims::Dim_C; |
| 455 | } else { |
| 456 | SetTfDimOrder(dims, format); |
| 457 | } |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | inline const memory::desc GetTfLayout() const { |
| 462 | memory::dims dims; |