static TensorShape getShape(const tensorflow::NodeDef& node) { TensorShape resultShape; if(node.attr().count("shape") > 0) { auto shape = node.attr().at("shape").shape(); for(int i = 0; i < shape.dim_size(); i++) { resultShape.addDimension(shape.dim(i).size()); } } return resultShape; }
void dimension_check(const T& x, const U& hyper1) { if(dim_size(hyper1) > dim_size(x)) { throw std::logic_error("ERROR: dimensions of hyperparmeters are larger than the stochastic variable itself (is this really what you wanted to do?)"); } }
void TensorflowTensor::create(tensorflow::Tensor&& tensorflowTensor) { m_tensorflowTensor = tensorflowTensor; auto shape = m_tensorflowTensor.shape(); for(int i = 0; i < shape.dims(); ++i) m_shape.addDimension(shape.dim_size(i)); }
double size() const { return dim_size(value); }