def pseudo_inverse_scipy(tensor): dtype = tensor.dtype print(linalg.pinv, tensor, dtype) result = tf.py_func(linalg.pinv, [tensor], [dtype])[0] result.set_shape(tensor.shape) return result