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

Method GetTfShape

tensorflow/core/util/mkl_util.h:397–420  ·  view source on GitHub ↗

Return TensorShape that describes the Tensorflow shape of the tensor represented by this MklShape.

Source from the content-addressed store, hash-verified

395 /// Return TensorShape that describes the Tensorflow shape of the tensor
396 /// represented by this MklShape.
397 inline TensorShape GetTfShape() const {
398 CHECK_EQ(data_.is_mkl_tensor_, true);
399
400 std::vector<int32> shape(data_.dimension_, -1);
401 // As mentioned in the comment above, we now rely on TF's `data_format`
402 // attribute to determine if TF shape is in blocked format or not.
403 if (data_.tf_data_format_ != MklTensorFormat::FORMAT_BLOCKED) {
404 for (size_t idx = 0; idx < data_.dimension_; ++idx) {
405 shape[idx] = data_.sizes_[TfDimIdx(idx)];
406 }
407 } else {
408 // If Tensorflow shape is in Blocked format, then we don't have dimension
409 // map for it. So we just create Tensorflow shape from sizes in the
410 // specified order.
411 for (size_t idx = 0; idx < data_.dimension_; ++idx) {
412 shape[idx] = data_.sizes_[idx];
413 }
414 }
415
416 TensorShape ts;
417 bool ret = TensorShapeUtils::MakeShape(shape, &ts).ok();
418 CHECK_EQ(ret, true);
419 return ts;
420 }
421
422 inline void SetElemType(memory::data_type dt) { data_.T_ = dt; }
423 inline const memory::data_type GetElemType() { return data_.T_; }

Callers 15

operator==Method · 0.95
ComputeMethod · 0.80
ComputeMethod · 0.80
ComputeMethod · 0.80
ComputeMethod · 0.80
ComputeMethod · 0.80
CallEigenVersionMethod · 0.80
FindMklCommonFormatMethod · 0.80
ComputeMethod · 0.80
ComputeMethod · 0.80
AllocateOutputTensorMethod · 0.80
ComputeMethod · 0.80

Calls 2

MakeShapeFunction · 0.85
okMethod · 0.45

Tested by 1

TESTFunction · 0.64