Skip to content

Conversation

@shrit
Copy link
Member

@shrit shrit commented Jan 30, 2024

This PR uses the same class that @zoq did for ensmallen I copy pasted it and changed the relevant information for mlpack.
Then applied the modification on the ann part and a couple of places where we are using generic MatType with no nested template types.

PS: I will open subsequent PRs for randi, randn, and the remaining functions.

Comment on lines 38 to 41
inline static OutputType from(const InputType& input,
const typename std::enable_if_t<
coot::is_coot_type<InputType>::value ||
coot::is_coot_type<OutputType>::value>* = 0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcurtin now we are looking at both input and output types to cover cases such as std::vector<T>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise this is ready for review 👍

* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#include <mlpack/prereqs.hpp>
#include <mlpack/core/util/io.hpp>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not call any of these directly but instead, we should call core.hpp

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could remove the prereqs.hpp too, since core.hpp includes it.

Comment on lines -37 to -40
// All code should have access to logging.
#include <mlpack/core/util/log.hpp>
#include <mlpack/core/util/io.hpp>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already defined in core.hpp so they are useless here, and they are pulling load_image too early when it is not needed.
I just removed them it should be fine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's ok, so long as it doesn't make us include core.hpp where we could previously only include prereqs.hpp.

@shrit
Copy link
Member Author

shrit commented Jan 30, 2024

okay, I do not understand why the CI is failing, I am not having this issue locally at all. So either it is a CMake or a compiler issue or something wrong with our setups

@rcurtin
Copy link
Member

rcurtin commented Jan 30, 2024

The header include ordering is very carefully balanced. If you change it, I'm not entirely surprised that things break. I would revert to the minimal changes necessary for this PR (i.e. no include changes at all) and go from there.

@shrit
Copy link
Member Author

shrit commented Jan 31, 2024

actually, headers are not breaking, because this is passing on my machine without an issue, and I am surprised that this is causing an error.

This reverts commit 447a9cc.

Signed-off-by: Omar Shrit <[email protected]>
Copy link
Member

@rcurtin rcurtin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Sorry it took so long for me to return to this! It has been a really busy two weeks with some paper deadlines.

* @param input The input that is converted.
*/
template<typename InputType>
inline static OutputType from(const InputType& input,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pedantic, I know, but to match the style guide this should be From(). If you want I can supply a patch, I know it's a little tedious to change.

// the primary hash table).
hashMat(arma::span(1, T), i) = // Compute code of rows 1:end of column i
arma::conv_to< arma::Col<size_t> >:: // floor by typecasting to size_t
ConvTo< arma::Col<size_t> >:: // floor by typecasting to size_t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ConvTo< arma::Col<size_t> >:: // floor by typecasting to size_t
ConvTo<arma::Col<size_t>>:: // floor by typecasting to size_t

I think the extra spaces were here because it was pre-C++11...

* http://www.opensource.org/licenses/BSD-3-Clause for more information.
*/
#include <mlpack/prereqs.hpp>
#include <mlpack/core/util/io.hpp>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could remove the prereqs.hpp too, since core.hpp includes it.

Comment on lines -37 to -40
// All code should have access to logging.
#include <mlpack/core/util/log.hpp>
#include <mlpack/core/util/io.hpp>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's ok, so long as it doesn't make us include core.hpp where we could previously only include prereqs.hpp.

Copy link

@mlpack-bot mlpack-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second approval provided automatically after 24 hours. 👍

@shrit shrit merged commit 3ec1716 into mlpack:master Feb 12, 2024
@shrit shrit deleted the coot_9 branch February 12, 2024 11:38
This was referenced May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants