Activations for models.
deepchem.models.tensorgraph.activations.
get_from_module
(identifier, module_params, module_name, instantiate=False, kwargs=None)[source]¶Retrieves a class of function member of a module.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | The target object. |
| Raises: | ValueError: if the identifier cannot be found. |
deepchem.models.tensorgraph.activations.
hard_sigmoid
(x)[source]¶The hard sigmoidal activation function
Piecewise-linear approximation to sigmoid.
| Parameters: | x (tf.Tensor) – Input tensor |
|---|
deepchem.models.tensorgraph.activations.
linear
(x)[source]¶A linear activation function.
Note that a linear activation function is simply the identity.
| Parameters: | x (tf.Tensor) – Input tensor |
|---|
deepchem.models.tensorgraph.activations.
relu
(x, alpha=0.0, max_value=None)[source]¶The rectified linear activation function
Wrapper around model_ops.relu.
| Parameters: | x (tf.Tensor) – Input tensor |
|---|
TensorFlow implementation of fully connected networks.
deepchem.models.tensorgraph.fcnet.
MultiTaskClassifier
(n_tasks, n_features, layer_sizes=[1000], weight_init_stddevs=0.02, bias_init_consts=1.0, weight_decay_penalty=0.0, weight_decay_penalty_type='l2', dropouts=0.5, activation_fns=<function relu>, n_classes=2, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.tensor_graph.TensorGraph
add_output
(layer)¶build
()¶create_submodel
(layers=None, loss=None, optimizer=None)¶Create an alternate objective for training one piece of a TensorGraph.
A TensorGraph consists of a set of layers, and specifies a loss function and optimizer to use for training those layers. Usually this is sufficient, but there are cases where you want to train different parts of a model separately. For example, a GAN consists of a generator and a discriminator. They are trained separately, and they use different loss functions.
A submodel defines an alternate objective to use in cases like this. It may optionally specify any of the following: a subset of layers in the model to train; a different loss function; and a different optimizer to use. This method creates a submodel, which you can then pass to fit() to use it for training.
| Parameters: |
|
|---|---|
| Returns: |
|
evaluate
(dataset, metrics, transformers=[], per_task_metrics=False)¶Evaluates the performance of this model on specified dataset.
| Parameters: |
|
|---|---|
| Returns: | Maps tasks to scores under metric. |
| Return type: |
evaluate_generator
(feed_dict_generator, metrics, transformers=[], labels=None, outputs=None, weights=[], per_task_metrics=False)¶fit
(dataset, nb_epoch=10, max_checkpoints_to_keep=5, checkpoint_interval=1000, deterministic=False, restore=False, submodel=None)¶Train this model on a dataset.
| Parameters: |
|
|---|
fit_generator
(feed_dict_generator, max_checkpoints_to_keep=5, checkpoint_interval=1000, restore=False, submodel=None)¶Train this model on data from a generator.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | the average loss over the most recent checkpoint interval |
fit_on_batch
(X, y, w, submodel=None)¶get_global_step
()¶get_layer_variables
(layer)¶Get the list of trainable variables in a layer of the graph.
get_model_filename
(model_dir)¶Given model directory, obtain filename for the model itself.
get_num_tasks
()¶get_params
(deep=True)¶Get parameters for this estimator.
| Parameters: | deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. |
|---|---|
| Returns: | params – Parameter names mapped to their values. |
| Return type: | mapping of string to any |
get_params_filename
(model_dir)¶Given model directory, obtain filename for the model itself.
get_pickling_errors
(obj, seen=None)¶get_pre_q_input
(input_layer)¶get_task_type
()¶Currently models can only be classifiers or regressors.
load_from_dir
(model_dir)¶predict
(dataset, transformers=[], outputs=None)[source]¶Uses self to make predictions on provided Dataset object.
| Parameters: |
|
|---|---|
| Returns: | y_pred |
| Return type: | numpy ndarray or list of numpy ndarrays |
predict_on_batch
(X, transformers=[], outputs=None)¶Generates predictions for input samples, processing samples in a batch.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | A Numpy array of predictions. |
predict_on_generator
(generator, transformers=[], outputs=None)¶| Parameters: |
|
|---|
predict_proba_on_batch
(X, transformers=[], outputs=None)¶Generates predictions for input samples, processing samples in a batch.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | A Numpy array of predictions. |
predict_proba_on_generator
(generator, transformers=[], outputs=None)¶| Returns: | numpy ndarray of shape (n_samples, n_classes*n_tasks) |
|---|---|
| Return type: | y_pred |
reload
()¶Reload trained model from disk.
restore
()¶Reload the values of all variables from the most recent checkpoint file.
save
()¶save_checkpoint
(max_checkpoints_to_keep=5)¶Save a checkpoint to disk.
Usually you do not need to call this method, since fit() saves checkpoints automatically. If you have disabled automatic checkpointing during fitting, this can be called to manually write checkpoints.
| Parameters: | max_checkpoints_to_keep (int) – the maximum number of checkpoints to keep. Older checkpoints are discarded. |
|---|
set_loss
(layer)¶set_optimizer
(optimizer)¶Set the optimizer to use for fitting.
set_params
(**params)¶Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each
component of a nested object.
| Returns: | |
|---|---|
| Return type: | self |
topsort
()¶deepchem.models.tensorgraph.fcnet.
MultiTaskFitTransformRegressor
(n_tasks, n_features, fit_transformers=[], n_evals=1, batch_size=50, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.fcnet.MultiTaskRegressor
Implements a MultiTaskRegressor that performs on-the-fly transformation during fit/predict.
Example:
>>> n_samples = 10
>>> n_features = 3
>>> n_tasks = 1
>>> ids = np.arange(n_samples)
>>> X = np.random.rand(n_samples, n_features, n_features)
>>> y = np.zeros((n_samples, n_tasks))
>>> w = np.ones((n_samples, n_tasks))
>>> dataset = dc.data.NumpyDataset(X, y, w, ids)
>>> fit_transformers = [dc.trans.CoulombFitTransformer(dataset)]
>>> model = dc.models.MultiTaskFitTransformRegressor(n_tasks, [n_features, n_features],
... dropouts=[0.], learning_rate=0.003, weight_init_stddevs=[np.sqrt(6)/np.sqrt(1000)],
... batch_size=n_samples, fit_transformers=fit_transformers, n_evals=1)
n_features after fit_transform: 12
add_output
(layer)¶build
()¶create_submodel
(layers=None, loss=None, optimizer=None)¶Create an alternate objective for training one piece of a TensorGraph.
A TensorGraph consists of a set of layers, and specifies a loss function and optimizer to use for training those layers. Usually this is sufficient, but there are cases where you want to train different parts of a model separately. For example, a GAN consists of a generator and a discriminator. They are trained separately, and they use different loss functions.
A submodel defines an alternate objective to use in cases like this. It may optionally specify any of the following: a subset of layers in the model to train; a different loss function; and a different optimizer to use. This method creates a submodel, which you can then pass to fit() to use it for training.
| Parameters: |
|
|---|---|
| Returns: |
|
evaluate
(dataset, metrics, transformers=[], per_task_metrics=False)¶Evaluates the performance of this model on specified dataset.
| Parameters: |
|
|---|---|
| Returns: | Maps tasks to scores under metric. |
| Return type: |
evaluate_generator
(feed_dict_generator, metrics, transformers=[], labels=None, outputs=None, weights=[], per_task_metrics=False)¶fit
(dataset, nb_epoch=10, max_checkpoints_to_keep=5, checkpoint_interval=1000, deterministic=False, restore=False, submodel=None)¶Train this model on a dataset.
| Parameters: |
|
|---|
fit_generator
(feed_dict_generator, max_checkpoints_to_keep=5, checkpoint_interval=1000, restore=False, submodel=None)¶Train this model on data from a generator.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | the average loss over the most recent checkpoint interval |
fit_on_batch
(X, y, w, submodel=None)¶get_global_step
()¶get_layer_variables
(layer)¶Get the list of trainable variables in a layer of the graph.
get_model_filename
(model_dir)¶Given model directory, obtain filename for the model itself.
get_num_tasks
()¶get_params
(deep=True)¶Get parameters for this estimator.
| Parameters: | deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. |
|---|---|
| Returns: | params – Parameter names mapped to their values. |
| Return type: | mapping of string to any |
get_params_filename
(model_dir)¶Given model directory, obtain filename for the model itself.
get_pickling_errors
(obj, seen=None)¶get_pre_q_input
(input_layer)¶get_task_type
()¶Currently models can only be classifiers or regressors.
load_from_dir
(model_dir)¶predict
(dataset, transformers=[], outputs=None)¶Uses self to make predictions on provided Dataset object.
| Parameters: |
|
|---|---|
| Returns: | results |
| Return type: | numpy ndarray or list of numpy ndarrays |
predict_on_batch
(X, transformers=[], outputs=None)¶Generates predictions for input samples, processing samples in a batch.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | A Numpy array of predictions. |
predict_proba
(dataset, transformers=[], outputs=None)¶| Parameters: |
|
|---|---|
| Returns: | y_pred |
| Return type: | numpy ndarray or list of numpy ndarrays |
predict_proba_on_batch
(X, transformers=[], outputs=None)¶Generates predictions for input samples, processing samples in a batch.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | A Numpy array of predictions. |
predict_proba_on_generator
(generator, transformers=[], outputs=None)¶| Returns: | numpy ndarray of shape (n_samples, n_classes*n_tasks) |
|---|---|
| Return type: | y_pred |
reload
()¶Reload trained model from disk.
restore
()¶Reload the values of all variables from the most recent checkpoint file.
save
()¶save_checkpoint
(max_checkpoints_to_keep=5)¶Save a checkpoint to disk.
Usually you do not need to call this method, since fit() saves checkpoints automatically. If you have disabled automatic checkpointing during fitting, this can be called to manually write checkpoints.
| Parameters: | max_checkpoints_to_keep (int) – the maximum number of checkpoints to keep. Older checkpoints are discarded. |
|---|
set_loss
(layer)¶set_optimizer
(optimizer)¶Set the optimizer to use for fitting.
set_params
(**params)¶Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each
component of a nested object.
| Returns: | |
|---|---|
| Return type: | self |
topsort
()¶deepchem.models.tensorgraph.fcnet.
MultiTaskRegressor
(n_tasks, n_features, layer_sizes=[1000], weight_init_stddevs=0.02, bias_init_consts=1.0, weight_decay_penalty=0.0, weight_decay_penalty_type='l2', dropouts=0.5, activation_fns=<function relu>, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.tensor_graph.TensorGraph
add_output
(layer)¶build
()¶create_submodel
(layers=None, loss=None, optimizer=None)¶Create an alternate objective for training one piece of a TensorGraph.
A TensorGraph consists of a set of layers, and specifies a loss function and optimizer to use for training those layers. Usually this is sufficient, but there are cases where you want to train different parts of a model separately. For example, a GAN consists of a generator and a discriminator. They are trained separately, and they use different loss functions.
A submodel defines an alternate objective to use in cases like this. It may optionally specify any of the following: a subset of layers in the model to train; a different loss function; and a different optimizer to use. This method creates a submodel, which you can then pass to fit() to use it for training.
| Parameters: |
|
|---|---|
| Returns: |
|
evaluate
(dataset, metrics, transformers=[], per_task_metrics=False)¶Evaluates the performance of this model on specified dataset.
| Parameters: |
|
|---|---|
| Returns: | Maps tasks to scores under metric. |
| Return type: |
evaluate_generator
(feed_dict_generator, metrics, transformers=[], labels=None, outputs=None, weights=[], per_task_metrics=False)¶fit
(dataset, nb_epoch=10, max_checkpoints_to_keep=5, checkpoint_interval=1000, deterministic=False, restore=False, submodel=None)¶Train this model on a dataset.
| Parameters: |
|
|---|
fit_generator
(feed_dict_generator, max_checkpoints_to_keep=5, checkpoint_interval=1000, restore=False, submodel=None)¶Train this model on data from a generator.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | the average loss over the most recent checkpoint interval |
fit_on_batch
(X, y, w, submodel=None)¶get_global_step
()¶get_layer_variables
(layer)¶Get the list of trainable variables in a layer of the graph.
get_model_filename
(model_dir)¶Given model directory, obtain filename for the model itself.
get_num_tasks
()¶get_params
(deep=True)¶Get parameters for this estimator.
| Parameters: | deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. |
|---|---|
| Returns: | params – Parameter names mapped to their values. |
| Return type: | mapping of string to any |
get_params_filename
(model_dir)¶Given model directory, obtain filename for the model itself.
get_pickling_errors
(obj, seen=None)¶get_pre_q_input
(input_layer)¶get_task_type
()¶Currently models can only be classifiers or regressors.
load_from_dir
(model_dir)¶predict
(dataset, transformers=[], outputs=None)¶Uses self to make predictions on provided Dataset object.
| Parameters: |
|
|---|---|
| Returns: | results |
| Return type: | numpy ndarray or list of numpy ndarrays |
predict_on_batch
(X, transformers=[], outputs=None)¶Generates predictions for input samples, processing samples in a batch.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | A Numpy array of predictions. |
predict_on_generator
(generator, transformers=[], outputs=None)¶| Parameters: |
|
|---|
predict_proba
(dataset, transformers=[], outputs=None)¶| Parameters: |
|
|---|---|
| Returns: | y_pred |
| Return type: | numpy ndarray or list of numpy ndarrays |
predict_proba_on_batch
(X, transformers=[], outputs=None)¶Generates predictions for input samples, processing samples in a batch.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: | A Numpy array of predictions. |
predict_proba_on_generator
(generator, transformers=[], outputs=None)¶| Returns: | numpy ndarray of shape (n_samples, n_classes*n_tasks) |
|---|---|
| Return type: | y_pred |
reload
()¶Reload trained model from disk.
restore
()¶Reload the values of all variables from the most recent checkpoint file.
save
()¶save_checkpoint
(max_checkpoints_to_keep=5)¶Save a checkpoint to disk.
Usually you do not need to call this method, since fit() saves checkpoints automatically. If you have disabled automatic checkpointing during fitting, this can be called to manually write checkpoints.
| Parameters: | max_checkpoints_to_keep (int) – the maximum number of checkpoints to keep. Older checkpoints are discarded. |
|---|
set_loss
(layer)¶set_optimizer
(optimizer)¶Set the optimizer to use for fitting.
set_params
(**params)¶Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each
component of a nested object.
| Returns: | |
|---|---|
| Return type: | self |
topsort
()¶Created on Thu Mar 30 14:02:04 2017
@author: michael
deepchem.models.tensorgraph.graph_layers.
DAGGather
(n_graph_feat=30, n_outputs=30, max_atoms=50, layer_sizes=[100], init='glorot_uniform', activation='relu', dropout=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
TensorGraph style implementation The same as deepchem.nn.DAGGather
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶description and explanation refer to deepchem.nn.DAGGather parent layers: atom_features, membership
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
DAGLayer
(n_graph_feat=30, n_atom_feat=75, max_atoms=50, layer_sizes=[100], init='glorot_uniform', activation='relu', dropout=None, batch_size=64, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
TensorGraph style implementation The same as deepchem.nn.DAGLayer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶description and explanation refer to deepchem.nn.DAGLayer parent layers: atom_features, parents, calculation_orders, calculation_masks, n_atoms
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
DTNNEmbedding
(n_embedding=30, periodic_table_length=30, init='glorot_uniform', **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
TensorGraph style implementation The same as deepchem.nn.DTNNEmbedding
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶description and explanation refer to deepchem.nn.DTNNEmbedding parent layers: atom_number
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
DTNNExtract
(task_id, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
DTNNGather
(n_embedding=30, n_outputs=100, layer_sizes=[100], output_activation=True, init='glorot_uniform', activation='tanh', **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
TensorGraph style implementation The same as deepchem.nn.DTNNGather
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶description and explanation refer to deepchem.nn.DTNNGather parent layers: atom_features, atom_membership
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
DTNNStep
(n_embedding=30, n_distance=100, n_hidden=60, init='glorot_uniform', activation='tanh', **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
TensorGraph style implementation The same as deepchem.nn.DTNNStep
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶description and explanation refer to deepchem.nn.DTNNStep parent layers: atom_features, distance, distance_membership_i, distance_membership_j
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
EdgeNetwork
(pair_features, n_pair_features=8, n_hidden=100, init='glorot_uniform')[source]¶Bases: object
Submodule for Message Passing
deepchem.models.tensorgraph.graph_layers.
GatedRecurrentUnit
(n_hidden=100, init='glorot_uniform')[source]¶Bases: object
Submodule for Message Passing
deepchem.models.tensorgraph.graph_layers.
MessagePassing
(T, message_fn='enn', update_fn='gru', n_hidden=100, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
General class for MPNN default structures built according to https://arxiv.org/abs/1511.06391
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶Perform T steps of message passing
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
SetGather
(M, batch_size, n_hidden=100, init='orthogonal', **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
set2set gather layer for graph-based model model using this layer must set pad_batches=True
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶Perform M steps of set2set gather, detailed descriptions in: https://arxiv.org/abs/1511.06391
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
WeaveGather
(batch_size, n_input=128, gaussian_expand=False, init='glorot_uniform', activation='tanh', epsilon=0.001, momentum=0.99, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
TensorGraph style implementation The same as deepchem.nn.WeaveGather
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶description and explanation refer to deepchem.nn.WeaveGather parent layers: atom_features, atom_split
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.graph_layers.
WeaveLayer
(n_atom_input_feat=75, n_pair_input_feat=14, n_atom_output_feat=50, n_pair_output_feat=50, n_hidden_AA=50, n_hidden_PA=50, n_hidden_AP=50, n_hidden_PP=50, update_pair=True, init='glorot_uniform', activation='relu', dropout=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
TensorGraph style implementation The same as deepchem.nn.WeaveLayer Note: Use WeaveLayerFactory to construct this layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
build
()[source]¶Construct internal trainable weights.
TODO(rbharath): Need to make this not set instance variables to follow style in other layers.
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶description and explanation refer to deepchem.nn.WeaveLayer parent layers: [atom_features, pair_features], pair_split, atom_to_pair
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
Ops for tensor initialization
deepchem.models.tensorgraph.initializations.
glorot_normal
(shape, name=None)[source]¶Glorot normal variance scaling initializer.
deepchem.models.tensorgraph.initializations.
he_normal
(shape, name=None)[source]¶He normal variance scaling initializer.
deepchem.models.tensorgraph.initializations.
he_uniform
(shape, name=None)[source]¶He uniform variance scaling initializer.
deepchem.models.tensorgraph.initializations.
lecun_uniform
(shape, name=None)[source]¶LeCun uniform variance scaling initializer.
deepchem.models.tensorgraph.initializations.
orthogonal
(shape, scale=1.1, name=None)[source]¶Orthogonal initializer.
deepchem.models.tensorgraph.layers.
ANIFeat
(in_layers, max_atoms=23, radial_cutoff=4.6, angular_cutoff=3.1, radial_length=32, angular_length=8, atom_cases=[1, 6, 7, 8, 16], atomic_number_differentiated=True, coordinates_in_bohr=True, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Performs transform from 3D coordinates to ANI symmetry functions
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶In layers should be of shape dtype tf.float32, (None, self.max_atoms, 4)
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Add
(in_layers=None, weights=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Compute the (optionally weighted) sum of the input layers.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
This method should be used when constructing AlphaShare layers from Sluice Networks
| Parameters: | in_layers (list of Layers or tensors) – tensors in list must be the same size and list must include two or more tensors |
|---|---|
| Returns: |
|
Bases: deepchem.models.tensorgraph.layers.Layer
Part of a sluice network. Adds alpha parameters to control sharing between the main and auxillary tasks
Factory method AlphaShare should be used for construction
| Parameters: | in_layers (list of Layers or tensors) – tensors in list must be the same size and list must include two or more tensors |
|---|---|
| Returns: |
|
Can only be called after self.create_layer to gaurentee that name is not none
Create a copy of this layer with different inputs.
Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
AtomicConvolution
(atom_types=None, radial_params=[], boxsize=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶| Parameters: |
|
|---|---|
| Returns: | layer – A new tensor representing the output of the atomic conv layer |
| Return type: | tf.Tensor of shape (B, N, l) |
distance_matrix
(D)[source]¶Calcuates the distance matrix from the distance tensor
B = batch_size, N = max_num_atoms, M = max_num_neighbors, d = num_features
| Parameters: | D (tf.Tensor of shape (B, N, M, d)) – Distance tensor. |
|---|---|
| Returns: | R – Distance matrix. |
| Return type: | tf.Tensor of shape (B, N, M) |
distance_tensor
(X, Nbrs, boxsize, B, N, M, d)[source]¶Calculates distance tensor for batch of molecules.
B = batch_size, N = max_num_atoms, M = max_num_neighbors, d = num_features
| Parameters: |
|
|---|---|
| Returns: | D – Coordinates/features distance tensor. |
| Return type: | tf.Tensor of shape (B, N, M, d) |
gather_neighbors
(X, nbr_indices, B, N, M, d)[source]¶Gathers the neighbor subsets of the atoms in X.
B = batch_size, N = max_num_atoms, M = max_num_neighbors, d = num_features
| Parameters: |
|
|---|---|
| Returns: | neighbors – Neighbor coordinates/features tensor for single atom. |
| Return type: | tf.Tensor of shape (B, M, d) |
gaussian_distance_matrix
(R, rs, e)[source]¶Calculates gaussian distance matrix.
B = batch_size, N = max_num_atoms, M = max_num_neighbors
| Parameters: |
|
|---|---|
| Returns: | retval [B, N, M] – Gaussian distance matrix. |
| Return type: | tf.Tensor |
layer_number_dict
= {}¶none_tensors
()¶radial_cutoff
(R, rc)[source]¶Calculates radial cutoff matrix.
B = batch_size, N = max_num_atoms, M = max_num_neighbors
| Parameters: |
|
|---|---|
| Returns: | FC [B, N, M] – Radial cutoff matrix. |
| Return type: | tf.Tensor |
radial_symmetry_function
(R, rc, rs, e)[source]¶Calculates radial symmetry function.
B = batch_size, N = max_num_atoms, M = max_num_neighbors, d = num_filters
| Parameters: | |
|---|---|
| Returns: | retval – Radial symmetry function (before summation) |
| Return type: | tf.Tensor of shape (B, N, M) |
set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
AttnLSTMEmbedding
(n_test, n_support, n_feat, max_depth, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Implements AttnLSTM as in matching networks paper.
The AttnLSTM embedding adjusts two sets of vectors, the “test” and “support” sets. The “support” consists of a set of evidence vectors. Think of these as the small training set for low-data machine learning. The “test” consists of the queries we wish to answer with the small amounts ofavailable data. The AttnLSTMEmbdding allows us to modify the embedding of the “test” set depending on the contents of the “support”. The AttnLSTMEmbedding is thus a type of learnable metric that allows a network to modify its internal notion of distance.
References: Matching Networks for One Shot Learning https://arxiv.org/pdf/1606.04080v1.pdf
Order Matters: Sequence to sequence for sets https://arxiv.org/abs/1511.06391
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶Execute this layer on input tensors.
| Parameters: | in_layers (list) – List of two tensors (X, Xp). X should be of shape (n_test, n_feat) and Xp should be of shape (n_support, n_feat) where n_test is the size of the test set, n_support that of the support set, and n_feat is the number of per-atom features. |
|---|---|
| Returns: | Returns two tensors of same shape as input. Namely the output shape will be [(n_test, n_feat), (n_support, n_feat)] |
| Return type: | list |
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
BatchNorm
(in_layers=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
BatchNormalization
(epsilon=1e-05, axis=-1, momentum=0.99, beta_init='zero', gamma_init='one', **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
Bases: deepchem.models.tensorgraph.layers.Layer
Part of a sluice network. Adds beta params to control which layer outputs are used for prediction
| Parameters: | in_layers (list of Layers or tensors) – tensors in list must be the same size and list must include two or more tensors |
|---|---|
| Returns: | output_layers – Distance matrix. |
| Return type: | list of Layers or tensors with same size as in_layers |
Can only be called after self.create_layer to gaurentee that name is not none
Create a copy of this layer with different inputs.
Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
Size of input layers must all be the same
Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
CombineMeanStd
(in_layers=None, training_only=False, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Generate Gaussian nose.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Concat
(in_layers=None, axis=1, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Constant
(value, dtype=tf.float32, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Output a constant value.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Conv1D
(width, out_channels, stride=1, padding='SAME', activation_fn=<function relu>, biases_initializer=<class 'tensorflow.python.ops.init_ops.RandomNormal'>, weights_initializer=<class 'tensorflow.python.ops.init_ops.RandomNormal'>, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
A 1D convolution on the input.
This layer expects its input to be a three dimensional tensor of shape (batch size, width, # channels). If there is only one channel, the third dimension may optionally be omitted.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Conv2D
(num_outputs, kernel_size=5, stride=1, padding='SAME', activation_fn=<function relu>, normalizer_fn=None, biases_initializer=<class 'tensorflow.python.ops.init_ops.Zeros'>, weights_initializer=<function xavier_initializer>, scope_name=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.SharedVariableScope
A 2D convolution on the input.
This layer expects its input to be a four dimensional tensor of shape (batch size, height, width, # channels). If there is only one channel, the fourth dimension may optionally be omitted.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
deepchem.models.tensorgraph.layers.
Conv2DTranspose
(num_outputs, kernel_size=5, stride=1, padding='SAME', activation_fn=<function relu>, normalizer_fn=None, biases_initializer=<class 'tensorflow.python.ops.init_ops.Zeros'>, weights_initializer=<function xavier_initializer>, scope_name=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.SharedVariableScope
A transposed 2D convolution on the input.
This layer is typically used for upsampling in a deconvolutional network. It expects its input to be a four dimensional tensor of shape (batch size, height, width, # channels). If there is only one channel, the fourth dimension may optionally be omitted.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
deepchem.models.tensorgraph.layers.
Conv3D
(num_outputs, kernel_size=5, stride=1, padding='SAME', activation_fn=<function relu>, normalizer_fn=None, biases_initializer=<class 'tensorflow.python.ops.init_ops.Zeros'>, weights_initializer=<function xavier_initializer>, scope_name=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.SharedVariableScope
A 3D convolution on the input.
This layer expects its input to be a five dimensional tensor of shape (batch size, height, width, depth, # channels). If there is only one channel, the fifth dimension may optionally be omitted.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
deepchem.models.tensorgraph.layers.
Conv3DTranspose
(num_outputs, kernel_size=5, stride=1, padding='SAME', activation_fn=<function relu>, normalizer_fn=None, biases_initializer=<class 'tensorflow.python.ops.init_ops.Zeros'>, weights_initializer=<function xavier_initializer>, scope_name=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.SharedVariableScope
A transposed 3D convolution on the input.
This layer is typically used for upsampling in a deconvolutional network. It expects its input to be a five dimensional tensor of shape (batch size, height, width, depth, # channels). If there is only one channel, the fifth dimension may optionally be omitted.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
deepchem.models.tensorgraph.layers.
Dense
(out_channels, activation_fn=None, biases_initializer=<class 'tensorflow.python.ops.init_ops.Zeros'>, weights_initializer=<function variance_scaling_initializer>, time_series=False, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.SharedVariableScope
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
deepchem.models.tensorgraph.layers.
Divide
(in_layers=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Compute the ratio of the input layers.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Dropout
(dropout_prob, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Exp
(in_layers=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Compute the exponential of the input.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Feature
(**kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Input
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_pre_q
(batch_size)¶create_tensor
(in_layers=None, set_tensors=True, **kwargs)¶get_pre_q_name
()¶layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Flatten
(in_layers=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Flatten every dimension except the first
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
GRU
(n_hidden, batch_size, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
A Gated Recurrent Unit.
This layer expects its input to be of shape (batch_size, sequence_length, ...). It consists of a set of independent sequence (one for each element in the batch), that are each propagated independently through the GRU.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Gather
(in_layers=None, indices=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Gather elements or slices from the input.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
GraphCNN
(num_filters, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
GraphCNN Layer from Robust Spatial Filtering with Graph Convolutional Neural Networks https://arxiv.org/abs/1703.00792
Spatial-domain convolutions can be defined as H = h_0I + h_1A + h_2A^2 + ... + hkAk, H ∈ R**(N×N)
We approximate it by H ≈ h_0I + h_1A
We can define a convolution as applying multiple these linear filters over edges of different types (think up, down, left, right, diagonal in images) Where each edge type has its own adjacency matrix H ≈ h_0I + h_1A_1 + h_2A_2 + . . . h_(L−1)A_(L−1)
V_out = sum_{c=1}^{C} H^{c} V^{c} + b
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
GraphConv
(out_channel, min_deg=0, max_deg=10, activation_fn=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
GraphEmbedPoolLayer
(num_vertices, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
GraphCNNPool Layer from Robust Spatial Filtering with Graph Convolutional Neural Networks https://arxiv.org/abs/1703.00792
This is a learnable pool operation It constructs a new adjacency matrix for a graph of specified number of nodes.
This differs from our other pool opertions which set vertices to a function value without altering the adjacency matrix.
$V_{emb} = SpatialGraphCNN({V_{in}})$$V_{out} = sigma(V_{emb})^{T} * V_{in}$ $A_{out} = V_{emb}^{T} * A_{in} * V_{emb}$
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
create_tensor
(in_layers=None, set_tensors=True, **kwargs)[source]¶| Parameters: |
|
|---|
layer_number_dict
= {}¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
GraphGather
(batch_size, activation_fn=None, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
GraphPool
(min_degree=0, max_degree=10, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.
This takes a list, which contains the initial values to use for all of this layer’s values (in the same order retured by TensorGraph.get_layer_variables()). When this layer is used in a TensorGraph, it will automatically initialize each variable to the value specified in the list. Note that some layers also have separate mechanisms for specifying variable initializers; this method overrides them. The purpose of this method is to let a Layer object represent a pre-trained layer, complete with trained values for its variables.
shape
¶Get the shape of this Layer’s output.
Create a copy of this layer that shares variables with it.
This is similar to clone(), but where clone() creates two independent layers, this causes the layers to share variables with each other.
| Parameters: |
|
|---|---|
| Returns: | |
| Return type: |
deepchem.models.tensorgraph.layers.
Highway
(activation_fn=<function relu>, biases_initializer=<class 'tensorflow.python.ops.init_ops.Zeros'>, weights_initializer=<function variance_scaling_initializer>, **kwargs)[source]¶Bases: deepchem.models.tensorgraph.layers.Layer
Create a highway layer. y = H(x) * T(x) + x * (1 - T(x)) H(x) = activation_fn(matmul(W_H, x) + b_H) is the non-linear transformed output T(x) = sigmoid(matmul(W_T, x) + b_T) is the transform gate
reference: https://arxiv.org/pdf/1505.00387.pdf
This layer expects its input to be a two dimensional tensor of shape (batch size, # input features). Outputs will be in the same shape.
add_summary_to_tg
()¶Can only be called after self.create_layer to gaurentee that name is not none
clone
(in_layers)¶Create a copy of this layer with different inputs.
copy
(replacements={}, variables_graph=None, shared=False)¶Duplicate this Layer and all its inputs.
This is similar to clone(), but instead of only cloning one layer, it also recursively calls copy() on all of this layer’s inputs to clone the entire hierarchy of layers. In the process, you can optionally tell it to replace particular layers with specific existing ones. For example, you can clone a stack of layers, while connecting the topmost ones to different inputs.
For example, consider a stack of dense layers that depend on an input:
>>> input = Feature(shape=(None, 100))
>>> dense1 = Dense(100, in_layers=input)
>>> dense2 = Dense(100, in_layers=dense1)
>>> dense3 = Dense(100, in_layers=dense2)
The following will clone all three dense layers, but not the input layer. Instead, the input to the first dense layer will be a different layer specified in the replacements map.
>>> replacements = {input: new_input}
>>> dense3_copy = dense3.copy(replacements)
| Parameters: |
|
|---|
layer_number_dict
= {}¶none_tensors
()¶set_summary
(summary_op, summary_description=None, collections=None)¶Annotates a tensor with a tf.summary operation Collects data from self.out_tensor by default but can be changed by setting self.tb_input to another tensor in create_tensor
| Parameters: |
|
|---|
set_tensors
(tensor)¶set_variable_initial_values
(values)¶Set the initial values of all variables.