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 +...
by Suf | Jan 15, 2022 | Machine Learning, Programming, Python, TensorFlow, Tips
A common error you may encounter when using Python is modulenotfounderror: no module named ‘keras’. Keras comes packaged with Tensorflow 2.0 as tensorflow.keras. To import and start using Keras, you need to install TensorFlow 2. You can install TensorFlow...