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

Method full_strides

tensorflow/stream_executor/dnn.cc:329–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329std::vector<int64> BatchDescriptor::full_strides(
330 const DataLayout& layout) const {
331 if (this->layout() == DataLayout::kBatchDepthYX4) {
332 LOG(FATAL)
333 << "Cannot compute full strides for batch descriptor " << ToString()
334 << ", because its layout is kBatchDepthYX4. In fact, "
335 "cudnnSetTensorNdDescriptor doesn't work for kBatchDepthYX4 at all. "
336 "Use cudnnSetTensor4DDescriptor to set cudnnTensorDescriptor_t "
337 "instead.";
338 }
339 std::vector<int64> phys_dims = full_dims(this->layout());
340 std::vector<int64> phys_strides(phys_dims.size());
341 phys_strides[ndims() + 1] = 1;
342 for (int i = ndims(); i >= 0; i--) {
343 phys_strides[i] = phys_strides[i + 1] * phys_dims[i + 1];
344 }
345 return ReorderDims(phys_strides, this->layout(), layout);
346}
347
348void BatchDescriptor::CloneFrom(const BatchDescriptor& other) {
349 tensor_ = other.tensor_;

Callers 4

CudnnTensorDescriptorMethod · 0.80
GetCudnnOperationGraphFunction · 0.80

Calls 4

layoutMethod · 0.95
ReorderDimsFunction · 0.85
ToStringFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected