在TensorFlow中关联(例如numpy.correlate)

时间:2019-03-14 03:13:49

标签: python numpy tensorflow

TensorFlow中是否存在CORRELATE函数(例如Promise.reject())?例如,

it('throws error message when dealer submit fails', done => {
  const mockComponentDidMount = () => Promise.resolve(
    new Response(JSON.stringify({"data":[{"key":22,"value":"Stationstraat 5"}],"default":22}), {
      status: 200,
      headers: { 'content-type': 'application/json' }
    })
  );
  const mockButtonClickFetchError = () => Promise.reject(new Error('my error'));

  jest.spyOn(global, 'fetch').mockImplementation(mockComponentDidMount);
  const element = mount(<DealerSelection />);

  setImmediate(() => {
    jest.spyOn(global, 'fetch').mockImplementation(mockButtonClickFetchError);
    const button = element.find('button');
    button.simulate('click');
    setImmediate(() => {
      console.log(element.state()); // state.error is 'my error'
      global.fetch.mockClear();
      done();
    });
  });
});

1 个答案:

答案 0 :(得分:0)

我建议使用this文档。但是我不使用这个框架。

我使用pip install --upgrade tensorflow-probability安装了它。

import tensorflow as tf
import tensorflow_probability as tfp


x = tf.random_uniform((5,2),2,3)
y = tf.random_uniform((5,2),2,3)


corr = tfp.stats.correlation(x, y)

with tf.Session() as sess :
    print(sess.run( corr))
  

[[0.32789752 -0.12169117]

     

[0.83670807 -0.09973542]]