utils.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:autodiff 作者: bgavran 项目源码 文件源码
def eval_graphs(my_graph, tf_graph, my_var, tf_var, n):
    tf_grads = 0
    if tf_graph is not None:
        tf_grads = tf_graph.eval()
    my_grads = my_graph()

    print("---------- " + str(n) + "df w.r.t. " + str(my_var) + " ----------")
    print("My_val:", my_grads)
    print("Tf_val:", tf_grads)
    my_val = np.broadcast_to(my_grads, my_var.shape)
    tf_val = np.broadcast_to(tf_grads, my_var.shape)
    arrays_allclose(my_val, tf_val)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号