Esempio n. 1
0
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;
}
Esempio n. 2
0
 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?)");
   }
 }
Esempio n. 3
0
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));
}
Esempio n. 4
0
 double size() const { return dim_size(value); }