小编MAl*_*ori的帖子

带有急切模式的TF.data.dataset.map(map_func)

我使用启用了eager模式的TF 1.8。

我无法在mapfunc中打印示例。当我从mapfunc中运行tf.executing_eagerly()时,出现“ False”

import os
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)

tfe = tf.contrib.eager
tf.enable_eager_execution()
x = tf.random_uniform([16,10], -10, 0, tf.int64)
print(x)
DS = tf.data.Dataset.from_tensor_slices((x))


def mapfunc(ex, con):
    import pdb; pdb.set_trace()
    new_ex = ex + con
    print(new_ex) 
    return new_ex

DS = DS.map(lambda x: mapfunc(x, [7]))
DS = DS.make_one_shot_iterator()

print(DS.next())
Run Code Online (Sandbox Code Playgroud)

print(new_ex)输出:

Tensor("add:0", shape=(10,), dtype=int64)
Run Code Online (Sandbox Code Playgroud)

在mapfunc外部,它可以正常工作。但是在其中,传递的示例没有值,也没有.numpy()属性。

python eager dataset tensorflow

4
推荐指数
1
解决办法
973
查看次数

尽管已安装tensorflow 2.0.0-beta1,仍无法使用pip安装tensorflow-text

我的tensorflow 2.0.0beta1正常运行,但是我无法使用命令pip install tensorflow-text安装tensorflow-text(如tensorflow页面上所述)。我可以使用pip search tensorflow-text找到它,但出现错误

ERROR: Could not find a version that satisfies the requirement tensorflow-text (from versions: none)
Run Code Online (Sandbox Code Playgroud)

该软件包没有要求(即特定的python版本)。我在Windows上运行,使用conda,python 3.6.9

python pip tensorflow

3
推荐指数
1
解决办法
113
查看次数

禁用动态创建按钮的"原因验证"

我创建了两次相同的按钮:一次在Page_Load上,另一次在:Page_PreRender上.我希望看到相同的行为,但是,在Page_PreRender上创建的按钮不能按照预期的方式工作.(即属性"causeValidation"仍为true).

"我想为page_preRender中的按钮禁用"causeValidation",我想在PreRender中使用它.此外,我希望Button_Click函数对两个按钮执行,目前它只对"Page_load"上创建的按钮执行.

我正在寻找这种行为的解决方案或解释.

谢谢.

看看代码:

protected void Page_Load(object sender, EventArgs e)
    {            
        form1.Controls.Add(GetButton("Button1", "Click"));
    }

    protected void page_PreRender(object sender, EventArgs e)
    {
        form1.Controls.Add(GetButton("Button3", "Click"));
    }

    private Button GetButton(string id, string name)
    {
        Button b = new Button();
        b.Text = name;
        b.ID = id;
        b.CausesValidation = false;
        b.Click += new EventHandler(Button_Click);
        b.OnClientClick = "ButtonClick('" + b.ClientID + "')";
        return b;
    }

    protected void Button_Click(object sender, EventArgs e)
    {
        ClientScript.RegisterClientScriptBlock(this.GetType(), ((Button)sender).ID, "<script>alert('Button_Click');</script>");
        Response.Write(DateTime.Now.ToString() + ": " + ((Button)sender).ID + " …
Run Code Online (Sandbox Code Playgroud)

c# asp.net

2
推荐指数
1
解决办法
919
查看次数

标签 统计

python ×2

tensorflow ×2

asp.net ×1

c# ×1

dataset ×1

eager ×1

pip ×1