(encoder_inputs, buckets, encoder,
                       enc_latent, softmax_loss_function=None,
                       per_example_loss=False, name=None)
return means, logvars
Create a sequence-to-sequence model with support for bucketing.
Create a sequence-to-sequence model with support for bucketing.
Create a sequence - to - sequence model with support for bucketing .
def variational_encoder_with_buckets(encoder_inputs, buckets, encoder,
                       enc_latent, softmax_loss_function=None,
                       per_example_loss=False, name=None):
  """Create a sequence-to-sequence model with support for bucketing.
  """
  if len(encoder_inputs) < buckets[-1][0]:
    raise ValueError("Length of encoder_inputs (%d) must be at least that of la"
                     "st bucket (%d)." % (len(encoder_inputs), buckets[-1][0]))

  all_inputs = encoder_inputs
  means = []
  logvars = []
  with ops.name_scope(name, "variational_encoder_with_buckets", all_inputs):
    for j, bucket in enumerate(buckets):
      with variable_scope.variable_scope(variable_scope.get_variable_scope(),
                                         reuse=True if j > 0 else None):
        encoder_last_state = encoder(encoder_inputs[:bucket[0]])
        mean, logvar = enc_latent(encoder_last_state)
        means.append(mean)
        logvars.append(logvar)

  return means, logvars
def variational_encoder_with_buckets ( encoder_inputs , buckets , encoder , enc_latent , softmax_loss_function = None , per_example_loss = False , name = None ) : if len ( encoder_inputs ) < buckets [ - 1 ] [ 0 ] : raise ValueError ( "Length of encoder_inputs (%d) must be at least that of la" "st bucket (%d)." % ( len ( encoder_inputs ) , buckets [ - 1 ] [ 0 ] ) ) all_inputs = encoder_inputs means = [ ] logvars = [ ] with ops . name_scope ( name , "variational_encoder_with_buckets" , all_inputs ) : for j , bucket in enumerate ( buckets ) : with variable_scope . variable_scope ( variable_scope . get_variable_scope ( ) , reuse = True if j > 0 else None ) : encoder_last_state = encoder ( encoder_inputs [ : bucket [ 0 ] ] ) mean , logvar = enc_latent ( encoder_last_state ) means . append ( mean ) logvars . append ( logvar ) return means , logvars