by Suf | Mar 26, 2022 | Machine Learning, Programming, Python, Tips
TensorFlow 2 has integrated deep-learning Keras API as tensorflow.keras. If you try to import from the standalone Keras API with a Tensorflow 2 installed on your system, this can raise incompatibility issues, and you may raise the AttributeError: module...
by Suf | Mar 25, 2022 | Machine Learning, Programming, Python, Tips
In TensorFlow 2.0, tf.Session is no longer in use. TensorFlow 2.0 encapsulates graph computations as Python functions instead of using Session making TensorFlow more Pythonic. If you want to continue using Session in TensorFlow 2.0, use tf.compat.v1.Session() instead....
by Suf | Mar 25, 2022 | Machine Learning, Programming, Python, Tips
In TensorFlow 2.0, tf.ConfigProto is no longer in use. The functionalities of ConfigProto are now under tf.config.experimental. If you want to continue using ConfigProto in TensorFlow 2.0 use tf.compat.v1.ConfigProto() instead. You can follow the migration guide if...
by Suf | Mar 16, 2022 | Machine Learning, Programming, Python, PyTorch
Concatenating joins a sequence of tensors along an existing axis. The PyTorch function for concatenation is cat(). Stacking joins a sequence of tensors along a new axis. The PyTorch function for stacking is stack(). Table of Contents Introduction PyTorch Cat PyTorch...
by Suf | Mar 14, 2022 | Programming, Python, PyTorch, Tips
To convert a NumPy array to a PyTorch tensor you can: Use the from_numpy() function, for example, tensor_x = torch.from_numpy(numpy_array)Pass the NumPy array to the torch.Tensor() constructor or by using the tensor function, for example, tensor_x =...
by Suf | Mar 13, 2022 | NLP, Programming, Rust, Tips
This tutorial will go through concatenating strings and describe the two types of strings in Rust. Table of contentsStrings in RustConcatenate Strings in Rust using push_str()Concatenate Strings in Rust using format!()Concatenate Strings in Rust using +...