Skip to content

Instantly share code, notes, and snippets.

@kunalghosh
Created January 19, 2020 14:49
Show Gist options
  • Save kunalghosh/90496b448e8d0fdefed0c344aec6cd40 to your computer and use it in GitHub Desktop.
Save kunalghosh/90496b448e8d0fdefed0c344aec6cd40 to your computer and use it in GitHub Desktop.
Python stacktrace
(tensorflow-env) [ghoshk1@x86_64-conda_cos6-linux-gnu]/scratch/work/ghoshk1/SWAVI_tfp/Linear_Regression_QMC% python plot_K_hat_vs_D_fr_swa.py
2020-01-17 17:18:42.228790: I tensorflow/core/platform/profile_utils/cpu_utils.cc:101] CPU Frequency: 2793045000 Hz
2020-01-17 17:18:42.229921: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x561889248eb0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-01-17 17:18:42.229970: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Traceback (most recent call last):
File "plot_K_hat_vs_D_fr_swa.py", line 148, in <module>
init, max_iterations=1000)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/optimizer/lbfgs.py", line 260, in minimize
parallel_iterations=parallel_iterations)[0]
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py", line 574, in new_func
return func(*args, **kwargs)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/ops/control_flow_ops.py", line 2491, in while_loop_v2
return_same_structure=True)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/ops/control_flow_ops.py", line 2727, in while_loop
loop_vars = body(*loop_vars)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/optimizer/lbfgs.py", line 238, in _body
tolerance, f_relative_tolerance, x_tolerance, stopping_condition)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/optimizer/bfgs_utils.py", line 153, in line_search_step
converged=inactive) # No search needed for these.
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/optimizer/linesearch/hager_zhang.py", line 255, in hager_zhang
threshold_use_approximate_wolfe_condition)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/optimizer/linesearch/hager_zhang.py", line 636, in _prepare_args
val_initial = value_and_gradients_function(initial_step_size)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/optimizer/bfgs_utils.py", line 248, in _restricted_func
objective_value, gradient = value_and_gradients_function(pt)
File "plot_K_hat_vs_D_fr_swa.py", line 147, in <lambda>
lambda par: qmc_loss.loss_and_gradient(par),
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/eager/def_function.py", line 558, in __call__
return self._python_function(*args, **kwds)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 3277, in bound_method_wrapper
return wrapped_fn(weak_instance(), *args, **kwargs)
File "/scratch/work/ghoshk1/SWAVI_tfp/Linear_Regression_QMC/qmcLoss.py", line 75, in loss_and_gradient
return tfp.math.value_and_gradient(lambda par: self.loss(par), par)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/math/gradient.py", line 79, in value_and_gradient
y = f(*xs)
File "/scratch/work/ghoshk1/SWAVI_tfp/Linear_Regression_QMC/qmcLoss.py", line 75, in <lambda>
return tfp.math.value_and_gradient(lambda par: self.loss(par), par)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/eager/def_function.py", line 558, in __call__
return self._python_function(*args, **kwds)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/eager/function.py", line 3277, in bound_method_wrapper
return wrapped_fn(weak_instance(), *args, **kwargs)
File "/scratch/work/ghoshk1/SWAVI_tfp/Linear_Regression_QMC/qmcLoss.py", line 69, in loss
discrepancy = discrepancy_fn(target_log_prob - tf.reshape(surrogate.log_prob(q_samples),(-1, 1)))
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/distributions/distribution.py", line 883, in log_prob
return self._call_log_prob(value, name, **kwargs)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/distributions/distribution.py", line 865, in _call_log_prob
return self._log_prob(value, **kwargs)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/internal/distribution_util.py", line 1388, in _fn
return fn(*args, **kwargs)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/distributions/mvn_linear_operator.py", line 222, in _log_prob
return super(MultivariateNormalLinearOperator, self)._log_prob(x)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/distributions/transformed_distribution.py", line 432, in _log_prob
x = self.bijector.inverse(y, **bijector_kwargs)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1073, in inverse
return self._call_inverse(y, name, **kwargs)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1045, in _call_inverse
mapping = mapping.merge(x=self._inverse(y, **kwargs))
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/bijectors/chain.py", line 236, in _inverse
y = b.inverse(y, **kwargs.get(b.name, {}))
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1073, in inverse
return self._call_inverse(y, name, **kwargs)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/bijectors/bijector.py", line 1045, in _call_inverse
mapping = mapping.merge(x=self._inverse(y, **kwargs))
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_probability/python/bijectors/scale_matvec_linear_operator.py", line 115, in _inverse
return self.scale.solvevec(y, adjoint=self.adjoint)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/ops/linalg/linear_operator.py", line 896, in solvevec
return self._solvevec(rhs, adjoint=adjoint)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/ops/linalg/linear_operator.py", line 847, in _solvevec
solution_mat = self.solve(rhs_mat, adjoint=adjoint)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/ops/linalg/linear_operator.py", line 842, in solve
return self._solve(rhs, adjoint=adjoint, adjoint_arg=adjoint_arg)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/ops/linalg/linear_operator_lower_triangular.py", line 202, in _solve
self._get_tril(), rhs, lower=True, adjoint=adjoint)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/ops/linalg/linear_operator_util.py", line 429, in matrix_triangular_solve_with_broadcast
adjoint=adjoint and still_need_to_transpose)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/ops/gen_linalg_ops.py", line 1896, in matrix_triangular_solve
_ops.raise_from_not_ok_status(e, name)
File "/home/ghoshk1/.local/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 6625, in raise_from_not_ok_status
six.raise_from(core._status_to_exception(e.code, message), None)
File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input matrix is not invertible. [Op:MatrixTriangularSolve]
(tensorflow-env) [ghoshk1@x86_64-conda_cos6-linux-gnu]/scratch/work/ghoshk1/SWAVI_tfp/Linear_Regression_QMC%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment