original_docstring: Compute the log loss of each element [batch_size, sequence_length]
docstring: Compute the log loss of each element [batch_size, sequence_length]
docstring_tokens: Compute the log loss of each element [ batch_size sequence_length ]
code: def _get_spatial_temporal_loss(self,
                                     output_socres):
          """Compute the log loss of each element [batch_size, sequence_length]"""
  
          # Tensor shape: [batch_size, sequence_length, 1]
          target_lat_sequence = self.tensors.get_placeholder_by_name(
              Features.lat.name)
          target_lon_sequence = self.tensors.get_placeholder_by_name(
              Features.lon.name)
          target_start_time_sequence = self.tensors.get_placeholder_by_name(
              Features.start_hour_since_day.name)
          target_duration_sequence = self.tensors.get_placeholder_by_name(
              Features.duration.name)
  
          # Tensor shape: [batch_size, sequence_length, n_mixtures]
          pi, mu_lat, mu_lon, s_lat, s_lon, \
              mu_st, mu_dur, s_st, s_dur, rho_st_dur = \
              self.mixture_density_builder.get_spatial_temporal_parameters(
                  output_socres)
  
          # Tensor shape: [batch_size, sequence_length, n_mixtures]
          spatial_loss = \
              DistributionHelper.probability_2d_normal(target_lat_sequence,
                                                       target_lon_sequence,
                                                       mu_lat,
                                                       mu_lon,
                                                       s_lat,
                                                       s_lon)
  
          # Tensor shape: [batch_size, sequence_length, n_mixtures]
          temporal_loss = \
              DistributionHelper.probability_2d_normal_correlated(target_start_time_sequence,
                                                                  target_duration_sequence,
                                                                  mu_st,
                                                                  mu_dur,
                                                                  s_st,
                                                                  s_dur,
                                                                  rho_st_dur)
  
          # Tensor shape: [batch_size, sequence_length]
          loss = tf.reduce_sum(pi * spatial_loss * temporal_loss, axis=-1)
  
          return -tf.log(tf.clip_by_value(loss, 1e-30, 1e30))
code_tokens: def _get_spatial_temporal_loss ( self , output_socres ) : target_lat_sequence = self . tensors . get_placeholder_by_name ( Features . lat . name ) target_lon_sequence = self . tensors . get_placeholder_by_name ( Features . lon . name ) target_start_time_sequence = self . tensors . get_placeholder_by_name ( Features . start_hour_since_day . name ) target_duration_sequence = self . tensors . get_placeholder_by_name ( Features . duration . name ) pi , mu_lat , mu_lon , s_lat , s_lon , mu_st , mu_dur , s_st , s_dur , rho_st_dur = self . mixture_density_builder . get_spatial_temporal_parameters ( output_socres ) spatial_loss = DistributionHelper . probability_2d_normal ( target_lat_sequence , target_lon_sequence , mu_lat , mu_lon , s_lat , s_lon ) temporal_loss = DistributionHelper . probability_2d_normal_correlated ( target_start_time_sequence , target_duration_sequence , mu_st , mu_dur , s_st , s_dur , rho_st_dur ) loss = tf . reduce_sum ( pi * spatial_loss * temporal_loss , axis = - 1 ) return - tf . log ( tf . clip_by_value ( loss , 1e-30 , 1e30 ) )
short_docstring: Compute the log loss of each element [batch_size, sequence_length]
short_docstring_tokens: Compute the log loss of each element [ batch_size sequence_length ]
comment: """Compute the log loss of each element [batch_size, sequence_length]"""$SEP$# Tensor shape: [batch_size, sequence_length, 1]$SEP$# Tensor shape: [batch_size, sequence_length, n_mixtures]$SEP$# Tensor shape: [batch_size, sequence_length, n_mixtures]$SEP$# Tensor shape: [batch_size, sequence_length, n_mixtures]$SEP$# Tensor shape: [batch_size, sequence_length]