-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Binary op (for testing) #19
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the code.
It works after following the comments.
I will send you also the fixed code on Mattermost.
Lorenzo
private: | ||
|
||
std::string fNX1; | ||
std::string fNX2; | ||
std::string fNY; | ||
std::vector<size_t> fShape; | ||
template <typename T, EBasicBinaryOperator Op1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would define these template struct outside the class definition, before line 16, because there could be some issues with partial template specialisations for internal classes
private: | ||
|
||
std::string fNX1; | ||
std::string fNX2; | ||
std::string fNY; | ||
std::vector<size_t> fShape; | ||
template <typename T, EBasicBinaryOperator Op1> | ||
struct BinaryOperatorTrait { | ||
const char * Name() { return "";} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these should be static functions. DO:
static const char * Name() {....}
static const char * Op() {....}
} | ||
std::stringstream out; | ||
// int length = 1; | ||
// for(auto& i: fShape){ | ||
// length *= i; | ||
// } | ||
size_t length = ConvertShapeToLength(fShape); | ||
out << "\n//------ Add\n"; | ||
out << "\n//------ " + s->Name()+"\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use here:
BinaryOperatorTrait<T,Op>::Name()
and 2 lines below
BinaryOperatorTrait<T,Op>::Op()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here we should use std::string. Maybe we define the functions to return a std::string instead of doing
std::string(BinaryOperatorTrait<T,Op>::Op())
template <typename T> | ||
class ROperator_Add final : public ROperator | ||
{ | ||
enum EBasicBinaryOperator { Add, Sub, Mul, Div }; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to make it a template class, add this line:
template <typename T, EBasicBinaryOperator Op>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And the class should not be called RModel_BasicBinaryOp
, but to be consistent:
ROperator_BasicBinary
@@ -35,7 +35,7 @@ std::unique_ptr<ROperator> make_ROperator_RNN(const onnx::NodeProto& nodeproto, | |||
std::unique_ptr<ROperator> make_ROperator_LSTM(const onnx::NodeProto& nodeproto, const onnx::GraphProto& graphproto, std::unordered_map<std::string, ETensorType>& tensor_type); | |||
std::unique_ptr<ROperator> make_ROperator_BatchNormalization(const onnx::NodeProto& nodeproto, const onnx::GraphProto& graphproto, std::unordered_map<std::string, ETensorType>& tensor_type); | |||
std::unique_ptr<ROperator> make_ROperator_Pool(const onnx::NodeProto& nodeproto, const onnx::GraphProto& graphproto, std::unordered_map<std::string, ETensorType>& tensor_type); | |||
std::unique_ptr<ROperator> make_ROperator_Add(const onnx::NodeProto &nodeproto, const onnx::GraphProto &graphproto, std::unordered_map<std::string, ETensorType> &tensor_type); | |||
std::unique_ptr<ROperator> make_RModel_BasicBinaryOp(const onnx::NodeProto &nodeproto, const onnx::GraphProto &graphproto, std::unordered_map<std::string, ETensorType> &tensor_type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment on different name for class
(use ROperator_BasicBinary}
@@ -48,7 +48,7 @@ std::unique_ptr<ROperator> make_ROperator_Add(const onnx::NodeProto& nodeproto, | |||
op.reset(new ROperator_Add<float>(nodeproto.input(0), nodeproto.input(1), nodeproto.output(0))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do:
op.reset(new ROperator_BasicBinary<float,Add>
Such pointer will be automatically released when unloading library or program is stopped
In commit 196ef3b, `operator=` for the RooPolyFunc was implemented, but it was implemented wrognly: it used the assignment operator the the proxy collections, which does value syncronization and not copy assignment! It's better to delete the copy assignment for RooPolyFunc, because copy/move assignment of RooFit objects is very badly supported.
There was a bug in a schema evolution rule for a very old RooProduct version, where a `RooSetProxy` member was replaced by a `RooListProxy`. The problem was that only the content was copied to the new proxy list, not the other members. This lead to an invalid state for the RooSetProxy, because it had no registered owner. Commit aa55e5c attempted to fix the problem, but the fix used the `RooArgList::operator=`, which doesn't implement copy assignment, but value synchronization! So the target proxy list was empty after calling it. Therefore, one the RooCollectionProxy needs to be extended with something that does exactly what the schema evolution requires: setting the owner of the proxy and adding all elements without registering the elements as servers (the server lists are copied separately by IO). A new member function initializeAfterIOConstructor` was added to the RooCollectionProxy for this. In the initial attempt to the fix, it was thought the original problem was only that the proxy owner was not set in the proxy, but actually the _proxyList only contained `nullptr` after reading and old RooProduct! The reason for that is the reason for which `RooAbsArg::ioStreamerPass2()` exists (quoting from its documentation): > second pass is typically needed when evolving data member of > RooAbsArg-derived classes that are container classes with references > to other members, which may not yet be 'live' in the first > ioStreamer() evolution pass. Hence, `RooProduct` needs to override `ioStreamerPass2()` and set the proxy list correctly there, which is also done in this commit.
The documentation of `RooAbsArg::ioStreamerPass2()` says: > Classes may overload this function, but must call the base method in > the overloaded call to ensure base evolution is handled properly This was not done in the overload in RooHistFunc, which is a mistake that probably leads to backwards compatibility errors that are undetected to far.
Two of the previous commits have shown that copy assignment for RooCollectionProxy is dangerous because it behaves unexpectedly. However, it is not clear how it *should* behave. Should default assignment be used? But then, it will use the assignment operators of the RooFit collections, which actually don't do assignment, but value syncronization! Should it be re-implemented to be actual assignment? That would be inconsistent with the base class! So it's better to not support it at all.
This commit renames and refactors `RDaosEventQueue` to include: - Parent events that are responsible for a batch of asynchronous events originating from a single RW call. This simplifies polling, which is a waiting call on the batch of requests sent under that parent that are inflight (`WaitOnParentBarrier`, which sets a parent event barrier and waits for all children launched before it to complete). - Poolwide event queues that are shared among its underlying containers and persist between RW calls. This eliminates the significant overhead behind instantiating new queues for each call to `VectorReadWrite`. - Queue management obeying RAII principle. - Better handling of synchronous events in `FetchUpdateArgs` (the default behavior). The event is an optional attribute which yields a nullptr to DAOS fetch/update calls in such cases, indicating the request is blocking. - The functions `daos_event_test` and `daos_event_parent_barrier`, used for polling and sending parent events respectively, to `libdaos_mock`. Co-authored-by: Giovanna Lazzari Miotto <[email protected]> Co-authored-by: Javier Lopez-Gomez <[email protected]>
Ensure that buffer will be deleted when painter is deleted
All contour plots was not releasing that painter at the end
Ensure that allocated memory always released
Special "contours" object which is created in with "list" draw option, was not fully deleted when option used again
Ensure that allocated memory released at the end in any circumstances
Also avoid comparation obj->TestBit(bit) == 0 or == 1, just use in logical operators
Inline C++ needs double quotes, Python is ok with single quotes.
We now register all RDefine nodes, incuding varied defines, with RLoopManager, which is in charge of calling InitSlot on all registered nodes, so we do not need to propagate the InitSlot call from RVariation or RDefine to other RDefines.
Temporary TBox object was not deleted, now just in stack
Temporary TText object was not deleted, now used in stack
It is good practice to cleanup memory at macro exit
Original object was not deleted properly
This is to get rid of deprecation warninigs when building on Ubuntu 22.04. Should cause no backwards compatibility poblems, as the functions that are used now are around at least since OpenSSL 1.0.2: https://www.openssl.org/docs/man1.0.2/man3/EVP_DigestInit_ex.html This patch was already applied to upstream civet: civetweb/civetweb#1072
Keep old code for Windows and older SSL versions
…d and 3d case (root-project#10768) * Fix the issue related to 1d and 3d MaxPool operators * Update ROperator_Pool.hxx * The issue related to Maxpool for 1d and 3d fixed * Test related to MaxPool 1d added * MaxPool Operator fixed for 1d and 3d cases and tests added * Max Pool operator errors related to 1d and 3d case resolved * Max Pool operator errors related to 1d and 3d case resolved * Updated the Pool Operator * Fix warning in new implementation of Pool operator * Added the tests for MaxPool 2d and 3d Operators * Fix 2d and 3d MaxPool operators Use the correct stride for the height when loopoing at the tensor element. The height stride for 2d is equal to wsize, and in 3d is equal to wsize*dsize. Precompute the hstride in 3d to avoid a multiplication when looping through the tensor elements. * Tests added for AvgPool * Corrected the spelling errors Co-authored-by: moneta <[email protected]>
If the proxy normSet changed, we also have to set the value dirty flag of the proxy owner. Otherwise, value for the new normalization set might not get recomputed, which causes bugs! The issue can be reproduced with this small code snippet: ```C++ using namespace RooFit; RooRealVar x("x", "x", 0, -10, 10); RooGaussian gauss("gauss", "gauss", x, RooConst(0), RooConst(2)); RooAddition add("add", "add", {gauss}); std::cout << add.getVal() << std::endl; std::cout << add.getVal(x) << std::endl; ``` Without this commit, the value will be the same with and without normalization set, because changing only the normalization set didn't trigger a recomputation. This code snippet has also been implemented as a unit test now, where it is tested that the values are different.
Much of the functionality of RooAddition is implemented in exactly the same way as in RooRealSumPdf. Hence, to avoid code duplication, we can reuse the static functions in RooRealSumPdf that provide this implementation.
Much of the functionality of RooAddPdf is implemented in exactly the same way as in RooRealSumPdf. Hence, to avoid code duplication, we can reuse the static functions in RooRealSumPdf that provide this implementation.
Use more clear std::make_unique calls
Created list of functions and list of parameters names was not deleted properly.
…oot-project#10435) * Some error messages and spelling mistakes fixed related to operaters * Update the indentation of BatchNormalization.hxx Co-authored-by: Neel Shah <neelshah29042002.com>
…ponding unit tests and Multi-directional broadcasting functionality is added for SOFIE
This Pull request:
Changes or fixes:
Checklist:
This PR fixes #