小编Vol*_*ken的帖子

运行时的Java Carbon Component警告 - OS X.

我最近学会了如何将声音添加到我正在创建的小蛇游戏中.当蛇吃苹果时声音会播放.我遇到的问题是每次蛇吃苹果我都会在cosole中得到这个警告(但程序继续运行):

015-10-13 10:00:16.922 java [39731:970632] 10:00:16.922警告:140:此应用程序或其使用的库正在使用不推荐使用的Carbon Component Manager来托管Audio Units.将来的版本中将删除对此的支持.此外,这使主机与版本3音频单元不兼容.请转换到API中AudioComponent.h.

这是什么意思,我需要做些什么才能解决这个错误?

这是播放声音的方法:

 private static void playSound(File Sound){

    try{
        Clip clip = AudioSystem.getClip();
        clip.open(AudioSystem.getAudioInputStream(Sound));
        clip.start();

        Thread.sleep(clip.getMicrosecondLength()/1000);

    }catch(Exception e){

    }

}
Run Code Online (Sandbox Code Playgroud)

java audio

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

Tensorflow错误:ValueError:形状必须等于等级,但是2和1从形状1与其他形状合并

我试图使用tensorflow来实现dcgan并遇到这个错误:

ValueError: Shapes must be equal rank, but are 2 and 1
From merging shape 1 with other shapes. for 'generator/Reshape/packed' (op: 'Pack') with input shapes: [?,2048], [100,2048], [2048].
Run Code Online (Sandbox Code Playgroud)

至于iv聚集它表明我的张量形状是不同的,但我看不出我需要改变什么来修复这个错误.我相信错误在这些方法之间悬而未决:

首先,我使用以下方法在方法中创建占位符:

self.z = tf.placeholder(tf.float32, [None,self.z_dimension], name='z')
self.z_sum = tf.histogram_summary("z", self.z)

self.G = self.generator(self.z)
Run Code Online (Sandbox Code Playgroud)

然后最后一个语句调用生成器方法,此方法使用reshape通过以下方式更改张量:

 self.z_ = linear(z,self.gen_dimension * 8 * sample_H16 * sample_W16, 'gen_h0_lin', with_w=True)

 self.h0 = tf.reshape(self.z_,[-1, sample_H16, sample_W16,self.gen_dimension * 8])

 h0 = tf.nn.relu(self.gen_batchnorm1(self.h0))
Run Code Online (Sandbox Code Playgroud)

如果它有帮助,这是我的线性方法:

def linear(input_, output_size, scope=None, stddev=0.02, bias_start=0.0, with_w=False):
shape = input_.get_shape().as_list()

with tf.variable_scope(scope or "Linear"): …
Run Code Online (Sandbox Code Playgroud)

python artificial-intelligence tensorflow

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

Tensorflow 类型错误:传递给参数“shape”的值的 DataType float32 不在允许值列表中:int32、int64

我正在尝试创建 DCGAN,当我想我正在尝试使用 linear() 方法时遇到了这个错误:

Traceback (most recent call last):
  File "spritegen.py", line 71, in <module>
    tf.app.run()
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "spritegen.py", line 51, in main
    cp_directory=FLAGS.checkpoint_dir)
  File "/home/lewis/Documents/Sprite Generator/Sprite-Generator/dcgan.py", line 99, in __init__
    self.build()
  File "/home/lewis/Documents/Sprite Generator/Sprite-Generator/dcgan.py", line 113, in build
    self.G = self.generator(self.z)
  File "/home/lewis/Documents/Sprite Generator/Sprite-Generator/dcgan.py", line 281, in generator
    self.h0 = tf.reshape(self.z,[-1, sample_H16, sample_W16, self.gen_dimension * 8])
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 2630, in reshape
    name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 585, in apply_op
    param_name=input_name)
  File …
Run Code Online (Sandbox Code Playgroud)

python artificial-intelligence tensorflow

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