I'm new to TFX and a bit confused about what the v1 about, and what is its relationship with the code outside v1?
Do I understand correctly that the official APIs are in v1, meaning I should always do
import tfx.v1.something
instead of just
import tfx.something
Related
import tensorflow as tf
from tensorflow import keras
from keras import backend as K
What is the reason behind using the command—>
from keras import backend as K
What does it do? I would appreciate it if anyone explains it the simple way so that it does not get complicated in the mind.
You can find more information on what Keras backend actually is here or here.
In simpler terms to understand what Keras backend actually is
Keras is a model-level library that provides high-level building blocks for developing deep learning models. Keras does not provide low-level operations such as tensor multiplication and convolution. Instead, it relies on a specialized, well-optimized tensor library that serves as Keras' "backend engine". Instead of choosing one single tensor library and tying your Keras implementation to that library, Keras handles the problem in a modular way, allowing you to seamlessly connect multiple different backend engines to Keras.
Keras backend will allow you to write custom code or in a particular case a new "Keras module" for your use case that can support Theano and/or Tensorflow both. Like instead of tf.placeholder() you could write keras.backend.placeholder() which will work across both the libraries mentioned earlier.
I am new to tf, and during reading a model code, I noticed it used 1), but most document I can find are using 2) and 3). So what is the tensorflow.python library used for,seems it is not in official document? And what is the relation between 1 to 2,3?
from tensorflow.python.training.adagrad import AdagradOptimizer
from tf.compat.v1.train import AdagradOptimizer
from tf.keras.optimizers import Adagrad
Basically:
tensorflow.python is essentially "internal" code and not part of the public API. You should never use anything in there directly. It may work, but it can also lead to instabilities, break completely if you update your TF version, etc.
This is a hold-over from old TF versions, before Keras was tightly integrated with it. IMHO you should just forget that this exists and they should have just removed it completely. This would be used with the outdated layers interface (tf.compat.v1.layers).
This is what you should use if using tf.keras (models and/or layers) and should be your go-to interface (not necessarily Adagrad specifically, but all the optimizers in tf.keras.optimizers).
I want to use TensorFlow for preprocessing in sagemaker pipelines.
But, I haven't been able to find a way to use it.
Right now, I'm using this library for preprocessing:
from sagemaker.sklearn.processing import SKLearnProcessor
framework_version = "0.23-1"
sklearn_processor = SKLearnProcessor(
framework_version=framework_version,
instance_type=processing_instance_type,
instance_count=processing_instance_count,
base_job_name="abcd",
role=role,
)
Now, I need to use TensorFlow in preprocessing but the python module cant import TensorFlow.
Any help would be much appreciated. Thanks.
So there's no TensorFlow Processor module, the list of available processing modules are in the following doc and can be seen at the bottom of the page.
You can use a Processor and ScriptProcessor class and pass in your TF preprocessing as a script with a requirements.txt for the necessary modules.
I work for AWS and my opinions are my own.
How to replace from tensorflow.contrib import layers with new core functionality. I want to move my TF 1.4 code to 1.12 in preparation for TF 2.0.
The core functionality corresponding to tf.contrib.layers is in tf.layers. Some of the differences are discussed in this question. However this will not prepare you for TF 2.0.
If your goal is to prepare your code for TF 2.0, consider that tf.contrib will be removed entirely (either split from TF or integrated into it) and that tf.layers too will be removed and the high-level API will reside under tf.keras. So to best prepare for TF 2.0 you should start using tf.keras.layers instead.
Here is a blog post about some of the practical differences to expect with TF 2.0.
In TF 1.12 or TF 2.0 is there going to be a replacement for the following function:
from tensorflow.contrib.training.python.training import hparam
I read that contrib module will go away or merge into core.
In TF 2.0 there is a new API tensorboard.plugins.hparams.api that includes a class HParam
Usage of the new API is described in this guide: Hyperparameter Tuning with the HParams Dashboard
Recently found this Weights and Biases framework that seems to nail the job. It's a more comprehensive solution, and they've got a nicer dashboard.