junxiaosong / AlphaZero_Gomoku

An implementation of the AlphaZero algorithm for Gomoku (also called Gobang or Five in a Row)
MIT License
3.27k stars 964 forks source link

TF NCHW->NHWC #34

Closed Observerspy closed 6 years ago

Observerspy commented 6 years ago

conv2d in Tensorflow now only support data_format='channels_last', so just change "channels_first" to "channels_last" and add tf.transpose(self.input_states, [0, 2, 3, 1]) for input placeholder.

junxiaosong commented 6 years ago

I checked the API doc of Tensorflow 1.8 and it seems that the 'channels_first' data_format is still supported.

Observerspy commented 6 years ago

I just update my tf to 1.8.0 and data_format="channels_first" still got Error "UnimplementedError (see above for traceback): Generic conv implementation only supports NHWC tensor format for now."

junxiaosong commented 6 years ago

Hi @dshnightmare,what is the version of TF you are using?Have you ever met the Error?This pull request is somehow reverting the last one #29

junxiaosong commented 6 years ago

I just tried for some versions of tensorflow and got the same Error as you. Thank you for the pull request. I will merge it now.

dshnightmare commented 6 years ago

@Observerspy @junxiaosong I'm using tensorflow 1.8 and unimplementedError is encountered when use cpu version of tensorflow, and I think a transpose operation is a better general approach for both of cpu and gpu version. It is my fault not making it clear.