tensorflow .graph文件没有生成

时间:2017-06-03 07:02:39

标签: tensorflow tensorboard

这些是示例代码。

Tensor("Add:0", shape=(), dtype=int32)

它会显示这样的消息,

Ext.onReady(function () {
    Ext.state.Manager.setProvider(Ext.create('Ext.state.CookieProvider'));

    Ext.create('Ext.data.Store', {
        storeId: 'simpsonsStore',
        fields: ['name', 'email', 'phone'],
        data: {
            'items': [{
                'name': 'Lisa',
                "email": "lisa@simpsons.com",
                "phone": "555-111-1224"
            }, {
                'name': 'Bart',
                "email": "bart@simpsons.com",
                "phone": "555-222-1234"
            }, {
                'name': 'Homer',
                "email": "home@simpsons.com",
                "phone": "555-222-1244"
            }, {
                'name': 'Marge',
                "email": "marge@simpsons.com",
                "phone": "555-222-1254"
            }]
        },
        proxy: {
            type: 'memory',
            reader: {
                type: 'json',
                root: 'items'
            }
        }
    });

    Ext.create('Ext.container.Viewport', {
        items: [
            Ext.create('Ext.Button', {
                text: 'Click me',
                listeners: {
                    'click': function () {
                        var grid = Ext.create('Ext.grid.Panel', {
                            title: 'Simpsons',
                            store: Ext.data.StoreManager.lookup('simpsonsStore'),
                            columns: [{
                                text: 'Name',
                                dataIndex: 'name'
                            }, {
                                text: 'Email',
                                dataIndex: 'email',
                                flex: 1
                            }, {
                                text: 'Phone',
                                dataIndex: 'phone'
                            }],

                            stateful: true,
                            stateId: 'some_state_id'
                        });

                        var win = Ext.create('Ext.window.Window', {
                            title: 'Hello',
                            height: 200,
                            width: 900,
                            layout: 'fit',
                            items: grid
                        });

                        win.show();
                    }
                }
            })
        ]
    });
})

但是没有生成文件。

1 个答案:

答案 0 :(得分:1)

这是一个应该运行的修改后的代码:

import tensorflow as tf

const1 = tf.constant(2)
const2 = tf.constant(3)
add_op = tf.add(const1,const2)
mul_op = tf.multiply(add_op,const2)  # probably you use old version of TF

with tf.Session() as sess:
    writer = tf.summary.FileWriter('logs', sess.graph)
    result,result2 = sess.run([mul_op,add_op])
    writer.close()

我删除了打印件,更改了操作的名称,以便能够在新版本的TF中运行它(推荐给update)将编写器置于顶部并在最后正确关闭它。同时更改日志目录。

现在,从用于运行脚本的同一目录运行以下命令:tensorboard --logdir=logs。浏览浏览器并查看结果。