Coverage for encodermap/encodermap_tf1/encodermap.py: 32%

15 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2023-02-07 11:05 +0000

1import tensorflow.compat.v1 as tf 

2 

3from .autoencoder import Autoencoder 

4from .misc import distance_cost 

5 

6 

7class EncoderMap(Autoencoder): 

8 def _setup_cost(self): 

9 self._auto_cost() 

10 self._center_cost() 

11 self._l2_reg_cost() 

12 self._distance_cost() 

13 

14 def _distance_cost(self): 

15 if self.p.distance_cost_scale is not None: 

16 dist_cost = distance_cost( 

17 self.main_inputs, 

18 self.latent, 

19 *self.p.dist_sig_parameters, 

20 self.p.periodicity, 

21 ) 

22 tf.summary.scalar("sigmoid_loss", dist_cost) 

23 if self.p.distance_cost_scale != 0: 

24 self.cost += self.p.distance_cost_scale * dist_cost