This repository was archived by the owner on Jan 3, 2023. It is now read-only.
Conversation
In 'ngraph_utils.cc', methods like 'const gtl::ArraySlice<DataType>&
NGraphNumericDTypes()' directly construct an instance of 'gtl::ArraySlice'
from an intializer list. This leads to the corruption of 'DataType'
instances held inside the array slice, and therefore no 'DataType' can
pass the following check within the 'TypeConstraintOk' method:
DataType dt;
if (GetNodeAttr(node->attrs(), type_attr_name, &dt) != Status::OK() ||
std::find(allowed_types.begin(), allowed_types.end(), dt) ==
allowed_types.end()) {
Since the 'allowed_types' array contains already destructed instances of 'DataType's.
The constructor of 'gtl::ArraySlice' that takes an initializer list has
the following comment (see
https://github.com/petewarden/tensorflow_makefile/blob/master/tensorflow/core/lib/gtl/array_slice.h):
// Implicitly constructs an ArraySlice from an initializer list. This makes it
// possible to pass a brace-enclosed initializer list to a function expecting
// an ArraySlice:
// void Process(ArraySlice<int> x);
// Process({1, 2, 3});
// The data referenced by the initializer_list must outlive this
// ArraySlice. For example, "ArraySlice<int> s={1,2};" and "return
// ArraySlice<int>({3,4});" are errors, as the resulting ArraySlice may
// reference data that is no longer valid.
So, an additional memory is required to store the held instances of
the 'DataType' class. This commit introduces 'std::vector' as the store
for 'DataType's. For backward compatibility, a static variable of
'ArraySlice<DataType>' is introduced in each method and the methods
return references to those variables.
Signed-off-by: Pavel Samolysov <samolisov@gmail.com>
Author
|
@avijit-nervana Could you have a look at the PR, please? Maybe I wasn't able to properly titled the PR, but it is very important because without this change any |
sayantan-nervana
approved these changes
Mar 21, 2019
sayantan-nervana
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thanks for fixing this
Contributor
|
TESTNOW |
1 similar comment
Contributor
|
TESTNOW |
Author
|
I have no access to the CI server and unfortunately am not able to see what is wrong with the commits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
In 'ngraph_utils.cc', methods like 'const gtl::ArraySlice&
NGraphNumericDTypes()' directly construct an instance of 'gtl::ArraySlice'
from an intializer list. This leads to the corruption of 'DataType'
instances held inside the array slice, and therefore no 'DataType' can
pass the following check within the 'TypeConstraintOk' method:
Since the 'allowed_types' array contains already destructed instances of 'DataType's.
The constructor of 'gtl::ArraySlice' that takes an initializer list has
the following comment (see
https://github.com/petewarden/tensorflow_makefile/blob/master/tensorflow/core/lib/gtl/array_slice.h):
So, an additional memory is required to store the held instances of
the 'DataType' class. This commit introduces 'std::vector' as the store
for 'DataType's. For backward compatibility, a static variable of
'ArraySlice' is introduced in each method and the methods
return references to those variables.
Signed-off-by: Pavel Samolysov samolisov@gmail.com