(self, y_data, y_noise, cost_type='dis')
Returns the discriminator cost. Note sign flip of the discriminator
        cost relative to Goodfellow et al. 2014 so we can minimize the cost
        rather than maximizing discriminiation.
        Args:
            y_data (Tensor or OpTree): Output of the data minibatch
            y_noise (Tensor or OpTree): Output of noise minibatch
            cost_type (str): 'dis' (default), 'dis_data', 'dis_noise' or 'gen'
        Returns:
            OpTree: discriminator or generator cost, controlled by cost_type
Returns the discriminator cost. Note sign flip of the discriminator
        cost relative to Goodfellow et al. 2014 so we can minimize the cost
        rather than maximizing discriminiation.
        Args:
            y_data (Tensor or OpTree): Output of the data minibatch
            y_noise (Tensor or OpTree): Output of noise minibatch
            cost_type (str): 'dis' (default), 'dis_data', 'dis_noise' or 'gen'
        Returns:
            OpTree: discriminator or generator cost, controlled by cost_type
Returns the discriminator cost . Note sign flip of the discriminator cost relative to Goodfellow et al . 2014 so we can minimize the cost rather than maximizing discriminiation . Args : y_data ( Tensor or OpTree ) : Output of the data minibatch y_noise ( Tensor or OpTree ) : Output of noise minibatch cost_type ( str ) : dis ( default ) dis_data dis_noise or gen Returns : OpTree : discriminator or generator cost controlled by cost_type
def __call__(self, y_data, y_noise, cost_type='dis'):
        """
        Returns the discriminator cost. Note sign flip of the discriminator
        cost relative to Goodfellow et al. 2014 so we can minimize the cost
        rather than maximizing discriminiation.
        Args:
            y_data (Tensor or OpTree): Output of the data minibatch
            y_noise (Tensor or OpTree): Output of noise minibatch
            cost_type (str): 'dis' (default), 'dis_data', 'dis_noise' or 'gen'
        Returns:
            OpTree: discriminator or generator cost, controlled by cost_type
        """
        assert y_data.shape == y_noise.shape, "Noise and data output shape mismatch"
        if self.func == 'original':
            cost_dis_data = -self.be.safelog(y_data)
            cost_dis_noise = -self.be.safelog(1-y_noise)
            cost_gen = -self.be.safelog(y_noise)
        elif self.func == 'modified':
            cost_dis_data = -self.be.safelog(y_data)
            cost_dis_noise = -self.be.safelog(1-y_noise)
            cost_gen = self.be.safelog(1-y_noise)
        elif self.func == 'wasserstein':
            cost_dis_data = y_data
            cost_dis_noise = -y_noise
            cost_gen = y_noise

        if cost_type == 'dis':
            return self.be.mean(cost_dis_data + cost_dis_noise, axis=0)
        elif cost_type == 'dis_data':
            return self.be.mean(cost_dis_data, axis=0)
        elif cost_type == 'dis_noise':
            return self.be.mean(cost_dis_noise, axis=0)
        elif cost_type == 'gen':
            return self.be.mean(cost_gen, axis=0)
def __call__ ( self , y_data , y_noise , cost_type = 'dis' ) : assert y_data . shape == y_noise . shape , "Noise and data output shape mismatch" if self . func == 'original' : cost_dis_data = - self . be . safelog ( y_data ) cost_dis_noise = - self . be . safelog ( 1 - y_noise ) cost_gen = - self . be . safelog ( y_noise ) elif self . func == 'modified' : cost_dis_data = - self . be . safelog ( y_data ) cost_dis_noise = - self . be . safelog ( 1 - y_noise ) cost_gen = self . be . safelog ( 1 - y_noise ) elif self . func == 'wasserstein' : cost_dis_data = y_data cost_dis_noise = - y_noise cost_gen = y_noise if cost_type == 'dis' : return self . be . mean ( cost_dis_data + cost_dis_noise , axis = 0 ) elif cost_type == 'dis_data' : return self . be . mean ( cost_dis_data , axis = 0 ) elif cost_type == 'dis_noise' : return self . be . mean ( cost_dis_noise , axis = 0 ) elif cost_type == 'gen' : return self . be . mean ( cost_gen , axis = 0 )