zoukankan      html  css  js  c++  java
  • tf.py_func

    在 faster  rcnn的tensorflow 实现中看到这个函数

    rois,rpn_scores=tf.py_func(proposal_layer,[rpn_cls_prob,rpn_bbox_pred,self._im_info,self.mode,self._feat_stride,self._anchors,self._num_anchors],[tf.float32,tf.float32],name="proposal")
    

      tensorflow 官网上的解释

    py_func(
        func,
        inp,
        Tout,
        stateful=True,
        name=None
    )

    将python 函数包装为一个tensorflow操作符
    python 函数proposal_layer 以numpy 矩阵作为输入输出,使函数变为tensorflow图中的操作符
    定义一个简单的sinh函数在tensorflow图中:
    def my_func(x):
      # x will be a numpy array with the contents of the placeholder below
      return np.sinh(x)
    inp = tf.placeholder(tf.float32)
    y = tf.py_func(my_func, [inp], tf.float32)
    
  • 相关阅读:
    if
    C#
    C#
    C#
    .net 5.0
    .net 5.0
    .net 5.0
    设计模式
    GAN网络中采用导向滤波的论文
    pytorch~多loss的选择
  • 原文地址:https://www.cnblogs.com/fanhaha/p/7792248.html
Copyright © 2011-2022 走看看