1

I want to know how to make chainer support float64 precision calculations. Below is my simple Autoencoder code I wrote in chainer. Initially I was running it with float32 dtype but now I want to test out float64 precision how do I do that ?

class AutoEncoder(chainer.Chain):
    def __init__(self, num_input=1024, num_hidden=512, activate=F.leaky_relu, dropout_ratio=0.0):
        super(AutoEncoder, self).__init__(
            encoder=L.Linear(num_input, num_hidden),
            decoder=L.Linear(num_hidden, num_input))
        self.num_input = num_input
        self.num_hidden = num_hidden
        self.activate = activate
        self.dropout_ratio = dropout_ratio

    def __call__(self, x, hidden=False):
        h = F.dropout(self.activate(self.encoder(x)), ratio=self.dropout_ratio)
        if hidden:
            return h

        y = F.dropout((self.decoder(h)), ratio=self.dropout_ratio)
        return y

When I try to run this with float64 data, it raises a dtype mismatch error.

Kanmani
  • 479
  • 7
  • 21
  • At least you need to change global config for dtype: https://docs.chainer.org/en/stable/reference/configuration.html – corochann Jun 17 '19 at 08:22

0 Answers0