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
Tensor init refactor #175
Tensor init refactor #175
Conversation
Not sure what the reason for this attribute is? I have removed it for now.
Instead of our code checking supported data types, let numpy check if the value can be converted to an ndarray. We only care if it is an ndarray or not anyway.
Can't have GPUBuffer without GPU=True
Reduce a line as data will always have a dtype at this point.
data = np.array(data, dtype=np.float32) | ||
elif GPU and isinstance(data, GPUBuffer): | ||
self.gpu = True | ||
self.gpu = False |
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.
default_gpu gone?
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.
default_gpu
is never set True
unless the user at runtime sets Tensor.default_gpu = True
. Perhaps this was supposed to read from the system environment(export GPU=true
)?
But that being said, setting default_gpu=True
fails the tests anyway. This is due to the way .cuda_
handles conversions.
For this reason, I removed it and if support needs to be added again, we should refactor .cuda_
and .cuda()
.
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 also believe that it would be better in the future to add default GPU support in the kwargs
of the __init__
.
I.e.
def __init__(self, data, gpu=GPU, requires_grad=True):
Or something like that.
Did parts of this, removed default. Want to rebase and I'll merge? |
Not required. See #196 for even better init. |
No description provided.