小编kwa*_*gjj的帖子

FromBluetoothAddressAsync IAsyncOperation不包含"GetAwaiter"错误的定义

我正在研究一个简单的流行语.我一直在提到这段代码

我在视觉工作室2017工作.

我的核心代码如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Threading;


using Windows.Devices.Bluetooth.Advertisement;
using Windows.Devices.Bluetooth;
using Windows.Devices;
using Windows.Foundation;
using Windows;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {

        private BluetoothLEAdvertisementWatcher watcher;

        public Form1()
        {

            InitializeComponent();
            watcher = new BluetoothLEAdvertisementWatcher();

            watcher.Received += OnAdvertisementReceived;
        }

        private async void OnAdvertisementReceived(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs eventArgs)
        {
            var dev = await BluetoothLEDevice.FromBluetoothAddressAsync(eventArgs.BluetoothAddress);

            }


    }
Run Code Online (Sandbox Code Playgroud)

在该行中var dev = await BluetoothLEDevice.FromBluetoothAddressAsync(eventArgs.BluetoothAddress) …

c# bluetooth async-await

9
推荐指数
2
解决办法
4069
查看次数

如何在张量流中随机初始化权重?

在 tensorflow 中,我从教程中了解到可以用类似的东西初始化变量 sess.run(tf.global_variables_initializer())

但是我发现每次使用相同的输入数据集运行它时,损失值都以相同的值开始。

我认为这是因为初始化总是设置具有相同值的变量。(可能为零)

我希望随机化权重的值。我已经尝试过搜索这个,但是如果初始化是在默认情况下使用零值或随机值完成的,tensorflow 文档并没有给出明确的答案。

如何指定初始化以设置随机值?


更新

我的网络首先是一堆 CNN 和池化层,如下所示:``` conv1 = tf.layers.conv2d(inputs=input_layer, filters=32, kernel_size=[3,3], padding="same", activation=tf .nn.relu, name="conv_chad_1")

    pool1 = tf.layers.max_pooling2d(inputs=conv1,pool_size=[2,2],strides=2)

    conv2 = tf.layers.conv2d(inputs=pool1, filters=64, kernel_size=[3,3], padding="same", activation=tf.nn.relu, name="conv_chad_2")

    pool2 = tf.layers.max_pooling2d(inputs=conv2,pool_size=[2,2],strides=2, name="pool_chad_2")
Run Code Online (Sandbox Code Playgroud)

``

AFAIK,权重是在这些预定义层内定义的。如何指定这些层来随机初始化它们的权重变量?

tensorflow

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

为什么这个sed命令不起作用?

我想从pwd命令的结果中删除父目录的某些部分.第一步,我想在sed'home'之后获得字符串部分,但老实说我不知道​​我做错了什么.我想我已经正确设置了子串,并成为sed替代品的输出.

$ pwd
/home/user1/projects/bashscript
$ pwd | sed -r 's/\*home(\*)/\1/'
/home/user1/projects/bashscript
Run Code Online (Sandbox Code Playgroud)

regex sed

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

标签 统计

async-await ×1

bluetooth ×1

c# ×1

regex ×1

sed ×1

tensorflow ×1