当前位置: 首页>>代码示例>>C++>>正文


C++ NodeVector::at方法代码示例

本文整理汇总了C++中NodeVector::at方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeVector::at方法的具体用法?C++ NodeVector::at怎么用?C++ NodeVector::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NodeVector的用法示例。


在下文中一共展示了NodeVector::at方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ngraph_error

shared_ptr<Node> op::Divide::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 2)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    return make_shared<Divide>(new_args.at(0), new_args.at(1));
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:divide.cpp

示例2: order

void op::Softmax::generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& deltas)
{
    auto delta = deltas.at(0);

    auto z = delta * shared_from_this();
    auto zsum = make_shared<op::Sum>(z, m_axes);

    Shape shape;
    for (size_t i = 0; i < get_shape().size(); ++i)
    {
        if (m_axes.find(i) == m_axes.end())
        {
            shape.push_back(get_shape()[i]);
        }
        else
        {
            shape.push_back(1);
        }
    }
    AxisVector order(zsum->get_shape().size());
    iota(order.begin(), order.end(), 0);
    auto zreshape = make_shared<op::Reshape>(zsum, order, shape);

    auto adjoint =
        z - builder::make_with_numpy_broadcast<op::Multiply>(shared_from_this(), zreshape);

    auto x = get_argument(0);
    adjoints.add_delta(x, adjoint);
}
开发者ID:okhat,项目名称:ngraph,代码行数:29,代码来源:softmax.cpp

示例3: ngraph_error

shared_ptr<Node> op::ConvolutionBias::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 3)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }

    return shared_ptr<Node>(new ConvolutionBias(new_args.at(0),
                                                new_args.at(1),
                                                new_args.at(2),
                                                get_window_movement_strides(),
                                                get_window_dilation_strides(),
                                                get_padding_below(),
                                                get_padding_above(),
                                                get_data_dilation_strides()));
}
开发者ID:okhat,项目名称:ngraph,代码行数:16,代码来源:conv_bias.cpp

示例4:

template<class NodeVector> void FileSystem::debugPrintNodes(NodeVector nodes) {
    if( debug) {
        unsigned int ix;
        NodeInfo* node;

        for (ix = 0; ix < nodes.size(); ++ix) {
            node = nodes.at(ix);

            cout << "Node: " << node->getName()
                << "\t\tSize: " << node->getSize()
                << "\tModify: " << node->getModifyTime()
                << "\tPath: " << node->getPath()
                << "\tSimilars: ";
        
            vector<NodeInfo*>::iterator it;
            vector<NodeInfo*> nodes = node->getSimilar();
            for(it=nodes.begin(); it != nodes.end(); ++it) {
                cout << (*it)->getPath() << ", ";
            }

            cout << endl;
        }
    }

}
开发者ID:ruskiyos,项目名称:duplocator,代码行数:25,代码来源:FileSystem.cpp

示例5:

void op::Cos::generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& deltas)
{
    auto delta = deltas.at(0);

    auto x = get_argument(0);

    adjoints.add_delta(x, -delta * (make_shared<op::Sin>(x)));
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:cos.cpp

示例6: ngraph_error

shared_ptr<Node> op::Softmax::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 1)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    return make_shared<Softmax>(new_args.at(0), m_axes);
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:softmax.cpp

示例7: ngraph_error

shared_ptr<Node> op::Result::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 1)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }

    if (new_args.at(0)->get_outputs().size() != 1)
    {
        throw ngraph_error("Expected a single-output argument");
    }

    auto res = make_shared<Result>(new_args.at(0));
    res->set_needs_copy(m_needs_copy);
    res->set_needs_default_layout(m_needs_default_layout);
    return res;
}
开发者ID:okhat,项目名称:ngraph,代码行数:17,代码来源:result.cpp

示例8: ngraph_error

shared_ptr<Node> op::GetOutputElement::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 1)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    return make_shared<GetOutputElement>(new_args.at(0), m_n);
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:get_output_element.cpp

示例9: ngraph_error

shared_ptr<Node> op::OneHot::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 1)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    return make_shared<OneHot>(new_args.at(0), m_shape, m_one_hot_axis);
}
开发者ID:okhat,项目名称:ngraph,代码行数:8,代码来源:one_hot.cpp

示例10:

void op::Divide::generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& deltas)
{
    auto delta = deltas.at(0);

    auto x = get_argument(0);
    auto y = get_argument(1);

    adjoints.add_delta(x, delta / y);
    adjoints.add_delta(y, -delta * shared_from_this() / y);
}
开发者ID:okhat,项目名称:ngraph,代码行数:10,代码来源:divide.cpp

示例11: ngraph_error

shared_ptr<Node> op::ReduceWindow::copy_with_new_args(const NodeVector& new_args) const
{
    if (new_args.size() != 2)
    {
        throw ngraph_error("Incorrect number of new arguments");
    }
    auto node = make_shared<ReduceWindow>(new_args.at(0),
                                          new_args.at(1),
                                          m_reduction_function,
                                          m_window_shape,
                                          m_window_movement_strides);
    node->m_reduction_function = clone_function(*m_reduction_function);
    return node;
}
开发者ID:okhat,项目名称:ngraph,代码行数:14,代码来源:reduce_window.cpp

示例12:

void op::ConvolutionBias::generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& deltas)
{
    auto delta = deltas.at(0);

    auto data = get_argument(0);
    const auto data_shape = data->get_shape();

    auto filter = get_argument(1);
    const auto filter_shape = filter->get_shape();

    auto bias = get_argument(2);
    const auto bias_shape = bias->get_shape();

    // using regular convolution backprop for data
    adjoints.add_delta(data,
                       make_shared<op::ConvolutionBackpropData>(data_shape,
                                                                filter,
                                                                delta,
                                                                m_window_movement_strides,
                                                                m_window_dilation_strides,
                                                                m_padding_below,
                                                                m_padding_above,
                                                                m_data_dilation_strides));

    auto filter_bias_backprop =
        make_shared<op::ConvolutionBiasBackpropFiltersBias>(data,
                                                            filter_shape,
                                                            bias_shape,
                                                            delta,
                                                            m_window_movement_strides,
                                                            m_window_dilation_strides,
                                                            m_padding_below,
                                                            m_padding_above,
                                                            m_data_dilation_strides);
    auto filter_delta = make_shared<op::GetOutputElement>(filter_bias_backprop, 0);
    auto bias_delta = make_shared<op::GetOutputElement>(filter_bias_backprop, 1);

    adjoints.add_delta(filter, filter_delta);
    adjoints.add_delta(bias, bias_delta);
}
开发者ID:okhat,项目名称:ngraph,代码行数:40,代码来源:conv_bias.cpp

示例13:

void op::Result::generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& deltas)
{
    auto delta = deltas.at(0);

    adjoints.add_delta(get_argument(0), delta);
}
开发者ID:okhat,项目名称:ngraph,代码行数:6,代码来源:result.cpp

示例14:

void op::GetOutputElement::generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& deltas)
{
    auto delta = deltas.at(0);

    adjoints.add_delta(get_inputs().at(0).get_output().get_node(), delta, get_n());
}
开发者ID:okhat,项目名称:ngraph,代码行数:6,代码来源:get_output_element.cpp


注:本文中的NodeVector::at方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。