Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is breaking and makes a few key changes:
Flow
is now an abstract typeAbstractFlow
, with a subtypeManifoldFlow
parameterized by the type of the manifold. This allows us to have generic code, but still dispatch on the manifold for specialized methods and GPU compatibility. Examples:EuclideanFlow
is nowManifoldFlow{<:Manifolds.Euclidean}
RotationalFlow
is nowManifoldFlow{<:Manifolds.SpecialOrthogonal}
RelaxedDiscreteFlow
is nowFlow{<:Manifolds.ProbabilitySimplex}
FlowState{T,N}
is nowBatchedState{T,N} <: AbstractArray{State{T,N}}
, whereState{T,N}
represents/wraps a point on the manifold represented by an array, andN
the array dimensionality, whereas the oldN
included the batch dimensions.BatchedState
is an array of states, but we useArraysOfArrays.ArrayOfSimilarArrays
to make each element a view of the underlying array with an arbitrary number of batch dimension (accessible withflatarray
). This allows generic code (e.g.interpolate(::ManifoldFlow, ::BatchedState, ...)
to dispatch on another simpler method that only has to worry about the shortest geodesic between two singular states).statesize
exists as a helper function to ensure compatibility between aFlow
andState
/BatchedState
.statesize(Flow(Manifolds.Euclidean(3))) == (3,)
since the points in euclidean space are represented as arrays, in this case vectors of length 3.statesize(Flow(Manifolds.SpecialOrthogonal(3))) == (3, 3)
since the rotations in the orthogonal group are represented as matrices.statesize(State(rand(3, 3))) == statesize(BatchedState(rand(3, 3, 10))) == (3, 3)
since theState
is manifold-agnostic.statesize(BatchedState(rand(3, 3, 10, 20, 30), 3)) == (3, 3)
since theBatchedState
can have multiple batch dimensions (for e.g. 2D images)Manifolds.Euclidean(3, 3)
.Does the gaussian noise
perturb!
method make sense forProbabilitySimplex
(seeLinearFlow
method), and shouldFlow{<:ProbabilitySimplex}
belong to theLinearFlow
union type?Checklist