Program Listing for File tensors.h¶
↰ Return to documentation for file (source/utilities/tensors.h
)
/*
* tensors.h Utilities to help with Eigen::Tensors
*
* Author: Tom Clark (thclark @ github)
*
* Copyright (c) 2019 Octue Ltd. All Rights Reserved.
*
*/
#ifndef ES_FLOW_TENSORS_H
#define ES_FLOW_TENSORS_H
#include <string>
namespace utilities {
template<typename T>
std::string tensor_dims(T &tensor) {
std::stringstream dims;
for (auto i = tensor.dimensions().begin(); i != tensor.dimensions().end(); ++i) {
dims << *i << " x ";
}
std::string dim_str = dims.str();
dim_str.pop_back();
dim_str.pop_back();
dim_str.pop_back();
return dim_str;
}
} /* namespace utilities */
#endif //ES_FLOW_TENSORS_H