40db92599e7607b97f5b52a4d6a90bef9612c317,kronecker.py,,slog_determinant,#Any#,44

Before Change


  pows = 1
  for core_idx in range(kron_a.ndims()):
    core = kron_a.tt_cores[core_idx]
    if core.get_shape()[1] != core.get_shape()[2]:
      raise ValueError("The argument should be a Kronecker product of square"
                      "matrices (tt-cores must be square)")
    pows *= core.get_shape()[1].value

After Change


    raise ValueError("The argument should be a Kronecker product " 
                     "(tt-ranks should be 1)")
 
  shapes_defined = kron_a.get_shape().is_fully_defined()
  if shapes_defined:
    i_shapes = kron_a.get_raw_shape()[0]
    j_shapes = kron_a.get_raw_shape()[1]
  else:
    i_shapes = raw_shape(kron_a)[0]

  if shapes_defined:
    if i_shapes != j_shapes:
      raise ValueError("The argument should be a Kronecker product of square "
                       "matrices (tt-cores must be square)")
  pows = tf.cast(tf.reduce_prod(i_shapes), kron_a.dtype)
                                                          
  logdet = 0.
  det_sign = 1.
  for core_idx in range(kron_a.ndims()):
    core = kron_a.tt_cores[core_idx]
    core_det = tf.matrix_determinant(core[0, :, :, 0])
    core_abs_det = tf.abs(core_det)
    core_det_sign = tf.sign(core_det)
    core_pow = pows / i_shapes[core_idx].value
    logdet += tf.log(core_abs_det) * core_pow
    det_sign *= core_det_sign**(core_pow)
  
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: Bihaqo/t3f
Commit Name: 40db92599e7607b97f5b52a4d6a90bef9612c317
Time: 2017-02-11
Author: izmailovpavel@gmail.com
File Name: kronecker.py
Class Name:
Method Name: slog_determinant


Project Name: Bihaqo/t3f
Commit Name: 330154d9f5344f0a6ab39b3a313626c4b574dbbd
Time: 2017-02-11
Author: izmailovpavel@gmail.com
File Name: kronecker.py
Class Name:
Method Name: determinant


Project Name: Bihaqo/t3f
Commit Name: 92e936b10af3f12fcbb1ad00b50b9c82b09503a7
Time: 2017-02-11
Author: novikov@bayesgroup.ru
File Name: ops.py
Class Name:
Method Name: tt_sparse_flat_inner


Project Name: Bihaqo/t3f
Commit Name: 40db92599e7607b97f5b52a4d6a90bef9612c317
Time: 2017-02-11
Author: izmailovpavel@gmail.com
File Name: kronecker.py
Class Name:
Method Name: slog_determinant